<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by 05-10 Archivist on Medium]]></title>
        <description><![CDATA[Stories by 05-10 Archivist on Medium]]></description>
        <link>https://medium.com/@0510-archivist?source=rss-589a49518502------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*alXdRs7yfxoqm-tJ.jpg</url>
            <title>Stories by 05-10 Archivist on Medium</title>
            <link>https://medium.com/@0510-archivist?source=rss-589a49518502------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 16:58:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0510-archivist/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[CryptoHack Writeup Series Part 8— Crypto On The Web Challenges]]></title>
            <link>https://systemweakness.com/cryptohack-writeup-series-part-8-crypto-on-the-web-challenges-776ca2a164ed?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/776ca2a164ed</guid>
            <category><![CDATA[jwt-exploitation]]></category>
            <category><![CDATA[crypto-hack]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[jwt]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Tue, 20 Dec 2022 23:12:33 GMT</pubDate>
            <atom:updated>2022-12-30T21:09:42.960Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tfqyQ2WQwJH61bLK-sYOxw.png" /></figure><p><strong><em>(Updated December 21, 2022)</em></strong></p><p>Welcome to Part 8 of our CryptoHack Challenges Write up.</p><p><a href="https://cryptohack.org/">CrytoHack</a> is an online platform where you can learn the fundamentals of cryptography as well as more complex concepts such as the underlying mathematics of encryption.</p><p>Similar to the other write-ups within the series, this publication is not yet complete. I’ll constantly update this as I go along with the challenges or if ever I find a good resource that could help you answer the puzzles.</p><p>The Crypto On The Web Challenges section is divided into three subcategories: <strong>JSON Web Tokens</strong>, <strong>TLS Part 1: The Protocol</strong>, and <strong>Cloud</strong>.</p><h3>JSON Web Token Challenges</h3><h4>Token Appreciation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uftJm6meGxEs98jGKal9pw.png" /></figure><p>The given JWT is eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmbGFnIjoiY3J5cHRve2p3dF9jb250ZW50c19jYW5fYmVfZWFzaWx5X3ZpZXdlZH0iLCJ1c2VyIjoiQ3J5cHRvIE1jSGFjayIsImV4cCI6MjAwNTAzMzQ5M30.shKSmZfgGVvd2OSB2CGezzJ3N6WAULo3w9zCl_T47KQ</p><p>As mentioned, JWTs are broken to three parts separated by . the first part is the header, the second is the payload, and the last one is the signature.</p><p>Both the header and payload can easily be decrypted to see its plaintext value. The signature, on the other hand, is encrypted with a 256-bit secret key.</p><p>You can use <a href="https://jwt.io/">online tools like this one</a> in order to decode JWTs but since the challenge recommended that we use PyJWT in order to prepare us for future challenges, we’re going to use that.</p><pre>import jwt<br><br>jwt_encoded = &quot;eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmbGFnIjoiY3J5cHRve2p3dF9jb250ZW50c19jYW5fYmVfZWFzaWx5X3ZpZXdlZH0iLCJ1c2VyIjoiQ3J5cHRvIE1jSGFjayIsImV4cCI6MjAwNTAzMzQ5M30.shKSmZfgGVvd2OSB2CGezzJ3N6WAULo3w9zCl_T47KQ&quot;<br><br><br>jwt.decode(jwt_encoded, options={&quot;verify_signature&quot;: False})</pre><p>This code will output the payload content of the JWT</p><p>The answer is <strong>‘flag’: ‘crypto{jwt_contents_can_be_easily_viewed}’</strong></p><h4>JWT Sessions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NeADpKFSfs_NJDaeTu8Gng.png" /></figure><p>Main advantage of JWTs as opposed to session ID is that JWTs live on the client side and it’s easier to scale. Different back end servers can authorize a single JWT instead of having to create multiple session object per server.</p><p>The answer for this challenge is <strong>authorization</strong></p><h4>No Way Jose</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*10lqGiDAXG8-ZF9PMr6Xzg.png" /></figure><p>As mentioned on the first challenge, <strong>Token Appreciation</strong>, the first part of JWT is the JOSE header.</p><p>This is where you indicate that this is a JWT and what algorithm was used for the encryption. According to the challenge, this is a major flaw since a server have to process this untrusted payload before verifying the JWT as a whole, enabling us to essentially bypass authorization by manipulating the contents of this header.</p><p>The No Way Jose challenge will present you with a code</p><pre>import base64<br>import json<br>import jwt # note this is the PyJWT module, not python-jwt<br><br><br>SECRET_KEY = ?<br>FLAG = ?<br><br><br>@chal.route(&#39;/no-way-jose/authorise/&lt;token&gt;/&#39;)<br>def authorise(token):<br>    token_b64 = token.replace(&#39;-&#39;, &#39;+&#39;).replace(&#39;_&#39;, &#39;/&#39;) # JWTs use base64url encoding<br>    try:<br>        header = json.loads(base64.b64decode(token_b64.split(&#39;.&#39;)[0] + &quot;===&quot;))<br>    except Exception as e:<br>        return {&quot;error&quot;: str(e)}<br><br>    if &quot;alg&quot; in header:<br>        algorithm = header[&quot;alg&quot;]<br>    else:<br>        return {&quot;error&quot;: &quot;There is no algorithm key in the header&quot;}<br><br>    if algorithm == &quot;HS256&quot;:<br>        try:<br>            decoded = jwt.decode(token, SECRET_KEY, algorithms=[&#39;HS256&#39;])<br>        except Exception as e:<br>            return {&quot;error&quot;: str(e)}<br>    elif algorithm == &quot;none&quot;:<br>        try:<br>            decoded = jwt.decode(token, algorithms=[&quot;none&quot;], options={&quot;verify_signature&quot;: False})<br>        except Exception as e:<br>            return {&quot;error&quot;: str(e)}<br>    else:<br>        return {&quot;error&quot;: &quot;Cannot decode token&quot;}<br><br>    if &quot;admin&quot; in decoded and decoded[&quot;admin&quot;]:<br>        return {&quot;response&quot;: f&quot;Welcome admin, here is your flag: {FLAG}&quot;}<br>    elif &quot;username&quot; in decoded:<br>        return {&quot;response&quot;: f&quot;Welcome {decoded[&#39;username&#39;]}&quot;}<br>    else:<br>        return {&quot;error&quot;: &quot;There is something wrong with your session, goodbye&quot;}<br><br><br>@chal.route(&#39;/no-way-jose/create_session/&lt;username&gt;/&#39;)<br>def create_session(username):<br>    encoded = jwt.encode({&#39;username&#39;: username, &#39;admin&#39;: False}, SECRET_KEY, algorithm=&#39;HS256&#39;)<br>    return {&quot;session&quot;: encoded}</pre><p>You can play with it using different usernames and see if you can be verified as an admin.</p><p>First, generate a JWT using the admin username</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ySodIUNo36boFLTt2VIyEQ.png" /><figcaption>eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOmZhbHNlfQ.yRhbtEnBab1UfHM95yP6Ukz3EQrQqP6lwZFcqwvKwjg</figcaption></figure><p>If we decode the generated JWT we will have this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gY8zGdy4pAxJZmUedPaI0Q.png" /></figure><p>The nice thing about <a href="http://jwt.io/">jwt.io</a> is that we can edit the contents of the payload. So, change the admin value to true</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7MEFN9tcL_n9goMlulDe9w.png" /></figure><p>Note that only the payload section was modified, the JOSE header still says the algorithm is HS256. However, since JWTs are just Base64url encoded, we can create our own JOSE header exploiting the “none” algorithm bypass.</p><pre>import base64<br><br>JOSE_header = &#39;{&quot;typ&quot;:&quot;JWT&quot;,&quot;alg&quot;:&quot;none&quot;}&#39;<br><br>JOSE_bytes = JOSE_header.encode(&#39;ascii&#39;)<br>base64_bytes = base64.b64encode(JOSE_bytes)<br>JOSE_header_encoded = base64_bytes.decode(&#39;ascii&#39;)<br><br>print(JOSE_header_encoded)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GmSQhQypIDzIbCZzHEyx0g.png" /></figure><p>The output is <strong>eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0=</strong> but we can ignore the <strong>=</strong> padding.</p><p>So now we have a complete JWT</p><pre>eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.CxKAPL3ryUMNCisd3UUDFzI8UtMugBH-luvnO8zwxck</pre><p>JOSE header that was modified make the algorithm as “none” <strong>eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0</strong></p><p>Payload modified to the value of admin as true<br><strong>eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9</strong></p><p>And the original signature<br><strong>CxKAPL3ryUMNCisd3UUDFzI8UtMugBH-luvnO8zwxck</strong></p><p>Using all that, we now have the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TAsACKaFEexXj_XeXo427w.png" /></figure><p>The answer is <strong>crypto{The_Cryptographic_Doom_Principle}</strong></p><h4>JWT Secrets</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wkvwIovnmTLIkT8KWEBA5w.png" /></figure><p>So there are two common algorithms being used when signing and verifying JWTs, one uses symmetric encryption (HS256) and the other uses assymetric encryption (RS256).</p><p>For this challenge, we’re going to focus on HS256. Since this is a symmetric encryption, it uses one key for encryption and verification so it’s important to make this key strong and secure.</p><p>Once that key is compromised, the attacker can easily forge sessions potentially leading to full web application compromise.</p><p>The challenge says that the code contains a strange comment about the secret key. So let’s look at it.</p><pre>import jwt # note this is the PyJWT module, not python-jwt<br><br><br>SECRET_KEY = ? # TODO: PyJWT readme key, change later<br>FLAG = ?<br><br><br>@chal.route(&#39;/jwt-secrets/authorise/&lt;token&gt;/&#39;)<br>def authorise(token):<br>    try:<br>        decoded = jwt.decode(token, SECRET_KEY, algorithms=[&#39;HS256&#39;])<br>    except Exception as e:<br>        return {&quot;error&quot;: str(e)}<br><br>    if &quot;admin&quot; in decoded and decoded[&quot;admin&quot;]:<br>        return {&quot;response&quot;: f&quot;Welcome admin, here is your flag: {FLAG}&quot;}<br>    elif &quot;username&quot; in decoded:<br>        return {&quot;response&quot;: f&quot;Welcome {decoded[&#39;username&#39;]}&quot;}<br>    else:<br>        return {&quot;error&quot;: &quot;There is something wrong with your session, goodbye&quot;}<br><br><br>@chal.route(&#39;/jwt-secrets/create_session/&lt;username&gt;/&#39;)<br>def create_session(username):<br>    encoded = jwt.encode({&#39;username&#39;: username, &#39;admin&#39;: False}, SECRET_KEY, algorithm=&#39;HS256&#39;)<br>    return {&quot;session&quot;: encoded}</pre><p>The comment of the secret key variable is # TODO: PyJWT readme key, change later. We can assume that the developer of this code uses the default key mentioned in PyJWT documentation which is secret.</p><p>Since we know what the secret key is, we can generate our own token in order to login as admin</p><pre>import jwt<br><br>key = &quot;secret&quot;<br>encoded = jwt.encode({&quot;username&quot;:&quot;admin&quot;,&quot;admin&quot;:True}, key, algorithm=&quot;HS256&quot;)<br><br>print(encoded)</pre><p>The output is eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.DuSXAPzL1erb7bIPPyenfl22Q23vgKOLkgY2J2ddELk</p><p>Use that to authorize yourself</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ni_Upv5-BnOf1_Mv5DxlOA.png" /></figure><p>The answer is <strong>crypto{jwt_secret_keys_must_be_protected}</strong></p><h4>RSA or HMAC?</h4><p>Soon</p><h4>JSON in JSON</h4><p>Soon</p><h4>RSA or HMAC? Part 2</h4><p>Soon</p><h3>TLS Part 1: The Protocol</h3><h4>Secure Protocols</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKrMid4fTyzkCRWR0QsAcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R4qxkcy5H9UiehHc9GCS4Q.png" /></figure><p>Read this one. Understand how secure protocols work before moving to the next challenge!</p><p>For the answer itself, go to tls1.cryptohack.org. Then click the lock button. There you’ll see the certificate authority that signed the certificate for tls1.cryptohack.org</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*FN8IaMy3QPgHmMAoX1Cehg.png" /></figure><p>The answer is <strong>Let’s Encrypt</strong></p><h4>Sharks on the Wire</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=776ca2a164ed" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/cryptohack-writeup-series-part-8-crypto-on-the-web-challenges-776ca2a164ed">CryptoHack Writeup Series Part 8— Crypto On The Web Challenges</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Paper — HackTheBox (L-E)]]></title>
            <link>https://systemweakness.com/paper-hackthebox-l-e-2be1b6b5c129?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/2be1b6b5c129</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Thu, 06 Oct 2022 06:35:29 GMT</pubDate>
            <atom:updated>2022-10-11T13:28:37.010Z</atom:updated>
            <content:encoded><![CDATA[<h4>HackTheBox</h4><h3><a href="https://0510-archivist.medium.com/paper-hackthebox-l-e-6d0aae791784?source=your_stories_page-------------------------------------">Paper — (L-E)</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RtQUB1rveVqPRoA3.png" /></figure><h3>Reconnaissance</h3><p>First, let’s check what’s up with the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6pGkR2ASF43J901D.png" /></figure><p>Nothing much we can check about the surface of this site. Time to run an Nmap scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6plmMd5q_wWdptIm.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aTdKgbVbYt2mqXaG.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fdBemqVghM_f9hQT.png" /></figure><p>So we have 3 open ports that we can work with. Similar information was given by the Wappalyzer extension regarding the version of technologies used on the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4yIrJFYQj3xVusEA.png" /></figure><p>At a glance, we have two things that we can potentially use later on to access the system</p><ul><li>Apache 2.4.37 is a vulnerable version with a number of known and available exploits</li><li>HTTP method TRACE is allowed</li></ul><p>Looking around the site, I noticed an unfamiliar field on the response header. X-Backend-Server: office.paper</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KbVsbmwctF3zUeBK.png" /></figure><p>I had to research about this since I absolutely have no idea what this is. This is the first time I encountered the X-Backend-Server header. My sources are <a href="https://www.zaproxy.org/docs/alerts/10039/">zaproxy</a>, <a href="https://docs.gitlab.com/ee/user/application_security/dast/checks/16.4.html">gitlab</a>, and <a href="https://webtechsurvey.com/response-header/x-backend-server">webtechsurvey</a>.</p><p>I tried accessing it directly but only met error so I tried mapping it to the IP of the machine on /etc/hosts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EgyepBO6LDnlFkfh.png" /></figure><p>And the site is now accessible and it’s an obvious nod to the Dunder Mifflin paper company from the series ‘The Office’</p><h3>Exploitation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wxGzAJr6SQ5_iJRc.png" /></figure><p>We can see that the site is using Wordpress 5.2.3 which, after a bit of looking around, is confirmed to be vulnerable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HkMnAckiCUAa98iB.png" /></figure><p>I found this simple vulnerability exploit in <a href="https://www.exploit-db.com/exploits/47690">Exploit-Db</a>.</p><blockquote><em>CVE-2019–17671</em></blockquote><blockquote><em>In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled.</em></blockquote><p>By just adding ?static=1 at the end of the wordpress url, you’ll see a hidden page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7rvssCtD5-C8sez5.png" /></figure><p><a href="http://chat.office.paper/register/8qozr226AhkCHZdyY">http://chat.office.paper/register/8qozr226AhkCHZdyY</a></p><p>Add the chat.office.paper again to the /etc/hosts file to access the site</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*trMKZYzSXgAfE0c4.png" /></figure><p>After registering, you will be redirected to a slack-looking interface and a chat for the “general” channel will pop out. Here you’ll read that Dwight created a bot to facilitate conversations and you can command this bot to retrieve files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GhA02LdG_aTWVCiG.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RYL-uwgE-w9gKQv0.png" /></figure><p>As mentioned, the bot is only restricted to the sales folder. After some testing, it seems that the path is /home/dwight/sales</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j1WK4zYvuJNeZIda.png" /></figure><p>I saw that the user.txt file is just one directory over (under /home/dwight/) but I have no permission</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*PJ8-kjMiN_jR9k8i.png" /></figure><p>You’ll notice one weird directory and that is “hubot”. I googled it and it turns out to be a bot similar to slackbot. <a href="https://hubot.github.com/">https://hubot.github.com/</a></p><p>Inside the hubot directory you’ll see that .env file for the bot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*og-kWG2HroQD5gQ7.png" /></figure><blockquote><em>&lt;!=====Contents of file ../hubot/.env=====&gt;<br>export ROCKETCHAT_URL=’http://127.0.0.1:48320&#39;<br>export ROCKETCHAT_USER=recyclops<br>export ROCKETCHAT_PASSWORD=</em><em>&lt;&lt;SECRET PW&gt;&gt;<br>export ROCKETCHAT_USESSL=false<br>export RESPOND_TO_DM=true<br>export RESPOND_TO_EDITED=true<br>export PORT=8000<br>export BIND_ADDRESS=127.0.0.1<br>&lt;!=====End of file ../hubot/.env=====&gt;</em></blockquote><p>Remember on our nmap scan that port 22 is open? Maybe we can use this credential to authenticate?</p><p>I initially tried the recyclops user since that’s the one indicated on the .env file but it failed so tried with ‘dwight’ since he’s the admin that created the bot and voila, I’m in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LpD_oATXHLqDzEXc.png" /></figure><h3>User Flag</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*65AWb92nkxgPWkGL.png" /></figure><h3>Root Flag</h3><p>This is a bit cheating as I already know that this machine is vulnerable to polkit exploit since another user left the python script.</p><p>I’ll update this write-up once I figure out another way to escalate my privilege on this machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WDis2cBm2SE7wheG.png" /></figure><h3>References</h3><ul><li><a href="https://security.stackexchange.com/questions/31659/testing-for-http-trace-method">https://security.stackexchange.com/questions/31659/testing-for-http-trace-method</a></li><li><a href="https://www.zaproxy.org/docs/alerts/10039/">https://www.zaproxy.org/docs/alerts/10039/</a></li><li><a href="https://docs.gitlab.com/ee/user/application_security/dast/checks/16.4.html">https://docs.gitlab.com/ee/user/application_security/dast/checks/16.4.html</a></li><li><a href="https://webtechsurvey.com/response-header/x-backend-server">https://webtechsurvey.com/response-header/x-backend-server</a></li><li><a href="https://kb.leaseweb.com/products/hosting/web-hosting/adding-a-website-to-hosts-file-and-testing-it#Addingawebsitetohostsfileandtestingit-InLinux">https://kb.leaseweb.com/products/hosting/web-hosting/adding-a-website-to-hosts-file-and-testing-it#Addingawebsitetohostsfileandtestingit-InLinux</a></li><li><a href="https://www.exploit-db.com/exploits/47690">https://www.exploit-db.com/exploits/47690</a></li><li><a href="https://hubot.github.com/">https://hubot.github.com/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2be1b6b5c129" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/paper-hackthebox-l-e-2be1b6b5c129">Paper — HackTheBox (L-E)</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Knife — HackTheBox Write-up (L-E)]]></title>
            <link>https://0510-archivist.medium.com/knife-hackthebox-write-up-l-e-c0ab8cf23c3c?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0ab8cf23c3c</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Fri, 13 Aug 2021 17:23:35 GMT</pubDate>
            <atom:updated>2021-08-13T17:23:35.671Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Knife — HackTheBox Write-up (L-E)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*ncBEjU2EpQu-SxngpXn0mQ.png" /></figure><h3>Reconnaissance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*k3X-ArCDvXjf--RMUVGiJQ.png" /></figure><p>So we only have 2 interesting ports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnf73laRVLavSU06GSpfvQ.png" /></figure><p>The website is quite empty. All the tab on the upper right is not clickable. Let’s see if we can enumerate some hidden directories.</p><h3>Enumeration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*gQtH-2-TmnddcMXHdntXWg.png" /></figure><p>That’s weird. We don’t have any useful directories.</p><p>Snooping around we’ll see that this website is running on PHP 8.1.0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*3qWa8kZ_l-ECTY0_WAq9ZA.png" /></figure><p>(Or if you have the Wappalyzer plugin, you’ll see this info immediately)</p><p>This is good news for us since PHP 8.1.0 have an existing remote code execution vulnerability that you can see <a href="https://www.exploit-db.com/exploits/49933"><strong>here</strong></a>.</p><p>Let’s try it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*LZtDiEPGfQ2TmJz_-ZtckA.png" /></figure><p>And it works! We now have access to the system!</p><h3>User Flag</h3><p>Since we already have access, it’s just a simple matter of finding the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*uY1uZy-KCD_WopuvYeoJrg.png" /></figure><h3>Root Flag</h3><p>Let’s run a reverse shell to have a more stable connection then spawn a python interactive shell. I used this <a href="https://www.revshells.com/"><strong>site</strong></a> to help me generate reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*6Zgot9t7FZ6yHUms74ghmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*hbfYIkV70ex8wgL4Xn3PwA.png" /></figure><p>Since we can obviously access the root director to get the root flag, let’s check what this user can run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*we9ZWX8rxulhk68gK4alGg.png" /></figure><p>So we can run the knife command. GTFOBins a great <a href="https://gtfobins.github.io/gtfobins/knife/"><strong>website</strong></a> that lists valid commands we can use in Linux binaries to help us escalate our privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*gulohYafwh73jtQBLo3nSg.png" /></figure><p>To find the root flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*-WbTc-IdoTP-Q_dpYxwAIA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0ab8cf23c3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — RootMe Write-up]]></title>
            <link>https://0510-archivist.medium.com/tryhackme-rootme-write-up-85f0a188304c?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/85f0a188304c</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Sun, 08 Aug 2021 13:27:59 GMT</pubDate>
            <atom:updated>2022-06-17T10:49:03.585Z</atom:updated>
            <content:encoded><![CDATA[<h3>RootMe — TryHackMe Write-up</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vAPLORaxnAfBo5Ya.png" /><figcaption><a href="https://tryhackme.com/room/rrootme">https://tryhackme.com/room/rrootme</a></figcaption></figure><blockquote>A ctf for beginners, can you root me?</blockquote><h3>Reconnaissance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*y5E9YrZ_TS-TpIvIlEhvtQ.png" /><figcaption>nmap -sC -sV 10.10.161.38</figcaption></figure><p>As we can see there are two ports; <strong>22</strong> (ssh) and <strong>80</strong> (http). Let’s focus more on port 80 as this is more likely to give us an entry point.</p><ul><li>Scan the machine, how many ports are open? 2</li><li>What version of Apache is running? 2.4.29</li><li>What service is running on port 22? SSH</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lrywvj93joi4YTIXLUTz0Q.png" /><figcaption><a href="http://10.10.161.38/">http://10.10.161.38/</a></figcaption></figure><p>The website doesn’t show anything aside from the text above. The page source also doesn’t show anything interesting.</p><p>Time to enumerate!</p><h3>Enumeration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jVoifs5N7F3kaomU-2P1nQ.png" /><figcaption>gobuster dir — random-agent -u <a href="http://10.10.161.38/">http://10.10.161.38/</a> -w /usr/share/wordlists/dirb/common.txt -t 10</figcaption></figure><p>That /panel looks interesting. Let’s take a peek.</p><ul><li>What is the hidden directory? /panel</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*laLAVsK-fQNcVUD-5v3DKA.png" /></figure><p>This is perfect. This could allow us to upload a web shell.</p><p>There are lots of available web shells out there but I’ll be using <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md#php">this one from Pentest Monkey</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*U76-mRNaQtFdraop0l3yNg.png" /></figure><p>Looks like uploading php files is not permitted.</p><p><a href="https://null-byte.wonderhowto.com/how-to/bypass-file-upload-restrictions-web-apps-get-shell-0323454/">Reference 1</a><br><a href="https://vulp3cula.gitbook.io/hackers-grimoire/exploitation/web-application/file-upload-bypass">Reference 2</a><br><a href="https://book.hacktricks.xyz/pentesting-web/file-upload">Reference 3</a></p><p>I found 3 references on how to bypass php file upload restrictions like this one. The easiest method would be to change the file extension to something like “<strong><em>phtml</em></strong>”</p><p>We might as well start our netcat listener in case it’s successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*j_hW3qRMvbGIzel3MVRWGA.png" /></figure><p>We’ve successfully uploaded the shell! Now we just need to trigger it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*k2jNke_SkUVLIDa3efo5gQ.png" /></figure><p>We have now a shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*DWAFakRzWKCwhd4GFkpU5A.png" /></figure><h3>Finding the User flag</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*05sO3Q3yBKKWWluO_EjywA.png" /></figure><ul><li>user.txt? THM{y0u_g0t_a_sh3ll}</li></ul><h3>Privilege Escalation</h3><p>We have to find a file that has a <a href="https://www.techrepublic.com/article/linux-101-what-is-the-suid-permission/">SUID</a> permission set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*pft1oOsS7LEh0rzfJiJPEQ.png" /></figure><p>That python file looks interesting since python doesn’t usually have this kind of permission.</p><ul><li>Search for files with SUID permission, which file is weird? /usr/bin/python</li></ul><p>For this system binaries exploit like this we have to refer to <a href="https://gtfobins.github.io/">GTFObins</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*QsxnDgwuW4Vs1t5Kp0UagA.png" /></figure><p>We are now root!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*kApb56s1BDcc-h-K2Y3h7A.png" /></figure><ul><li>root.txt? THM{pr1v1l3g3_3sc4l4t10n}</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85f0a188304c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ready — HackTheBox Write-up (L-M)]]></title>
            <link>https://0510-archivist.medium.com/ready-hackthebox-write-up-l-m-d978adcb426c?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/d978adcb426c</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Mon, 19 Apr 2021 18:31:24 GMT</pubDate>
            <atom:updated>2021-04-19T18:31:24.924Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ready — HackTheBox Write-up (L-M)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*9lEjr1pMNjmREryYbNOYrA.png" /></figure><h3>Reconnaissance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*UL0wdS3aVV258h1Ctvk2sQ.png" /></figure><p>Looking at <strong>http://10.10.10.220:5080</strong>, we could see that this is a self hosted instance of Gitlab Community Edition</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8mAO65xCCXl1oiLFbmKJtA.png" /></figure><p>I ran a enumeration using dirbuster and found the following directories</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R1EktQsA5xf10lVKpbKUdA.png" /></figure><p>As seen also during the NMAP scan, the robots.txt file of the site contains a lot of directories</p><pre># See <a href="http://www.robotstxt.org/robotstxt.html">http://www.robotstxt.org/robotstxt.html</a> for documentation on how to use the robots.txt file<br>#<br># To ban all spiders from the entire site uncomment the next two lines:<br># User-Agent: *<br># Disallow: /</pre><pre># Add a 1 second delay between successive requests to the same server, limits resources used by crawler<br># Only some crawlers respect this setting, e.g. Googlebot does not<br># Crawl-delay: 1</pre><pre># Based on details in <a href="https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/routes.rb">https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/routes.rb</a>, <a href="https://gitlab.com/gitlab-org/gitlab-ce/blob/master/spec/routing">https://gitlab.com/gitlab-org/gitlab-ce/blob/master/spec/routing</a>, and using application<br>User-Agent: *<br>Disallow: /autocomplete/users<br>Disallow: /search<br>Disallow: /api<br>Disallow: /admin<br>Disallow: /profile<br>Disallow: /dashboard<br>Disallow: /projects/new<br>Disallow: /groups/new<br>Disallow: /groups/*/edit<br>Disallow: /users<br>Disallow: /help<br># Only specifically allow the Sign In page to avoid very ugly search results<br>Allow: /users/sign_in</pre><pre># Global snippets<br>User-Agent: *<br>Disallow: /s/<br>Disallow: /snippets/new<br>Disallow: /snippets/*/edit<br>Disallow: /snippets/*/raw</pre><pre># Project details<br>User-Agent: *<br>Disallow: /*/*.git<br>Disallow: /*/*/fork/new<br>Disallow: /*/*/repository/archive*<br>Disallow: /*/*/activity<br>Disallow: /*/*/new<br>Disallow: /*/*/edit<br>Disallow: /*/*/raw<br>Disallow: /*/*/blame<br>Disallow: /*/*/commits/*/*<br>Disallow: /*/*/commit/*.patch<br>Disallow: /*/*/commit/*.diff<br>Disallow: /*/*/compare<br>Disallow: /*/*/branches/new<br>Disallow: /*/*/tags/new<br>Disallow: /*/*/network<br>Disallow: /*/*/graphs<br>Disallow: /*/*/milestones/new<br>Disallow: /*/*/milestones/*/edit<br>Disallow: /*/*/issues/new<br>Disallow: /*/*/issues/*/edit<br>Disallow: /*/*/merge_requests/new<br>Disallow: /*/*/merge_requests/*.patch<br>Disallow: /*/*/merge_requests/*.diff<br>Disallow: /*/*/merge_requests/*/edit<br>Disallow: /*/*/merge_requests/*/diffs<br>Disallow: /*/*/project_members/import<br>Disallow: /*/*/labels/new<br>Disallow: /*/*/labels/*/edit<br>Disallow: /*/*/wikis/*/edit<br>Disallow: /*/*/snippets/new<br>Disallow: /*/*/snippets/*/edit<br>Disallow: /*/*/snippets/*/raw<br>Disallow: /*/*/deploy_keys<br>Disallow: /*/*/hooks<br>Disallow: /*/*/services<br>Disallow: /*/*/protected_branches<br>Disallow: /*/*/uploads/</pre><p>Most of the directories are inaccessible and requires an account. So I created one just to see more information about this gitlab instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*LFYe5Lo_8-JW1BdTX63azg.png" /></figure><h3>Initial Foothold and User Flag</h3><p>A quick search on google would tell you that this version of GitLab CE is vulnerable to remote code execution. <a href="https://github.com/ctrlsam/GitLab-11.4.7-RCE"><strong>Git</strong></a> and <a href="https://www.exploit-db.com/exploits/49334"><strong>ExploitDB</strong></a><strong> </strong>reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*rUbp0H1__ekWfSlOFHeN1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*cNxvKjbW9uZUbnyxghCXfQ.png" /></figure><p>It worked!</p><p>Since we have established a connection, we can looking for the user flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*ZboY_knQtPRMg1igwOnUOg.png" /></figure><h3>Privilege Escalation</h3><p>We need to stabilize our shell first before we do anything. There are lot of ways but my go to is via python</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*bs4O-DvBZWF7jRduID_u7A.png" /></figure><p>sudo -l is not working so I don’t know the privilege and allowed commands for the user git. I’m sure that there are other ways but I don’t know.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*yKELiUVn0E3mh9nPwYv1ag.png" /></figure><p>Enumeration some more, I found gitlab.rb. It’s a config file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*19teh8-0bvE8N-QTpxRWuQ.png" /></figure><p>And it contains a password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*hUAd5EB63C617qGkNeh7pg.png" /><figcaption>gitlab_rails[‘smtp_password’] = “wW59U!ZKMbG9+*#h”</figcaption></figure><p>It works on root user!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*MILpZEH0ch6CNBXBLHt16A.png" /></figure><h3>Root Flag</h3><p>Since we’re now a root user. It’s just a matter of finding the root.txt file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*1bx_moueHa2cTzI-rF-hsw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d978adcb426c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beep — HackTheBox Write-up (L-E)]]></title>
            <link>https://0510-archivist.medium.com/beep-hackthebox-write-up-l-e-7f9e2d10c706?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f9e2d10c706</guid>
            <category><![CDATA[local-file-inclusion]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 15:09:58 GMT</pubDate>
            <atom:updated>2021-03-26T15:09:58.057Z</atom:updated>
            <content:encoded><![CDATA[<h3>Beep — HackTheBox Write-up (L-E)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*cCxE0v24Ct3BfuxE97sRFA.png" /></figure><h3>Reconnaissance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*r_rByJnZJNcsFesrTb34Tg.png" /></figure><p>Lots of open ports = big attack surface. The quickest one we could check is the webpage via port 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*040OrLM7v172bnVHlHkPfw.png" /></figure><h3>Gaining Access</h3><p>Since we have no information about the credential it’s not practical to blindly brute force it.</p><p>Searching around, we could see that there are lots of exploits available for Elastix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j4gYvjCFGK4LhsA0XTne8Q.png" /></figure><p>Since I don’t know the exact Elastix version for this one, I could just try all these and see what sticks. The most straightforward here if the LFI exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I78rGi_XXWFxfaAIrl8cWQ.png" /><figcaption><a href="https://www.exploit-db.com/exploits/37637">Source</a></figcaption></figure><p>Just append the exploit on the URL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*Wy4ojbALWY4xHneUkFe5dw.png" /></figure><p>And you will see this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xvh73CvWZh2ygr0mzfkfUA.png" /></figure><p>After viewing the page source to format this wall of text, we will see these credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*TkOaiUaXm98gyKpUROQgcg.png" /></figure><p>Maybe we could use this credential for SSH connection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*j9O9jIEBRlzC0qtLugkxZA.png" /></figure><p>This is an issue with key exchange but you resolve this temporarily using this command:</p><p><strong>ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 123.123.123.123</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*IOcUWwGmpCpYesAHFLODNg.png" /></figure><p>So admin is not working using the <strong>AMPDBPASS/AMBMGRPASS</strong>. Maybe we could try root as username using the same password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*xpBLfTieWwzcGSftUl-CnA.png" /></figure><h3>Finding the Flags</h3><p>Now that we have root access, finding the flags is trivial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*jKE9QstRkAIAqr-5-ebqVQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f9e2d10c706" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Script Kiddie — HackTheBox Write-up (L-E)]]></title>
            <link>https://0510-archivist.medium.com/script-kiddie-hackthebox-write-up-l-e-129890ba57a6?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/129890ba57a6</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[metaspolit]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 15:08:08 GMT</pubDate>
            <atom:updated>2021-03-26T15:08:08.688Z</atom:updated>
            <content:encoded><![CDATA[<h3>Script Kiddie — HackTheBox Write-up (L-E)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fkFI1RzZP2YAQSPui5ngQg.png" /></figure><blockquote>An easy machine that will practice your skills in using metasploit and creating reverse shells.</blockquote><h3>Initial Reconnaissance</h3><p>Let’s see scan the machine using nmap to see open ports that we can work with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*KI4slVzhXeHOYcO_zKXBfA.png" /></figure><p>Let’s check port 5000 first as it’s running a http service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-_8uYhgX3NDC9AxWWR1ZoQ.png" /></figure><p>The page allows you to scan an IP using nmap, upload metasploit payloads, and search exploits using searchploit.</p><p>Searching about metasploit venom I found this</p><blockquote>MSFvenom is a combination of Msfpayload and Msfencode, putting both of these tools into a single Framework instance. msfvenom replaced both msfpayload and msfencode as of June 8th, 2015.</blockquote><p>Since this the only part of the site that allows us to upload something, maybe we can use this to get us a reverse shell.</p><p>Let’s use the built in searchploit module on the page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fyq3InozdOmcLS2444P0yA.png" /></figure><p>So it turns msfvenom has a command injection vulnerability that we can probably exploit.</p><h3>Payload Creation and Gaining Initial Access</h3><p>Search for the msfvenom on Metasploit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wbzzfU2cG4q28P4FUwBHUw.png" /></figure><p>Let’s use that. As you can see this is the default option for the particular exploit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*eqGqbbfjvuAsrU6isv2DyQ.png" /></figure><p>I just changed the LHOST to my own IP and we’re good to go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*ZRnzZmBnSZ-qDGUHGWMZ8A.png" /></figure><p>So Metasploit created an .apk payload. I’m going to setup up a listener on my end and upload the file on the webpage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*EralluqITaa5GHAeB1MayA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*NE86i28R0DMrNB7p83tlXg.png" /></figure><p>And we have successful connection! Now to make it more stable we’re going to spawn an interactive shell via python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*8tEBk1AUnXRSOFtwGrcFAg.png" /></figure><p>Now that we have a stable shell, we can start looking for the user flag.</p><h3>Finding the User Flag</h3><p>Let’s use find command to make our life easier</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*MxRRmfsrZueeJE3Pkzcpqg.png" /></figure><p>So it’s in the home directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*Wm4RseEvvUQqAQ-93aqx5g.png" /></figure><h4>Further Exploration and Privilege Escalation</h4><p>Looking around we’ll see that there are two users; kid and pwn</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*UhyUc-h8qVd145CYzdFtuQ.png" /></figure><p>Checking out pwn, we will see an interesting file called scanlosers.sh that is owned by pwn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*NIAbJFCthdc1LYDUhpiXSQ.png" /></figure><p>So maybe we can use the hackers file to create a reverse shell as pwn</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*vp6haDjmUCYKJF73O3Hbig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*CM7t1EqPsBmBBGQK4qmLxg.png" /></figure><p>It worked! Now we’re connected as pwn. Let’s see what we can do with this user.</p><blockquote>PS This shell <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md">cheat sheet</a> will save you a ton of time</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*lklHa1RRqM1z9bbC5Ju0JA.png" /></figure><p>Turns out we can run metasploit as root</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*F5DuGt8ZXkuXXufQWKLSSQ.png" /></figure><p>There we have our root flag!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=129890ba57a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lame — HackTheBox Write-up]]></title>
            <link>https://0510-archivist.medium.com/lame-hackthebox-write-up-5d5bd6522f20?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d5bd6522f20</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Sun, 28 Feb 2021 17:38:03 GMT</pubDate>
            <atom:updated>2023-04-28T06:29:19.901Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lame — HackTheBox Write-up (L-E)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jGSzgeDF_krxdPXu4qqwvg.png" /></figure><p>Lame is an <a href="https://app.hackthebox.eu/machines/1">easy Linux box</a> released way back in March 2017 that involves exploiting a SMB vulnerability on the machine.</p><h3>Reconnaissance</h3><p>Let’s check for open ports and running services using nmap</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVnyY61jPxWoR3SQov8XBw.png" /></figure><p>We have 4 ports open; 21, 22, 139, and 445.</p><p>Exploring the allowed anonymous login via FTP doesn’t really give us much. The only other interesting ports are the two smb ports.</p><h3>Exploitation and Privilege Escalation</h3><p>Searching around, we’ll see that Samba smbd 3.0.20 has a username map script command execution <a href="https://www.exploit-db.com/exploits/16320">vulnerability</a>. Let’s use that on Metasploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TQ9x8x524WsYXdSVbC_8_Q.png" /></figure><p>It worked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HsHHYnz2Ft9wLXNoaeC4xg.png" /></figure><p>Let’s stabilize our connection by spawning a python interactive shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*Y0MvOpxc6WiTs7s4qmkJNA.png" /></figure><p>Since we’re already a root user, finding both the user and root flag is just a matter of directly reading the files.</p><h4>User Flag</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*1-H23GmQkhdQf4O6dvKv5A.png" /></figure><h4>Root Flag</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*EhylvMZpZcCuDHkvH4N-dQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d5bd6522f20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Lian_YU Walkthrough]]></title>
            <link>https://0510-archivist.medium.com/tryhackme-lian-yu-walkthrough-ecc95e4f532?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecc95e4f532</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Wed, 17 Feb 2021 16:12:00 GMT</pubDate>
            <atom:updated>2021-02-28T09:01:03.023Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lian_YU — TryHackMe Write-up</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Lofd8_PCbhxim71J.jpg" /></figure><blockquote>A fun CTF on <a href="https://tryhackme.com/">TryHackMe</a> for fans of Arrow!</blockquote><h3>Reconnaissance</h3><p>Fire up NMAP and let’s see the open ports on this machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*O4c9FV-e0DjtNQpUTwqugg.png" /></figure><p>Port 80 is open and running so let’s look at the webpage first. Looks like the creator of this CTF challenge is a huge Arrow fan!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYB3UoK72t_yvQNKHd1Pdg.png" /></figure><p>Checking the page source, there seems to be no hidden comments nor other interesting information that we can use so let’s move to enumeration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*haDEX1bGAedGg1DOEkzXYA.png" /></figure><p>Looks like we have two notable directories; /island and /island/2100.</p><p>Let’s see /island first</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1rwCKhcvJAqaKshQGtrj-w.png" /></figure><p>The message looks incomplete. Maybe we can see the complete text in the page source?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*WTI2mSp13poj6YUJ_DHyww.png" /></figure><p>So the hidden word is vigilante. Actually, now knowing that they just used a white font color to hide the text, we can make it appear just by highlighting the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*L_lXN3N6M7PlfCMgmqg0fQ.png" /></figure><p>Now let’s check /island/2100</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*eVrC9M6ADVAA55RAHUuibg.png" /></figure><p>As you can see, highlighting didn’t reveal any hidden texts so let’s check the page source again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*xMcFjuxoCSOS-WL-c4xAXg.png" /></figure><p>.ticket huh? Maybe, a file is hidden somewhere in this directory with a .ticket extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*vZh1ZWL9-ejhN_uiUoM9gw.png" /></figure><p>Going to http://10.10.155.102/island/2100/green_arrow.ticket we’ll see this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*gI4SbwAC7tAwHnECmRqX7A.png" /><figcaption>RTy8yhBQdscX</figcaption></figure><p>I really have no idea what that means. If it’s a substitution cipher, it’s hard to determine the plaintext because of the length. For this one we could use <a href="https://gchq.github.io/CyberChef/">CyberChef </a>to help us out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMhOp4ewzw-GoJxM1QTxTA.png" /><figcaption>!#th3h00d</figcaption></figure><p>It turns out that it’s Base58 encoded. So now we have another interesting string !#th3h00d</p><blockquote>How did I know that it’s Base58? Trial and error. Is it a massive waste of time? Very much so, yes.</blockquote><p>Remember that ports 21 and 22 are open? Maybe vigilante and !#th3h00d are the credentials!</p><p>It doesn’t work on SSH but it worked on FTP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qeEvDMuAU8Ckuu44sfW3vA.png" /></figure><p>The first image, Leave_me_alone.png looks corrupted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*_XT9963mbPHzHE8BKMgJdg.png" /></figure><p>Examining the hex values of the image, we’ll see that it doesn’t follow the typical starting bytes of a png image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQ3rgPNajmdKGiTCbjjQlg.png" /></figure><p>Before we proceed, you should know about magic bytes. Magic bytes essentially refers to “a block of arcane byte values used to designate a file type in order for applications to be able to detect whether or not the file they plan to parse and consume is of the proper format”.</p><p>You can check <a href="https://medium.com/@d.harish008/what-is-a-magic-byte-and-how-to-exploit-1e286da1c198">this</a> and <a href="https://blog.netspi.com/magic-bytes-identifying-common-file-formats-at-a-glance/">this</a> for additional information.</p><p>Going over to <a href="https://en.wikipedia.org/wiki/List_of_file_signatures">Wikipedia</a>, we can see a list of file signature for each file type.</p><p>Fire up your preferred hex editor and let’s fix this image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*rr4IFrWcyBWZkR_cPtlOrg.png" /></figure><p>See the difference from the original hex values?</p><p>Now we can see the actual image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*aJ6KJ8jDKBsgRzQTNencjw.png" /><figcaption>Leave_me_alone.png</figcaption></figure><p>For the other two pictures, I tried using exiftool, binwalk, foremost, and strings on Queen’s_Gambit.png but it yielded empty results. I also tried using steghide but it says the image type is not supported.</p><p>I tried the same thing on aa.jpg and it all failed except steghide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*0lQkXX9KZc-MCjnqzj2RRA.png" /></figure><p>The password is actually the revealed on Leave_me_alone.png. The ss.zip contains two files; shado and passwd.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*wsoOyVurtLwUbEyb1awsUQ.png" /></figure><p>Trying M3tahuman on SSH fails because we still don’t have a user. Let’s see if we can find more info on FTP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*Q0OOlZD1vCuO3USIwkg7MA.png" /></figure><p>Apparently, we have another user on the system! let’s try that on SSH now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*UhA_W962taVqA4C7pXZ3IQ.png" /></figure><p>GOD DAMN IT WORKED.</p><p>Just a recap, we still have that Queen’s Gambit image to work with. Let’s explore this connection first.</p><h4>USER.TXT</h4><p>You’ll immediately the user.txt once you connected</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*Bec6gCNP3xSm7UokuXNGPw.png" /></figure><h4>ROOT.TXT</h4><p>Going directly to /root is not allowed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*X30JanAeB4Iyu3qJjEqmRg.png" /></figure><p>Let’s run sudo -l to see what restrictions we have on this user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*TeWsXQf4PCNr2cKq-xVDRg.png" /></figure><p>So we can run /usr/bin/pkexec as root.</p><p>I’m nor really familiar about privilege escalation using pkexec so I just searched around google and found <a href="https://book.hacktricks.xyz/linux-unix/privilege-escalation/interesting-groups-linux-pe">this</a>. Basically we need to execute /bin/sh using pkexec to elevate our privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*QASa63X0mePkiVGzdFIfpQ.png" /></figure><p>Congrats on completing this room! TIL about pkexec. Google is definitely your friend when it comes to this kind of problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecc95e4f532" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Pickle Rick Write-up]]></title>
            <link>https://0510-archivist.medium.com/tryhackme-pickle-rick-write-up-b2676c9d69f8?source=rss-589a49518502------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2676c9d69f8</guid>
            <category><![CDATA[pickle-rick]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[05-10 Archivist]]></dc:creator>
            <pubDate>Mon, 15 Feb 2021 12:55:18 GMT</pubDate>
            <atom:updated>2021-02-27T17:39:09.641Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pickle Rick — TryHackMe Write-up</h3><p>A Rick and Morty CTF. Help turn Rick back into a human!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*snGkAeojBfNWBFge4fCd1g.jpeg" /><figcaption><a href="https://tryhackme.com/room/picklerick">https://tryhackme.com/room/picklerick</a></figcaption></figure><blockquote>This Rick and Morty themed challenge requires you to exploit a webserver to find 3 ingredients that will help Rick make his potion to transform himself back into a human from a pickle.</blockquote><p>As always, the first thing we need to do is to run scan for open ports</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*_lxEi1z7WUB-xTdWsK560g.png" /></figure><p>As we can see, there are three open ports on the machine; <strong>22</strong>, <strong>80</strong>, and <strong>2301</strong>. However, let’s focus on port 80 as that would more likely to give us something to work with.</p><p>Here’s the webpage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oFBWEnmXJxb-k1gPEqkBAA.png" /></figure><p>It’s a plain static webpage so not much information right there. Let’s check if we can find something interesting on the page source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*-iREwzd4u2GG8g_nU3v1xA.png" /><figcaption>R1ckRul3s</figcaption></figure><p>A username! That’s not very smart Rick!</p><p>Another common hidden file on webpages like this is the robots text file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*W3h6zDMOBKeQ5VDGquVIQQ.png" /></figure><p>So now we have a username, R1ckRul3s, and a random string from robots.txt, Wubbalubbadubdub.</p><p>The question is where can we use these? Time to run Dirbuster!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCK3I_OivYaYzk-xbyV8bQ.png" /></figure><p>There are lots of accessible files and directory but that login.php looks the most interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mRI78oT70oBVGX3esBHJag.png" /></figure><p>We all know the username. Maybe that weird string on robots.txt is the password?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y0ORDtrOlafqPmVe3JjEmQ.png" /></figure><p>It worked! Now we’re successfully logged in. However, it seems like some commands are not allowed such as cat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6P2la9Vtxp0_CM9zEu86VQ.png" /></figure><p>Let’s attempt to run a reverse shell on the command panel.</p><p>You can choose from these <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md">list of reverse shells</a>. Once it’s working, you should now have access to the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*Au9iNIp5HnuxpT860TWSuA.png" /></figure><p>It’s good to always check our current username and we can do that using the whoami command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*p3WnnPiqCKnMNTzaKre8Dg.png" /></figure><p>We could also check what commands we can run as this user using sudo -l</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*yRSDZQxGEbJ4C1WBILDEyw.png" /></figure><p>So that means we can run any command without restrictions!</p><h3>Getting the ingredients</h3><h4>First Ingredient</h4><p>On the initial directory after getting a shell, we’ll see an interesting file. Opening it will get us the first ingredient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*_yS7iiCZQrTJFu3jdimkXw.png" /></figure><h4>Second Ingredient</h4><p>So where’s the other ingredients? Let’s see the content of clue.txt.</p><p>Look around the file system for the other ingredient</p><p>We could manually look around the entire file system for the other ingredients or we could just utilize the find command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*D8VjvcFOxVKXnPDEHCQoig.png" /></figure><p>cat to see the second ingredient!</p><h4>Third Ingredient</h4><p>Going to the / directory, we can see a “root” directory. However, navigating to or accessing it is not allowed.</p><p>We need to use sudo to see the content of the directory, and hopefully the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*VEE70xj92DANE-I30ufUxA.png" /></figure><p>That’s it! Congratulations on completing this room!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2676c9d69f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>