<?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 Bennet Sharwin on Medium]]></title>
        <description><![CDATA[Stories by Bennet Sharwin on Medium]]></description>
        <link>https://medium.com/@bennetsharwin001?source=rss-7cf74c0afa2a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TD03Z9SEsW4rPdCo</url>
            <title>Stories by Bennet Sharwin on Medium</title>
            <link>https://medium.com/@bennetsharwin001?source=rss-7cf74c0afa2a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:35:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bennetsharwin001/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[How to Build an Active Directory Homelab]]></title>
            <link>https://medium.com/@bennetsharwin001/how-to-build-an-active-directory-homelab-bc2d3dfd638c?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc2d3dfd638c</guid>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[administration]]></category>
            <category><![CDATA[enterprise-technology]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Fri, 17 Jul 2026 13:45:03 GMT</pubDate>
            <atom:updated>2026-07-17T13:45:03.568Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vMYftSJdgMVN6VLb" /></figure><p>Active Directory (AD) is the backbone of enterprise identity and access management. For system administrators, security analysts, and penetration testers alike, a solid understanding of how AD functions and how to manage it efficiently is a critical career skill.</p><p>While you can read documentation all day, nothing beats hands-on experience.</p><p>In this guide, we will walk through setting up a self-hosted Active Directory homelab from scratch. We will deploy a Windows Server 2022 virtual machine on Oracle VirtualBox, promote it to a Domain Controller, connect a Windows 10/11 Pro client machine, and then leverage PowerShell to automate daily administrative tasks like user onboarding, system auditing, password resets, and bulk CSV ingestion.</p><h3>1. Lab Architecture &amp; Design</h3><p>To keep resources light and accessible on any typical home PC, we will build a two-machine homelab. One VM will act as the Domain Controller (DC), hosting both the Active Directory Domain Services (AD DS) and Domain Name System (DNS) roles. The second VM will act as a client workstation.</p><pre>Your PC (Host) <br>└── VirtualBox (Using NAT Network: 10.0.2.0/24) <br>├── WinSrv2022-DC (IP: 10.0.2.15 | 4GB RAM | DC + DNS | Domain: corp.example.com) <br>└── WinPro-Client (IP: 10.0.2.20 [DHCP/Static] | 4GB RAM | Member Workstation)</pre><h4>Lab Specifications</h4><ul><li><strong>Virtualization Platform:</strong> Oracle VirtualBox</li><li><strong>Domain Controller (DC):</strong> 1 × Windows Server 2022 (Desktop Experience)</li></ul><p><em>Resources:</em> 4 GB RAM, 2 CPU cores, 60 GB dynamically allocated disk space. <em>Domain Namespace:</em> corp.example.com</p><ul><li><strong>Workstation Client:</strong> 1 × Windows 10 or Windows 11 Pro</li></ul><p><em>Resources:</em> 4 GB RAM, 2 CPU cores, 50 GB dynamically allocated disk space</p><ul><li><strong>Network configuration:</strong> VirtualBox <strong>NAT Network</strong> (Allows both VMs to communicate with each other while maintaining internet access)</li></ul><blockquote><strong><em>Note on Domains:</em></strong><em> The domain namespace </em><em>corp.example.com is used purely as an internal AD namespace. It will not conflict with public DNS resolutions, and your external DNS services remain untouched.</em></blockquote><h3>2. Deploying the Virtual Machine (Domain Controller)</h3><h4>Step 1: Download the Windows Server 2022 Evaluation ISO</h4><p>Microsoft offers a free 180-day evaluation copy of Windows Server 2022. You can download the ISO directly from the <a href="https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2022">Microsoft Evaluation Center</a>. Select the <strong>ISO download</strong> option. No licensing key is required for the evaluation period.</p><h4>Step 2: Configure the DC VM in VirtualBox</h4><p>Open VirtualBox, click <strong>New</strong>, and configure the virtual machine settings as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*pLjHOuOBkcuDiQ-zgJNMxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/0*pKJOuvC2Khe-IZvV.png" /></figure><p>After creation, navigate to <strong>Settings → Storage</strong>, select the empty optical drive, and mount the downloaded Windows Server 2022 ISO file.</p><h4>Step 3: Install the Operating System</h4><ol><li>Start the virtual machine.</li><li>Select your language and time settings, and click <strong>Install Now</strong>.</li><li>Choose <strong>Windows Server 2022 Standard Evaluation (Desktop Experience)</strong>. This option installs the standard graphical user interface (GUI).</li><li>Select <strong>Custom: Install Windows only (advanced)</strong> and click Next to install on the virtual disk.</li><li>Once the installation completes, the system will prompt you to set a password for the local Administrator account (e.g., Admin@2024!).</li></ol><h3>3. Configuring and Promoting the Domain Controller</h3><p>With the base operating system installed, we will configure the VM networking, host naming, and promote it to a Domain Controller. We will use PowerShell to keep our configurations precise and repeatable.</p><h4>Step 1: Set a Static IP Address</h4><p>A Domain Controller must have a reliable, static IP address because it hosts critical network services like DNS. Open <strong>PowerShell as Administrator</strong> inside the VM and execute:</p><pre># Retrieve the network adapter name (typically &quot;Ethernet&quot;)<br>Get-NetAdapter<br><br># Configure the static IP address and default gateway<br>New-NetIPAddress `<br>    -InterfaceAlias &quot;Ethernet&quot; `<br>    -IPAddress &quot;10.0.2.15&quot; `<br>    -PrefixLength 24 `<br>    -DefaultGateway &quot;10.0.2.1&quot;<br><br># Point DNS client settings to the VM&#39;s own IP address<br>Set-DnsClientServerAddress `<br>    -InterfaceAlias &quot;Ethernet&quot; `<br>    -ServerAddresses &quot;10.0.2.15&quot;</pre><h4>Step 2: Rename the Server</h4><p>Rename the server to something that fits standard corporate naming conventions (like DC01) and reboot:</p><pre>Rename-Computer -NewName &quot;DC01&quot; -Restart</pre><h4>Step 3: Install the Active Directory Domain Services (AD DS) Role</h4><p>Once the server restarts, log back in and run the following command in PowerShell to install the AD DS role along with the required management utilities:</p><pre>Install-WindowsFeature `<br>    -Name AD-Domain-Services `<br>    -IncludeManagementTools</pre><h4>Step 4: Promote the Server to a Forest Root</h4><p>Now, promote this server to a new Domain Controller inside a brand new Active Directory forest ( corp.example.com):</p><pre>Import-Module ADDSDeployment<br><br>Install-ADDSForest `<br>    -DomainName &quot;corp.example.com&quot; `<br>    -DomainNetbiosName &quot;CORP&quot; `<br>    -ForestMode &quot;WinThreshold&quot; `<br>    -DomainMode &quot;WinThreshold&quot; `<br>    -InstallDns:$true `<br>    -SafeModeAdministratorPassword (ConvertTo-SecureString &quot;DSRM@2024!&quot; -AsPlainText -Force) `<br>    -Force:$true</pre><blockquote><strong><em>Directory Services Restore Mode (DSRM):</em></strong><em> The DSRM password is a critical recovery credential used to log in to the DC in offline mode for database repair.</em></blockquote><p>The server will automatically reboot to complete the promotion process.</p><h3>4. Post-Deployment Configuration &amp; DNS Forwarders</h3><p>Once the VM restarts, log in using the newly created domain credentials: CORP\Administrator.</p><p>Because the Domain Controller is configured to point to itself for DNS resolution, it cannot resolve external domain names by default. To restore internet connectivity inside the VM for web browsing and updates, configure <strong>DNS Forwarders</strong> to forward unknown queries to external public DNS servers:</p><pre># Add Google DNS as forwarders<br>Add-DnsServerForwarder -IPAddress &quot;8.8.8.8&quot;<br>Add-DnsServerForwarder -IPAddress &quot;8.8.4.4&quot;<br><br># Verify the forwarders configuration<br>Get-DnsServerForwarder</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/0*gsAQDBUCFVW2znHF.png" /></figure><h3>5. Joining a Windows Pro Client to the Domain</h3><p>Now that our Domain Controller is live, we will join our second VM-a Windows 10/11 Pro workstation-to the corp.example.com domain.</p><h4>Step 1: Align VirtualBox Network Adapter Settings</h4><p>To let the two machines communicate, they must reside on the same VirtualBox Network.</p><ol><li>Open the VirtualBox settings for <strong>both</strong> the DC VM (WinSrv2022-DC) and the Client VM (WinPro-Client).</li><li>Go to <strong>Network</strong>.</li><li>Under <strong>Attached to</strong>, select <strong>NAT Network</strong>.</li><li>Select the name of the network you created (e.g., NatNetwork).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*4mOvO3RDDJuHCy3_.png" /></figure><h4>Step 2: Configure Client DNS Settings</h4><p>For the client workstation to locate the Active Directory Domain Services, it must query the Domain Controller’s DNS server.</p><ol><li>Log in to the Windows Pro Client VM.</li><li>Open <strong>Run</strong> (Win + R), type ncpa.cpl, and hit Enter to open Network Connections.</li><li>Right-click your active network adapter and choose <strong>Properties</strong>.</li><li>Select <strong>Internet Protocol Version 4 (TCP/IPv4)</strong> and click <strong>Properties</strong>.</li><li>Keep “Obtain an IP address automatically” (or assign a static IP inside the subnet, e.g., 10.0.2.20).</li><li>Under DNS Settings, select <strong>Use the following DNS server addresses</strong> and configure:</li></ol><p><strong>Preferred DNS Server:</strong> 10.0.2.15 (The static IP of your Domain Controller)</p><p><strong>Alternate DNS Server:</strong> Leave empty or set to 8.8.8.8.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/0*E0hWALDX8633pVY6.png" /></figure><p>7. Open Command Prompt and test domain resolution:</p><pre>nslookup corp.example.com</pre><p><em>Expected Output: It should resolve to the Domain Controller IP </em><em>10.0.2.15.</em></p><h4>Step 3: Perform the Domain Join</h4><ol><li>Open <strong>Settings</strong> on the Windows Pro Client.</li><li>Navigate to <strong>System → About</strong>, scroll down, and click <strong>Advanced system settings</strong> (on the right pane or bottom).</li><li>Switch to the <strong>Computer Name</strong> tab and click <strong>Change.</strong></li><li>Change the computer name to a structured name (e.g., DESKTOP-01).</li><li>Select <strong>Domain</strong> under “Member of” and enter: corp.example.com.</li><li>Click <strong>OK</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/0*lF7MzFC6Nlwnhwx4.png" /></figure><p>7. A login credential prompt will appear. Enter the domain credentials:</p><p><strong>Username:</strong> CORP\Administrator</p><p><strong>Password:</strong> Admin@2024! (or your configured admin password)</p><p>8. Upon successful validation, a pop-up dialog will read <em>“Welcome to the corp.example.com domain.”</em></p><p>9. Click <strong>OK</strong> and restart the workstation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/0*NssPcfKQwsGuR5hg.png" /></figure><h4>Step 4: Login with Domain Credentials</h4><p>After rebooting, select <strong>Other User</strong> on the login screen. You can log in using CORP\Administrator or any domain account created in the steps below.</p><blockquote><strong><em>Understanding Computer vs. User Accounts:</em></strong><em> You do </em><strong><em>not</em></strong><em> manually set a password for the computer account </em><em>DESKTOP-01 itself.</em></blockquote><blockquote><strong>Computer Accounts</strong> have machine passwords managed automatically in the background by Windows and Active Directory (rotating every 30 days) to secure the channel between the workstation and the DC.</blockquote><blockquote><strong>User Authentication:</strong> To log in, you use <strong>Domain User Accounts</strong> (like CORP\Administrator or users created in the verification section) whose credentials are managed on the Domain Controller.</blockquote><blockquote><strong>Local Accounts:</strong> If you ever need to log in to the original local account on DESKTOP-01, select <strong>Other User</strong> and enter .\LocalUsername as the username, using the local password you set up when installing Windows on the client VM.</blockquote><h3>6. Administrative Automation using PowerShell</h3><p>Manual administration via graphical utilities (like Active Directory Users and Computers) is slow and prone to human error. In production environments, administrators rely on scripting.</p><p>Let’s explore how to query and manage Active Directory using PowerShell, and write modular scripts to automate daily operational tasks.</p><h4>Basic AD Queries</h4><p>First, import the Active Directory module (automatically installed on Domain Controllers):</p><pre>Import-Module ActiveDirectory</pre><p>Here are the essential cmdlets you will use to search the directory:</p><pre># Query all users in the domain<br>Get-ADUser -Filter *<br><br># Find a specific user by their username (sAMAccountName)<br>Get-ADUser -Identity &quot;jsmith&quot;<br><br># Query users with specific extended attributes<br>Get-ADUser -Filter * -Properties Department, Title<br><br># Find locked out domain accounts<br>Search-ADAccount -LockedOut<br><br># Find users with expired passwords<br>Search-ADAccount -PasswordExpired<br><br># List all computers joined to the domain<br>Get-ADComputer -Filter *<br><br># Get high-level domain information<br>Get-ADDomain</pre><h4>Script 1: Standardized User Onboarding</h4><p>This script automates user creation. It constructs a standardized username format (first initial + last name), places the user into a specific Organizational Unit (OU), sets a temporary password, forces a password change at first logon, and assigns them to their respective department group.</p><p>name it as New-UserOnboarding.ps1:</p><pre>param (<br>    [Parameter(Mandatory=$true)] [string]$FirstName,<br>    [Parameter(Mandatory=$true)] [string]$LastName,<br>    [Parameter(Mandatory=$true)] [string]$Department,<br>    [Parameter(Mandatory=$true)] [string]$Title,<br>    [string]$OUPath = &quot;OU=Users,DC=corp,DC=example,DC=com&quot;<br>)<br><br># Generate username: John Smith -&gt; jsmith<br>$Username    = ($FirstName.Substring(0,1) + $LastName).ToLower()<br>$DisplayName = &quot;$FirstName $LastName&quot;<br>$TempPass    = ConvertTo-SecureString &quot;Welcome@2024!&quot; -AsPlainText -Force<br><br># Create the user account in AD<br>New-ADUser `<br>    -GivenName              $FirstName `<br>    -Surname                $LastName `<br>    -Name                   $DisplayName `<br>    -SamAccountName         $Username `<br>    -UserPrincipalName      &quot;$Username@corp.example.com&quot; `<br>    -Department             $Department `<br>    -Title                  $Title `<br>    -Path                   $OUPath `<br>    -AccountPassword        $TempPass `<br>    -ChangePasswordAtLogon  $true `<br>    -Enabled                $true<br><br># Automatically add the user to a matching department group if it exists<br>$Group = &quot;$Department-Team&quot;<br>if (Get-ADGroup -Filter { Name -eq $Group } -ErrorAction SilentlyContinue) {<br>    Add-ADGroupMember -Identity $Group -Members $Username<br>}<br><br>Write-Host &quot;Successfully created account: $Username ($DisplayName) in $OUPath&quot; -ForegroundColor Green</pre><p><strong>Usage:</strong></p><pre>.\New-UserOnboarding.ps1 -FirstName &quot;John&quot; -LastName &quot;Smith&quot; -Department &quot;IT&quot; -Title &quot;Security Analyst&quot;</pre><h4>Script 2: Computer Asset Onboarding &amp; Auditing</h4><p>When a new computer object joins the domain, it is placed in the default Computers container by default. This script relocates the system to the correct target OU based on its asset type (Server or Workstation) and stamps it with an audit description.</p><p>name it as New-SystemOnboarding.ps1:</p><pre>param (<br>    [Parameter(Mandatory=$true)] [string]$ComputerName,<br>    [Parameter(Mandatory=$true)] [string]$ComputerType, # &quot;Workstation&quot; or &quot;Server&quot;<br>    [string]$AssignedUser = &quot;&quot;<br>)<br><br># Determine destination OU<br>$TargetOU = if ($ComputerType -eq &quot;Server&quot;) {<br>    &quot;OU=Servers,DC=corp,DC=example,DC=com&quot;<br>} else {<br>    &quot;OU=Workstations,DC=corp,DC=example,DC=com&quot;<br>}<br><br># Verify the computer asset exists in the domain<br>$Computer = Get-ADComputer -Identity $ComputerName -ErrorAction Stop<br><br># Relocate the object to its structured OU<br>Move-ADObject -Identity $Computer.DistinguishedName -TargetPath $TargetOU<br>Write-Host &quot;Moved computer $ComputerName to $TargetOU&quot; -ForegroundColor Cyan<br><br># Write audit information to the description property<br>$Desc = &quot;Onboarded: $(Get-Date -Format &#39;yyyy-MM-dd&#39;)&quot;<br>if ($AssignedUser) { $Desc += &quot; | Assigned User: $AssignedUser&quot; }<br>Set-ADComputer -Identity $ComputerName -Description $Desc<br><br>Write-Host &quot;System $ComputerName successfully onboarded.&quot; -ForegroundColor Green</pre><p><strong>Usage:</strong></p><pre>.\New-SystemOnboarding.ps1 -ComputerName &quot;DESKTOP-01&quot; -ComputerType &quot;Workstation&quot; -AssignedUser &quot;jsmith&quot;</pre><h4>Script 3: Helpdesk Password Reset Utility</h4><p>Password resets are the most frequent request for IT helpdesks. This script resets a user’s password, unlocks their account if locked out due to multiple failed login attempts, and forces them to choose a new password at their next login.</p><p>name it as Reset-UserPassword.ps1:</p><pre>param (<br>    [Parameter(Mandatory=$true)] [string]$Username,<br>    [string]$NewPassword = &quot;Welcome@Reset1!&quot;<br>)<br><br># Convert plain-text password to a SecureString in memory<br>$SecurePass = ConvertTo-SecureString $NewPassword -AsPlainText -Force<br><br># Reset the password directly<br>Set-ADAccountPassword `<br>    -Identity $Username `<br>    -NewPassword $SecurePass `<br>    -Reset<br><br># Force password change at next authentication<br>Set-ADUser -Identity $Username -ChangePasswordAtLogon $true<br><br># Unlock account<br>Unlock-ADAccount -Identity $Username<br><br># Output verification information<br>$UserStatus = Get-ADUser -Identity $Username -Properties LockedOut, PasswordLastSet<br>Write-Host &quot;Reset account: $Username | Locked status: $($UserStatus.LockedOut) | Last Password Change: $($UserStatus.PasswordLastSet)&quot; -ForegroundColor Green</pre><p><strong>Usage:</strong></p><pre>.\Reset-UserPassword.ps1 -Username &quot;jsmith&quot;</pre><h4>Script 4: User Account Modifications &amp; Offboarding</h4><p>This script handles day-to-day changes, such as job title modifications, department transfers, OU migrations, and disabling accounts for offboarding.</p><p>name it as Update-UserAccount.ps1:</p><pre>param (<br>    [Parameter(Mandatory=$true)] [string]$Username,<br>    [string]$NewTitle      = &quot;&quot;,<br>    [string]$NewDepartment = &quot;&quot;,<br>    [string]$NewOU         = &quot;&quot;,<br>    [bool]$Disable         = $false<br>)<br><br># Update attributes<br>if ($NewTitle)      { Set-ADUser -Identity $Username -Title $NewTitle }<br>if ($NewDepartment) { Set-ADUser -Identity $Username -Department $NewDepartment }<br><br># Move user to a new OU if specified<br>if ($NewOU) {<br>    $DN = (Get-ADUser -Identity $Username).DistinguishedName<br>    Move-ADObject -Identity $DN -TargetPath $NewOU<br>    Write-Host &quot;Moved $Username to $NewOU&quot; -ForegroundColor Cyan<br>}<br><br># Disable user account if requested<br>if ($Disable) {<br>    Disable-ADAccount -Identity $Username<br>    Write-Host &quot;Account disabled: $Username&quot; -ForegroundColor Yellow<br>}<br><br>Write-Host &quot;Updated user account settings for $Username.&quot; -ForegroundColor Green</pre><p><strong>Usage:</strong></p><pre># Update Title<br>.\Update-UserAccount.ps1 -Username &quot;jsmith&quot; -NewTitle &quot;Senior Security Analyst&quot;<br><br># Move to a new OU<br>.\Update-UserAccount.ps1 -Username &quot;jsmith&quot; -NewOU &quot;OU=HR,DC=corp,DC=example,DC=com&quot;<br><br># Disable account<br>.\Update-UserAccount.ps1 -Username &quot;jsmith&quot; -Disable $true</pre><h4>Script 5: Bulk User Ingestion from CSV</h4><p>In enterprise deployments-such as office expansions, new school terms, or acquisitions-administrators must create hundreds of accounts at once. This script reads details from a CSV file, skips any duplicates to prevent errors, and imports users in bulk.</p><p>First, create a sample CSV file named users.csv:</p><pre>FirstName,LastName,Username,Department,Title,OU<br>John,Smith,jsmith,IT,Analyst,&quot;OU=IT,DC=corp,DC=example,DC=com&quot;<br>Jane,Doe,jdoe,HR,Manager,&quot;OU=HR,DC=corp,DC=example,DC=com&quot;<br>Bob,Johnson,bjohnson,Finance,Accountant,&quot;OU=Finance,DC=corp,DC=example,DC=com&quot;<br>Alice,Williams,awilliams,IT,Engineer,&quot;OU=IT,DC=corp,DC=example,DC=com&quot;<br>Charlie,Brown,cbrown,HR,Recruiter,&quot;OU=HR,DC=corp,DC=example,DC=com&quot;</pre><blockquote><strong><em>Pro Tip:</em></strong><em> By wrapping field values containing commas (like the distinguished name </em><em>&quot;OU=IT,DC=corp,DC=example,DC=com&quot;) in double quotes, standard CSV parsers-including PowerShell&#39;s </em><em>Import-Csv -will read it correctly as a single string field.</em></blockquote><p>name it as Import-BulkUsers.ps1:</p><pre>param (<br>    [Parameter(Mandatory=$true)] [string]$CsvPath,<br>    [string]$DefaultPassword = &quot;Welcome@2024!&quot;<br>)<br><br>if (-not (Test-Path $CsvPath)) {<br>    Write-Error &quot;CSV file not found at: $CsvPath&quot;<br>    exit 1<br>}<br><br>$Users      = Import-Csv -Path $CsvPath<br>$SecurePass = ConvertTo-SecureString $DefaultPassword -AsPlainText -Force<br>$Created = $Failed = $Skipped = 0<br><br>foreach ($User in $Users) {<br>    # Check if user already exists<br>    if (Get-ADUser -Filter { SamAccountName -eq $User.Username } -ErrorAction SilentlyContinue) {<br>        Write-Warning &quot;Skipping $($User.Username) — account already exists.&quot;<br>        $Skipped++<br>        continue<br>    }<br><br>    try {<br>        New-ADUser `<br>            -GivenName             $User.FirstName `<br>            -Surname               $User.LastName `<br>            -Name                  &quot;$($User.FirstName) $($User.LastName)&quot; `<br>            -SamAccountName        $User.Username `<br>            -UserPrincipalName     &quot;$($User.Username)@corp.example.com&quot; `<br>            -Department            $User.Department `<br>            -Title                 $User.Title `<br>            -Path                  $User.OU `<br>            -AccountPassword       $SecurePass `<br>            -ChangePasswordAtLogon $true `<br>            -Enabled               $true<br><br>        Write-Host &quot;Created user: $($User.Username)&quot; -ForegroundColor Green<br>        $Created++<br>    } catch {<br>        Write-Host &quot;Failed to create $($User.Username): $($_.Exception.Message)&quot; -ForegroundColor Red<br>        $Failed++<br>    }<br>}<br><br>Write-Host &quot;`nBulk Import Summary: Created: $Created | Skipped: $Skipped | Failed: $Failed&quot; -ForegroundColor Cyan</pre><p><strong>Usage:</strong></p><pre>.\Import-BulkUsers.ps1 -CsvPath &quot;C:\Scripts\users.csv&quot;</pre><h3>7. Hands-On Verification &amp; Initial Setup</h3><p>To verify the lab is working as designed and confirm the scripts are executing properly, we will run through a quick end-to-end verification.</p><h4>1. Active Directory Domain Diagnostics</h4><p>Run the command-line domain controller diagnostic tool to scan DNS configuration, connectivity, and netlogon health:</p><pre># Run basic health diagnostics<br>dcdiag /test:dns<br>dcdiag /test:netlogons</pre><h4>2. Verify Active Directory Web Services &amp; Domain Controllers</h4><p>Verify that crucial domain processes are running as expected:</p><pre># Check services status<br>Get-Service ADWS, DNS, KDC, Netlogon | Select-Object Name, Status</pre><p>All listed services should display Running.</p><h4>3. Verify DNS SRV Records</h4><p>Domain Controllers advertise themselves to clients on a network using DNS SRV records. If these records are missing or incorrect, domain computers cannot log in or resolve DNS queries:</p><pre># Query local SRV records for LDAP and Kerberos services<br>Resolve-DnsName -Name &quot;_ldap._tcp.corp.example.com&quot; -Type SRV<br>Resolve-DnsName -Name &quot;_kerberos._tcp.corp.example.com&quot; -Type SRV</pre><p>The commands should return the host name ( DC01.corp.example.com) and its static IP address ( 10.0.2.15).</p><h4>4. Setting Up the Directory Structure</h4><p>Before onboarded users can be placed into their respective organizational containers, create the organizational structure in the domain root:</p><pre>$DN = &quot;DC=corp,DC=example,DC=com&quot;<br><br># Create core Organizational Units (OUs)<br>New-ADOrganizationalUnit -Name &quot;IT&quot; -Path $DN -ProtectedFromAccidentalDeletion $true<br>New-ADOrganizationalUnit -Name &quot;HR&quot; -Path $DN -ProtectedFromAccidentalDeletion $true<br>New-ADOrganizationalUnit -Name &quot;Servers&quot; -Path $DN -ProtectedFromAccidentalDeletion $true<br>New-ADOrganizationalUnit -Name &quot;Workstations&quot; -Path $DN -ProtectedFromAccidentalDeletion $true<br><br># Confirm the OUs were created<br>Get-ADOrganizationalUnit -Filter * | Select-Object Name, DistinguishedName</pre><h4>5. Running Onboarding Verification</h4><p>To check the scripts, execute this script block to verify user onboarding and security group mapping. This script sets up standard department-level distribution/security groups first, then runs user creations:</p><pre># Create team security groups<br>New-ADGroup -Name &quot;IT-Team&quot; -GroupScope Global -GroupCategory Security -Path &quot;OU=IT,DC=corp,DC=example,DC=com&quot;<br>New-ADGroup -Name &quot;HR-Team&quot; -GroupScope Global -GroupCategory Security -Path &quot;OU=HR,DC=corp,DC=example,DC=com&quot;<br><br># Deploy standard test accounts<br>$UsersList = @(<br>    @{ First=&quot;Alice&quot;;   Last=&quot;Adams&quot;;   UN=&quot;aadams&quot;;   Dept=&quot;IT&quot;;  Title=&quot;Security Analyst&quot;; OU=&quot;OU=IT,DC=corp,DC=example,DC=com&quot; },<br>    @{ First=&quot;Bob&quot;;     Last=&quot;Baker&quot;;   UN=&quot;bbaker&quot;;   Dept=&quot;IT&quot;;  Title=&quot;Network Engineer&quot;; OU=&quot;OU=IT,DC=corp,DC=example,DC=com&quot; },<br>    @{ First=&quot;Carol&quot;;   Last=&quot;Chen&quot;;    UN=&quot;cchen&quot;;    Dept=&quot;HR&quot;;  Title=&quot;HR Manager&quot;;       OU=&quot;OU=HR,DC=corp,DC=example,DC=com&quot; },<br>    @{ First=&quot;David&quot;;   Last=&quot;Davis&quot;;   UN=&quot;ddavis&quot;;   Dept=&quot;HR&quot;;  Title=&quot;Recruiter&quot;;        OU=&quot;OU=HR,DC=corp,DC=example,DC=com&quot; },<br>    @{ First=&quot;Emma&quot;;    Last=&quot;Evans&quot;;   UN=&quot;eevans&quot;;   Dept=&quot;IT&quot;;  Title=&quot;Systems Admin&quot;;    OU=&quot;OU=IT,DC=corp,DC=example,DC=com&quot; }<br>)<br><br>$Pass = ConvertTo-SecureString &quot;Welcome@2024!&quot; -AsPlainText -Force<br><br>foreach ($U in $UsersList) {<br>    New-ADUser `<br>        -GivenName             $U.First `<br>        -Surname               $U.Last `<br>        -Name                  &quot;$($U.First) $($U.Last)&quot; `<br>        -SamAccountName        $U.UN `<br>        -UserPrincipalName     &quot;$($U.UN)@corp.example.com&quot; `<br>        -Department            $U.Dept `<br>        -Title                 $U.Title `<br>        -Path                  $U.OU `<br>        -AccountPassword       $Pass `<br>        -ChangePasswordAtLogon $true `<br>        -Enabled               $true<br><br>    # Add to team group if exists<br>    $TeamGroup = &quot;$($U.Dept)-Team&quot;<br>    if (Get-ADGroup -Filter { Name -eq $TeamGroup } -ErrorAction SilentlyContinue) {<br>        Add-ADGroupMember -Identity $TeamGroup -Members $U.UN<br>    }<br><br>    Write-Host &quot;Successfully provisioned testing user: $($U.UN)&quot; -ForegroundColor Green<br>}<br><br># Verify user properties and group assignments<br>Get-ADUser -Filter * -Properties Department |<br>    Select-Object Name, SamAccountName, Department, DistinguishedName |<br>    Format-Table -AutoSize</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YBjBGSoRh-pYFIVF.png" /></figure><h3>8. Next Steps: Expanding Your Homelab</h3><p>Congratulations! You now have a fully operational Active Directory homelab running on a Windows Server 2022 Domain Controller and a Windows Pro client workstation. By leveraging PowerShell, you’ve configured a robust base, set up automation for user provisioning and computer assets, and successfully validated the environment.</p><p>With this foundation, here are a few ways you can expand your homelab environment:</p><ol><li><strong>Experiment with Group Policies (GPO):</strong> Create Group Policy Objects to enforce security settings, restrict unauthorized actions, or script startup processes on client VMs.</li><li><strong>Learn Security Auditing &amp; Pentesting:</strong> Turn on Advanced Auditing policies to monitor event logs for anomalies (such as brute-force logons or unauthorized credential queries) or simulate active directory security assessments in a safe, fully legal homelab environment.</li><li><strong>Deploy a Second Domain Controller:</strong> Add another Windows Server VM and promote it as a backup DC to explore replication topology and high-availability operations.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc2d3dfd638c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Attacked My Own SOC Lab With Atomic Red Team. Here’s What It Caught | SOC Project — Phase 5]]></title>
            <link>https://medium.com/@bennetsharwin001/i-attacked-my-own-soc-lab-with-atomic-red-team-heres-what-it-caught-soc-project-phase-5-ea0c5faa89ac?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea0c5faa89ac</guid>
            <category><![CDATA[mitre-attack]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[atomic-red-team]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[incident-response]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 05:06:22 GMT</pubDate>
            <atom:updated>2026-04-18T05:06:22.913Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DMLMm7nZKNVzGzrR" /></figure><p>Now that our entirely automated detection and response pipeline is built, the final step is to validate it. To do this, we’ll use <strong>Atomic Red Team</strong>, an open-source library of simple, automated tests mapped directly to the <strong>MITRE ATT&amp;CK framework</strong>. This is the perfect testing kit for our SOC because the attacks are built precisely around specific MITRE tactics and techniques — meaning our SOAR workflow will parse the alerts and our Jira tickets will display this exact threat intelligence perfectly.</p><p>For our testing, we will execute an attack simulation on the Windows endpoint we established earlier in Phase 3.</p><h3>Step 1: Installing Atomic Red Team</h3><p>We’ll install the Invoke-AtomicRedTeam PowerShell framework on our Windows VM to easily execute these tests.</p><ol><li>Open PowerShell on your Windows VM as an Administrator.</li><li>Run the following commands to install the execution framework and the library of atomics:</li></ol><pre>IEX (IWR &#39;https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/install-atomicredteam.ps1&#39; -UseBasicParsing);<br>Install-AtomicRedTeam -getAtomics</pre><p>3. Once installed, import the module into your session:</p><pre>Import-Module &quot;C:\AtomicRedTeam\invoke-atomicredteam\Invoke-AtomicRedTeam.psd1&quot; -Force</pre><h3>Step 2: Executing a Simulated Attack</h3><p>Let’s simulate a common technique: <strong>Process Injection</strong> (e.g., T1055) or another test of your choosing.</p><p>From your Administrative PowerShell prompt, list the available tests for a specific technique, then execute one:</p><pre># See details about the tests<br>Invoke-AtomicTest T1055 -ShowDetails <br># Run the first test<br>Invoke-AtomicTest T1547.001 -TestNumbers 1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*2tWeiP_XxfA0eNHz5Jjarg.png" /></figure><h3>Step 3: Validating the Pipeline Lifecycle</h3><p>With the attack executed, let’s watch our SOAR pipeline spring into action from start to finish.</p><ol><li><strong>Detection in Wazuh:</strong> Our Windows Wazuh agent immediately detects the suspicious execution, matches it against its Sysmon/Security logs, and fires a high-severity alert.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jd3HIJQKj4b0wMMozpFEZg.png" /></figure><p><strong>2. Orchestration in n8n:</strong> The Wazuh Manager forwards the alert via our configured webhook into n8n. The workflow grabs the webhook, identifies the OS, uses Gemini to assign a risk score, summarizes the attack context, and normalizes all the parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPUgiHwPuVDEDU7vBhSUlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nYtbxkVXdkMTLdWcLvCxGg.png" /></figure><p><strong>3. Case Creation in Jira:</strong> Based on the n8n logic, a new “Critical” Incident ticket is generated on our SOC_Board. The ticket is seamlessly populated with the Affected Host, Rule ID, and perfectly maps the <strong>MITRE Tactic and Technique</strong> pulled directly from the Atomic Red Team test!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHP8FSim3poxFbNMGTa7Dw.png" /></figure><p><strong>4. Notification in Slack:</strong> A split second later, the SOC team receives an alert in their dedicated Slack channel containing a quick summary, risk score, and a direct link to the newly created Jira ticket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mgUc4sTgHP_FegHHsorWog.png" /></figure><h3>Conclusion</h3><p>When we started this project, the goal was simple but ambitious: prove that you don’t need a six-figure budget or a team of specialists to understand how a real Security Operations Center works. After five phases, the result speaks for itself.</p><h3>What We Actually Built</h3><p>Let’s take a moment to appreciate the full scope of what’s now running:</p><ul><li><strong>A hardened AWS VPC</strong> with a Bastion Host architecture, ensuring no direct external SSH access to any internal server. This is the same jump-box design used in production enterprise environments.</li><li><strong>A fully operational SIEM</strong> (Wazuh) ingesting real-time telemetry from both Linux and Windows endpoints, correlating events against hundreds of built-in detection rules.</li><li><strong>A forensic investigation platform</strong> (Velociraptor) capable of running on-demand hunts, pulling the MFT, analyzing process trees, and executing VQL queries against live endpoints — without ever needing physical access to them.</li><li><strong>A SOAR pipeline</strong> (n8n) that catches every high-severity Wazuh alert via webhook, enriches it using Google Gemini for AI-driven risk scoring and summarization, and routes it to the appropriate destination based on severity — automatically, with zero human input.</li><li><strong>An automated case management system</strong> (Jira) that receives structured, analyst-ready tickets with fields like MITRE Tactic, Affected Host, Risk Score, and Recommendations already populated. No manual copy-pasting.</li><li><strong>A Slack notification layer</strong> that gives the SOC team instant awareness of threats, with a direct link to the corresponding Jira ticket — all triggered without anyone lifting a finger.</li></ul><p>And then we validated all of it with <strong>Atomic Red Team</strong>, running real adversary simulations mapped to the MITRE ATT&amp;CK framework and watching how each component of the pipeline responds — giving you a front-row seat to the security lifecycle.</p><h3>The Architecture in Review</h3><p>The magic of this build isn’t any single tool — it’s how they chain together:</p><pre>Windows/Linux Endpoints<br>        │<br>        │  (Wazuh Agent → Logs &amp; Telemetry)<br>        ▼<br>  Wazuh SIEM (EC2)<br>        │<br>        │  (Webhook → Rule Level ≥ 7)<br>        ▼<br>  n8n SOAR Workflow<br>        │<br>        ├─ Normalize → Risk Score (Gemini)<br>        ├─ Summarize (Gemini) → Final Normalization<br>        │<br>        ├─ Severity: HIGH  → Jira Ticket (SOC_Board)<br>        └─ Severity: MED/LOW → Slack Notification</pre><p>Every link in that chain is something you built, configured, and tested yourself. That’s not a lab you read about — that’s a lab you <em>understand</em>.</p><h3>Key Takeaways</h3><p><strong>1. Open-source tools provide the foundational mechanics.</strong><br>While enterprise environments move to paid platforms for scale and support, tools like Wazuh, Velociraptor, and n8n allow you to master the underlying logic. The skills you built here translate directly to professional environments.</p><p><strong>2. Architecture decisions matter more than tool choices.</strong><br>The Bastion Host pattern, key isolation, subnet-level firewall rules, and the webhook integration model — these are the design decisions that distinguish a secure deployment from an insecure one. Any tool can be mis-deployed; the right architecture is what makes a deployment defensible.</p><p><strong>3. Automation is the force multiplier.</strong><br>A single analyst manually triaging every alert is a losing battle at scale. The n8n pipeline demonstrated what true Tier-1 automation looks like: ingest, enrich, score, route, and notify — all without human intervention. Analysts now only see pre-triaged, context-rich incidents.</p><p><strong>4. You can’t validate what you don’t test.</strong><br>The Atomic Red Team phase wasn’t optional. Without simulating real attacks, you’re just hoping your detection rules work. The MITRE ATT&amp;CK framework gives you a structured vocabulary for both offense and defense, and running these tests closed the loop on every phase that came before it.</p><p><strong>5. AI has a real role in modern SOC workflows.</strong><br>Using Gemini for risk scoring and attack summarization isn’t a gimmick — it demonstrates how LLMs can augment SOC analysts by processing noisy, repetitive alert data into structured, actionable intelligence faster than any human could.</p><h3>What’s Next?</h3><p>This lab is a foundation, not a ceiling. Here are some natural next steps to extend it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*pTsAKoYewmgcA0AhfwXZSA.png" /></figure><h3>Final Thought</h3><p>The goal of this project was never to build a perfect SOC. It was to understand one deeply enough to be dangerous in a good way.</p><p>You’ve now seen how logs become alerts, how alerts become cases, and how cases become resolved incidents — end to end, with tooling that mirrors what enterprises actually use. The next time someone asks you how a SOC works, you won’t just be able to explain it. You’ll have built one.</p><p>That’s the difference.</p><h3>About the Author</h3><p>Hi, I’m <strong>Bennet Sharwin</strong>. I’m dedicated to documenting my journey in Cybersecurity and Cloud Infrastructure, making security knowledge accessible to everyone.</p><p><strong>Connect with me:</strong></p><ul><li><a href="https://github.com/bencrypted0">GitHub (bencrypted0)</a></li><li><a href="https://www.linkedin.com/in/bennetsharwin/">LinkedIn (bennetsharwin)</a></li></ul><p><em>If you found this blueprint helpful, feel free to share it or star the repository. If you have questions about the setup, drop a comment below or reach out via LinkedIn!</em></p><p><em>Ciao!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea0c5faa89ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Raw Alerts Become Analyst-Ready Jira Tickets — Automatically | SOC Project — Phase 4]]></title>
            <link>https://medium.com/@bennetsharwin001/how-raw-alerts-become-analyst-ready-jira-tickets-automatically-soc-project-phase-4-e9dd197442c9?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9dd197442c9</guid>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[soar]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 04:28:23 GMT</pubDate>
            <atom:updated>2026-04-25T09:50:08.478Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*7q-JMnB3dPcvti5l.png" /></figure><p>While there are many open-source case management platforms, many enterprises use Jira for tracking security incidents. For this lab, we will integrate Jira Software Cloud to automatically manage our alerts.</p><h3>Step 1: Setting up a Jira Cloud Account and Project</h3><ol><li>Sign up for a free Jira Software Cloud account via Atlassian’s website.</li><li>Create a new project. For this lab, we’ll name it “SOC_Board” to match our automation.</li><li>Choose a project template like “Kanban” to start with a basic board layout (e.g., To Do → In Progress → Done).</li></ol><h3>Step 2: Adding Custom Fields for SOC Alerts</h3><p>To make our Jira tickets useful for security analysis, we need to map the specific threat data parsed by our n8n workflow into structured fields on the ticket.</p><ol><li>Go to your <strong>Project settings</strong> &gt; <strong>Issue types</strong>.</li><li>Select the issue type you want to use for alerts (e.g., “Task” or a custom “Alert” type).</li><li>Search for the <strong>Fields</strong> panel to create and add new custom fields. You will typically use “Short text” or “Number” field types for these.</li><li>Create and add the following custom fields to match our n8n parser:</li></ol><ul><li><strong>Source IP</strong> (Short text)</li><li><strong>Risk Score</strong> (Number)</li><li><strong>Affected Host</strong> (Short text)</li><li><strong>Source</strong> (Short text)</li><li><strong>Alert ID</strong> (Short text)</li><li><strong>Rule ID</strong> (Short text)</li><li><strong>MITRE Tactic</strong> (Short text)</li><li><strong>MITRE Technique</strong> (Short text)</li><li><strong>Resolution</strong> (Short text)</li><li><strong>Recommendation</strong> (Paragraph)</li></ul><p>5. Drag and drop these fields onto your issue view screen so they appear neatly under the “Details” section.</p><p><em>Note: Your Jira interface or specific field setup might look slightly different from mine depending on your exact version or project template, but the general concept remains the same.</em></p><p>Once configured and populated via our automation, it would look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dBnHNMUGSXMkANqb6bB-3w.png" /></figure><p>The order might be rearranged.</p><h3>Step 3: Generating a Jira API Token</h3><p>To allow n8n to create these tickets automatically, we need to authenticate it with an API token.</p><ol><li>Go to your Atlassian account settings (Profile &gt; Manage your account &gt; Security &gt; API tokens).</li><li>Click <strong>Create API token</strong>.</li><li>Name it “n8n Integration” and copy the token immediately.</li><li>Back in your n8n dashboard, you will use this token (along with your email and Jira domain) to authenticate the Jira node.</li></ol><h3>Step 4: Importing the Integrated n8n Workflow</h3><p>Now that both Wazuh (sending alerts) and Jira (receiving cases) are ready, we can deploy the complete SOAR pipeline.</p><p>Our n8n workflow does the heavy lifting: it receives the alert webhook, parses the OS, leverages an LLM (Google Gemini) for risk scoring and summarization, normalizes the data, determines severity, and finally roots the incident by creating a Jira ticket and dispatching a Slack message.</p><p>You can import my pre-built n8n workflow directly into your instance here:</p><p><a href="https://github.com/bencrypted0/SOC-Architecture-Setup.git"><strong>GitHub: n8n SOC Architecture Setup</strong></a></p><p>Once imported, simply update the credential nodes (Jira, Slack, Gemini API) with your own keys, and your automated SOC pipeline will be fully live. Make sure to check if there is a change with the webhook URL, if there is update it too.</p><p>Thanks for reading Phase 4 of the SOC Project series.</p><p>If you’ve made it this far, you now have a fully wired pipeline where a suspicious process on a Windows endpoint automatically becomes a structured, analyst-ready Jira ticket with zero manual input. That’s not a toy — that’s how real SOC automation is supposed to work.</p><p>If you have questions about the Jira custom field setup, the n8n workflow logic, or just want to connect — find me here:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/bennetsharwin/">https://www.linkedin.com/in/bennetsharwin/</a></p><p>GitHub: <a href="https://github.com/bencrypted0">https://github.com/bencrypted0</a></p><p>The full n8n workflow JSON with the Jira integration is on GitHub, import it, swap in your credentials, fine tune if needed and it’s live in minutes.</p><p>→ Next up: <a href="https://medium.com/@bennetsharwin001/i-attacked-my-own-soc-lab-with-atomic-red-team-heres-what-it-caught-soc-project-phase-5-ea0c5faa89ac"><strong>I Attacked My Own SOC Lab With Atomic Red Team. Here’s What It Caught | SOC Project — Phase 5</strong></a></p><p>Stay tuned !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9dd197442c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Automated My Entire Tier-1 Alert Pipeline With n8n and Gemini | SOC Project — Phase 3]]></title>
            <link>https://medium.com/@bennetsharwin001/i-automated-my-entire-tier-1-alert-pipeline-with-n8n-and-gemini-soc-project-phase-3-5884bbcc5370?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5884bbcc5370</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[soar]]></category>
            <category><![CDATA[n8n]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 04:14:24 GMT</pubDate>
            <atom:updated>2026-04-25T09:49:02.013Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/0*kNQZ-oOxhSjUtg_J.png" /></figure><p>In this phase, we will deploy n8n to handle our security orchestration and automated response (SOAR) workflows.</p><h3>Step 1: Launch the n8n Server Instance</h3><p>Spin up a new EC2 instance to host n8n:</p><ul><li><strong>Instance type</strong>: t3.medium or similar (2 vCPU, 4 GB RAM)</li><li><strong>OS</strong>: Ubuntu 24.04 LTS</li><li><strong>Network</strong>: Place it in your My_SOC_Lab VPC, public subnet</li><li><strong>Auto-assign public IP</strong>: Enable this</li></ul><p>Configure the security group (e.g., n8n_SG) to allow inbound traffic on port 22 (from the Bastion Host) and port 5678 (for the n8n web interface and webhooks).</p><h3>Step 2: Install Docker and Docker Compose</h3><p>SSH into your new instance via the Bastion Host:</p><pre>ssh -i SOC_project_main.pem -o &quot;ProxyJump ubuntu@&lt;BASTION-PUBLIC-IP&gt; -i SOC_Bastion.pem&quot; ubuntu@&lt;N8N-PRIVATE-IP&gt;</pre><p>Install Docker and Docker Compose:</p><pre>sudo apt-get update &amp;&amp; sudo apt-get upgrade -y<br>sudo apt-get install -y docker.io docker-compose-v2<br>sudo systemctl enable --now docker<br>sudo usermod -aG docker ubuntu</pre><h3>Step 3: Deploy n8n Container</h3><p>Create a new directory for n8n and create a docker-compose.yml file:</p><pre>mkdir ~/n8n-docker<br>cd ~/n8n-docker<br>nano docker-compose.yml</pre><p>Add the following configuration (replace &lt;ec2-ip&gt; with your server&#39;s public IP or domain):</p><pre>services:<br>  n8n:<br>    image: n8nio/n8n:latest<br>    restart: always<br>    ports:<br>      - &quot;0.0.0.0:5678:5678&quot;<br>    environment:<br>      N8N_HOST: &quot;&lt;ec2-ip&gt;&quot; # if not elastic you would have to change it every single time you restart the ec2<br>      N8N_PORT: &quot;5678&quot;<br>      N8N_PROTOCOL: &quot;http&quot;<br>      N8N_SECURE_COOKIE: &quot;false&quot;       # allow cookies over HTTP<br>      N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: &quot;true&quot;<br>      N8N_RUNNERS_ENABLED: &quot;true&quot;<br>    volumes:<br>      - n8n_data:/home/node/.n8n<br><br>volumes:<br>  n8n_data:</pre><p>Start the container:</p><pre>sudo docker compose up -d</pre><h3>Step 4: Create a Webhook in n8n</h3><ol><li>Access the n8n interface by navigating to http://&lt;N8N-PUBLIC-IP&gt;:5678 in your browser.</li><li>Complete the initial setup to create your owner account.</li><li>Create a new workflow.</li><li>Add a <strong>Webhook</strong> node to act as the trigger for the workflow.</li><li>Double-click the webhook node to open its settings and copy the <strong>Test URL</strong> or <strong>Production URL</strong>. You will need this URL to forward alerts from Wazuh.</li></ol><h3>Step 5: Configure Wazuh to Forward Alerts</h3><p>To forward Wazuh alerts with rule level ≥ 7 (i.e., above level 6) to your n8n webhook, use Wazuh’s built-in Shuffle integration module. This is the simplest and most reliable method — no custom Python script or bash wrapper is required. The Shuffle integrator (included out-of-the-box since Wazuh 4.4+) does exactly what you need: it POSTs the full alert as JSON to any webhook URL you specify when the level filter matches.</p><p>n8n’s Webhook node will receive the alert payload perfectly with this setup.</p><p>SSH into your <strong>Wazuh Manager</strong> instance and edit the main configuration file:</p><pre>sudo nano /var/ossec/etc/ossec.conf</pre><p>Add the following block inside the &lt;ossec_config&gt; section (anywhere before the closing &lt;/ossec_config&gt; tag):</p><pre>&lt;integration&gt;<br>  &lt;name&gt;shuffle&lt;/name&gt;<br>  &lt;hook_url&gt;https://your-n8n-domain-or-ip:5678/webhook/xxxxxxxxxxx&lt;/hook_url&gt;  &lt;!-- ← Replace with your exact n8n webhook URL --&gt;<br>  &lt;level&gt;7&lt;/level&gt;<br>  &lt;alert_format&gt;json&lt;/alert_format&gt;<br>&lt;/integration&gt;</pre><p><strong>Understanding the configuration:</strong></p><ul><li>&lt;name&gt;shuffle&lt;/name&gt; → Uses the built-in integrator (no extra files needed).</li><li>&lt;level&gt;7&lt;/level&gt; → Sends only alerts with rule level 7 or higher (exactly what you asked for: above level 6). The filter is “greater than or equal to”.</li><li>&lt;alert_format&gt;json&lt;/alert_format&gt; → Guarantees the full alert JSON is sent in the POST body.</li></ul><p><em>(Optional)</em> You can also add extra filters if you want to restrict the alerts further:</p><pre>&lt;rule_id&gt;5710,5715&lt;/rule_id&gt;        &lt;!-- specific rules only --&gt;<br>&lt;group&gt;authentication_failures&lt;/group&gt;</pre><p>Restart the Wazuh manager to apply the changes (Since we are running docker):</p><pre>sudo docker compose restart</pre><p>Thanks for reading Phase 3 of the SOC Project series.</p><p>If you’re building something similar, have questions about the n8n workflow, or just want to connect with someone who spent way too long fine-tuning a Gemini prompt to correctly classify Windows vs Linux alerts — find me here:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/bennetsharwin/">https://www.linkedin.com/in/bennetsharwin/</a></p><p>GitHub: <a href="https://github.com/bencrypted0/SOC-Architecture-Setup">https://github.com/bencrypted0/SOC-Architecture-Setup</a></p><p>The full n8n workflow JSON and all automation references are on GitHub if you want to import and adapt them directly.</p><p>→ Next up: <a href="https://medium.com/@bennetsharwin001/how-raw-alerts-become-analyst-ready-jira-tickets-automatically-soc-project-phase-4-e9dd197442c9"><strong>How Raw Alerts Become Analyst-Ready Jira Tickets — Automatically | SOC Project — Phase 4</strong></a></p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5884bbcc5370" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your SIEM Can't See Everything. Velociraptor EDR Fills the Gap | SOC Project — Phase 2]]></title>
            <link>https://medium.com/@bennetsharwin001/your-siem-cant-see-everything-velociraptor-edr-fills-the-gap-soc-project-phase-2-f57299565e35?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f57299565e35</guid>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[velociraptor]]></category>
            <category><![CDATA[xdr]]></category>
            <category><![CDATA[edr]]></category>
            <category><![CDATA[soc]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Fri, 10 Apr 2026 12:17:42 GMT</pubDate>
            <atom:updated>2026-04-25T09:48:21.312Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MpfF6oAybtUXwWWEoFxpvg.jpeg" /></figure><p>While Wazuh excels at aggregating logs and alerting on known indicators, it isn’t designed for deep-dive, interactive forensic analysis. For that, we use <strong>Velociraptor</strong>. Velociraptor allows us to query our fleets of endpoints for artifacts, grab memory dumps, pull the MFT (Master File Table), and run custom VQL (Velociraptor Query Language) hunts.</p><h3>Step 1: Launch the Velociraptor Server Instance</h3><p>Just like we did for Wazuh, we need an EC2 instance to host the Velociraptor Server. Make sure your free trial allows these types of EC2 Instances.</p><ol><li><strong>Launch an EC2 Instance:</strong> Go to your AWS Dashboard.</li><li><strong>OS:</strong> Ubuntu 24.04 LTS.</li><li><strong>Instance Type:</strong> t3.medium (2 vCPU, 4GB RAM) or similar.</li><li><strong>Network:</strong> Place it in the My_SOC_Lab VPC, in your <strong>public subnet</strong>.</li><li><strong>Auto-assign public IP:</strong> Enable.</li><li><strong>Key Pair:</strong> Use SOC_project_main.pem (meaning you will SSH into it via your Bastion Host).</li><li><strong>Storage:</strong> 20 GB gp2 (endpoints will stream forensic artifacts here, so give it some space).</li></ol><h3>Step 2: Configure the Security Group</h3><p>Create a new security group named Velociraptor_SG and open the following ports:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*p32TAUfJQ4MOdaJx3Uv-BQ.png" /></figure><h3>Step 3: Server Installation</h3><p><strong>Important notes before starting:</strong></p><ul><li>These steps use <strong>self-signed certificates</strong> (common for labs/testing). For production, use proper TLS certificates and secure the GUI (e.g., via reverse proxy, VPN, or firewall restrictions).</li><li>Run commands as root or with sudo where indicated.</li><li>Official documentation is highly recommended for advanced configurations: <a href="https://docs.velociraptor.app/docs/deployment/">Velociraptor Deployment</a>.</li></ul><p>SSH into your new Velociraptor instance (remember to jump through the Bastion).</p><pre>ssh -i SOC_project_main.pem -o &quot;ProxyJump ubuntu@&lt;BASTION-PUBLIC-IP&gt; -i SOC_Bastion.pem&quot; ubuntu@&lt;VELOCIRAPTOR-PRIVATE-IP&gt;</pre><h4>Download and Prepare the Binary</h4><p>Once inside, download the latest Velociraptor binary. You can verify the latest release on the <a href="https://github.com/Velocidex/velociraptor/releases">official GitHub releases</a>.</p><pre># Replace with the latest version, e.g., 0.76.0<br>VELOCIRAPTOR_VERSION=&quot;0.76.0&quot;<br><br>cd /tmp<br>wget https://github.com/Velocidex/velociraptor/releases/download/v${VELOCIRAPTOR_VERSION}/velociraptor-v${VELOCIRAPTOR_VERSION}-linux-amd64 -O velociraptor<br>sudo mv velociraptor /usr/local/bin/velociraptor<br>sudo chmod +x /usr/local/bin/velociraptor<br><br># Verify Installation<br>velociraptor --version</pre><h4>Create Directories and Generate Server Configuration</h4><pre>sudo mkdir -p /etc/velociraptor /var/lib/velociraptor<br><br># Interactive generation (recommended for first setup)<br>sudo velociraptor config generate -i</pre><p>During the interactive generation (-i):</p><ul><li>Choose <strong>linux</strong> as OS.</li><li>Set datastore/filestore paths to /var/lib/velociraptor (hit enter for default).</li><li>Provide your server’s <strong>Public IP address</strong> or hostname.</li><li>Keep the frontend port (default: 8000) and GUI port (default: 8889).</li><li>Enable self-signed SSL when prompted.</li><li>Set a GUI username (e.g., admin) and a strong password.</li></ul><h4>Edit the Configuration (If Needed)</h4><pre>sudo nano /etc/velociraptor/server.config.yaml</pre><p>Change bind_address: 127.0.0.1 to 0.0.0.0 or your server&#39;s specific IP for the frontend and GUI services so they can listen externally (search and replace carefully). Adjust any other paths, ports, or logging as needed, then save and exit.</p><p><em>(Note: If you didn’t create an admin user during the interactive prompt, you can add one manually using </em><em>sudo velociraptor --config /etc/velociraptor/server.config.yaml user add admin --role administrator).</em></p><h4>Create and Enable Systemd Service</h4><p>Create a persistent system service so Velociraptor runs continuously:</p><pre>sudo nano /etc/systemd/system/velociraptor-server.service</pre><p>Add this content:</p><pre>[Unit]<br>Description=Velociraptor Server<br>After=network.target<br><br>[Service]<br>Type=simple<br>User=root<br>ExecStart=/usr/local/bin/velociraptor --config /etc/velociraptor/server.config.yaml frontend -v<br>Restart=always<br>RestartSec=10<br>LimitNOFILE=65536<br><br>[Install]<br>WantedBy=multi-user.target</pre><p>Next, enable and start the service:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable --now velociraptor-server<br>sudo systemctl status velociraptor-server</pre><p><em>(Check logs with </em><em>journalctl -u velociraptor-server -f if any issues arise).</em></p><h4>Access the Web GUI</h4><p>Navigate to the server’s GUI URL in your browser:</p><pre>https://&lt;VELOCIRAPTOR-PUBLIC-IP&gt;:8889</pre><p>Accept the self-signed certificate warning in your browser and log in using the admin credentials you created.</p><h3>Step 4: Client Configuration and Deployment</h3><p>Now that the server is running, we need to connect our endpoints. Clients connect to the server using a generated configuration file that embeds the server’s SSL certificate and connection details.</p><h4>Generate Client Configuration</h4><p>On the <strong>Velociraptor Server</strong>, generate the client config:</p><pre>sudo velociraptor --config /etc/velociraptor/server.config.yaml config client &gt; /tmp/client.config.yaml<br>cat /tmp/client.config.yaml   # Review it (contains server URLs and CA cert)</pre><p>Transfer the /tmp/client.config.yaml file AND the /usr/local/bin/velociraptor binary securely to your target endpoints (you can use scp via your local machine to pull them down securely).</p><h4>Deploy Client on a Linux Endpoint</h4><p>Log into the local Linux VM (employee endpoint simulation) and execute the deployment:</p><ol><li>Copy the <strong>velociraptor binary</strong> and client.config.yaml to the endpoint.</li><li>Place them in system paths:</li></ol><pre>sudo mkdir -p /etc/velociraptor<br>sudo cp velociraptor /usr/local/bin/velociraptor<br>sudo chmod +x /usr/local/bin/velociraptor<br>sudo cp client.config.yaml /etc/velociraptor/client.config.yaml</pre><ol><li>Create a systemd service for the client:</li></ol><pre>sudo nano /etc/systemd/system/velociraptor-client.service</pre><p>Add this content:</p><pre>[Unit]<br>Description=Velociraptor Client<br>After=network.target<br><br>[Service]<br>Type=simple<br>User=root<br>ExecStart=/usr/local/bin/velociraptor --config /etc/velociraptor/client.config.yaml client -v<br>Restart=always<br>RestartSec=10<br><br>[Install]<br>WantedBy=multi-user.target</pre><ol><li>Enable and start:</li></ol><pre>sudo systemctl daemon-reload<br>sudo systemctl enable --now velociraptor-client<br>sudo systemctl status velociraptor-client</pre><h4>Deploy Client on a Windows Endpoint</h4><ol><li>Download the <strong>Windows binary</strong> (velociraptor-vX.Y.Z-windows-amd64.exe) directly from the <a href="https://github.com/Velocidex/velociraptor/releases">GitHub releases page</a> to your Windows VM.</li><li>Copy the client.config.yaml (that you generated on the server) into the same directory, or a fixed path like C:\Program Files\Velociraptor\client.config.yaml.</li><li>Test interactively (from an admin PowerShell/Command Prompt):</li></ol><pre>.\velociraptor.exe --config client.config.yaml client -v</pre><ol><li>If it connects successfully, install it as a persistent Windows service:</li></ol><pre>.\velociraptor.exe --config client.config.yaml service install</pre><p><em>(Alternatively, you can create an MSI package directly from the </em><strong><em>server GUI</em></strong><em> via “Server Artifacts → Build Collector” for easier mass deployment).</em></p><h3>Step 5: Verify Client Connection</h3><ol><li>Refresh the Velociraptor GUI Navigate to the <strong>Clients</strong> tab (or click the magnifying glass).</li><li>The new client(s) should appear (it may take a minute). You can now run hunts, collect artifacts, and execute VQL queries directly on your lab endpoints!</li></ol><p><strong>Troubleshooting Tips:</strong></p><ul><li><strong>No connection</strong>: Check the AWS firewall (allow port 8000), ensure server_urls in the client config points to the correct server IP/hostname:8000.</li><li><strong>Self-signed issues</strong>: Clients usually trust the embedded CA; edit the client config if needed (e.g., use_self_signed_ssl: true).</li><li><strong>Permissions</strong>: Run the client with admin/root privileges for full artifact collection.</li></ul><p>Thanks for reading Phase 2 of the SOC Project series.</p><p>Velociraptor is one of those tools that feels like a cheat code once you get it running — the ability to query a live endpoint from a browser tab, pull forensic artifacts on demand, and run VQL hunts across your entire fleet without ever touching the machine is genuinely powerful. And now it’s wired into your lab.</p><p>If you’re following along, have questions about the deployment, or want to trade notes on endpoint forensics — find me here:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/bennetsharwin/">https://www.linkedin.com/in/bennetsharwin/</a><br>GitHub: <a href="https://github.com/bencrypted0">https://github.com/bencrypted0</a></p><p>→ Next up: <a href="https://medium.com/@bennetsharwin001/i-automated-my-entire-tier-1-alert-pipeline-with-n8n-and-gemini-soc-project-phase-3-5884bbcc5370">I Automated My Entire Tier-1 Alert Pipeline With n8n and Gemini | SOC Project — Phase 3</a></p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f57299565e35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Hardened AWS SOC Infrastructure for Free | SOC Project — Phase 1]]></title>
            <link>https://medium.com/@bennetsharwin001/i-built-a-hardened-aws-soc-infrastructure-for-free-soc-project-phase-1-78836c8b59be?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/78836c8b59be</guid>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[system-hardening]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[aws-free-tier]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 04:23:39 GMT</pubDate>
            <atom:updated>2026-04-25T09:47:25.108Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9fna8VbWHChwFYMyITrT7g.jpeg" /><figcaption>(I blame grok imagine)</figcaption></figure><p>Building a Security Operations Center (SOC) from scratch is one of the most effective ways to understand how modern defensive security works. While enterprise environments often rely on multi-million dollar budgets and specialized proprietary platforms, the <strong>core principles</strong> of log ingestion, correlation, and response remain the same.</p><p>This guide is designed for <strong>students and aspiring security analysts</strong> who want to learn the mechanics of the SOC stack without the barrier of expensive licensing. We aren’t replacing enterprise-grade solutions; we are using their open-source counterparts to build a foundational understanding of how these systems talk to each other.</p><p>This isn’t just a setup guide — it’s a <strong>learning blueprint</strong>. Over five phases, we’ll move from initial VM provisioning through live attack simulation, giving you a front-row seat to the entire detection and response lifecycle.</p><h3>Lab At A Glance (TL;DR)</h3><p>Category Details <strong>Primary Goal</strong> Master the mechanics of a SIEM/EDR/SOAR pipeline on AWS. <strong>Target Audience</strong> Students, Aspiring Security Analysts &amp; Lab Enthusiasts. <strong>Tools Used</strong> Wazuh (SIEM), Velociraptor (EDR), n8n (SOAR), Jira &amp; Slack. <strong>Infrastructure</strong> AWS Free Tier (VPC, EC2, IGW) + Local Endpoints (Windows/Linux). <strong>Estimated Time</strong> 2–4 Hours for setup; plus testing.</p><h3>The Tech Stack</h3><ul><li><strong>Wazuh</strong></li><li><strong>Velociraptor</strong></li><li><strong>n8n</strong></li></ul><h3>Prerequisites &amp; Lab Requirements</h3><p>Because this lab involves a significant number of tools and services, running all of them locally would require a massive amount of resources. To make this accessible and realistic, our architecture is split:</p><ul><li><strong>Cloud Hosted Infrastructure:</strong> The core servers (Wazuh, Velociraptor Server, n8n) are hosted in the cloud. We will provision these instances progressively as we move through the phases.</li><li><strong>Local Endpoints:</strong> The agents (for log generation and monitoring) will run locally on our own Windows and Linux virtual machines or physical devices.</li></ul><p><em>Note: The specific system configurations (RAM, CPU, and Disk space) required for each cloud server will be explained in its respective phase. While the software used is free, the AWS infrastructure required to run it will likely incur costs outside of the Free Tier if kept running over the limited time. Be sure to monitor your usage.</em></p><h3>Warning</h3><p><strong>Check your Free Tier Eligibility!</strong></p><ul><li><strong>Accounts created after July 15, 2025:</strong> You are eligible for 750 hours of c7i-flex.large per month.</li><li><strong>Accounts created before July 15, 2025:</strong> The c7i-flex.large instance is <strong>NOT</strong> included in the Free Tier and will incur hourly charges (approx. $0.05 - $0.07/hr).</li></ul><p>Even if you are on the Free Tier, monitor your billing dashboard daily. To keep costs minimal, it is highly recommended to <strong>stop your EC2 instances</strong> when you are not actively working on the lab.</p><ul><li><strong>Accounts created before July 15, 2025:</strong> The c7i-flex.large instance is <strong>NOT</strong> included in the Free Tier and will incur hourly charges (approx. $0.05 - $0.07/hr).</li></ul><p>Even if you are on the Free Tier, monitor your billing dashboard daily. To keep costs minimal, it is highly recommended to <strong>stop your EC2 instances</strong> when you are not actively working on the lab.</p><h3>Architecture &amp; Data Flow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1RvNpr0W902w-Izrv2jpsg.png" /></figure><p><strong>The data flows from top to bottom through the pipeline:</strong></p><ol><li><strong>Log Generation &amp; Shipping:</strong> The endpoints (Windows and Linux machines) run Wazuh and Velociraptor agents that monitor system activity and ship logs downstream to the Wazuh Manager.</li><li><strong>Ingestion &amp; Detection (SIEM):</strong> The Wazuh Manager ingests, normalizes, and correlates those logs. It fires alerts when custom detection rules or FIM (DLP) rules match suspicious activity.</li><li><strong>Orchestration (SOAR):</strong> Those alerts are sent via webhook into Shuffle and n8n to begin automated processing and data transformation.</li><li><strong>Threat Intelligence Enrichment:</strong> The SOAR platforms automatically enrich Indicators of Compromise (IOCs) by looking them up against VirusTotal and AbuseIPDB APIs.</li><li><strong>Case Management &amp; Response:</strong> The enriched data is pushed into TheHive (and Cortex) to automatically create cases for analysts. Finally, response playbooks execute actions such as isolating the endpoint, blocking the IP, disabling the user account, or initiating forensic hunts in Velociraptor.</li></ol><h3>Phase 1: Infrastructure &amp; SIEM Deployment (Wazuh)</h3><p>In this part, we’re spinning up the foundational infrastructure for our lab — a custom AWS VPC and an EC2 instance that will host Wazuh, our SIEM. If you’ve never done this before, don’t worry. We’re keeping it simple: one VPC, one public subnet, one route table, one internet gateway, and one EC2 instance. This is the network skeleton everything else attaches to.</p><h3>Step 1: Create Your Custom VPC</h3><p>Head to the AWS VPC dashboard and create a new VPC named My_SOC_Lab with CIDR block 10.0.0.0/16. This gives you a private, isolated network address space with 65,536 usable addresses. You&#39;re not using them all—you just want room to grow without redesigning later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*VfGakCC1whDsxLFEetqqnw.png" /></figure><p>Why this CIDR? It’s the standard for lab environments. It keeps your internal addresses separate from anything that leaks into the real world, and it’s large enough that you’ll never feel cramped adding subnets or instances.</p><h3>Step 2: Create a Public Subnet</h3><p>Inside the VPC, create a public subnet with CIDR block 10.0.1.0/24. This is a smaller network (256 addresses) carved out of your VPC—it&#39;s where your EC2 instance will live. We will host out Wazuh Server in a EC2 instance in this subnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R_AN5aktzzXbZ_z5KyAKdQ.png" /></figure><p>The /24 means the first 24 bits are fixed (10.0.1) and the last 8 bits vary (0–255). In practice, AWS reserves a few addresses for infrastructure, so you get roughly 251 usable IPs per subnet.</p><p>Now go to the <strong>Edit Subnet Settings</strong> and turn on the Enable auto-assign public IPv4 address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bzw9LHMcbNMjfoVMY3VaAA.png" /></figure><h3>Step 3: Enable Internet Access</h3><p>For your instances to reach the internet (and for the internet to reach them), create an Internet Gateway and attach it to your VPC. Then update the subnet’s route table to send all traffic destined for 0.0.0.0/0 (the entire internet) to the Internet Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9yZfwFdk4XJllGCw89quqA.png" /></figure><p>After Creating the Internet Gateway, click the attach to VPC option from the actions list. Select our VPC and click attach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJnvEhY-2yeyozAFHkZD0g.png" /></figure><p>This single route entry says: “If a packet’s destination isn’t in our VPC, send it out through the Internet Gateway.” Without this, instances stay locked in the VPC with no outside connectivity.</p><p>Now go to the Edit Routes and add the route to allow All public IP to pass through Internet gateway we created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V3sxp6l-0BPjIW2oQ_TWLQ.png" /></figure><h3>Network Architecture So Far</h3><p>Before we launch EC2, here’s what you’ve built:</p><pre>Internet<br>   ↓<br>Internet Gateway (IGW)<br>   ↓<br>VPC (10.0.0.0/16)<br>   ├── Public Subnet (10.0.1.0/24)<br>   │   └── Route: 0.0.0.0/0 → IGW<br>   │<br>   └── (Ready for EC2 instance)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8EWGmk_haiSolG0YOsS1Ng.png" /></figure><h3>Step 4: Launch the EC2 Instance</h3><p>Now for the compute part. Launch a new EC2 instance with these specs:</p><ul><li><strong>Instance type</strong>: c7i-flex.large (2 vCPU, 4 GB RAM, included in the new free tier)</li><li><strong>OS</strong>: Ubuntu 24.04 LTS</li><li><strong>Storage</strong>: 15 GB (gp2 general-purpose)</li><li><strong>Network</strong>: Place it in your My_SOC_Lab VPC, public subnet</li><li><strong>Auto-assign public IP</strong>: Enable this</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPGamXqumQtJu92v5AwU4A.png" /></figure><h3>Step 5: Create Your Key Pairs (Credential Isolation)</h3><p>Since we are hardening our lab, we will use two different keys to ensure that a compromise of our “front door” (Bastion) doesn’t automatically grant access to our “vault” (Wazuh).</p><p>Create two new key pairs in the EC2 dashboard:</p><ol><li><strong>SOC_Bastion.pem</strong>: For the public-facing jump box.</li><li><strong>SOC_projoect_main.pem</strong>: For the Wazuh Manager and all future internal servers.</li></ol><p>Download both, store them securely, and lock down their permissions:</p><p>Assign SOC_projoect_main.pem to this instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*G5QC1iea8LcxrDSRWRnMiA.png" /></figure><pre>chmod 600 SOC_Bastion.pem<br>chmod 600 SOC_Internal.pem</pre><p>If running windows then:</p><ol><li>Remove inheritance (stops it from pulling in broad permissions from parent folders)</li></ol><pre>icacls &quot;SOC_Bastion.pem&quot; /inheritance:r<br>icacls &quot;SOC_Internal.pem&quot; /inheritance:r</pre><p>2. Give yourself full control and remove everyone else</p><pre>icacls &quot;SOC_Bastion.pem&quot; /grant:r &quot;$($env:USERNAME):F&quot;<br>icacls &quot;SOC_Internal.pem&quot; /grant:r &quot;$($env:USERNAME):F&quot;</pre><p>3. (Optional but clean) Explicitly remove the common troublemakers</p><pre>icacls &quot;SOC_Bastion.pem&quot; /remove &quot;NT AUTHORITY\Authenticated Users&quot; &quot;BUILTIN\Users&quot; &quot;Everyone&quot;<br>icacls &quot;SOC_Internal.pem&quot; /remove &quot;NT AUTHORITY\Authenticated Users&quot; &quot;BUILTIN\Users&quot; &quot;Everyone&quot;</pre><p>SSH will refuse to use a key file with loose permissions — it’s a safety feature.</p><h3>Step 6: Configure the Security Group</h3><p>Because we are deploying Wazuh as a single-node Docker stack, the Wazuh Indexer, Manager, and Dashboard will all share this EC2 instance’s network. The security group (firewall) needs to allow traffic for all external-facing components.</p><p>Create a security group (or use the default) and allow these inbound rules:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*vyBmikXTdm5f6V_OuWgEKA.png" /></figure><p><strong>Detailed Port Logic:</strong></p><ul><li><strong>Port 22:</strong> Now strictly locked down to the public subnet range. <strong>The Wazuh server will no longer accept SSH connections from your laptop.</strong> You must first SSH into the <strong>Bastion Host</strong> (which listens to your IP) and then jump to the Wazuh Manager.</li><li><strong>Port 443:</strong> The web UI for your dashboard.</li><li><strong>Ports 1514 &amp; 1515:</strong> Required for your local agents to talk to the cloud manager.</li><li><strong>Port 55000:</strong> Restricted for SOAR integration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*gpCyihQdVkpwJCycoBSqEQ.png" /></figure><p><strong>⚠️ Security note</strong>: By using a Bastion host, you create a “choke point.” Attackers now have to compromise two separate machines to reach your logs, and you only have one SSH port to monitor for brute-force attempts.</p><h3>Step 7: Launch the Bastion Host</h3><p>To actually use a Jump Box, we need to create one. Go back to the EC2 launch wizard and spin up a second instance:</p><ul><li><strong>Instance type</strong>: t3.micro or t4g.micro (Often covered by the Free Tier)</li><li><strong>OS</strong>: Ubuntu 24.04 LTS</li><li><strong>Network</strong>: Place it in your My_SOC_Lab VPC, public subnet</li><li><strong>Auto-assign public IP</strong>: Enable this</li><li><strong>Key Pair</strong>: Use the exact same SOC_project_main.pem key you downloaded earlier.</li></ul><p><strong>Bastion Security Group:</strong><br> Create a <em>new</em> security group named Bastion_SG and allow:</p><ul><li><strong>Port 22 (SSH)</strong> from <strong>Your IP only</strong>.<br> <em>(This is why the Wazuh server only accepts SSH from the subnet — your laptop talks to the Bastion, and the Bastion talks to Wazuh).</em></li></ul><p>Click “Launch” to start your new Bastion host.</p><h3>Step 8: Verify the Jump Workflow</h3><p>Wait 2–3 minutes for both instances to boot. To reach your Wazuh Server using two different keys, the most professional method is to use an <strong>SSH Config File</strong>, but you can also do it in one line, get the public and private IP of bastion and Wazuh Server and type this in your local terminal:</p><pre>ssh -i SOC_project_main.pem -o &quot;ProxyJump ubuntu@&lt;BASTION-PUBLIC-IP&gt; -i SOC_Bastion.pem&quot; ubuntu@&lt;WAZUH-PRIVATE-IP&gt;</pre><blockquote><strong>Security Tip: Never store your private keys on the Bastion.</strong><br> Even with two keys, keep them both on your local laptop. By using the command above, your machine uses SOC_Bastion.pem to open the tunnel and SOC_Internal.pem to authenticate the final destination.</blockquote><p>You should get a shell prompt. If you get a timeout or “connection refused,” check:</p><ol><li>Is the security group allowing port 22 from your IP?</li><li>Did you use the correct key file?</li><li>Is the instance fully booted? (Give it another minute if you’re impatient.)</li></ol><blockquote><em>NOTE: Sometimes you might have to specify the connection settings in .ssh/ssh_config file in order to connect to the device.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ML2sTF9ZSgUhY9OfF-BnVw.png" /></figure><h3>Understanding the Network Flow</h3><p>Here’s how packets move:</p><ol><li>Your laptop sends an SSH request to the public IP.</li><li>The Internet Gateway receives it.</li><li>The gateway translates the destination IP from “public” to “private” (the instance’s internal 10.0.1.x address) via NAT.</li><li>The packet reaches the EC2 instance on the private network.</li><li>The instance responds; the gateway translates back to public.</li></ol><p>You see the public IP; the instance knows only its private IP (usually something like 10.0.1.42). The IGW is the NAT translator.</p><p>Always check your billing dashboard to monitor your spend. To keep costs minimal, it is highly recommended to <strong>stop your EC2 instances</strong> when you are not actively working on the lab, and only start them when you need to use them.</p><h3>Current State</h3><p>You now have:</p><ul><li>✅ A custom VPC with an isolated network space</li><li>✅ A public subnet where instances get real internet addresses</li><li>✅ Internet access via an Internet Gateway</li><li>✅ <strong>Two</strong> EC2 instances running: A heavy Wazuh server and a lightweight Bastion Host</li><li>✅ Specific security groups restricting internal and external traffic</li><li>✅ SSH access securely chained and verified</li></ul><p>You’re ready to install Wazuh and start collecting logs.</p><h3>Wazuh Installation</h3><p>Now that we are securely SSH’d into our Wazuh server instance, it’s time to deploy Wazuh. We will use the official Docker deployment because it encapsulates the Wazuh Manager, Indexer, and Dashboard into manageable containers, making it much easier to deploy, update, and maintain compared to a bare-metal installation.</p><h4>1. System Preparation</h4><p>First, update your package lists and install necessary dependencies:</p><pre>sudo apt-get update &amp;&amp; sudo apt-get upgrade -y<br>sudo apt-get install -y curl apt-transport-https ca-certificates software-properties-common</pre><p>Wazuh Indexer (which is based on OpenSearch) requires a higher mapped memory limit. Add this to your sysctl.conf to make it permanent, then apply it immediately:</p><pre>echo &quot;vm.max_map_count=262144&quot; | sudo tee -a /etc/sysctl.conf<br>sudo sysctl -p</pre><h4>2. Install Docker and Docker Compose</h4><p>Install Docker Engine on Ubuntu:</p><pre># Add Docker&#39;s official GPG key<br>sudo install -m 0755 -d /etc/apt/keyrings<br>sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc<br>sudo chmod a+r /etc/apt/keyrings/docker.asc<br># Add the repository to Apt sources<br>echo \<br>  &quot;deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \<br>  $(. /etc/os-release &amp;&amp; echo &quot;$VERSION_CODENAME&quot;) stable&quot; | \<br>  sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null<br>sudo apt-get update<br>sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</pre><p>Verify docker is running:</p><pre>sudo systemctl enable docker<br>sudo systemctl start docker<br>docker compose version</pre><h4>3. Clone the Wazuh Docker Repository</h4><p>We will pull the single-node setup directly from Wazuh’s GitHub:</p><pre>git clone https://github.com/wazuh/wazuh-docker.git -b v4.14.3<br>cd wazuh-docker/single-node</pre><h4>4. Generate Certificates</h4><p>Wazuh components communicate over encrypted channels. The repo includes a script to auto-generate the required certificates:</p><pre># Run the script to create the certificates<br>sudo docker compose -f generate-indexer-certs.yml run --rm generator</pre><p>This will create a config/wazuh_indexer_ssl_certs folder populated with certificates for the indexer, manager, and dashboard.</p><h4>5. Start the Wazuh Stack</h4><p>With certificates in place, bring up the entire stack in detached mode:</p><pre>sudo docker compose up -d</pre><p>Docker will now pull the images for wazuh.manager, wazuh.indexer, and wazuh.dashboard and start them. This process will take 3-5 minutes depending on your cloud instance network speed.</p><p>You can monitor the startup process by viewing the logs:</p><pre>sudo docker compose logs -f</pre><h4>6. Accessing the Dashboard</h4><p>Once all containers are healthy, open your web browser and navigate to the <strong>public IP address of your Wazuh Manager instance</strong> over HTTPS:</p><pre>https://&lt;WAZUH-PUBLIC-IP&gt;</pre><p>Your browser will likely display a self-signed certificate warning. This is expected in a lab environment — proceed past the warning.</p><p><strong>Default Credentials:</strong></p><ul><li><strong>Username:</strong> admin</li><li><strong>Password:</strong> SecretPassword <em>(If you wish to change this later, it can be adjusted in the </em><em>docker-compose.yml file, but for our isolated lab, the default is fine).</em></li></ul><p>Welcome to your new SIEM! You now have a production-capable log aggregation and alerting system running.</p><h4>7. Deploying Wazuh Agents (Linux &amp; Windows)</h4><p>Now that the SIEM is operational, we need to feed it logs. Wazuh Agents are lightweight and monitor system activity, shipping logs securely to the Manager.</p><p><strong>Warning: Version Mismatch</strong><br> When deploying agents, always ensure the <strong>Wazuh Agent version matches or is lower than the Wazuh Manager version</strong>.</p><ul><li>If your Manager is v4.14, your Agent should be v4.14 or below.</li><li><strong>Never</strong> install an Agent that is a higher version than your Manager, as it will cause communication and enrollment failures.</li></ul><h4>A. Deploying on Linux (Ubuntu/Debian)</h4><p>For your Linux endpoints (local VMs or servers):</p><ol><li><strong>Add the Repository:</strong></li></ol><pre>curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import &amp;&amp; chmod 644 /usr/share/keyrings/wazuh.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main&quot; | tee -a /etc/apt/sources.list.d/wazuh.list<br>apt-get update</pre><p><strong>2. Install and Enroll:</strong><br> Provide your EC2 Manager’s public IP:</p><pre>WAZUH_MANAGER=&quot;&lt;WAZUH-PUBLIC-IP&gt;&quot; apt-get install wazuh-agent</pre><p><strong>3. Start the Agent:</strong></p><pre>systemctl daemon-reload<br>systemctl enable wazuh-agent<br>systemctl start wazuh-agent</pre><h4>B. Deploying on Windows</h4><p>For your local Windows VM or workstation:</p><ol><li><strong>Open PowerShell as Administrator.</strong></li><li><strong>Execute the Installation Command:</strong><br> Replace &lt;WAZUH-PUBLIC-IP&gt; with your EC2 instance IP. This command downloads the MSI and installs the agent with the correct manager settings in one go:</li></ol><pre>Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-4.14.3-1.msi -OutFile ${env:tmp}\wazuh-agent.msi; msiexec.exe /i ${env:tmp}\wazuh-agent.msi /q WAZUH_MANAGER=&#39;&lt;WAZUH-PUBLIC-IP&gt;&#39;</pre><p><strong>3. Start the Service:</strong></p><pre>NET START Wazuh</pre><h4>Verify Connection in the Dashboard</h4><p>Go back to your Wazuh Dashboard (<strong>Dropdown → Agents</strong>). Both your Linux and Windows VMs should appear as “Active” within 2–3 minutes.</p><p>Congratulations! Your SIEM is now securely ingesting its first stream of live endpoint data.</p><p>Thanks for reading Phase 1 of the SOC Project series.</p><p>If you’re building something similar, have questions about the setup, <br>or just want to connect with someone who thinks setting up a SIEM on <br>a Friday night is a good time — find me here:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/bennetsharwin/">https://www.linkedin.com/in/bennetsharwin/</a><br>GitHub: <a href="https://github.com/bencrypted0">https://github.com/bencrypted0</a></p><p>The full project code, n8n workflow file, and config references <br>are all on GitHub if you want to skip ahead or reference anything.</p><p>→ Next up: <a href="https://medium.com/@bennetsharwin001/your-siem-cant-see-everything-velociraptor-edr-fills-the-gap-soc-project-phase-2-f57299565e35"><strong>Your SIEM Can’t See Everything. This Tool Fills the Gap | SOC Project — Phase 2</strong></a></p><p>Stay tuned !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78836c8b59be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up Security Detections In ELK Stack]]></title>
            <link>https://medium.com/@bennetsharwin001/setting-up-security-detections-in-elk-stack-449611285d4f?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/449611285d4f</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security-operations]]></category>
            <category><![CDATA[elk-stack]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[siem]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 04:31:57 GMT</pubDate>
            <atom:updated>2026-03-26T04:44:34.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uEyP0kE9acjKG1NzYWhRBA.png" /></figure><p>Previous article: <a href="https://medium.com/@bennetsharwin001/build-a-real-time-log-monitoring-system-with-elk-stack-complete-tutorial-c146c89afb99">https://medium.com/@bennetsharwin001/build-a-real-time-log-monitoring-system-with-elk-stack-complete-tutorial-c146c89afb99</a></p><h3>Introduction</h3><p>In the last article, we got our ELK stack running on the Logging Network, configured Filebeat to ship Nginx access logs from the DMZ directly to Elasticsearch, and verified the pipeline was working through Kibana’s pre-built Nginx dashboards. The infrastructure is solid — logs are flowing, the dashboards are live.</p><p>But visibility alone isn’t a SOC. A SOC detects. That’s what we’re building toward in this article.</p><p>We’re going to write detection rules inside Kibana that watch the incoming Nginx log data and fire alerts when they spot patterns that look like attacks against our OWASP Juice Shop. Juice Shop is intentionally vulnerable — SQL injection endpoints, broken authentication, exposed admin routes — which means it’s a realistic and repeatable target for testing whether our detections actually work.</p><p>By the end of this article you’ll have working detection rules firing against real attack traffic and alerts surfacing in Kibana’s SIEM view.</p><h3>Setting Up Kibana Watcher for Detection</h3><p>Kibana Watcher is the alerting engine built into the Elastic Stack. It lets you define watches — scheduled queries that run against your Elasticsearch data and trigger actions when conditions are met. This is what we’ll use to detect attack patterns hitting DVWA through Nginx and turn them into actionable alerts.</p><h3>Activating the Trial License</h3><p>Watcher is an X-Pack feature that requires at least a Gold license. Elastic provides a free 30-day trial that unlocks the full feature set, which is more than enough for this lab. Activate it from the Kibana Dev Tools console:</p><p>Navigate to <strong>Kibana → Dev Tools</strong> and run:</p><pre>POST /_license/start_trial?acknowledge=true</pre><p>You should get back a response confirming the trial has started. Once active, Watcher will be available under <strong>Stack Management → Watcher</strong>.</p><h3>Setting Up Slack Alerting</h3><p>Rather than just logging alerts silently into Elasticsearch, we want them surfaced somewhere an analyst actually looks. We’ll use Slack as our notification channel — posting alerts to a dedicated #soc-alerts channel in real time.</p><p><strong>Create a Slack Incoming Webhook:</strong></p><ol><li>Go to <a href="https://api.slack.com/apps">api.slack.com/apps</a> and create a new app</li><li>Under <strong>Features</strong>, enable <strong>Incoming Webhooks</strong></li><li>Click <strong>Add New Webhook to Workspace</strong> and point it at a channel like #soc-alerts</li><li>Copy the generated webhook URL — it will look like <a href="https://hooks.slack.com/services/T.../B.../...">https://hooks.slack.com/services/T.../B.../...</a></li></ol><p>Keep this URL handy. It goes into every watch we create as the Slack action endpoint.</p><h3>How Each Watch Is Structured</h3><p>search → condition met → write to watcher-alerts index → Slack notification</p><p>Every detection rule we build follows the same two-action pattern:</p><ul><li><strong>Index action</strong> — writes the triggered alert as a document into Elasticsearch, giving us a persistent record of every detection</li><li><strong>Slack action</strong> — posts a notification to #soc-alerts containing the attacker&#39;s IP, the malicious URL that triggered the rule, the timestamp, and the relevant <strong>MITRE ATT&amp;CK technique ID</strong></li></ul><p>Tying each alert to a MITRE ATT&amp;CK technique ID is a small detail that pays off significantly. It maps your detections directly to the adversary behavior framework used by every professional SOC, making this lab directly comparable to real-world detection engineering work.</p><h3>Slack Detection Rules</h3><h4>Rule 1 — DoS / High Request Rate</h4><p>Property Value Watch ID dos_detection MITRE T1499 — Endpoint Denial of Service Severity High Schedule Every 1 minute Logic Aggregates requests per source.ip over last 1 min. Fires if any single IP exceeds 50 requests.</p><pre>PUT _watcher/watch/dos_detection<br>{<br>  &quot;trigger&quot;: { &quot;schedule&quot;: { &quot;interval&quot;: &quot;1m&quot; } },<br>  &quot;input&quot;: {<br>    &quot;search&quot;: {<br>      &quot;request&quot;: {<br>        &quot;indices&quot;: [&quot;filebeat-*&quot;],<br>        &quot;body&quot;: {<br>          &quot;size&quot;: 0,<br>          &quot;query&quot;: { &quot;range&quot;: { &quot;@timestamp&quot;: { &quot;gte&quot;: &quot;now-1m&quot; } } },<br>          &quot;aggs&quot;: {<br>            &quot;by_ip&quot;: {<br>              &quot;terms&quot;: { &quot;field&quot;: &quot;source.ip&quot;, &quot;size&quot;: 10, &quot;min_doc_count&quot;: 50 }<br>            }<br>          }<br>        }<br>      }<br>    }<br>  },<br>  &quot;condition&quot;: {<br>    &quot;compare&quot;: { &quot;ctx.payload.aggregations.by_ip.buckets&quot;: { &quot;not_eq&quot;: [] } }<br>  },<br>  &quot;actions&quot;: {<br>    &quot;log_to_index&quot;: { &quot;index&quot;: { &quot;index&quot;: &quot;watcher-alerts&quot; } },<br>    &quot;notify_slack&quot;: {<br>      &quot;webhook&quot;: {<br>        &quot;scheme&quot;: &quot;https&quot;,<br>        &quot;host&quot;: &quot;hooks.slack.com&quot;,<br>        &quot;port&quot;: 443,<br>        &quot;method&quot;: &quot;post&quot;,<br>        &quot;path&quot;: &quot;/services/&lt;YOUR_WEBHOOK_PATH&gt;&quot;,<br>        &quot;headers&quot;: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>        &quot;body&quot;: &quot;{\&quot;text\&quot;: \&quot;:rotating_light: *DoS Attack Detected*\\nIP: {{ctx.payload.aggregations.by_ip.buckets.0.key}}\\nRequests: {{ctx.payload.aggregations.by_ip.buckets.0.doc_count}} in 1 min\\nTime: {{ctx.execution_time}}\\nMITRE: T1499\&quot;}&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Simulate:</p><pre>for i in $(seq 1 100); do curl -s http://&lt;TARGET_IP&gt;/ &gt; /dev/null &amp; done; wait</pre><h4>Rule 2 — SQL Injection</h4><p>Property Value Watch ID sqli_detection MITRE T1190 — Exploit Public-Facing Application Severity Critical Schedule Every 1 minute Logic Wildcard search on url.original for SQLi patterns. Fires on any single match in last 2 minutes. Key patterns *UNION*SELECT*, *1=1*, *OR+1*, *--+*, *sleep(*, *information_schema*</p><pre>PUT _watcher/watch/sqli_detection<br>{<br>  &quot;trigger&quot;: { &quot;schedule&quot;: { &quot;interval&quot;: &quot;1m&quot; } },<br>  &quot;input&quot;: {<br>    &quot;search&quot;: {<br>      &quot;request&quot;: {<br>        &quot;indices&quot;: [&quot;filebeat-*&quot;],<br>        &quot;body&quot;: {<br>          &quot;size&quot;: 5,<br>          &quot;query&quot;: {<br>            &quot;bool&quot;: {<br>              &quot;must&quot;: [ { &quot;range&quot;: { &quot;@timestamp&quot;: { &quot;gte&quot;: &quot;now-2m&quot; } } } ],<br>              &quot;should&quot;: [<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*UNION*SELECT*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*union*select*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*1=1*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*OR+1*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*%27+OR*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*--+*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*%27--*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*sleep(*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*information_schema*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*sqli*&quot; } }<br>              ],<br>              &quot;minimum_should_match&quot;: 1<br>            }<br>          }<br>        }<br>      }<br>    }<br>  },<br>  &quot;condition&quot;: {<br>    &quot;compare&quot;: { &quot;ctx.payload.hits.total&quot;: { &quot;gt&quot;: 0 } }<br>  },<br>  &quot;actions&quot;: {<br>    &quot;log_to_index&quot;: { &quot;index&quot;: { &quot;index&quot;: &quot;watcher-alerts&quot; } },<br>    &quot;notify_slack&quot;: {<br>      &quot;webhook&quot;: {<br>        &quot;scheme&quot;: &quot;https&quot;,<br>        &quot;host&quot;: &quot;hooks.slack.com&quot;,<br>        &quot;port&quot;: 443,<br>        &quot;method&quot;: &quot;post&quot;,<br>        &quot;path&quot;: &quot;/services/&lt;YOUR_WEBHOOK_PATH&gt;&quot;,<br>        &quot;headers&quot;: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>        &quot;body&quot;: &quot;{\&quot;text\&quot;: \&quot;:rotating_light: *SQL Injection Detected*\\nIP: {{ctx.payload.hits.hits.0._source.source.ip}}\\nURL: {{ctx.payload.hits.hits.0._source.url.original}}\\nTime: {{ctx.execution_time}}\\nMITRE: T1190\&quot;}&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Simulate:</p><pre>curl -b dvwa_cookie.txt \<br>  &quot;http://&lt;TARGET_IP&gt;/vulnerabilities/sqli/?id=1+UNION+SELECT+null,user()--+&amp;Submit=Submit&quot;</pre><p>OR<br> Perform SQL Injection from the web application itself</p><h4>Rule 3 — XSS (Cross-Site Scripting)</h4><p>Property Value Watch ID xss_detection MITRE T1189 — Drive-by Compromise Severity High Schedule Every 1 minute Logic Wildcard search on url.original for script injection patterns including URL-encoded tags, event handlers, and javascript: scheme. Key patterns *%3Cscript%3E*, *&lt;script&gt;*, *alert(*, *onerror=*, *onload=*, *javascript:*</p><pre>PUT _watcher/watch/xss_detection<br>{<br>  &quot;trigger&quot;: { &quot;schedule&quot;: { &quot;interval&quot;: &quot;1m&quot; } },<br>  &quot;input&quot;: {<br>    &quot;search&quot;: {<br>      &quot;request&quot;: {<br>        &quot;indices&quot;: [&quot;filebeat-*&quot;],<br>        &quot;body&quot;: {<br>          &quot;size&quot;: 5,<br>          &quot;query&quot;: {<br>            &quot;bool&quot;: {<br>              &quot;must&quot;: [ { &quot;range&quot;: { &quot;@timestamp&quot;: { &quot;gte&quot;: &quot;now-2m&quot; } } } ],<br>              &quot;should&quot;: [<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*%3Cscript%3E*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*%3C%2Fscript%3E*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*&lt;script&gt;*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*alert(*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*onerror=*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*onload=*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*javascript:*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*xss*&quot; } }<br>              ],<br>              &quot;minimum_should_match&quot;: 1<br>            }<br>          }<br>        }<br>      }<br>    }<br>  },<br>  &quot;condition&quot;: {<br>    &quot;compare&quot;: { &quot;ctx.payload.hits.total&quot;: { &quot;gt&quot;: 0 } }<br>  },<br>  &quot;actions&quot;: {<br>    &quot;log_to_index&quot;: { &quot;index&quot;: { &quot;index&quot;: &quot;watcher-alerts&quot; } },<br>    &quot;notify_slack&quot;: {<br>      &quot;webhook&quot;: {<br>        &quot;scheme&quot;: &quot;https&quot;,<br>        &quot;host&quot;: &quot;hooks.slack.com&quot;,<br>        &quot;port&quot;: 443,<br>        &quot;method&quot;: &quot;post&quot;,<br>        &quot;path&quot;: &quot;/services/&lt;YOUR_WEBHOOK_PATH&gt;&quot;,<br>        &quot;headers&quot;: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>        &quot;body&quot;: &quot;{\&quot;text\&quot;: \&quot;:rotating_light: *XSS Attack Detected*\\nIP: {{ctx.payload.hits.hits.0._source.source.ip}}\\nURL: {{ctx.payload.hits.hits.0._source.url.original}}\\nTime: {{ctx.execution_time}}\\nMITRE: T1189\&quot;}&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Simulate:</p><pre>curl &quot;http://&lt;TARGET_IP&gt;/vulnerabilities/xss_r/?name=%3Cscript%3Ealert(1)%3C%2Fscript%3E&quot;</pre><h4>Rule 4 — Path Traversal / Directory Scanning</h4><p>Property Value Watch ID pathscan_detection MITRE T1595.003 — Active Scanning Severity Critical Schedule Every 1 minute Logic Wildcard search on url.original for traversal sequences in raw and URL-encoded form, plus direct /etc/passwd references. Key patterns *../*, *%2e%2e%2f*, *%252e%252e*, *..%2f*, */etc/passwd*</p><pre>PUT _watcher/watch/pathscan_detection<br>{<br>  &quot;trigger&quot;: { &quot;schedule&quot;: { &quot;interval&quot;: &quot;1m&quot; } },<br>  &quot;input&quot;: {<br>    &quot;search&quot;: {<br>      &quot;request&quot;: {<br>        &quot;indices&quot;: [&quot;filebeat-*&quot;],<br>        &quot;body&quot;: {<br>          &quot;size&quot;: 5,<br>          &quot;query&quot;: {<br>            &quot;bool&quot;: {<br>              &quot;must&quot;: [ { &quot;range&quot;: { &quot;@timestamp&quot;: { &quot;gte&quot;: &quot;now-2m&quot; } } } ],<br>              &quot;should&quot;: [<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*../*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*%2e%2e%2f*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*%252e%252e*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*..%2f*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*/etc/passwd*&quot; } },<br>                { &quot;wildcard&quot;: { &quot;url.original&quot;: &quot;*%2fetc%2fpasswd*&quot; } }<br>              ],<br>              &quot;minimum_should_match&quot;: 1<br>            }<br>          }<br>        }<br>      }<br>    }<br>  },<br>  &quot;condition&quot;: {<br>    &quot;compare&quot;: { &quot;ctx.payload.hits.total&quot;: { &quot;gt&quot;: 0 } }<br>  },<br>  &quot;actions&quot;: {<br>    &quot;log_to_index&quot;: { &quot;index&quot;: { &quot;index&quot;: &quot;watcher-alerts&quot; } },<br>    &quot;notify_slack&quot;: {<br>      &quot;webhook&quot;: {<br>        &quot;scheme&quot;: &quot;https&quot;,<br>        &quot;host&quot;: &quot;hooks.slack.com&quot;,<br>        &quot;port&quot;: 443,<br>        &quot;method&quot;: &quot;post&quot;,<br>        &quot;path&quot;: &quot;/services/&lt;YOUR_WEBHOOK_PATH&gt;&quot;,<br>        &quot;headers&quot;: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>        &quot;body&quot;: &quot;{\&quot;text\&quot;: \&quot;:rotating_light: *Path Traversal Detected*\\nIP: {{ctx.payload.hits.hits.0._source.source.ip}}\\nURL: {{ctx.payload.hits.hits.0._source.url.original}}\\nTime: {{ctx.execution_time}}\\nMITRE: T1595.003\&quot;}&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Simulate:</p><pre>curl -b dvwa_cookie.txt \<br>  &quot;http://&lt;TARGET_IP&gt;/vulnerabilities/fi/?page=../../../../../../etc/passwd&quot;</pre><p>Check if all 4 watches are loaded</p><pre>GET _watcher/watch/dos_detection <br>GET _watcher/watch/sqli_detection <br>GET _watcher/watch/xss_detection <br>GET _watcher/watch/pathscan_detection</pre><h3>Seeing It All Come Together (simulation)</h3><p>With the watches deployed and Slack connected, it’s time to run attack simulations against DVWA and watch the entire detection pipeline fire end to end — from the attacker’s browser, through Nginx, into Elasticsearch, and out to your alerting channel.</p><h3>What You Should See</h3><p><strong>Example: Cross-Site Scripting (XSS)</strong></p><p>After submitting an XSS payload through DVWA, two things should happen almost immediately. In the <strong>Kibana Nginx Dashboard</strong>, the request appears as a new event — you can see the attacker IP, the suspicious URL containing the payload, the HTTP method, and the timestamp. The response code tells you whether the attack reached the application:</p><h4>DVWA:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFG7GdBijK5uyZr-GvToLA.png" /></figure><p>In the <strong>Elastic SIEM / Watcher alert view</strong>, the triggered watch appears as a logged detection with the structured fields we defined — source IP, matched URL, trigger time, and the MITRE ATT&amp;CK technique tag:</p><h4>Elastic Dashboard</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vkkKuwTN2Vw4XVP7y4mocA.png" /></figure><p>In <strong>Slack</strong>, your #soc-alerts channel receives the notification within seconds of the watch firing:</p><h4>Slack:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xrjSaArwqRAHjA6cHYvRQw.png" /></figure><h3>Congratulations — You’ve Built a Working SOC Pipeline</h3><p>This is the moment the whole lab has been building toward. An attack was executed, a detection rule fired, and an alert landed in your incident channel with enough context to begin an investigation — attacker IP, the exact URL that triggered the rule, the time of the event, and a MITRE ATT&amp;CK technique ID telling you what class of attack you’re dealing with.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=449611285d4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Real-Time Log Monitoring System with ELK Stack (Complete Tutorial)]]></title>
            <link>https://medium.com/@bennetsharwin001/build-a-real-time-log-monitoring-system-with-elk-stack-complete-tutorial-c146c89afb99?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c146c89afb99</guid>
            <category><![CDATA[elk-stack]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 08:05:25 GMT</pubDate>
            <atom:updated>2026-03-26T04:33:14.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*0E0I-Q-r4xWb-iSd.png" /></figure><p><strong>In today’s cybersecurity landscape, visibility is everything.</strong> Even the most hardened firewall rules and carefully segmented networks are ineffective if you lack insight into the traffic flowing through them. This is exactly where a <strong>SIEM (Security Information and Event Management)</strong> system becomes critical.</p><p>In this hands on guide, you’ll learn how to build a <strong>fully functional ELK Stack (Elasticsearch, Logstash, and Kibana)</strong> from scratch for real-time log monitoring and performance analysis. We’ll deploy it in a segmented lab environment using <strong>pfSense as the firewall</strong>, along with an intentionally vulnerable web application to simulate real-world monitoring scenarios.</p><p>By the end of this tutorial, you’ll have a <strong>three-zone network architecture (WAN, DMZ, LAN)</strong> that streams live log data from a DMZ-hosted web server into a centralized <strong>Kibana dashboard</strong> — mirroring the same logging and monitoring architecture used in real <strong>Security Operations Centers (SOCs)</strong>.</p><h3>Setting Up pfSense as Our Network Gateway</h3><p>Before any log data can flow into our ELK stack, we need a network that actually separates and routes that data correctly. pfSense is going to serve as our firewall and router, and giving us full visibility into traffic between zones.</p><blockquote><em>To set up pfSense and DMZ , follow this article first: </em><a href="https://medium.com/@bennetsharwin001/how-to-simulate-a-dmz-demilitarized-zone-network-with-virtualbox-and-pfsense-firewall-b36aea158d3c"><strong><em>pfSense &amp; DMZ Setup</em></strong></a></blockquote><h3>A Key Difference From the Standard Setup</h3><p>If you’ve followed a typical pfSense + DMZ guide, you’ll have seen a three-zone layout: WAN, DMZ, and an Internal LAN. We’re going to make <strong>one deliberate change</strong> to that architecture.</p><p>Instead of a general-purpose Internal LAN, we’re introducing a dedicated <strong>Logging Network</strong>. This is an isolated zone whose sole purpose is to receive log data forwarded from the DMZ and hand it off to Logstash. Keeping logs on their own network segment means:</p><ul><li>Log traffic never competes with or gets mixed into production traffic</li><li>If a DMZ host is compromised, it can’t pivot directly into your analysis infrastructure</li><li>It mirrors how real SOC environments isolate their log collection pipeline</li></ul><p>Think of it as a one-way mirror — the DMZ can send data <em>into</em> the logging network, but that’s where the relationship ends.</p><h3>Renaming the Interface</h3><p>Assuming you already have devices in your DMZ and your existing internal interface configured, the first step is a simple but important one — renaming the Internal LAN interface to Logging to reflect its new purpose.</p><ol><li>Log in to your <strong>pfSense web interface</strong></li><li>Navigate to <strong>Interfaces → [Your Internal LAN interface]</strong></li><li>Change the <strong>Description</strong> field from LAN to Logging</li><li>Hit <strong>Save</strong>, then <strong>Apply Changes</strong></li></ol><p>Now you should have something like this:</p><p>This is a small change, but naming your interfaces accurately pays off the moment you’re staring at firewall rules at 2am trying to figure out why logs aren’t arriving.</p><h3>Deploying the Target: DVWA</h3><p>A SOC without something to monitor is just infrastructure. We need a target — something running in our DMZ that generates realistic, attack-worthy traffic. For this lab, that target is <strong>DVWA</strong>.</p><p>DVWA is an intentionally vulnerable web application built specifically for security training. It’s riddled with real-world vulnerabilities — SQL injection, XSS, broken authentication, and more — which makes it perfect for our purposes. We’re not just setting up a dummy service; we’re deploying something we can actively attack, so we have meaningful data flowing into our SIEM.</p><h3>The Architecture: Why Nginx Lives on the Host</h3><p>Rather than running everything in Docker, we’re making a deliberate split:</p><ul><li><strong>DVWA</strong> runs inside a Docker container, exposed on port 3000</li><li><strong>Nginx</strong> is installed directly on the host system, not in Docker</li></ul><p>The reason comes down to log access. When Nginx runs inside a container, Filebeat has to reach into that container to tail the log files — adding complexity and a layer of indirection. When Nginx is installed on the host, its logs land at /var/log/nginx/ like any standard system service, and Filebeat can watch them directly with no extra configuration. It&#39;s a cleaner, more reliable setup that mirrors how a real environment would be instrumented.</p><p>Nginx acts as the reverse proxy, sitting on port 80 and forwarding all traffic to DVWA on port 3000. Every request that hits the server gets logged by Nginx — that&#39;s the data Filebeat will be shipping to Logstash.</p><h3>Step 1 — Run DVWA in Docker</h3><p>Create a docker-compose.yml on the DMZ server:</p><pre>services:<br>  dvwa:<br>    image: ghcr.io/digininja/dvwa:latest<br>    container_name: dvwa<br>    restart: always<br>    ports:<br>      - &quot;127.0.0.1:3000:80&quot;</pre><p>DVWA’s container exposes port 80 internally — we map it to 3000 on the host so the Nginx config needs no changes from the DVWA setup. The bind to 127.0.0.1:3000 means DVWA is only reachable locally on the host, not directly from the network. Nginx remains the only intended entry point.</p><p>Bring it up:</p><pre>docker compose up -d</pre><h3>Step 2 — Install Nginx on the Host</h3><pre>sudo apt update &amp;&amp; sudo apt install nginx -y</pre><h3>Step 3 — Configure Nginx as a Reverse Proxy</h3><p>Replace the default config at /etc/nginx/sites-available/default with the following, or create a new site config:</p><pre>server {<br>    listen 80;<br>    server_name _;</pre><pre>    access_log /var/log/nginx/access.log;<br>    error_log  /var/log/nginx/error.log;</pre><pre>    location / {<br>        proxy_pass         <a href="http://127.0.0.1:3000;">http://127.0.0.1:3000;</a><br>        proxy_http_version 1.1;<br>        proxy_set_header   Host              $host;<br>        proxy_set_header   X-Real-IP         $remote_addr;<br>        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;<br>    }<br>}</pre><p>server_name _; is a catch-all — it matches any hostname, which is fine for a lab. The X-Real-IP and X-Forwarded-For headers are important: they ensure the actual client IP is preserved in the log, rather than just showing 127.0.0.1 for every request.</p><p>Test the config and reload:</p><pre>sudo nginx -t<br>sudo systemctl reload nginx</pre><h3>What This Gives Us</h3><p>Once both are running, any request hitting http://&lt;DMZ-IP&gt;:80 lands on DVWA via Nginx. Every one of those requests gets written to /var/log/nginx/access.log on the host — exactly where Filebeat will be watching. The log pipeline is ready to be connected.</p><h3>Setting Up ELK in the Logging Network</h3><p>If you’ve followed the previous steps, you should have a VM sitting on the Logging Network — the isolated zone we renamed from LAN earlier. That VM is going to be the home of our entire ELK stack.</p><h3>Why Docker Compose?</h3><p>We’re deploying ELK using Docker Compose rather than installing each component directly on the host. The reasons are practical:</p><ul><li><strong>Speed:</strong> The entire stack spins up with a single command — docker compose up -d</li><li><strong>Isolation:</strong> Each component runs in its own container, with no dependency conflicts on the host OS</li><li><strong>Reproducibility:</strong> If something breaks or you want to start fresh, docker compose down -v tears everything down cleanly and you can rebuild in minutes</li><li><strong>Portability:</strong> The same docker-compose.yml works on any machine, making it easy to share and version-control</li></ul><h3>The Docker Compose File</h3><p>This is the core of the deployment. Three services — Elasticsearch, Logstash, and Kibana — all on a shared internal Docker network called elk.</p><pre>version: &#39;3&#39;<br>services:<br>  elasticsearch:<br>    image: elasticsearch:7.9.1<br>    container_name: elasticsearch<br>    ports:<br>      - &quot;9200:9200&quot;<br>      - &quot;9300:9300&quot;<br>    volumes:<br>      - test_data:/usr/share/elasticsearch/data/<br>      - ./elk-config/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml<br>    environment:<br>      - discovery.type=single-node<br>      - http.host=0.0.0.0<br>      - transport.host=0.0.0.0<br>      - xpack.security.enabled=false<br>      - xpack.monitoring.enabled=false<br>      - cluster.name=elasticsearch<br>      - bootstrap.memory_lock=true<br>      - ES_JAVA_OPTS=-Xms512m -Xmx512m<br>    mem_limit: 1GB<br>    networks:<br>      - elk<br>  logstash:<br>      image: logstash:7.9.1<br>      container_name: logstash<br>      ports:<br>        - &quot;5044:5044&quot;<br>        - &quot;9600:9600&quot;<br>        - &quot;5140:5140/udp&quot;<br>      volumes:<br>        - ./elk-config/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf<br>        - ./elk-config/logstash/logstash.yml:/usr/share/logstash/config/logstash.yml<br>        - ./elk-config/logstash/patterns:/usr/share/logstash/patterns<br>        - ls_data:/usr/share/logstash/data<br>      environment:<br>        - LS_JAVA_OPTS=-Xms512m -Xmx512m<br>      mem_limit: 1GB<br>      networks:<br>        - elk<br>      depends_on:<br>        - elasticsearch<br>    kibana:<br>      image: kibana:7.9.1<br>      container_name: kibana<br>      ports:<br>        - &quot;5601:5601&quot;<br>      volumes:<br>        - ./elk-config/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml<br>        - kb_data:/usr/share/kibana/data<br>      mem_limit: 1GB<br>      networks:<br>        - elk<br>      depends_on:<br>        - elasticsearch<br>  networks:<br>    elk:<br>      driver: bridge<br>  volumes:<br>    test_data:<br>    ls_data:<br>    kb_data:</pre><p>A few things worth understanding before you just run it:</p><ul><li><strong>All three services are pinned to version 7.9.1.</strong> Mixing versions across Elasticsearch, Logstash, and Kibana is a common source of silent failures — always keep them in sync.</li><li><strong>discovery.type=single-node</strong> tells Elasticsearch not to look for cluster peers. This is essential for a single-VM lab setup — without it, the node will sit waiting to form a cluster and never become healthy.</li><li><strong>xpack.security.enabled=false</strong> disables authentication for simplicity in the lab environment. In a production deployment, you would never do this.</li><li><strong>ES_JAVA_OPTS=-Xms512m -Xmx512m</strong> and <strong>mem_limit: 1GB</strong> keep each container&#39;s memory footprint bounded. ELK is memory-hungry — without these limits, Elasticsearch will happily consume all available RAM.</li><li><strong>depends_on</strong> ensures Logstash and Kibana wait for Elasticsearch to start first, since both need it to be reachable before they initialize.</li></ul><h3>The Configuration Files</h3><p>Each service gets its own config file, mounted into the container via the volumes block. Here&#39;s what each one does:</p><p><strong>elasticsearch.yml</strong></p><pre>cluster.name: &quot;elasticsearch&quot;<br>network.host: localhost</pre><p>Minimal config — just sets the cluster name and binds to localhost inside the container. The docker-compose.yml environment variables handle the rest.</p><p><strong>logstash.conf</strong></p><pre>input {<br>  beats {<br>    port =&gt; 5044<br>  }<br>}<br><br>filter {<br>}<br><br>output {<br>  elasticsearch {<br>    hosts =&gt; &quot;http://elasticsearch:9200&quot;<br>    index =&gt; &quot;filebeat-test%{+YYYY.MM.DD}&quot;<br>    user =&gt; &quot;elastic&quot;<br>    password =&gt; &quot;password&quot;<br>  }<br>}js</pre><p>This is the Logstash pipeline. Right now the filter {} block is empty — we&#39;re getting the plumbing connected first. In the next section we&#39;ll add Grok patterns here to parse the Nginx and pfSense logs into structured fields. Notice that the output references elasticsearch by container name — Docker&#39;s internal DNS resolves this automatically within the elk network.</p><p><strong>logstash.yml</strong></p><pre>http.host: 0.0.0.0<br>xpack.monitoring.elasticsearch.hosts: [&quot;http://elasticsearch:9200&quot;]</pre><p>Binds the Logstash HTTP API to all interfaces (so we can hit the monitoring endpoint) and points the monitoring module at our Elasticsearch container.</p><p><strong>kibana.yml</strong></p><pre>server.name: kibana<br>server.host: &quot;0&quot;<br>elasticsearch.hosts: [ &quot;http://elasticsearch:9200&quot; ]<br>monitoring.ui.container.elasticsearch.enabled: true</pre><p>Tells Kibana where to find Elasticsearch and enables the container monitoring UI. server.host: &quot;0&quot; binds Kibana to all interfaces so it&#39;s reachable from your browser outside the container.</p><h3>Bringing It Up</h3><p>With all config files in place under ./elk-config/, run:</p><pre>docker compose up -d</pre><p>Give it 30–60 seconds for Elasticsearch to fully initialize, then navigate to:</p><pre>http://&lt;logging-vm-ip&gt;:5601</pre><p>You should be greeted by the Kibana home dashboard — the analyst’s interface for everything we’re about to build. If Kibana shows a connection error on first load, wait another 30 seconds and refresh; Elasticsearch sometimes takes a moment longer than Kibana expects.</p><h3>Verifying the Stack is Healthy</h3><p>Before touching any configuration, let’s confirm all three services are up and talking to each other. Run through these checks top to bottom.</p><h3>1 — All containers running</h3><pre>docker ps</pre><p>You should see elasticsearch, logstash, and kibana all with status Up. If any show Exited, check its logs with docker logs &lt;container_name&gt;.</p><h3>2 — Elasticsearch is responding</h3><pre>curl http://localhost:9200<br>curl http://localhost:9200/_cluster/health?pretty</pre><p>The first command should return a JSON response with &quot;You Know, for Search&quot;. The second gives you cluster health — green or yellow are both fine for a single-node setup. red means something is wrong.</p><h3>3 — Kibana is reachable</h3><p>Open http://localhost:5601 in a browser on the Logging VM. If the Kibana UI loads, it has successfully connected to Elasticsearch on its own.</p><h3>4 — Logstash is connected</h3><pre>curl http://localhost:9600?pretty<br>docker logs logstash</pre><p>The API should return &quot;status&quot;: &quot;green&quot;. In the logs, look for Successfully started Logstash API endpoint and Pipeline started successfully. If you see Connection refused, there&#39;s an issue in your logstash.conf pipeline.</p><h3>5 — Config files are mounted</h3><pre>ls ./elk-config/elasticsearch/<br>ls ./elk-config/logstash/<br>ls ./elk-config/kibana/</pre><p>If any directory is empty or missing, the container will either fail silently or fall back to defaults — which will cause subtle issues later.<br> Once all five checks pass, the stack is healthy and ready for configuration.</p><h3>Setting Up Filebeat on the Web Server</h3><p>With Nginx writing logs on the DMZ host and ELK running on the Logging VM, the missing piece is the bridge between them — <strong>Filebeat</strong>. It runs on the DMZ server, watches the Nginx log files, and ships every new line directly to Elasticsearch.</p><h3>Installing Filebeat via Kibana</h3><p>Kibana actually walks you through the Filebeat setup with a built-in tutorial. On the Logging VM, open:</p><pre>http://localhost:5601/app/home#/tutorial/nginxLogs</pre><p>This page gives you the exact installation commands for your OS, a pre-built Nginx module configuration, and instructions for loading the default Nginx dashboards into Kibana. Follow the steps there to install Filebeat on the <strong>DMZ VM</strong> — not the Logging VM.</p><h3>Two Important Changes to filebeat.yml</h3><p>The tutorial will generate a filebeat.yml with some defaults that need adjusting before anything works correctly.</p><p><strong>1 — Send directly to Elasticsearch, not Logstash</strong></p><p>By default the tutorial points output at Logstash. We’re bypassing Logstash here and shipping directly to Elasticsearch — this gives the Nginx module proper control over index mappings and field parsing, which is what makes those pre-built dashboards actually populate correctly.</p><p>In filebeat.yml, comment out the Logstash output and uncomment the Elasticsearch output:</p><pre># Comment this out:<br># output.logstash:<br>#   hosts: [&quot;&lt;logging-vm-ip&gt;:5044&quot;]<br># Uncomment and configure this:<br>output.elasticsearch:<br>  hosts: [&quot;&lt;logging-vm-ip&gt;:9200&quot;]</pre><blockquote><strong><em>Firewall Rule Required:</em></strong><em> For Filebeat on the DMZ VM to reach Elasticsearch, you need a pfSense firewall rule allowing traffic from the DMZ network to port </em><em>9200 on the Logging VM. Without this, the connection will be silently dropped at the network level regardless of how </em><em>filebeat.yml is configured.</em></blockquote><p><strong>2 — Skip the credentials</strong></p><p>The tutorial will also include fields for an Elasticsearch username and password. Leave those out. When we set up the ELK stack, we explicitly disabled authentication in the Docker Compose file:</p><pre>environment:<br>  - xpack.security.enabled=false</pre><p>This turns off all authentication for Elasticsearch entirely — no username, no password, no TLS. With security disabled, adding credentials to filebeat.yml won&#39;t just be unnecessary, it can cause connection errors.</p><h3>Troubleshooting: Logs Appearing in Error Log Instead of Access Log</h3><p>If you open the Kibana dashboard and notice that GET requests and 200/304 status codes are showing up under the <strong>Nginx error logs</strong> panel instead of access logs, the Nginx module is misrouting them — it&#39;s picking up the wrong file for the wrong log type.</p><p>Check your Nginx module config on the DMZ VM:</p><pre>sudo nano /etc/filebeat/modules.d/nginx.yml</pre><p>Make sure the paths are explicitly set for both log types:</p><pre>- module: nginx<br>  access:<br>    enabled: true<br>    var.paths: [&quot;/var/log/nginx/access.log*&quot;]<br>  error:<br>    enabled: true<br>    var.paths: [&quot;/var/log/nginx/error.log*&quot;]</pre><p>Without explicit paths, Filebeat’s auto-detection can assign the access log to the error log input. After saving the file, restart Filebeat:</p><pre>sudo systemctl restart filebeat</pre><h3>A Note on Security Worth Documenting</h3><p>Disabling xpack.security is a deliberate shortcut for this lab, and it&#39;s worth being honest about what that means:</p><ul><li>Anyone who can reach port 9200 on the Logging VM can freely read, write, or delete your Elasticsearch data</li><li>There is no audit trail of who accessed what</li><li>All data between Filebeat and Elasticsearch travels unencrypted</li></ul><p>Note that security was intentionally disabled for lab simplicity. If you are doing this in production, research what hardening looks like enabling xpack.security, setting up TLS certificates between services, and creating role-based users for Kibana and any log shippers.</p><h3>Loading the Pre-Built Nginx Dashboards</h3><p>Once Filebeat is installed and configured, run this on the DMZ VM to import the default Kibana dashboards that ship with the Nginx module:</p><pre>sudo filebeat setup --dashboards</pre><p>This connects to Kibana and automatically pulls in a set of pre-built dashboards. Once it completes, head over to the Kibana UI on the Logging VM:</p><pre>http://localhost:5601</pre><p>Navigate to <strong>Kibana → Dashboard</strong> and search for nginx. You should see:</p><ul><li>[Filebeat Nginx] Access and Error Logs</li><li>[Filebeat Nginx] Overview</li></ul><p>If both dashboards appear, Filebeat has a clean connection to Kibana and the Nginx module is loaded correctly. At this point, any traffic hitting DVWA through Nginx will start populating these dashboards automatically.</p><p>Now to get the dashboard views correctly you need to refresh the index patterns, to do that Go to: <strong>Kibana → Management → Index Patterns → filebeat-*</strong><br> Click the <strong>refresh</strong> button in the top right of the index pattern page. This rescans the index and picks up any new fields that have been created since the index pattern was last updated.</p><p>Then you would have something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_fXeoIBB8Zhi8lnr1zjqQ.png" /></figure><h3>Conclusion</h3><p>We’ve gone from a blank network to a fully operational log monitoring pipeline. pfSense is segmenting the traffic, DVWA is running behind an Nginx reverse proxy in the DMZ, Filebeat is shipping access logs across network zones, and Kibana is indexing and visualizing everything in real time.</p><p>This is a strong foundation. In the next article, we’ll move from monitoring to detection — writing Kibana Watcher rules that fire alerts when attack patterns hit DVWA, and routing those alerts into Slack with MITRE ATT&amp;CK context attached.</p><p>Next Article: <a href="https://medium.com/@bennetsharwin001/setting-up-security-detections-in-elk-stack-449611285d4f">https://medium.com/@bennetsharwin001/setting-up-security-detections-in-elk-stack-449611285d4f</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c146c89afb99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mr. Robot TryHackMe CTF Writeup | Complete Walkthrough]]></title>
            <link>https://medium.com/@bennetsharwin001/mr-robot-tryhackme-ctf-writeup-complete-walkthrough-da0a41a5dac4?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/da0a41a5dac4</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Wed, 18 Feb 2026 12:00:35 GMT</pubDate>
            <atom:updated>2026-02-18T12:00:35.942Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mr. Robot — TryHackMe CTF Writeup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eI-kbXl6r-inluHX.png" /></figure><h2>Table of Contents</h2><ol><li>Reconnaissance</li><li>Web Application Enumeration</li><li>Initial Access — WordPress Exploitation</li><li>Post-Exploitation &amp; Lateral Movement</li><li>Privilege Escalation — SUID Abuse</li><li>Flags Summary</li><li>Lessons Learned &amp; Remediation</li></ol><h2>1. Reconnaissance &amp; Enumeration</h2><p>Starting off with an Nmap scan to identify open ports, running services, and OS information on the target.</p><h3>1.1 Nmap Scan</h3><pre>sudo nmap -sC -sV -A 10.49.141.115</pre><p><strong>Output:</strong></p><pre>Starting Nmap 7.95 ( https://nmap.org ) at 2026-02-18 03:05 EST<br>Stats: 0:00:26 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan<br>NSE Timing: About 94.84% done; ETC: 03:05 (0:00:00 remaining)<br>Nmap scan report for 10.49.141.115<br>Host is up (0.033s latency).<br>Not shown: 997 filtered tcp ports (no-response)<br>PORT    STATE SERVICE  VERSION<br>22/tcp  open  ssh      OpenSSH 8.2p1 Ubuntu 4ubuntu0.13 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   3072 08:67:45:ee:fe:d0:d6:02:ea:12:54:1e:06:5f:18:e8 (RSA)<br>|   256 4d:7f:84:70:c2:e1:1c:29:24:f4:10:cd:d0:82:ab:fd (ECDSA)<br>|_  256 ef:6b:f3:3e:82:97:53:16:88:21:6c:3e:a0:dd:94:05 (ED25519)<br>80/tcp  open  http     Apache httpd<br>|_http-server-header: Apache<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>443/tcp open  ssl/http Apache httpd<br>|_http-server-header: Apache<br>| ssl-cert: Subject: commonName=www.example.com<br>| Not valid before: 2015-09-16T10:45:03<br>|_Not valid after:  2025-09-13T10:45:03<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port<br>Device type: general purpose|specialized|phone|storage-misc<br>Running (JUST GUESSING): Linux 4.X|5.X|3.X (91%), Crestron 2-Series (86%), Google Android 10.X|11.X|12.X (85%), HP embedded (85%)<br>OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:crestron:2_series cpe:/o:linux:linux_kernel:3 cpe:/o:google:android:10 cpe:/o:google:android:11 cpe:/o:google:android:12 cpe:/h:hp:p2000_g3<br>Aggressive OS guesses: Linux 4.15 - 5.19 (91%), Linux 4.15 (88%), Linux 5.4 (88%), Crestron XPanel control system (86%), Linux 3.8 - 3.16 (86%), Android 10 - 12 (Linux 4.14 - 4.19) (85%), HP P2000 G3 NAS device (85%)<br>No exact OS matches for host (test conditions non-ideal).<br>Network Distance: 3 hops<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><h3>1.2 Nmap Analysis</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*RMyQF31AXaT0-TG33IMc8A.png" /></figure><p>The SSL certificate is using a default placeholder (www.example.com), which tells us the server wasn&#39;t hardened properly. 997 ports came back as <strong>filtered</strong>, so there&#39;s a firewall in play. The web server is our main target here.</p><h2>2. Web Application Enumeration</h2><p>With the web server confirmed, the next move is to find hidden directories, sensitive files, and figure out what CMS is running.</p><h3>2.1 Directory Brute-Forcing with FFUF</h3><p>Ran <strong>FFUF</strong> against the web server to discover directories:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MDe-YSXuvCrWk1274ryYgw.png" /></figure><p><strong>Interesting endpoints:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*yBCxlvNeDRFg6Fh1pmM5eg.png" /></figure><p>The /login and /admin endpoints confirm this is a <strong>WordPress</strong> site, which opens up a lot of attack vectors — theme editing, plugin exploits, XML-RPC brute-forcing, and more.</p><h3>2.2 Exploring robots.txt — Flag 1</h3><p>robots.txt tells search engines what to crawl and what to ignore. Pentesters check this file because developers sometimes leak sensitive paths in it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*PgjxMUy2P0Sd7n8ibevO2w.png" /></figure><p>Two entries were listed:</p><ol><li><strong>key-1-of-3.txt</strong> — The first flag</li><li><strong>fsociety.dic</strong> — A dictionary file (wordlist for brute-forcing)</li></ol><p>Navigating to key-1-of-3.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*EjnPphm2pkndXw_F1w3ATg.png" /></figure><blockquote><strong>Flag 1:</strong> 073403c8a58a1f80d943455fb30724b9</blockquote><h3>2.3 The fsociety.dic Wordlist</h3><p>The second file turned out to be a wordlist — a list of potential passwords and usernames. Grabbed it for later use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*QjvSoJnqBh8d4f-HFtQfUQ.png" /></figure><p>Custom wordlists found on a target tend to be more effective than generic ones like rockyou.txt, so it&#39;s always worth downloading them.</p><h3>2.4 The /license Endpoint — Credential Discovery</h3><p>The /license page had a Base64-encoded string hidden in it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ldPuOeOYZ030AuQC9bDsWw.png" /></figure><p>Decoding it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BiEm9BnI5cH7_9wYcgTObQ.png" /></figure><p>This gave us a <strong>username:password</strong> pair. Base64 is just encoding, not encryption — it provides no real security. These are essentially plaintext credentials sitting on a public page.</p><h2>3. Initial Access — WordPress Exploitation</h2><h3>3.1 Logging into WordPress</h3><p>Used the decoded credentials on the WordPress login page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*kWjoVKegNQ3LAOtq0sru4w.png" /></figure><p>We’re in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1Y5P8d_ApFXCY01LLirfQ.png" /></figure><h3>3.2 Reverse Shell — Attempt 1: Direct File Upload (Failed)</h3><p>First approach was to upload a PHP reverse shell through the media library:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JYOI4-PMjHWIs3NiIscoSg.png" /></figure><p>WordPress blocked the upload. Tried renaming the file extension to get around the filter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*okKM8Siiu0b2o8PwaV0dJA.png" /></figure><p>Attempted to trigger execution with a Netcat listener ready.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*-kVqrfpFH8ELv8bNaMHnlw.png" /></figure><p>WordPress renamed the file on upload, stripping the extension. This approach didn’t work.</p><h3>3.3 Reverse Shell — Attempt 2: Theme Editor (Successful)</h3><p>WordPress <strong>v4.3.1</strong> allows admins to edit theme files directly from the dashboard. This is a well-known way to get code execution:</p><ol><li>Go to <strong>Appearance &gt; Editor</strong></li><li>Select the <strong>404.php</strong> template</li><li>Replace the content with a <a href="https://github.com/pentestmonkey/php-reverse-shell">Pentest Monkey PHP Reverse Shell</a></li><li>Update the attacker IP and port in the shell code</li><li>Save the file</li><li>Start a Netcat listener: nc -lvnp &lt;PORT&gt;</li><li>Visit a non-existent page (e.g., http://10.49.141.115/doesnotexist) to trigger the 404 template</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PaHkFkdkU1g1tJylAVB1Ow.png" /></figure><p>Shell caught:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x_V-evHk-fri3pwEAMFH3A.png" /></figure><p>We now have a shell as the <strong>daemon</strong> user (the Apache web server process).</p><p>We went with 404.php because it&#39;s easy to trigger, doesn&#39;t break the site, and is unlikely to be noticed.</p><h2>4. Post-Exploitation &amp; Lateral Movement</h2><p>With a shell as daemon, the next step is to move to a higher-privileged user.</p><h3>4.1 Exploring the robot User&#39;s Home Directory</h3><p>Found the home directory of a user called <strong>robot</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*bOHrA781-WOHqu35qwYeag.png" /></figure><p>Two files inside:</p><ul><li><strong>key-2-of-3.txt</strong> — The second flag, but we can&#39;t read it yet (owned by robot)</li><li><strong>password.raw-md5</strong> — The robot user&#39;s password stored as a raw MD5 hash</li></ul><h3>4.2 Cracking the MD5 Hash with Hashcat</h3><p>Used <strong>Hashcat</strong> with the fsociety.dic wordlist we grabbed earlier:</p><pre>hashcat -m 0 &lt;hash_file&gt; fsociety.dic</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*WpkqiGk0iYjxnm9QL0JYOA.png" /></figure><p><strong>Cracked:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*QOnjAFoiIKDxzSYJQVIV9A.png" /></figure><blockquote>(Machine IP was reset from here onwards)</blockquote><h3>4.3 Switching to the robot User — Flag 2</h3><p>Tried switching with su robot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*rWQhflwNd9ssctyA1mK7eQ.png" /></figure><p>The password from Hashcat was shown in uppercase, but the actual password needed to be <strong>lowercase</strong>. Worth remembering to try both cases when cracking hashes.</p><p>After switching to robot, we can read the flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*Saeaoysu7VRBL1IHrvub_w.png" /></figure><blockquote><strong>Flag 2:</strong> 822c73956184f694993bede3eb39f959</blockquote><h2>5. Privilege Escalation — SUID Abuse</h2><p>Now as robot, but the last flag is almost certainly in /root/. We need root access.</p><h3>5.1 Finding SUID Binaries</h3><p>SUID binaries run with the permissions of the file owner (usually root) regardless of who executes them. Misconfigured SUID binaries are a common privilege escalation path.</p><pre>find / -perm -4000 -type f 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*E-BsWu76SX5i9BuOFebkUw.png" /></figure><h3>5.2 Nmap with SUID — The Odd One Out</h3><p>Among the usual SUID binaries (passwd, ping, sudo, etc.), <strong>/usr/local/bin/nmap</strong> stood out. Nmap should never have the SUID bit set.</p><p>Older versions of Nmap (v2.02 to v5.21) had an --interactive mode that drops the user into a Nmap shell. With SUID set, that shell runs as root.</p><p>Reference: <a href="https://gtfobins.github.io/gtfobins/nmap/">GTFOBins — Nmap</a></p><h3>5.3 Getting a Root Shell</h3><pre>nmap --interactive</pre><p>Then from the Nmap interactive prompt:</p><pre>nmap&gt; !sh</pre><p>This spawns a shell running as root:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*-lZndCG9sXlT_99eo793Eg.png" /></figure><p>We are root.</p><h3>5.4 Flag 3</h3><p>Navigated to /root/ and read the last key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*yXF9jpA4fERzaHqIguyMIQ.png" /></figure><blockquote><strong>Flag 3:</strong> 04787ddef27c3dee1ee161b21670b4e4</blockquote><h2>6. Flags Summary</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*_VLhjchAzvZZ9wyljzjfnw.png" /></figure><h2>7. Lessons Learned &amp; Remediation</h2><p>This box shows how small misconfigurations chain together to give an attacker full system access. None of the individual issues are hard to fix, but together they create a clean path from zero to root.</p><h3>Findings &amp; Remediation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-B9lLVazP8CId_8TuCEOwA.png" /></figure><h3>Key Takeaways</h3><ol><li><strong>Chained vulnerabilities</strong> are where the real risk is. The path here was: information disclosure &gt; credential leak &gt; code execution &gt; weak hash &gt; SUID abuse.</li><li>Always check robots.txt, sitemap.xml, .htaccess, and backup files like wp-config.php.bak during enumeration.</li><li>SUID auditing should be part of any Linux hardening checklist. Cross-reference findings with <a href="https://gtfobins.github.io/">GTFOBins</a>.</li><li>MD5 is not fit for password hashing — a single GPU can crack billions of MD5 hashes per second.</li></ol><h2>Tools Used</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*hSmdQEeEXtH-tQZULMWCeQ.png" /></figure><p><em>Writeup by bennet | TryHackMe — Mr. Robot CTF</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da0a41a5dac4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Penetration Testing on AWS Goat]]></title>
            <link>https://medium.com/@bennetsharwin001/penetration-testing-on-aws-goat-bb214717b5da?source=rss-7cf74c0afa2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb214717b5da</guid>
            <category><![CDATA[cloud-pentesting]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[vulnerable-app]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Bennet Sharwin]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 13:07:13 GMT</pubDate>
            <atom:updated>2025-12-10T13:07:13.308Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*VOa1cT7FJygQtfBB.png" /></figure><p>Previously we have set up AWSGoat using terraform and AWS cli. Now its ready to receive requests.</p><p><a href="https://medium.com/@bennetsharwin001/setting-up-aws-goat-6ba93beb779c">https://medium.com/@bennetsharwin001/setting-up-aws-goat-6ba93beb779c</a></p><p>What is The AWSGoat?</p><p>AWSGoat is a Vulnerable AWS Infrastructure for teaching people to AWS cloud vulnerabilities and pentesting. It has some vulnerabilities like;</p><p>· XSS<br>· SQL Injection<br>· Insecure Direct Object Reference<br>· Server Side Request Forgery on Lambda Environment<br>· Sensitive Data Exposure and Password Reset<br>· S3 Misconfigurations<br>· IAM Privilege Escalations<br>· ECS Container Breakout</p><p>The terraform apply command after finishing gave us this link:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/0*dlbghR_9_zKfJ6lW.png" /></figure><p>app_url = &quot;https://lboeqh1eq7.execute-api.us-east-1.amazonaws.com/prod/react&quot;</p><p>visiting the URL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*gU7zVK5gFOgeNGou.png" /></figure><h3>Cross Site Scripting (XSS)</h3><p>In the search bar if I search something that will give me search results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*8yY97dLPcS-7TRK-.png" /></figure><p>This is a possible XSS, So I tried a simple XSS Injection and it worked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*YkmiMZi9-s62JBVK.png" /></figure><p>This proves the site is vulnerable to Reflex XSS attacks.</p><p>Clicking on the profile icon at the top — right there is a login page and when we visit it there is a Register page too, lets create a fake account and see what it holds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*09uTzhNb5ju9b-iZ.png" /></figure><p>lets create a fake account.<br>After registering it took us to the home page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*sSle0VojJYnFVxDA.png" /></figure><h3>Insecure Direct Object Reference (IDOR)</h3><p>Surfing through all the pages there is a profile page where I can change my profile. The possibility of IDOR existing here is high.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*RV5dpm7mYOr3Zchm.png" /></figure><p>I opened burp and started intercepting the requests that’s going to the server to understand which API call is used and how it is being used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*V_0TNtCX1NKqVDOW.png" /></figure><p>Looks like its just changing the password based on an id . That means if we manipulate it we can change the password of another user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*U3l-FmWpkJnleFb6.png" /></figure><p>And it worked I successfully changed the password of another user. This confirms the existence of IDOR vulnerability.</p><h3>SQL injection</h3><p>Going to the user tab there is a search box, and upon tinkering with it, I found that each time you type something it sends a request to the backend, There is a possible SQL Injection here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*xZ0cIC2mOyspylV-.png" /></figure><p>Lets type something and inspect the request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*CmE8K-5eEBLFmk68.png" /></figure><p>That gives is this an SQL Injection is possible here, lets send it to the repeater.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*4T_0QSYzzfUOwS7c.png" /></figure><p>Now lets go to the repeater tab in burp, and try the SQL Injection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*_ZEyZntW8ESha-dr.png" /></figure><p>And it works, it gives us all the details about the users present.<br>Now if we want we can change any users password and impersonate him. But that is not going to get us anywhere.</p><h3>Server Side Request Forgery SSRF</h3><p>Now we can check for SSRF vulnerabilities in the webpage, when I went to the newpost tab, I saw that we can upload an image or enter a URL for the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*JWvuzmniMDEdPQ1F.png" /></figure><p>What if we put a file URL instead? so I tried to get the contents of /etc/password .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Vr_tii3iN9DQ__ci.png" /></figure><p>Click upload and submit. Now to view the post go to the Posts tab, and click on all posts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*wDs9Qx814_Cq3CDV.png" /></figure><p>Click on the post we have created. Go to inspect and refresh the page.</p><p>We know that in AWS most of the time, images are stored in S3 buckets, so most probably the file we uploaded in place of the image will also be uploaded to the S3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*4BIptbuLaqvAMjuJ.png" /></figure><p>Looking at the request there is a png that failed, and it is being loaded from a bucket. Lets see what’s inside of it by downloading it. Right click and copy its URL and use wget to download.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*ZSszFeASdo4sQOo3.png" /></figure><p>This gave us the contents of /etc/passwd</p><p>Now we can understand that SSRF is completely possible here.</p><p>Lets check other files like environment variables. Lets create a new post and instead of file:///etc/passwd we will look for /proc/self/environ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*0o6lU8lwWf3aa31m.png" /></figure><p>Now click Upload and go to Burp Suite to intercept the request, turn on response intercept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*6hcjwHqEwyFqTRb1.png" /></figure><p>We have a bucket link, lets download it and check the contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*BEnOemXtq6ve4vJL.png" /></figure><p>That’s the entire dump of the environment variables that has been set in the instance. With a few commands we get a clear view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*rg3zbOncJaeZfQ7D.png" /></figure><p>Now this has all the credentials and endpoint URL’s we need.</p><p>lets load this credentials to a separate aws profile by editing the ~/.aws/credentials file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*jgBN6WiulfJ9OSNF.png" /></figure><p>lets run a identity check command to see if the creds worked:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/0*E1i1q9Nj_4CxUcZA.png" /></figure><p>Okay, that worked. We have the user ID, Account No, and the AWS Resource Name</p><h3>Gaining access to the EC2 Instance</h3><p>After surfing around using the credentials and seeing what we have access to, we can finally find s3 buckets, lambda function and two dynamodb tables blog_posts and blog_users.<br>Use this command to find the functions:</p><pre>aws dynamodb list-tables --region us-east-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/0*FIqffGl8eUVdJrQL.png" /></figure><p>lets take a look inside those tables</p><p>firstly blog-users:</p><pre>aws dynamodb scan --table-name blog-users --region us-east-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*16ZVBNASgjmw4TOA.png" /></figure><p>This contains a list of all the users and their details including security questions and password hashes.</p><p>Now lets look at the S3 buckets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*YYrqs6a01Yn9vakp.png" /></figure><p>This looks odd, a development bucket is also present with the production one. Sometimes this contains important information</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/0*BTBt4wFqIJyPipUH.png" /></figure><p>lets go through all those files to find something</p><p>In this folder: /shared/files/.ssh/ there are multiple keys that was supposed to stay hidden. And in the same folder there is file called config.txt, this file contains information such as IP, hostname, port, user, and the location to the key. Lets download it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*41N145cczSeMcorm.png" /></figure><p>And this is the config.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/0*AVBHFqx_FYkYDElg.png" /></figure><p>since we have the IP addresses lets see if they are actually open to receive SSH connections, we will use nmap to scan those ports</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/0*VzEmXlHkHyuEmXTy.png" /></figure><p>Looks like the second IP is ready to accept connections, lets try logging in with its SSH key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/0*htwDsyA3edTyAnxg.png" /></figure><p>We have successfully logged into the EC2 instance.</p><h3>IAM Enumeration</h3><p>In the newly exploited EC2 instance lets check the roles we have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*B1jc21RnWP6t48Ro.png" /></figure><p>Lets see what all policies does AWS_GOAT_ROLE role have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*N4XQ0V3HWIB5BcOT.png" /></figure><p>The role AWS_GOAT_ROLE has full access to AWS S3.<br>The other role is in development. lets take a closer look at it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*PHeoF8T-Dh6H4ZeW.png" /></figure><p>IAM policies can have up to 5 versions but this only has one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*WRRp6zt7SANdiINo.png" /></figure><p>This looks like we can perform multiple IAM action with this policy. one that stands out is iam:CreatePolicy . This could allow us to create a policy that will escalate our privileges to Admin.</p><p>So In order to create a admin account that has privileges to everything like a root account we need to create a policy</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: &quot;*&quot;,<br>      &quot;Resource&quot;: &quot;*&quot;<br>    }<br>  ]<br>}</pre><p>Now lets create the policy with the name adminesc:</p><pre>aws iam create-policy --policy-name adminesc --policy-document file://policy.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*cAgFELh57KMNFbKp.png" /></figure><p>Now that we have created a policy that has access to anything like a root user we need to attach it to a user, group or role:<br>Before we logged into this ec2 machine we had a different role we got from the SSRF attack, its name was blog-application-data .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*7_aLVN2K0oFXe6VD.png" /></figure><p>This role by default this didn’t have any high level access like to create a new user or something</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*0tyf_ihSA3ZYcF2e.png" /></figure><p>as the AWS_GOAT_ROLE we have access to create and attach policies, so we can attach the high privilege policy to blog-application-data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*CzSjk_LktHLYrIKi.png" /></figure><p>Lets try creating a user again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*0RyCeK45T-NG-buA.png" /></figure><p>lets give him maximum administrative access by attaching a administrative policy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*UgVs9xTbnJUT8poM.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*eqfuivl0mZLG8P2I.png" /></figure><p>We successfully created a Administrative user with maximum privileges.</p><h3>Roadmap</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8FgT3PsMRaPMzMPeDVZCw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb214717b5da" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>