<?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 Lance Lance on Medium]]></title>
        <description><![CDATA[Stories by Lance Lance on Medium]]></description>
        <link>https://medium.com/@SyakNiLance?source=rss-e7c45438805d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fuL_EpQMMPIMvsR-.jpg</url>
            <title>Stories by Lance Lance on Medium</title>
            <link>https://medium.com/@SyakNiLance?source=rss-e7c45438805d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 07:23:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SyakNiLance/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[Hack The Box: Canape]]></title>
            <link>https://medium.com/@SyakNiLance/hack-the-box-canape-499d3c93a1b5?source=rss-e7c45438805d------2</link>
            <guid isPermaLink="false">https://medium.com/p/499d3c93a1b5</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Lance Lance]]></dc:creator>
            <pubDate>Mon, 17 Sep 2018 12:52:16 GMT</pubDate>
            <atom:updated>2018-09-17T12:52:16.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*DLuvGmm-VhWiFgc3UIchxg.png" /><figcaption>Canape</figcaption></figure><p>Hi, all! Now that <strong>Canape’s</strong> been retired, let’s drop a write-up!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*4Honr_A6tVkOPdvJvY_LHw.jpeg" /><figcaption>Homer ma boi</figcaption></figure><p>For this box, the target’s IP address is 10.10.10.70.</p><h3>Enumeration</h3><p>So first let’s scan the target for open ports and to enumerate services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*25MnV6FAXX7_0PtOJcwfag.png" /><figcaption>nmap result</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jiay7PkGWSDRuxIvY8AXfA.png" /><figcaption>nmap result</figcaption></figure><p>We can see in the results that the http and ssh services are open. We can assume right now that we need to get credentials in order to use ssh (it requires credentials upong accessing it). For now, let’s visit the website hosted in port 80 to look for clues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ua1WkhkFGpaulDoTlQfPeQ.png" /><figcaption>landing page</figcaption></figure><p>About the website profile, it is a Simpsons Fan Site with the functionality of viewing and submitting quotes. The quotes submission functionality is interesting because we can probe it for input validation vulnerabilities. In parallel of doing that, we can crawl the application using <strong>BURP</strong> suite to look for interesting files and directories as well.</p><p>After crawling the website, a .git folder was found:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*dU-4QJqdhFHOn6gwYgffXA.png" /><figcaption>git gud aye!?</figcaption></figure><p>we can download the contents of a specific directory using the <strong>wget </strong>command:</p><blockquote>wget -r -np -R “index.html*” <a href="http://10.10.10.70/.git/">http://10.10.10.70/.git/</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgNFPiAh_n0NAieVW7xl1w.png" /><figcaption>wget</figcaption></figure><h3>Git gud aye!?</h3><p>Initially, the extracted directory only contains the .git folder. From here, it is really helpful to study how Git works. For further reading, you can check this article <a href="https://medium.freecodecamp.org/understanding-git-for-real-by-exploring-the-git-directory-1e079c15b807.">https://medium.freecodecamp.org/understanding-git-for-real-by-exploring-the-git-directory-1e079c15b807.</a> After researching about the inner workings of Git, we knew that the .git folder can be used to retrieve a ‘snapshot’ of the application. Using this snapshot, we might be able to replicate the original web application. Let’s see how it goes.</p><p>Here’s the contents of the directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*Of8EgBG5G8D6RAIsWk78MQ.png" /><figcaption>Directory Contents</figcaption></figure><p>Checking the logs…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*Xf3DpnGsejWlSv4FoNr5FA.png" /><figcaption>git logs</figcaption></figure><p>Following the guide here <a href="https://medium.freecodecamp.org/understanding-git-for-real-by-exploring-the-git-directory-1e079c15b807">https://medium.freecodecamp.org/understanding-git-for-real-by-exploring-the-git-directory-1e079c15b807</a> , you can now extract the source code.</p><p>After following the instructions from the link, we can now check the contents of the extracted snapshot. It seems that it contains the source code of the web application for the simpson fansite. From here, we can analyze how it works in the code level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*b-fF0vdpT4j7ylveEyH-FA.jpeg" /><figcaption>code level…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*h7a6T005qO7hXfgoZyiCDg.png" /><figcaption>source code directory</figcaption></figure><p>Here’s the source code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/923b517d5aafd20dbb486e4bd4518a3b/href">https://medium.com/media/923b517d5aafd20dbb486e4bd4518a3b/href</a></iframe><p>Below are details that I find interesting after reviewing the source code.</p><ol><li>The web application uses couchdb for storing data</li><li>It has two interesting functionalities (a) submit for sending quotes for specific characters and (b) check for checking specific quotes using an identifier.</li><li>The application uses pickle for serialization and deserialization of data.</li><li>If it finds “p1” in data, it will deserialize it and it is returned. (sounds fishy right?)</li></ol><p>Using this data, we can do the following:</p><ol><li>Test the input validation mechanisms of the application for vulnerabilities.</li><li>Check for vulnerabilities / known exploits on Pickle Serialization and couchdb.</li><li>Setup a local version of the application (extracted from the .git) for easier testing.</li></ol><h3>Setup Local Application Version</h3><p>To setup the web application locally, you need to install couchdb <a href="http://docs.couchdb.org/en/2.1.1/install/index.html">http://docs.couchdb.org/en/2.1.1/install/index.html</a> as well as the other dependencies of the web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sM861Lr-kTn9cGO6cDc6Kg.png" /><figcaption>couchdb</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*4qqQ2gbf7PKXfrYQYkDLGg.png" /><figcaption>Our local setup</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*iGqdOBTcYSUh83rS9DV_gA.png" /><figcaption>encryption</figcaption></figure><p>Based on the code snippet above, using the submit functionality will create an output file located in the /tmp folder. The name of the file is based on the character name (e.g. homer) concatenated into the quote and then hashed using MD5. We can verify this by using our local setup and then checking the results in our /tmp folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*AqFYibQHJh2cgKE3tGYrPA.png" /><figcaption>homer</figcaption></figure><p>Lengthy? We’re almost there lol.</p><h3>Vulnerability Analysis and Exploitation</h3><h4>Vulnerability Type: Remote Code Execution (Weak Input Validation)<br>Vulnerable Service: Cpickle Python Library<br>Exploit POC: payload.py</h4><h4>Gaining RCE</h4><p>After poking the application for sometime, I created a payload based on a security issue on pickle with regards to serialization <a href="https://www.exploit-db.com/exploits/21623/">https://www.exploit-db.com/exploits/21623/.</a> Ideally, It will submit quotes in the form of os commands. Initially, it didn’t work because the character name is being appended in the quote (where we put our payload).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*qvt385N-qeh_iakT7A-RhQ.png" /><figcaption>char is appended</figcaption></figure><p>In order to bypass this, we need to exploit another vulnerability — the application’s input validation on the ‘character’. Below is a snippet of the vulnerable code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*NVxvs0opusFP3pe2XqNS_g.png" /><figcaption>weak input validation</figcaption></figure><p>In the snippet above, it will not return an error as long as the ‘character’ submitted is in the whitelist (Check the source code in the github gist above). This means that <em>Homer </em>and <em>homer </em>is valid input as well as &lt;payload&gt;homer.</p><p>Below is the payload for RCE. It invokes python to create a reverse shell to our machine. Through this, we gained foothold to our target.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8db0262a6a17e3240ae539d0b5fbdcb9/href">https://medium.com/media/8db0262a6a17e3240ae539d0b5fbdcb9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iCyjsbB6Ckz5lNMmvXG5Uw.png" /><figcaption>Low priv shell</figcaption></figure><p>And there we have it. A low priv shell!</p><h3>Post-Exploitation</h3><h4>Pwning user.txt<br>Vulnerability Type: Privilege Escalation (Input Validation)<br>Vulnerable Service: Couchdb</h4><p>After gaining access into the machine. The first thing that I checked is the user.txt. However, we do not have the permission to open it. This only means one thing — we still haven’t pawned the target user! Now, we need to escalate our privilege from <em>www-data</em> to <em>homer </em>(the user where it might contain the user.txt). To do this, let’s first conduct enumeration into the machine.</p><p>I checked the ports and found out that port 5984 was used. It is the default port used by couchdb. After conducting enumeration, I shifted my focus to couchdb. It is ideal to read its documentation to understand how it works.<a href="http://docs.couchdb.org/en/2.1.1/config/http.html">http://docs.couchdb.org/en/2.1.1/config/http.html</a></p><p>Based on this exploit, <a href="https://www.exploit-db.com/exploits/44498/">https://www.exploit-db.com/exploits/44498/</a> you can create a privileged user in couchdb remotely. I used it create an admin account so I can check the contents of the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*lcbQwUsxrcyAPUvGK4dCJg.png" /><figcaption>curl request to create user</figcaption></figure><p>I enumerated the contents of the database and found out that it contains passwords.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*E79eupzngenwi3RBQfwYkQ.png" /><figcaption>pwd</figcaption></figure><p>I made the mistake of assuming that querying the table will return the data that I needed. After reading the documentation and some nudge from other people, it turns out that these are metadata. I used the following query to get the data that I needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*ZhRI0gdIJM_eJ_SL7I71-Q.png" /><figcaption>user credentials</figcaption></figure><p>From our previous nmap scan, ssh is opened on port 65535. We can use the credentials found in the couchdb to login as homer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*eG4kHg0vwz5cd2PErHVwBA.png" /><figcaption>ssh</figcaption></figure><p>After Logging in as homer, we can now get the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*4cCNF_cOMBW6gPemCpvEpg.png" /><figcaption>user flag</figcaption></figure><h3>Pwning root.txt</h3><h4>Vulnerability Type: Privilege Escalation (Input Validation)<br>Vulnerable Services: sudo</h4><p>After getting the user flag, the next thing that we need to get is the root flag. In order to do this, we need to escalate our privilege to that of root user. I conducted another enumeration and found out that we are allowed to run pip install as root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhSF9BxSnB3PzEIOLtlsSA.png" /><figcaption>priv</figcaption></figure><p>with this capability, we can use the FakePip (<a href="https://github.com/0x00-0x00/FakePip">https://github.com/0x00-0x00/FakePip</a>) exploit to escalate our privilege into root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxyIWuTBOsBB5Q6tTGgHUA.png" /><figcaption>pip exploit</figcaption></figure><h3>Flags</h3><h4>user -&gt; bce918696f293e62b2321703bb27288d<br>root -&gt; 928c3df1a12d7f67d2e8c2937120976d</h4><p>That’s it folks! We’ve made it \m/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0D4zbLrs3ixlaYpJ8f_KXA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=499d3c93a1b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB — Valentine Write-up]]></title>
            <link>https://medium.com/@SyakNiLance/htb-valentine-write-up-54592d5895c6?source=rss-e7c45438805d------2</link>
            <guid isPermaLink="false">https://medium.com/p/54592d5895c6</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Lance Lance]]></dc:creator>
            <pubDate>Sun, 29 Jul 2018 11:52:54 GMT</pubDate>
            <atom:updated>2018-07-29T11:52:54.890Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*Fd5ZvISSt9R3xHpnPA2d2w.png" /><figcaption>HTB — Valentine</figcaption></figure><p>Hi All! In this article, let’s try to solve the ‘Valentine’ machine. Given the name, this was the first thing that came into my mind:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*iVWVuVTvwmRd3FTHSa1fMQ.jpeg" /></figure><p>Our target machine is 10.10.10.79.</p><h3>Enumeration</h3><p>Using <em>nmap</em>, let’s check what are the open ports and services in the machine. Below is the result of the <em>nmap </em>scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*73owv_OKxIGdVJlTqdCGbg.png" /><figcaption>nmap results</figcaption></figure><p>As shown in the result, both <em>http </em>and <em>https </em>ports are open. Let’s visit the web application and check its technology stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*5MHbOA14u17bNtL7ljdqKA.png" /><figcaption>wappalyzer result</figcaption></figure><p>We can also use searchploit to check if there are know exploits to these technologies. Upon visiting the site, an image of a screaming woman and a bleeding heart was displayed. It’s a clue right :D ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imRDc5Dte7l3BiU-kOmhvQ.png" /><figcaption>Landing Page</figcaption></figure><p>Since we already know that the machine also runs <em>ssl</em>, let’s use <em>sslyze </em>to look for ssl-related vulnerabilities. As shown below, our target machine is vulnerable to <strong>heartbleed</strong>! Maybe we can exploit it to leak some sensitive data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*UMl0oSk1bH_3NN2Yz7AwAw.png" /><figcaption>Target machine is vulnerable to heartbleed</figcaption></figure><h3>Vulnerability Analysis and Exploitation</h3><p>Vulnerability Type: Heartbleed bug (sensitive information disclosure)<br>Vulnerably Service: OpenSSL Library<br>Exploit POC: heartbleed-exploit.py</p><p>Now, let’s take a look what is OpenSSL Heartbleed all about. According to heartbleed.com:</p><blockquote>The Heartbleed bug allows anyone on the Internet to read the memory of the systems protected by the vulnerable versions of the OpenSSL software. This compromises the secret keys used to identify the service providers and to encrypt the traffic, the names and passwords of the users and the actual content. This allows attackers to eavesdrop on communications, steal data directly from the services and users and to impersonate services and users.</blockquote><p>Let’s try to read the memory of our target machine. Let’s use this hearbleed exploit <a href="https://www.exploit-db.com/exploits/32745/">https://www.exploit-db.com/exploits/32745/.</a> Below are the results of the exploit script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UIRLzws3sSzNP9ARAXfZGg.png" /><figcaption>exploit result leaking sensitive data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*dyIIgTy8X_1y33zyH4rP5g.png" /><figcaption>exploit result leaking sensitive data</figcaption></figure><p>As we can see from the result, we extracted the following:</p><p>1. The <em>/dev</em> directory which contains the files<strong> notes.txt</strong> and<strong> hype_key</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*TvQ0AfEhrfK1FvtXHg4haQ.png" /><figcaption>/dev directory</figcaption></figure><p>2. The<em> /decode.php</em> file which is a <em>base64 </em>encoder and decoder utility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*949-V19ZqUqluM32jEdrTg.png" /><figcaption>decoder.php</figcaption></figure><p>3. And a variable named text</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*iISY5kDzFc7u45OEaPeAaQ.png" /><figcaption>$text variable</figcaption></figure><h3>Post Exploitation — Pwning user.txt</h3><p>First, let’s take a look at the <em>$text</em> variable. Analyzing its value, we can say that it might be encoded. From here, let’s use the decoder that we found in <a href="https://10.10.10.79/decode.php.">https://10.10.10.79/decode.php.</a> Using the decoder yields the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*noCsCyPqzOZ_Hp-5cVqVhw.png" /><figcaption>$text’s value decoded</figcaption></figure><p>The encoded form is <em>heartbleedbelievethehype</em>. For now, let’s just leave it as it is. The next thing to do is to check the <em>/dev</em> directory. It contains a file named <em>hype_key</em> and <em>notes.txt</em> as shown below:</p><p>a. Contents of the hype_key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHyjpMAwLAkGY4TNyQjjEQ.png" /><figcaption>hype key</figcaption></figure><p>b. Contents of notes.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*AKtGTRh74nGf-BZu3FK4SQ.png" /><figcaption>notes.txt</figcaption></figure><p>From the looks of it, hype_key seems to be in hex format. Let’s try to decode it in text:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*DGJtHOEFR7tlg-NZ9NCbWQ.png" /><figcaption>Encrypted key</figcaption></figure><p>We got an encrypted<em> RSA private key</em> after decoding the file. Now we can connect the dots :). Here’s what we have:</p><ol><li>From the <em>nmap </em>scan, we identified that <em>ssh </em>is available.</li><li>We obtained an encrypted<em> RSA Private Key</em> from <em>hype_key.</em></li><li>We also extracted a passphrase a while ago using the <strong>Heartbleed</strong> exploit.</li></ol><p>Let’s save the encrypted<em> RSA Private Key </em>in<em> enc.key</em>. Using <em>openssl </em>and the passphrase, we can decrypt it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*WqF2c7AeiCbH6w2PyPQLZw.png" /><figcaption>decrypting the RSA key</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*B1Xxa5Q1mwRfl08YCt8-Gw.png" /><figcaption>decrypted RSA key</figcaption></figure><p>Let’s use the file (where we extracted the key) for connecting into <em>ssh.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*7SLCdLBiEXYzJj8VnGp87A.png" /><figcaption>user hype</figcaption></figure><p>And there we have it. We are logged in as a user. Checking the directories, we can extract the user key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*MXW6uAPD7VrR7y2GlO_LdA.png" /><figcaption>user key</figcaption></figure><h3>Pwning root.txt (1st method)</h3><p>Vulnerability Type: Privilege Escalation (Dirtycow)<br>Vulnerable component: Linux kernel<br>Exploit POC: cowroot.c</p><p>I found out that the box uses an old Linux kernel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*s3xN6KKGPOprhorTf1gIaQ.png" /><figcaption>kernel version</figcaption></figure><p>The version is vulnerable to <strong>dirtycow. </strong>For more information, check <a href="https://dirtycow.ninja/)">https://dirtycow.ninja/</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2KO2JDJmQX2kkffa48fOA.png" /><figcaption>Privilege Escalation using DirtyCow</figcaption></figure><h3>Pwning root.txt (2nd method)</h3><p>The first method is pretty straightforward. Since the machine’s kernel is vulnerable to <em>dirtycow</em>, you can use the <em>Proof-of-Concept</em> available in the web. For the second method, we do our usual enumeration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*e_AVx-aOGMB90KwfwI7VVA.png" /><figcaption>ls -la output</figcaption></figure><p>As we can see, there’s a lot of files to check. What we need to focus on is the <em>.bash_history</em>. It contains the following data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*NSjG4R5d049aUVboO4fH5A.png" /><figcaption>.bash_history contents</figcaption></figure><p>One thing to take note here is the usage of <em>tmux </em>which is a terminal multiplexer. Let’s investigate the options used. We can see that there’s a <em>tmux </em>session in the <em>/.devs</em> directory. We can check its privileges using <em>ls -la</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*qKDwRxwc1NX6wsYpbrc3dw.png" /><figcaption>/.devs contents</figcaption></figure><p>We can see that it is owned by root. All we need to do is to attach into the session using <em>tmux. </em>Attaching to the session will give us root privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*qpozXSWjhPOVjGLiJNr3Jw.png" /><figcaption>root</figcaption></figure><h3>Flags</h3><p>And that’s how we pawned the Valentine Machine :)</p><p>user -&gt; e6710a5464769fdf5cd216e076961750<br>root -&gt; f1bb6d759df1f272914ebbc9ed7765b2</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54592d5895c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB — Aragog Writeup]]></title>
            <link>https://medium.com/@SyakNiLance/htb-aragog-writeup-7e7237ab23d5?source=rss-e7c45438805d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e7237ab23d5</guid>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Lance Lance]]></dc:creator>
            <pubDate>Sun, 22 Jul 2018 14:44:34 GMT</pubDate>
            <atom:updated>2018-07-22T14:53:12.392Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*Dx_c4AFvSIEd6WtYhPfS9A.png" /><figcaption>HTB — Aragog</figcaption></figure><p>Hi, all! the retired machine’s name is Aragog… does it ring a bell :D ? Assuming it’s a yes on your end, it seems like we’ll be crawling the web looonger this time!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQB2AdvtcjSwmyIxuTOMKw.png" /><figcaption>Aragog from <a href="https://www.google.com.ph/url?sa=i&amp;source=images&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwjujO3j-bLcAhVEfX0KHe8uDMMQjRx6BAgBEAU&amp;url=https%3A%2F%2Fwww.hp-lexicon.org%2Fcharacter%2Faragog%2F&amp;psig=AOvVaw1eO4TrKtx_C_WQMyNcx4hz&amp;ust=1532357256915668">www.hp-lexicon.org</a></figcaption></figure><p>The IP for the Aragog machine is 10.10.10.78</p><h3>Enumeration</h3><p>Initially, let’s run an nmap scan to enumerate open ports and services:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*qXmMVDe7guZhoqjJDLCdeQ.png" /><figcaption>nmap results</figcaption></figure><p>From the results, we can see that there’s an <strong>FTP </strong>service that allows anonymous access, <strong>SSH </strong>and <strong>HTTP </strong>services enabled, as well as other ports that are filtered. Before poking the FTP service, we can run searchsploit to look for known exploits on the identified services. So far, no known exploits are usable against the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*ebogJrkUOsH6zpC0-_dXig.png" /><figcaption>searchsploit results</figcaption></figure><p>From the nmap results, we identified that there’s an Anonymous FTP service. It means that anyone can log into the FTP server with a common login and any password to access the files on the server. To demonstrate it, we can use <em>‘anonymous’</em> as a username:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*5Tr7UXJ_lPECMlHQYupxaA.png" /><figcaption>anonymous FTP</figcaption></figure><p>Inside the file system, we found test.txt. It contains the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*AaQ9KuoEkKbIRuH3gtecDQ.png" /><figcaption>test.txt</figcaption></figure><p>At this moment, I don’t have any idea how to use this to exploit the machine. I used it as an input to nmap but showed no promising result. I also tried to explore the FTP server but I can’t get past the root directory. We’ll just leave it as it is for now. The next service to poke? http :D!</p><h3>Aragog and the HTTP Service</h3><p>Visiting 10.10.10.78 will lead us to a default page — nothing more, nothing less.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DMZ-zz6gDVEMaRD8HtNzQ.png" /><figcaption>landing page</figcaption></figure><p>Now, remember Aragog? He’s the giant spider from Harry Potter and the Chamber of Secrets :D . Combining it with http service …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*xstWX8wkN1XSsUGUOGPBZA.png" /></figure><p>Annnnnnnd, nothing happened LOL. Looking at the page source, there are no links relevant to our target machine. This poses as a limitation to our crawling activity. Another way of enumeration is to brute force common filenames. Several tools such as <strong>BURP Intruder</strong> and <strong>Dirbuster </strong>can do this task. On my end, I used <strong>gobuster</strong>. Aside from the common file names, I also specified some common file extensions that the application might be using.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*Op6htICAQDyiKVguQN0wTw.png" /><figcaption>gobuster results</figcaption></figure><p>hosts.php was found! I recreated the request in a web browser using BURP Suite. I sent it to <strong>BURP Repeater</strong> for further analysis.</p><p>To summarize, we have the following resources so far:</p><ol><li>text.txt using anonymous FTP</li><li>hosts.php by bruteforcing common file names</li></ol><p>First, let’s look into hosts.php. Creating a GET request yields the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61XQ1w7Z7yqnZTrB3uI0fw.png" /><figcaption>hosts.php</figcaption></figure><p>Analyzing the response, it seems like a default statement is returned. Theoretically, let’s complete the statement.<em> “There are 4294967294 possible hosts for </em><strong>netmask 0</strong><em>”</em>. Maybe a different response will be returned if we specify a netmask. But how?</p><p>Let’s take a good look into the request. Notice in the <strong>Accept </strong>header that it allows <em>html</em>, <em>xhtml</em>, and <em>xml </em>as inputs. Reviewing <strong>HTTP</strong>, we can use the <strong>POST </strong>request method to send data. As to what data format to use, do you remember the <em>text.txt</em> found in Anonymous FTP? It contains data in <strong>XML </strong>Format! Now let’s try to combine it to our POST request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*hfbw1C-UEpqb5HQdABvp5g.png" /><figcaption>XML Request</figcaption></figure><p>And there we have it! A host calculator :). A nice thing to add into our attack surface as it accepts arbitrary user input.</p><h3>Vulnerability Analysis and Exploitation</h3><h4>Vulnerability Type: XXE — XML eXternal Entity Attack (Weak XML parser config)<br>Vulnerable File: hosts.php</h4><p>Since we already know that it accepts xml, Let’s try an <em>XML External Entity Attack</em> against its parser. As the name implies, we can use XML External Entities to access sensitive data or execute commands. For more information about this attack, check A4 in OWASP Top 10 2017</p><p><a href="https://www.owasp.org/index.php/Top_10-2017_A4-XML_External_Entities_(XXE)">https://www.owasp.org/index.php/Top_10-2017_A4-XML_External_Entities_(XXE)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*df8VolXKKQRC6zsWJV7uEA.png" /><figcaption>XXE Attack</figcaption></figure><p>In the image above, the attack is successful as we can now read system-internal files.</p><h3>Post Exploitation — pwning user</h3><h4>Vulnerability Type: Local File Inclusion (LFI) via XXE<br>Vulnerable File: hosts.php</h4><p>By exploiting XXE, we accessed the <em>passwd </em>file which contains the user accounts. We identified <em>florian </em>and <em>cliff </em>in the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nQKzxrhgC4lo9NIN0b98RQ.png" /><figcaption>users</figcaption></figure><p>We also found out that we only have access to florian’s files. The <em>user.txt</em> file can be found inside his folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*4pg61HfFUASE6qY4V4Gjew.png" /><figcaption>user.txt</figcaption></figure><p>From here, we already pwned <em>user.txt</em> but we haven’t pwned the actual user machine. Going back to our nmap result, the ssh service is open. Maybe we can login as <em>florian</em>. Let’s check if he have ssh keys. We can save the private key to login as him.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pa875E_6eY4if9KRARSjaQ.png" /><figcaption>ssh keys</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*UZQZQxlXX9tTP75JX465Bg.png" /><figcaption>ssh login</figcaption></figure><h3>Privilege Escalation — pwning root.txt</h3><p>For privilege escalation, one thing is for sure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*9DpKNl0VoJ5qXSBh5tJrTQ.png" /></figure><p>Inside florian’s folder, we can find a lot of interesting files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*X_CM15M2eI2aNpwIbuq2GA.png" /><figcaption>interesting files</figcaption></figure><p>After checking the <em>.mysql_history</em> file, we identified the <em>/dev_wiki</em> directory being accessed. The next thing to do is to locate it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*JlNxK6wUM-T4AErUYkX55g.png" /><figcaption>/dev_wiki location</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*vpHJer2Bd_2ELvLfC_aEHA.png" /><figcaption>/dev_wiki files</figcaption></figure><p>We can see that it is a wordpress web app. I noticed that the files have global access permissions! First thing to check is the config file that contains the db credentials. I successfully accessed its database. It contains a hashed Admin password. I opt to crack it in the background while looking for other ways to escalate my privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pymBMhH0JDEzB2LH_Wa5Pg.png" /><figcaption>mysql admin creds</figcaption></figure><p>The next thing to do is to access the wordpress site. Accessing <em>10.10.10.78/dev_wiki</em> redirects to <a href="http://aragog/dev_wiki">http://aragog/dev_wiki</a> which results to an error. To fix this, we need to edit the <em>/etc/hosts </em>file to link 10.10.10.78 and aragog. It seems that http://aragog/dev_wiki is a blogging site. After exploring the application, I found an entry from <em>Cliff</em> which is addressed to <em>Florian</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*H9dMBf240y_qGS5wAa7bpA.png" /><figcaption>A message to Florian</figcaption></figure><p><em>“Back up fairly frequently”</em> and <em>“logging in regularly”</em> sounds like a clue to me. Let’s try to monitor the running processes! We can use a script to automate this one.</p><blockquote>#!/bin/bash</blockquote><blockquote>#Loop by line<br>IFS=$’\n’</blockquote><blockquote>old_process=$<strong>(ps</strong> -eo <strong>command)</strong></blockquote><blockquote><strong>while</strong> <strong>true;</strong> <strong>do</strong><br> new_process=$<strong>(ps</strong> -eo <strong>command)</strong><br> <strong>diff</strong> &lt;<strong>(echo</strong> “$old_process”<strong>)</strong> &lt;<strong>(echo</strong> “$new_process”<strong>)</strong> <strong>|grep</strong> [\&lt;\&gt;]<br> <strong>sleep</strong> 1<br> old_process=$new_process<br><strong>done</strong></blockquote><p>From the results, we found out that a script is being run from time to time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*HYzu1AEczFO78fbuLxb6UQ.png" /><figcaption>cron</figcaption></figure><p>From the name of the file, it can be a script used by cliff for logging into the application. So what can we do about it? Going back to our <em>/dev_wiki</em>, we knew that the files have global access! It means that we can modify the files to:</p><ol><li>Execute malicious commands when cliff’s script access <em>wp-login.php</em> (It failed lol. <strong>www-data</strong> is the user that web servers like Apache use by default for normal operation).</li><li>Steal his credentials :)</li></ol><p>The ability to capture credentials by modifying files can be useful for<em> lateral movement</em> in a Pentesting scenario. Skipping №1, we can steal his credentials by capturing his post requests. First, let’s check the forms inside wp-login.php to check what parameters are being used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*Ek1sBzJVY4eptuUiXwZopg.png" /><figcaption>Login Form</figcaption></figure><p>Next is to include the following code snippet in the <em>wp-login.php</em> file. It will capture POST requests and save it in <em>log.txt.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*_bNeZ0hUfLiVEoX854mMpQ.png" /><figcaption>capture POST requests</figcaption></figure><p>Now, let’s just wait for cliff’s login script to execute. We can use the captured credentials to login as root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*p78iLC_cgfZAX9sStny5EQ.png" /><figcaption>log.txt</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*4K3KZi_-xWrnJ1WvSVAJAw.png" /><figcaption>root access</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*Utd4JJkvIormEQlLTpo5gg.png" /><figcaption>root.txt</figcaption></figure><h3>Flags</h3><p>There we have it! the system flag :D <br>user-&gt;f43bdfbcfd3f2a955a7b67c7a6e21359<br>root-&gt;9a9da52d7aad358699a96a5754595de6</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e7237ab23d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB — Nibbles Write-up]]></title>
            <link>https://medium.com/@SyakNiLance/htb-nibbles-write-up-87b145195d8f?source=rss-e7c45438805d------2</link>
            <guid isPermaLink="false">https://medium.com/p/87b145195d8f</guid>
            <dc:creator><![CDATA[Lance Lance]]></dc:creator>
            <pubDate>Sun, 01 Jul 2018 11:22:41 GMT</pubDate>
            <atom:updated>2018-07-01T11:51:26.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*OTQF1XMUSjXODrwwHVAALA.png" /></figure><p>Good day everyone! In this article, I tried my first machine in <strong>Hack The Box </strong>Pentesting Labs. Since this is my first, I chose Nibbles from the list of active machines. [A write-up for the machine can only be published once the box is retired.]</p><p>The target’s IP address is 10.10.10.75.</p><h3>Enumeration</h3><p>First things first, let’s run some recon. I ran nmap to scan the target:</p><blockquote>nmap -sV -sC -oA nibbles-nmap 10.10.10.75</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*fZ3NVQGDbzoZi6avOQprBw.png" /></figure><p>From the initial results, it seems that only ports 22 and 80 are open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*MkV_35JlNOlK2zHJBTUv7g.png" /></figure><p>I ran searchsploit to look for open exploits for the disclosed software versions. For the meantime, let’s just list the ‘possible exploits’ and continue with the recon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRBehUR1W8tRTmEBF1z0MQ.png" /></figure><p>The next thing to do is to visit the website (notice that port 80 is open). A blank page is served upon visiting the website. Checking the view-source will lead us into discovering the<em> /nibbleblog/</em> directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*RSZg5Y-NlDLBx7tPiFgGwA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*x2KKpq66uES4b46Ex0LSpg.png" /></figure><p>Accessing <a href="http://10.10.10.75/nibbleblog/">http://10.10.10.75/nibbleblog/</a> will lead us to the homepage. Now, I need to be familiarized with the application. I also ran BURP Suite to crawl the application while I browse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aNuw_aRF9ChqP6q02HxKRw.png" /><figcaption>Nibbles Blog Home page</figcaption></figure><p>Here are some of the info I found after checking the site:</p><ol><li>It uses PHP</li><li>It uses Nibbleblog 4.0.3</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*r40RNHP6ehzyYJCJKEQ1Bw.png" /></figure><p>3. Other useful resources can be found upon crawling the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*cy81AmNgFwxdoiVCCdqXig.png" /></figure><h3>Vulnerability Analysis and Exploitation</h3><h4>Vulnerabilty Type: Remote Code Execution, Weak Password Policy<br>Vulnerable Service: NibbleBlog 4.0.3 (image plugin)</h4><p>What piqued my interest is the software it used(Nibbleblog) for the blogging page. Why not wordpress? or other more popular Blogging CMS? The next thing I did is to look for public exploits for Nibbleblog 4.0.3. This leads to a security advisory from Curesec Research Team about NibbleBlog 4.0.3. Sweeet!</p><p><a href="https://curesec.com/blog/article/blog/NibbleBlog-403-Code-Execution-47.html">NibbleBlog 4.0.3: Code Execution</a></p><p>Here’s the Vulnerability Description:</p><blockquote>When uploading image files via the “My image” plugin — which is delivered with NibbleBlog by default — , NibbleBlog 4.0.3 keeps the original extension of uploaded files. This extension or the actual file type are not checked, thus it is possible to upload PHP files and gain code execution.<br>Please note that admin credentials are required.</blockquote><p>Okay…wait, what!? admin credentials are required? But it does not have an admin page upon checking…</p><p><strong>OR DOES IT</strong> (smirks)?</p><p>So to find out, we can use dirbuster to bruteforce directories and file. Or, we could just visit the nibbleblog page to look for default pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*zH_niHrLS6UVKdgzFWVcCg.png" /></figure><p>Now, let’s apply it to our target:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSIpF4BgJEveiojQ7kKsAg.png" /></figure><p>So here comes the wall. We need to look for valid credentials. Most of the time, the default username for these puzzles is admin. So what about the password? I tried to use my wordlist but it does not contain the password. To rub salt into the wound, the login functionality implements soft lockout. Okay…fine. Let’s lurk into the forums to look for hints. And the best hint for me was from @peek!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*Nu0jYUeTI8u90xHZFmawMw.png" /></figure><p>LOL! So yeah. After trying several passwords and ramblings, the credentials for the admin are:</p><blockquote>admin / nibbles</blockquote><h3>Post Exploitation</h3><h4>Vulnerabilty Type: Remote Code Execution<br>Vulnerable Service: NibbleBlog 4.0.3 (image plugin)</h4><h3>Pwning user.txt</h3><p>So now we have an access inside the admin. Let’s try to exploit the vulnerability! In this case, I used pentestmonkey’s reverse shell</p><p><a href="http://pentestmonkey.net/tools/web-shells/php-reverse-shell">http://pentestmonkey.net/tools/web-shells/php-reverse-shell</a></p><p>I set up a listener for incoming connections; I followed the proof-of-concept of the vulnerability (upload php file in image plugin, then access that specific image); and poof! we got a shell :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*j4KykQsmUhKAhQufA1sk4A.png" /></figure><p>So let’s check the users</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*5AEXG-dYNSPcN3S7TfKgAg.png" /></figure><p>and then list the super users (of which it is only root)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*L05FyXLzyjGusyYqed4MPA.png" /></figure><p>We don’t have permission to other files as expected</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*0Rj9VPtZ18yRDIp967r7ww.png" /></figure><p>Now, let’s look for commands that we are allowed to invoke</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*ZRVX5vrUBnodExK8JmV68Q.png" /></figure><p>There you have it! we can run monitor.sh as root. Sounds fishy right? Before examining it, let’s visit each directory specified in the full path:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/1*N28OtmtNzVykfrG9SwVDaQ.png" /></figure><p>and now we can see user.txt . Let’s check its contents:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*ZFjGZ0UDIC5mHVGl-a7O1A.png" /></figure><p>Now we got the user flag! Let’s proceed until we reach monitor.sh. Initially, it was blank when I checked the contents of monitor.sh.</p><h3>Pwning root.txt</h3><p>Since it can be run as root, we can use it to check the contents of root folder. To do this, we use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*iTrT80np8n0_S2xHBEBXNQ.png" /></figure><p>Now we know that the root contains root.txt. Now, let’s extract the contents of the root.txt located in /root/root.txt by using monitor.sh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*O8vjyJbbxE4nj3MG3zcy5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*T8tispmF0fAbSUAtdklcNg.png" /></figure><p>There we have it! the system flag :D</p><h3>Flags</h3><p>user -&gt; b02ff32bb332deba49eeaed21152c8d8<br>root -&gt; b6d745c0dfb6457c55591efc898ef88c</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87b145195d8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix lvl 1]]></title>
            <link>https://medium.com/@SyakNiLance/kioptrix-lvl-1-dc03877ddebc?source=rss-e7c45438805d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc03877ddebc</guid>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Lance Lance]]></dc:creator>
            <pubDate>Mon, 28 May 2018 11:18:32 GMT</pubDate>
            <atom:updated>2018-05-28T11:18:32.653Z</atom:updated>
            <content:encoded><![CDATA[<p>Good day folks! In this article, we will check out the Kioptrix Level 1 VM Image from VulnHub. This can be found in the link below:</p><p><a href="https://www.vulnhub.com/entry/kioptrix-level-1-1,22/">Kioptrix: Level 1 (#1)</a></p><h3>About the Challenge</h3><p>Below is a description of the challenge:</p><blockquote>This Kioptrix VM Image are easy challenges. The object of the game is to acquire root access via any means possible (except actually hacking the VM server or player). The purpose of these games are to learn the basic tools and techniques in vulnerability assessment and exploitation. There are more ways then one to successfully complete the challenges.</blockquote><p>The Operating system of the image is GNU/Linux. It can be opened directly using VMWare.</p><h3>The Challenge</h3><p>In this setup, I am using a Host-only network. First, let’s check the IP address of our Kali box:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*njG9JqlWAfXpM_4dFN2CYQ.png" /></figure><p>And then we run a ping scan on the subnet to look for other IP addresses:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*XJEmUNy0n9iTRKs2C_X7aA.png" /></figure><p>We can conclude that the IP address of the Kioptrix1 VM is 192.168.174.129 based on the nmap scan. 192.168.174.128 is the IP address of our Kali box (check ifconfig screenshot).</p><p>Now that we know our target’s IP address, let’s run another nmap scan to scan for open ports, and to check for the technologies used. You can read nmap’s man page for more info.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*vt5A9ulGP2h_pTfwqWtGng.png" /></figure><p><strong>-A</strong> enables OS detection, version detection, script scanning, and traceroute.<br><strong>-oA</strong> store scan results in normal, XML and grepable formats at once.</p><p>To scan deeper, you might want to use the following command:</p><blockquote>nmap -v -p- -sT &lt;target IP&gt;</blockquote><p><strong>-v</strong> means verbose and it will print new port discovered along the way<br><strong>-p-</strong> will tell the nmap to scan all 65535 ports<br><strong>-sT</strong> is a full connect scan</p><p>Looking at the result of our previous command, we found out the following information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*oNVluPkvido61_HAXuHxmg.png" /></figure><p>Here is the actual result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*ugMaqUmMW8lVUZFH5TTXgg.png" /></figure><p>From our previous scan, we already enumerated open ports as well as the running services. More information might be found if we scan the whole port range. While scanning all 65535 ports in the background, we’ll just shift into other activities for a while.</p><p>Given that we have a list of open ports together with the running services and their versions, let’s look for public exploits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*oNVluPkvido61_HAXuHxmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JqZhiBAxlCzRsdzPxfn0Zg.png" /><figcaption><strong>OpenSSH 2.9p2</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOKopON9VFuzpzfEjYspKA.png" /><figcaption><strong>Apache</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBgdmK8BX1qak4m6Ff4kkA.png" /><figcaption><strong>mod_ssl</strong></figcaption></figure><p>Let’s just stick on the above services for now. Searching for samba yields a loooooooooot of result and a search for rpcbind results to Denial of Service Exploits.</p><h3>Testing the Exploits</h3><p>Now, let’s try each exploit for the specified services.</p><h4><strong>mod_ssl OpenFuckv2.c (764.c)</strong></h4><p>Initially, an error occured upon compiling the program. PaulSec wrote a straightforward article to fix this error.</p><p><a href="https://paulsec.github.io/blog/2014/04/14/updating-openfuck-exploit/">Updating OpenFuck Exploit - PaulSec&#39;s blog</a></p><p>After fixing the said error, Let’s compile the exploit:</p><blockquote>gcc -o Openfuck 764.c</blockquote><p>And then run it. A banner will be shown with the usage instruction. From our nmap result, we already knew that our target runs with Redhat Linux and Apache 1.3.20. We are now down into 2 options:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*-JV3tZdW3TDmKxQ7epcGBg.png" /></figure><p>After testing it, 0x6b works against our target. There are also times when both does not work wherein all you need to do is to run the exploit again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*cf8lQpY4LrhM0kYrSyHzbg.png" /></figure><p>There you have it! We achieved the Kioptrix 1 goal to obtain root access. I’ll update this article once I get the time to test the other exploits as well. Happy hacking!</p><p>In case you want to run this image on virtualbox, you might want to check this vm setup article</p><p><a href="https://www.reddit.com/r/netsecstudents/comments/72n2q2/kioptrix_level_11_vm_setup_problem/"><em>https://www.reddit.com/r/netsecstudents/comments/72n2q2/kioptrix_level_11_vm_setup_problem/</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc03877ddebc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Write-up 09/17/2017]]></title>
            <link>https://medium.com/@SyakNiLance/write-up-09-17-2017-e54f7273e95c?source=rss-e7c45438805d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e54f7273e95c</guid>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Lance Lance]]></dc:creator>
            <pubDate>Sun, 17 Sep 2017 13:04:13 GMT</pubDate>
            <atom:updated>2017-09-17T13:11:45.348Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*6x6NT9aScQsgL5qMSmStRg.jpeg" /><figcaption>Image from pixabay.com</figcaption></figure><p>Good day reader! Today, I watched some short videos that tackles productivity (thanks for the informative videos <a href="https://medium.com/u/f77d3d2954e7">Thomas Frank</a> and <a href="https://brightside.me/">https://brightside.me/</a> !). After watching some of it, I decided to create a write-up to review how I understand the following concepts. Let’s just say it’s a by product of the things I learned today. I plan to update this article for every productivity concepts I learn :).</p><h3>Mix and Match</h3><p>From the videos that I watched, some concepts are consistent… some are different. This time, I’ll try to mix and match different ideas, create a list, and try implement it on my current activities for some time.</p><ol><li>Reorganize current workstation and create a dedicated workstation (Lobdell’s). Try to remove / separate applications that are irrelevant.</li><li>Pick a task (e.g. A security test, a bugbounty program, etc.).</li><li>Consistency — implement the task everyday (Kaizen), and dedicate a certain time for the activity and break time (pomodoro) per day.</li><li>Study Actively (Lobdell)</li><li>List Distractions (pomodoro). Evaluate distractions at the end of the week.</li><li>Teach and Explain (Lobdell &amp; Feynman) what you learn using simple language (create a writeup and publish it in Medium).</li></ol><p>So, without further ado, here’s the write-up for the short videos I watched today.</p><h3>Feynman Technique</h3><p>The concept was named after Richard Feynman — a world-renowned physicist. Based on the video, the first principle is that you must not fool yourself and you are the easiest person to fool. Sometimes, we don’t fully understand a concept but we just pretend to do so. A good way to validate our understanding to such concepts is to teach it and explain it to someone else.</p><h4>The video also shows different steps for this technique:</h4><ol><li>Take a piece of paper and write the concept’s name at the top. Its like creating a write-up about the concept.</li><li>Explain the concept using simple language. Explaining stuff using a simple language will make your write-up understandable to the interested layman. It removes the listener’s anxiety by removing the complexity of the words used. Instead, you will just focus in explaining the concept itself.</li><li>Identify problem areas, then go back to the sources to review. These are the items that you cannot explain clearly or do not fully understand.</li><li>Pinpoint any complicated terms and challenge yourself to simplify them.</li></ol><p>Reference:<br><a href="https://www.youtube.com/watch?v=_f-qkGJBPts">https://www.youtube.com/watch?v=_f-qkGJBPts</a></p><h3>Kaizen</h3><p>Based on another video, Kaizen is a Japanese technique used to overcome laziness. Kaizen is a combination of the words <em>Kai </em>which means <em>change</em>, and <em>Zen </em>which means <em>wisdom</em>.</p><h4>The video suggests the 1 minute principle:</h4><p>First, you need to understand what it is you want to achieve. Second, we allocate one minute for that goal everyday. One minute was used because it is easy to commit in a thing for a minute. This gives people a sense of accomplishment (Input based instead of output) and motivation to continue. In the long run, you can increment the 1 minute commitment on your goal — it can be 30 minutes, or even hours.</p><p>The main take away for me in this concept is the consistency. The reality that you cannot achieve everything in a single try —there are things takes some time to achieve / develop.</p><p>Reference:<br><a href="https://www.youtube.com/watch?v=9DbvSl_C_kY">https://www.youtube.com/watch?v=9DbvSl_C_kY</a></p><h3>Marty Lobdell’s Lecture Review</h3><p>The video summarizes the lecture given by Marty Lobdell. It is all about how to study smart. The video gives the following takeaways:</p><ol><li><strong>Break </strong>your studying into chunked sessions. Efficiency goes down after some time. So the advice for this is to take a break to something fun / away from your current task.</li><li><strong>Create </strong>a dedicated study area. Dedicated in a sense that there should be no distractions around it — people, noise, irrelevant things. The things that you need on your task should be in one place.</li><li><strong>Study actively</strong>. In this section, you ask yourself what you are learning. Is it a fact? or a concept? Concepts remain longer(in memory) than facts. Once you understand the concept, it remains within you for some time. As an example, it is easier to discuss how to ride the bicycle vs. Enumerating the different parts of it.</li><li><strong>Highlight </strong>significant details. Quiz yourself. Take smart notes and update it as soon as the lecture is done for example.</li><li><strong>Teach </strong>what you learn. Teaching stuff to others is a good way to validate your understanding to it.</li><li><strong>Use </strong>your resources <strong>correctly</strong>. When reading your resources, you can do the following</li></ol><p><strong>Survey </strong>— before you start reading, skim the book for the different topics it covers, the questions at the end of the chapters, the headings, etc.</p><p><strong>Question </strong>— From the result of your survey, formulate questions.</p><p><strong>Read </strong>— Read the book and try to answer your formulated questions. This keeps you engaged and not just merely reading the book.</p><p><strong>Recite </strong>— Conceptualize what you read by creating a writeup on it. Identify the major points and discussed it to others. Answer the questions you formulated in the second step.</p><p><strong>Review </strong>— After finishing the whole coverage, you can summarize / explain what is it all about.</p><p>7. Use Mnemonics when studying facts (e.g. Visualize the things you are studying).</p><p>Reference:</p><p><a href="https://www.youtube.com/watch?v=23Xqu0jXlfs">https://www.youtube.com/watch?v=23Xqu0jXlfs</a></p><h3>Pomodoro Technique</h3><p>The video specifies that there’s a mental resistance before you start something. In my case, it is true. Before starting an activity, sometimes I tend to think of something else in order to avoid it. The technique suggests the following:</p><ol><li>Pick one task to work on. This can be anything.</li><li>Set a timer (e.g. 25 minutes) — work intensely. If there’s an interruption, write it down. The 25 minutes is just an example. You can input any value.</li><li>Take a break and then repeat the process three more times.</li><li>After taking a break, you can repeat pomodoro session or take it in a longer period of time.</li></ol><p>The technique externalizes how long you are supposed to work by using a timer. it re-frames task in terms of input. Input-based work gives you a time line when you can stop the work, take a break, and continue.</p><p>Reference:</p><p><a href="https://www.youtube.com/watch?v=H0k0TQfZGSc">https://www.youtube.com/watch?v=H0k0TQfZGSc</a></p><p>So there you have it! Some random thoughts I watched today. Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e54f7273e95c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello World!]]></title>
            <link>https://medium.com/@SyakNiLance/hello-world-e8010da9b863?source=rss-e7c45438805d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8010da9b863</guid>
            <category><![CDATA[hello-world]]></category>
            <category><![CDATA[first-post]]></category>
            <category><![CDATA[blogging]]></category>
            <dc:creator><![CDATA[Lance Lance]]></dc:creator>
            <pubDate>Thu, 31 Aug 2017 23:01:31 GMT</pubDate>
            <atom:updated>2017-08-31T23:01:31.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*h9cU-UO2RLmhwrqzaos3BQ.jpeg" /><figcaption>from https://pbs.twimg.com</figcaption></figure><p><strong>TL;DR </strong>-&gt; This is an ‘About’ article.</p><p>Yo! Hello there reader. It took me a great leap (of confidence) to start this first post (yay!). I’m Lance — an I.T. practitioner based in the Philippines.</p><h3><strong>Why start blogging?</strong></h3><p>This blog will serve as a platform for collecting random things that I learn along the way. As part of my continuous learning, I think one of the best way to assess your understanding to a certain discipline is to blog it … share it to others, and explain / write it as clearly as possible.</p><p>I’ve been working in the InfoSec field for 3 yrs as of this writing (noob alert!). So most of my entries will be InfoSec-related — CTF write ups, Tool highlights, Reinventing the wheel articles (proper citation included). I also write in <a href="https://infosecpinas.tech/">https://infosecpinas.tech/</a> whenever I’m free.</p><p>So there you have it — a short ‘motivation to blogging’ article. Have a great day folks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8010da9b863" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>