<?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 Gokul Karthik on Medium]]></title>
        <description><![CDATA[Stories by Gokul Karthik on Medium]]></description>
        <link>https://medium.com/@gokul_karthik?source=rss-c6927af32ea1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FNhaDlFpoFbuhnpusiegzA.jpeg</url>
            <title>Stories by Gokul Karthik on Medium</title>
            <link>https://medium.com/@gokul_karthik?source=rss-c6927af32ea1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:58:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gokul_karthik/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[Review of the CompTIA SecAI+ Exam]]></title>
            <link>https://infosecwriteups.com/comptia-secai-review-acc5bff2b890?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/acc5bff2b890</guid>
            <category><![CDATA[ai-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[certification]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Sat, 14 Nov 2026 01:36:01 GMT</pubDate>
            <atom:updated>2026-11-19T00:53:56.533Z</atom:updated>
            <content:encoded><![CDATA[<h4>Are Multiple Choice AI Exams worth it ?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*F_q0DeTz1ntm2N4nwG9-Qg.png" /></figure><p>I passed the <strong>CompTIA SecAI+</strong> recently, and since it’s still a pretty new cert, there aren’t a ton of reviews out there yet. So here’s mine: where I was coming from, why I took it, how I prepped, and whether I think it was worth it.</p><p>The short version: it’s a solid intro to the <em>language</em> of AI security, but it’s not a technical deep dive. And that’s okay, as long as you know that going in. 🙂</p><p>Let’s get into it.</p><h3>Background</h3><p>Before we get into it, a bit of context on where I’m coming from.</p><p>I’m currently a graduate student in Cybersecurity, and most of my experience is in other corners of security: <strong>DevSecOps, cloud security, and AppSec</strong>. I also recently picked up the OSCP and PNPT, which you can read about <a href="https://medium.com/bugbountywriteup/the-oscp-is-a-mental-game-d6583fc6b20b">here</a> and <a href="https://medium.com/meetcyber/how-i-passed-the-pnpt-on-my-second-attempt-2026-review-and-tips-dcdd829cd591">here</a>.</p><p>AI, on the other hand? Not much. I used AI tools day to day like everyone else, but I had little exposure to the <em>security</em> side of it: how these systems get attacked, how you defend them, and how organizations are supposed to govern them.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3ogwFGEHrVxusDbDjO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeWVqYzBhZ3kydXZzbmNoa2hueDNlZnZtcmEzcGUwb2IzM29mMno3cCZlcD12MV9naWZzX3NlYXJjaCZjdD1n%2F3ogwFGEHrVxusDbDjO%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExYjVtejh0OXM0YzU3Mmdvd3hxa2U0OWJsYzM0bDhrMnB3enJmN283byZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F3ogwFGEHrVxusDbDjO%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/773e6c3fadd82ab80cbd4b82ed4d8425/href">https://medium.com/media/773e6c3fadd82ab80cbd4b82ed4d8425/href</a></iframe><h3>Why SecAI+?</h3><p>Honestly? AI was everywhere. Every job description, every vendor pitch, every conference talk. And I felt like I didn’t have enough exposure to it from a security point of view.</p><p>So when CompTIA released SecAI+ about 9 months ago, I pulled the trigger.</p><p>I went in with realistic expectations. This was never going to be an OSCP-style exam. It’s CompTIA: multiple choice, a few PBQs, and heavy on theory. But I wanted a structured way to get the fundamentals and vocabulary down, and for that, it did the job.</p><h3>Preparation</h3><h4>A. Voucher vs. CertMaster Perform</h4><p>I had two options: buy just the exam voucher and study on my own, or get the <strong>CompTIA CertMaster Perform</strong> bundle, which comes with the course content and some labs.</p><p>I went with CertMaster for three reasons:</p><ul><li><strong>Labs:</strong> I wanted at least <em>some</em> hands-on exposure, not just reading.</li><li><strong>Flexibility:</strong> I wanted to take the exam on my own time, not right away.</li><li><strong>Student discount:</strong> CompTIA’s student pricing made the bundle easier to justify.</li></ul><p>If I hadn’t gone with CertMaster, I would’ve picked up a Udemy course and a set of practice exams. That’s a perfectly good and cheaper route.</p><h4>B. The “Prep” (aka Nine Months of Not Touching It)</h4><p>I bought the exam in February… and didn’t open it until November. 😅</p><p>Once I actually started, I prepped for about <strong>2 weeks</strong>:</p><ul><li><strong>Content:</strong> I speedran parts of it. A lot of the terms weren’t completely new to me, and it’s not the hardest exam out there. I slowed down on the AI-specific material that was new.</li><li><strong>Labs:</strong> They’re nice if you’re curious, but honestly not that relevant to the exam, since the format is just multiple choice and PBQs. Do them if you want the exposure and want to retain the concepts; skim them if you just want to pass.</li><li><strong>Passing score:</strong> 600/900 is generous compared to other CompTIA exams (Security+, for example, is 750). That took some pressure off.</li></ul><p>At the end of those two weeks, I sat the exam and passed. 🎉</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FAL10PPC3eZhxC%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeWlkZWVzaTU0NXRrdTBmbDRucXMzNXBwaXBscmhkdTBqcHdzeTVtayZlcD12MV9naWZzX3NlYXJjaCZjdD1n%2FAL10PPC3eZhxC%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbmJoaXJ0NXg5bHZnNDFwOHlsM2tpMHZ6eHhnNnZ6N2Q2dWkxdXBweSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FAL10PPC3eZhxC%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="291" frameborder="0" scrolling="no"><a href="https://medium.com/media/64cc3b8a6cdcf75ff8ce8d708464a3b1/href">https://medium.com/media/64cc3b8a6cdcf75ff8ce8d708464a3b1/href</a></iframe><h3>So, Was It Worth It?</h3><p><strong>Did I learn new AI terms and concepts?</strong> Yes. I came out with a much better mental map of AI security: the attack surface, the defensive controls, and the governance side that I’d mostly ignored before.</p><p><strong>Was it technical enough?</strong> No. But I knew that going in. You won’t be jailbreaking a model or poisoning a dataset here; you’ll be answering questions about those things.</p><p><strong>Overall?</strong> For about 2 weeks of prep, it felt about right. Any more than that and I think you’d be over-preparing for what the exam actually asks of you.</p><h4>Who Should Take It?</h4><ul><li><strong>Good fit:</strong> Security folks who want a structured intro to AI security, people in GRC or leadership roles, or anyone whose employer is covering the cost.</li><li><strong>Probably skip:</strong> If you’re already doing hands-on AI red teaming or ML engineering, you’ll likely know most of this already.</li></ul><h3>What’s Next?</h3><p>SecAI+ gave me the intro. Now I want the technical side.</p><p>But I’d love to hear from you: if you’re a security person who’s built hands-on AI security skills, what should be the next step? Courses, labs, certs, side projects, drop them in the comments!</p><h3>Final Thoughts</h3><p>SecAI+ isn’t going to make you an AI security expert, and it doesn’t pretend to. But if you’re coming from a traditional security background and want a structured, low-pressure way into the field, it’s a solid starting point. Just don’t stop there.</p><p>If you have questions about the exam or just want to chat, feel free to reach out to me on <a href="https://www.linkedin.com/in/gokulkarthik2001/">LinkedIn</a>.</p><p>Good luck! 🙂</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FTNhe3ZxgsEGJ2VICi5%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeHBwZjJxYm81d3ludXZ5eHV2NmJpcnVxOWowcWFlOXZ2eGxkeHd2ZyZlcD12MV9naWZzX3NlYXJjaCZjdD1n%2FTNhe3ZxgsEGJ2VICi5%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExdHBkdmdqM3JuMHE4aXQ5eDZ3OXF5YXE5eTU1MGh3NmtoN2twOHd5MyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FTNhe3ZxgsEGJ2VICi5%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/948cb893a9de755e94b21b7e7c483201/href">https://medium.com/media/948cb893a9de755e94b21b7e7c483201/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acc5bff2b890" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/comptia-secai-review-acc5bff2b890">Review of the CompTIA SecAI+ Exam</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JWT Exploits: Three Ways Trust Gets Misconfigured]]></title>
            <link>https://meetcyber.net/jwt-exploits-three-ways-trust-gets-misconfigured-3e0bda792437?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e0bda792437</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[vulnerability]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 22:50:11 GMT</pubDate>
            <atom:updated>2026-09-11T22:54:49.560Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is the </em><strong><em>2nd part</em></strong><em> in a two-part series on JWT security. If you haven’t read </em><a href="https://medium.com/@gokul_karthik/jwt-internals-whats-actually-inside-that-token-you-trust-28c4fbb9e451"><strong>Part 1</strong></a> <em>of this series, I recommend checking that out first as this part discusses JWT exploits!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nSgNhciFoEvEY_ftfA7C8w.png" /></figure><h3>Why I Built a Lab for This</h3><p>Whenever I sit down to solve a CTF challenge involving JWTs, it’s almost always one of a small, recurring set of patterns. After hitting the same handful of tricks across enough competitions, I got tired of relearning them cold each time.</p><p>So I built a lab that packages the common ones as actual hands-on challenges against a running app, so I can get up to speed before walking into a CTF or a real audit, instead of relearning it out live under a timer.</p><p>It’s called <a href="https://github.com/goku007xx/JWT-Exploit-Playground"><strong>JWT Exploit Playground</strong></a>, a Pokemon-themed lab where your “Trainer Card” is a JWT and each Gym Leader’s badge terminal trusts that card in a different broken way. For now, we will demonstrate three of those attacks, live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vNLBEeO7lr45rC2gm5InZA.png" /></figure><h3>Live Break #1: Brute-Forcing a Weak Secret (Saffron Gym)</h3><p><strong><em>Goal</em></strong><em>:</em> <em>Get the terminal to accept a Trainer Card where </em><em>&quot;rank&quot;: &quot;elite&quot;. How you modify the rank in the payload is the challenge.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tgJxPYOFpmkTPvVb2TwV3g.png" /></figure><p>In this challenge, the payload is signed with HS256, which means one shared secret does both jobs, it signs the token, and that exact same secret checks it later.</p><p>Here’s the thing though: <strong>HMAC-SHA256</strong>, the actual math behind it, is genuinely strong. Nobody’s breaking the algorithm here.</p><p>The verification code checking the token is also correct:</p><pre>function vulnerableVerify(token, trainerId) {<br>  // Get the HS256 secret<br>  const secret = getSecretForTrainer(trainerId);<br>  // Verify the user token with the secret<br>  return jwt.verify(token, secret, { algorithms: [&#39;HS256&#39;] });<br>}</pre><p>So what could possibly be the issue?</p><p>The secret itself. If it’s weak enough, an attacker can just guess it. 🫠</p><p>HMAC is deterministic, the same input and the same key always produce the same output. That means you can sit on your own laptop and test candidate secrets against a captured token, without ever touching the server. The moment a candidate secret produces the exact same signature as the real token, you’ve found it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXEwOmuLcUMsdILMJ1vdsQ.png" /></figure><p>In this case, we use a custom brute forcing script and found the secret to be <strong>pinsir (</strong>You can use john or hashcat as well<strong>)</strong>. Once you have the secret, you’re just as capable as the server is. You can sign anything you want. Build a fresh token, drop rank: &quot;elite&quot; into the payload, and sign it with the secret you just cracked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uXF01uybSFTN09zZZr7ygw.png" /></figure><p>Submit it, and the terminal checks the signature. It matches, because you signed it with the real secret, so it hands you the badge. It has no way of knowing you were never supposed to have that secret in the first place. 🙌</p><h4>How can we mitigate this type of attack ?</h4><ul><li>Use a long, high-entropy secret, never a word, phrase, or anything a wordlist could guess. Entropy is the only real defense here, since the attack is entirely offline and can’t be rate-limited.</li><li>Rotate secrets periodically and consider signing with a kid mapped to per-key secrets, so a cracked or leaked secret doesn&#39;t compromise every token you&#39;ve ever issued.</li></ul><h3>Live Break #2: Algorithm Confusion, RS256 → HS256 (Fuchsia Gym)</h3><p><strong><em>Goal</em></strong><em>:</em> <em>Get the terminal to accept a Trainer Card where </em><em>&quot;clearance&quot;: &quot;champion&quot; . The terminal normally checks an asymmetric signature but it never pins which family of algorithm you’re allowed to use.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwUYL8lhr3X-fmIPB1-ANQ.png" /></figure><p>In this challenge, the payload is signed with <strong>RS256</strong>, which means a private key signs the token and a public key checks it. That public key is exposed at /gym5/public-key.pem, which is completely normal, that&#39;s exactly how RS256 is supposed to work.</p><p>The asymmetric cryptography here is doing exactly what it’s supposed to do. Nobody’s cracking RSA. The keys themselves are fine.</p><p>The verification code checking the token looks reasonable ?</p><pre>const ALLOWED_ALGS = [&#39;RS256&#39;, &#39;HS256&#39;];<br><br>function vulnerableVerify(token) {<br>  const key = getPublicKeyPem(); // meant only for RS256<br>  return jws.verify(token, decodedHeader.alg, key); // reused for HS256 too<br>}</pre><p>So what could possibly be the issue ? The verifier accepts <strong><em>more than one</em></strong> algorithm, and reuses the same key for both. 🫠</p><p>RS256 and HS256 get treated as interchangeable here, and both are handed the exact same key variable, the <strong>RSA public key</strong>. RS256 correctly treats that as an asymmetric public key. HS256 has no idea what an asymmetric key even is, it just treats whatever it’s given as a raw string to use as an HMAC secret. And a PEM file, once you strip away the fact that it looks cryptographic, is just a string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-q0mpHQfmlcY9xsrfHKV6Q.png" /></figure><p>In this case, we fetch the public key from /gym5/public-key.pem, then build a brand new token with alg set to HS256 and clearance: &quot;champion&quot; in the payload. Instead of signing it with some cracked secret, we sign it with the entire public key text itself, BEGIN/END lines and all, using it as the HMAC secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Py0ZQDCnqpd_h4Qs6XvbKw.png" /></figure><p>Submit it, and the terminal reads HS256 off your header, grabs &quot;the key&quot; (still thinking it&#39;s for RS256), and checks your signature using HMAC instead. Since you signed with those exact same bytes it&#39;s comparing against, it matches. You&#39;ve just turned the server&#39;s own public key against it. 🙂</p><h4>How can we mitigate this type of attack ?</h4><ul><li>Pin the exact algorithm server-side and never accept more than one family in a single verify() call. Ignore whatever alg the header claims, decide it yourself.</li><li>Keep symmetric and asymmetric key material completely separate in code, never let one “key” variable get handed to both an HMAC check and an RSA check. Modern library versions increasingly refuse this by default, so staying current helps too.</li></ul><h3>Live Break #3: JWK Header Injection (Cinnabar Gym)</h3><p><strong>Goal:</strong><em> Get the terminal to accept a Trainer Card where </em><em>&quot;title&quot;: &quot;gym_leader&quot;. How you get there is the challenge.</em></p><p>In this challenge, the server resolves the verification key dynamically at check time, either pulling one from the token’s own header or falling back to a secret it holds. That’s meant to make key management flexible, letting an issuer support multiple keys without hardcoding just one.</p><p>Resolving a key dynamically like this is a completely normal, real pattern. Plenty of legitimate JWT setups do exactly this to support key rotation.</p><p>The verification code checking the token looks like this:</p><pre>function vulnerableVerify(token) {<br>  const decoded = jwt.decode(token, { complete: true });<br><br>  if (decoded.header.jwk) { // Pull public key straight out of header if present<br>    const pem = jwkToPem(decoded.header.jwk);<br>    return jwt.verify(token, pem, { algorithms: [decoded.header.alg] });<br>  }<br><br>  return jwt.verify(token, SERVER_SECRET, { algorithms: [&#39;HS256&#39;] });<br>}</pre><p>So what could possibly be the issue? The server trusts a key that came from inside the token it’s trying to verify. 🫠</p><p>If the header has a jwk, the server pulls a public key straight out of that header and checks the signature with it. Nobody ever asks whether that key belongs to anyone the server should actually trust, it&#39;s treated as good enough just because it showed up in the right field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbc5GMFUEXGeq4OdaXktiw.png" /></figure><p>We can exploit this by generating our own RSA keypair. We sign a brand new token with our own private key, paste our matching public key directly into the header&#39;s jwk field, and set title: &quot;gym_leader&quot; in the payload. The overview is given in the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-wqg-6_37vthl8TONuWMQ.png" /></figure><p>Submit it, and the server reads your header, spots a jwk sitting right there, pulls your public key out of it, and checks your signature with it. Of course it matches, you signed it minutes ago with the private half of that exact key. You didn&#39;t break any cryptography here, you just handed the server a lock and the matching key, and it used both without ever asking who they belonged to.</p><h4>How can we mitigate this type of attack ?</h4><ul><li>Never resolve a verification key from anything inside the token being verified, no jwk, no jku, no x5c. A key has to come from somewhere the server already trusts, not from the token&#39;s own say-so.</li><li>If you need key rotation, use jku against a strict host allowlist and map kid to keys in a server-side table you control, rather than trusting whatever the token hands you.</li></ul><h3>Conclusion</h3><p>These are just <strong>3 of the 6</strong> challenges sitting in the repo. Two easier ones we didn’t cover here and then there’s the final Gym, <strong>Indigo Plateau</strong>, which is the advanced one. It packs three attack paths into a single challenge: a jku header that fetches trust from wherever you point it, plus a kid field vulnerable to both path traversal and SQL injection, your pick which route in. It ties together pretty much everything from this whole series into one last challenge, so do give it a shot if you&#39;re up for it.</p><p>That’s a wrap on this series. If you have any questions, run into trouble setting up the lab, or just want to talk through any of it, let me know!</p><p>👉 <strong>Want to try these yourself?</strong> Check out the <a href="https://github.com/goku007xx/JWT-Exploit-Playground">Github repository</a> to explore and play around with these JWT attack scenarios hands-on.</p><p>Also check out <strong>Part 1</strong> of this article if you haven’t already!</p><p><a href="https://medium.com/@gokul_karthik/jwt-internals-whats-actually-inside-that-token-you-trust-28c4fbb9e451">JWT Internals: What’s Actually Inside That Token You Trust</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e0bda792437" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/jwt-exploits-three-ways-trust-gets-misconfigured-3e0bda792437">JWT Exploits: Three Ways Trust Gets Misconfigured</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JWT Internals: What’s Actually Inside That Token You Trust]]></title>
            <link>https://meetcyber.net/jwt-internals-whats-actually-inside-that-token-you-trust-28c4fbb9e451?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/28c4fbb9e451</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[jwt-token]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[jwt]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 22:50:04 GMT</pubDate>
            <atom:updated>2026-09-11T22:52:45.385Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s just base64 and a bit of math.</h4><p>Paste any JWT into <strong>jwt.io</strong>, or just split it on the dots and base64url-decode each piece yourself. What you get back is two plain JSON objects and a chunk of binary that looks like noise: <strong>header.payload.signature</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ESgKv6Zq-8DuxG6Azd4h6w.png" /></figure><p>That’s a JWT. Three parts, each with one job. Once you actually understand what each part is responsible for, you get why JWTs behave the way they do, and why they break the way they do too.</p><h3>Why JWT Exists in the First Place</h3><p>Before JWT became the default answer to “<strong>how do I handle auth”</strong>, most systems worked something like this: a user logs in, the server creates a session, stores it somewhere it controls (a database, Redis, whatever), and hands the browser a small cookie holding just a session ID. Every request after that, the server takes that ID and looks the session up before it can do anything at all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tLiVOzCixTobFCErxy4sIg.png" /></figure><p>That works fine right up until you have <strong>more than one server</strong>. Now that lookup has to happen against a shared store that every service can reach. Add a mobile app, a handful of backend services that all need to trust the same login, maybe a third party that needs to accept your users’ identity too, and that one shared session store turns into a bottleneck and a dependency everyone needs to worry about.</p><p><strong><em>JWT’s whole pitch is simple:</em></strong> what if the token just proved itself? Instead of handing out a meaningless ID that only means something once you’ve looked it up, you hand the client a token that already contains the claims (who they are, what they can do, when it expires) plus a signature over all of it. Any server that knows how to check that signature can verify the token completely on its own.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*sdTn0meE_v_r1hbLD5MEAw.png" /></figure><p>That’s the <strong>“stateless”</strong> part people keep mentioning. It’s a stateless way for any service, anywhere, to verify who’s making a request and what they’re allowed to do, without needing to ask anyone else first.</p><h3>The Anatomy: Three Parts, Three Jobs</h3><p><strong>i) Header</strong>: tells the verifier how to check the signature.</p><pre>{ &quot;alg&quot;: &quot;HS256&quot;, &quot;typ&quot;: &quot;JWT&quot; }</pre><p><strong>ii) Payload</strong>: the actual claims, whatever the issuer wants to say about whoever the token belongs to.</p><pre>{<br>  &quot;sub&quot;: &quot;1234&quot;,<br>  &quot;trainer&quot;: &quot;Ash&quot;,<br>  &quot;role&quot;: &quot;trainer&quot;,<br>  &quot;iat&quot;: 1716239022,<br>  &quot;exp&quot;: 1716242622<br>}</pre><p><strong>iii) Signature</strong>: a cryptographic proof over the first two parts. We’re about to spend a <a href="#0c44">whole section</a> on this one, because it’s the crux on why JWT works.</p><p>Notice what’s missing here first, though: <strong>encryption</strong>.</p><p>Header and payload are just <strong>base64url </strong><em>encoded</em>, which is not a cipher. Anyone holding the token can read every claim inside it. So if you’ve ever kept something sensitive into a JWT payload assuming it was safely “encoded,” I’ve got some bad news, it wasn’t. The actual design goal is to be readable and tamper evident, not confidential.</p><h3>What the Signature Is (and Isn’t)</h3><p>The signature isn’t computed over the JSON. It’s computed over the literal ASCII string you get by gluing the two encoded parts together with a dot:</p><pre>signing_input = base64url(https://medium.com/header) + &quot;.&quot; + base64url(https://medium.com/payload)</pre><p>Whatever signs the token runs that exact string through an algorithm, and the output becomes the third segment. Two ways that can happen:</p><ol><li><strong>HMAC (Eg: HS256)</strong>: one shared secret. The signature is just HMAC-SHA256(secret, signing_input), a keyed hash. Whoever has the secret can produce it, and whoever has the same secret can reproduce it and compare. Fast and simple, but that secret now has to live on every server doing verification.</li><li><strong>RSA / ECDSA (Eg: RS256, ES256)</strong>: a private key produces the signature, a public key checks it. sign(privateKey, signing_input) on one side, verify(publicKey, signature, signing_input) on the other. This is what makes JWTs work so well for OAuth and SSO. One identity provider signs with a key it never shares, and any number of downstream services verify using a key that&#39;s meant to be public.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ptImrtbNWp9xKE8Scrc4A.png" /></figure><p>So, what the signature actually <strong>is</strong>: proof that whoever produced it held the right key at that moment, and proof that the header and payload are identical to what that key signed. <strong>Change a single character anywhere in either part and the signature stops matching.</strong> That’s the guarantee.</p><p>What it is <strong>not</strong>:</p><ul><li>It’s not encryption. It proves the payload wasn’t altered, it does nothing to hide what’s in it.</li><li>It’s not proof of a specific person’s identity. It’s proof that <em>someone holding a particular key</em> produced this token. If that key leaks, the signature is just as “valid” coming from whoever stole it.</li><li>It’s not proof the claims are true or sensible. If an issuer signs a token saying a free-tier user has admin access, the signature will verify that just as faithfully as it would verify a correct token. Garbage in, faithfully verified garbage out.</li></ul><h3>How a Verifier Actually Checks a Token</h3><p>Every major language has a mature library for it:</p><ul><li>jsonwebtoken or the more spec-complete jose in Node.js</li><li>PyJWT or authlib in Python</li><li>jjwt or Nimbus JOSE+JWT in Java</li></ul><p>They all do the same job under slightly different APIs, and it&#39;s worth knowing what they&#39;re actually doing, because the abstraction hides a few decisions that matter a lot. The general steps are given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OhEmjld1IZn0BpzGOK0C2w.png" /></figure><ol><li><strong>Split the token on its two dots</strong>: If there are not exactly three segments, it means it’s not a JWT, reject immediately.</li><li><strong>Decode the header, read </strong><strong>alg (and often </strong><strong>kid)</strong>: Next, base64url-decode the header as JSON, alg tells you which crypto primitive to run in step 4, and kid, if present, tells you which key to use when there&#39;s more than one. More on kid in Part 2, it&#39;s its own attack surface.</li><li><strong>Decode the payload</strong>: Next, decode the second segment(payload) the same way, you get the claims as plain JSON, with no schema validation applied yet.</li><li><strong>Recompute the signature with the server’s own key</strong>: Take the key you were given (a HS256 secret, a RS256 public key, or a resolver callback) along with the alg from step 2, you can recompute a signature over the original signing input.</li><li><strong>Compare the two signatures in constant time</strong>: This is where tampering actually gets caught. If someone changed even a single character in the header or payload, the recomputed signature won’t match, because they don’t have the secret or private key needed to produce a matching one. That mismatch is the whole security guarantee JWT gives you.</li><li><strong>If it matches, hand back the claims</strong>: The request is successful. No database round trip anywhere. Just math, every request.</li></ol><h3>Next Up</h3><p><a href="https://medium.com/@gokul_karthik/jwt-exploits-three-ways-trust-gets-misconfigured-3e0bda792437?postPublishedType=initial">Part 2</a> is where we stop talking about how JWT is supposed to work and go exploit three real misconfigurations, live, against an actual running app.</p><ul><li>A HS256 secret weak enough to brute-force offline.</li><li>An algorithm mix-up that turns a public key into an attacker’s own forging tool.</li><li>A verifier that trusts a key the token brought along with it, sitting in its own header.</li></ul><p>None of these are flaws in JWT itself, they’re flaws in how it gets configured, which is exactly why they show up again and again. I built a small <a href="https://github.com/goku007xx/JWT-Exploit-Playground">hands-on lab</a> to walk through all three.</p><p>For now, go find a JWT you have lying around and read what’s sitting in the payload. You might learn something about what your own app has been trusting. 👀</p><p>You can check out <strong>Part 2</strong> below:</p><p><a href="https://medium.com/@gokul_karthik/jwt-exploits-three-ways-trust-gets-misconfigured-3e0bda792437">JWT Exploits: Three Ways Trust Gets Misconfigured</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28c4fbb9e451" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/jwt-internals-whats-actually-inside-that-token-you-trust-28c4fbb9e451">JWT Internals: What’s Actually Inside That Token You Trust</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The OSCP Is a Mental Game]]></title>
            <link>https://infosecwriteups.com/the-oscp-is-a-mental-game-d6583fc6b20b?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6583fc6b20b</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[offensive-security]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Mon, 22 Jun 2026 05:41:11 GMT</pubDate>
            <atom:updated>2026-11-19T00:56:50.067Z</atom:updated>
            <content:encoded><![CDATA[<h4>Yes, Another OSCP Blog Post. Bear With Me.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4ZZgeHTg0-k4ewQ4xiPLg.png" /></figure><p>Well, I got my <strong>OSCP</strong> a couple of weeks back and it was quite an experience. The last 3 months of preparation paid off and the main challenge wasn’t even the technical stuff. It was the <strong>mental ability</strong> to keep trying and not give up.</p><p>I’ll touch on the <strong>prep approach and resources</strong>, but the main thing I want to talk about is your mental state during the 24 hours of the exam. There are literally an infinite number of blogs and walkthroughs out there covering how to prepare and which resources to use <em>(I looked at them and you will too)</em>, which is great, but I won’t bore you with more of the same.</p><p>Let’s get into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*dFCv7sEpNU2P4xKZ.gif" /></figure><h3>Background</h3><p>Before we get into it, a bit of context on where I’m coming from.</p><p>I’m currently a graduate student in Cybersecurity with around 2 years of professional experience in AppSec and DevSecOps. Offensive security isn’t my forte and my background is on the defensive side but I’ve kept my hands dirty through THM, and occasional CTFs, which gave me a reasonable foundation going in.</p><p>Before attempting the OSCP, I also completed the PNPT certification, which I’d recommend as a stepping stone. It gave me a structured way to think about penetration testing methodology before diving into something more complicated. You can read more about that experience <a href="https://medium.com/bugbountywriteup/how-i-passed-the-pnpt-on-my-second-attempt-2026-review-and-tips-dcdd829cd591"><strong>here</strong></a>.</p><h3>Preparation</h3><h4>A. PEN-200 and Proving Grounds Practice</h4><p>My prep spanned around 3 months, split between the PEN-200 course material and Proving Grounds Practice machines. And no, I didn’t complete everything.</p><p>For the machines, I followed the <strong>OSCP LainKusanagi list with ratings</strong> rather than bouncing between multiple lists and resources. This is something I’d recommend: pick one list, commit to it, and resist the urge to constantly second-guess whether the grass is greener elsewhere. <strong>Chasing the perfect resource list</strong> is its own rabbit hole, and one you want to avoid before the exam even starts.</p><p>Did I finish every machine on the list? <strong>No.</strong></p><p>Managing a 3-month OSCP subscription alongside graduate studies doesn’t leave a lot of breathing room, and I had to align myself with that. If you’re coming in with little prior experience, seriously consider the 1-year subscription and go at your own pace.</p><p><strong>A few things that worked for me on the machines:</strong></p><ul><li><strong>Try it yourself first.</strong> Always. If you’re stuck for a meaningful amount of time, look up the writeup for only that specific step, not the whole box. Then put the writeup down and continue on your own.</li><li><strong>Keep notes on what worked and what didn’t.</strong> Not just commands that worked, but your weak areas, gaps in understanding, and things worth revisiting. I kept a simple running list of areas to improve on, an example of mine is below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*9KYIo1rmXPS4nAV_XYpD6g.png" /><figcaption>“Areas to improve on” for some of the PG Machines</figcaption></figure><p>The goal isn’t to grind through every machine. It’s to understand <em>why</em> things work, so you’re not lost when the exam throws something slightly different at you.</p><h4>B. Active Directory</h4><p>Having completed the PNPT, I already had a grasp of the base knowledge needed for the Active Directory section, though PEN-200 does go a bit deeper in its coverage. Even so, I felt I needed to grind through a fair number of AD sets beforehand to get comfortable with the OffSec methodology and with time management.</p><p>First things first: get comfortable running <strong>netexec</strong>, <strong>BloodHound</strong>, and <strong>mimikatz</strong>. These are the core tools you’ll be leaning on throughout the AD portion.</p><p><strong>Here are the main resources I used:</strong></p><ul><li><strong>Hacker Blueprint’s Labs</strong>: <a href="https://hackerblueprint.com/labs">https://hackerblueprint.com/labs</a></li></ul><p>I went through the first 4 of these. They’re useful for getting familiar with the AD environment, though they don’t really cover the pivoting side of things that you’d expect in the exam. Still a solid resource. Feel free to pick up some of the later labs as well, since I’ve heard the pivoting is better covered in those.</p><ul><li><strong>Derron C’s AD Playlist</strong>: <a href="https://www.youtube.com/watch?v=gY_9Dncjw-s&amp;list=PLT08J44ErMmb9qaEeTYl5diQW6jWVHCR2">Playlist Link</a></li></ul><p>These sets are more closely aligned with the OSCP exam and do demonstrate pivoting as you’d see it on the day. Watch them and add the techniques to your notes as you go.</p><ul><li><strong>My GitBook (notes and cheatsheet)</strong>: <a href="https://gokulkarthik.gitbook.io/pentesting-checklist">https://gokulkarthik.gitbook.io/pentesting-checklist</a></li></ul><p>Everything I took down throughout my prep got consolidated here. You don’t need to use it, but it was all I needed to quickly pull up commands during the exam, especially for the Windows and AD side of things.</p><h4>C. Challenge Labs</h4><p>Save the challenge labs for the final stretch, ideally 1 to 2 weeks before your exam date. These are the closest thing you’ll get to the real experience, so treat them as dress rehearsals.</p><ul><li><strong>Secura</strong> — AD focused, and in my opinion a bit easier than what you’ll see in the exam. Still good practice for building confidence.</li><li><strong>Medtech</strong> — A larger network with more techniques than the OSCP actually expects, but it’s fun and great for sharpening your skills.</li><li><strong>Zeus and Poseidon</strong> — More difficult and complex than the expected exam difficulty. Only take these on if you have time to spare, otherwise consider them optional.</li><li><strong>OSCP A,B,C </strong>— The closest to the actual exam in terms of difficulty and structure. Do these as near to your exam date as possible, and time-bound yourself to mimic the real exam conditions. Treating them like the real thing is the best way to test your stamina and pacing before the day itself.</li></ul><h4>D. Pivoting</h4><p>For pivoting, I relied on <strong>ligolo-ng</strong>, which I’d strongly recommend. Beyond pivoting itself, it covers two other use cases that are just as important on the exam:</p><ul><li><strong>Transferring files</strong> from your attacker machine to a host inside the internal network.</li><li><strong>Catching a reverse shell</strong> back to your attacker machine from a host inside the internal network.</li></ul><p>Both of these, along with the full ligolo-ng setup, are documented in my <a href="https://gokulkarthik.gitbook.io/pentesting-checklist/pivoting/ligolo-ng">GitBook</a> if you need a reference.</p><p>That said, ligolo-ng isn’t the only option. Feel free to fall back on tools like <strong>proxychains</strong> or <strong>chisel</strong> if the situation calls for it, though I’d treat those as a last resort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*whY-GeCLp0o_Wcuo.gif" /></figure><h3>The Day of Reckoning</h3><p>The day had finally come, and I was about to learn what “Try Harder” really meant<strong> 😣</strong></p><h4>The Strong Start</h4><p>I started on time and went straight for the AD section, which I felt more confident in compared to the standalones. Got admin on the first machine within half an hour. Riding that momentum, I moved on to the second machine and… hit a wall.</p><p>I chased an entry point that turned into a full-blown rabbit hole after a ton of enumeration.</p><blockquote><strong>Lesson:</strong> If something doesn’t work, maybe it was meant to not work. Don’t force it. The actual path forward is often something else entirely.</blockquote><p>Almost 3 hours gone, no progress. So I took a break.</p><blockquote><strong>Lesson:</strong> Take breaks when you’re burnt out or stuck. Stepping away clears your head, and you almost always come back with fresh ideas.</blockquote><h4>Pivoting to the Standalones</h4><p>With AD giving me grief, I switched over to the standalones to change up the pace.</p><p>Over the next 2 to 3 hours, I got <strong>shell access</strong> on a couple of them, but no root yet. The third standalone became its own headache: I found the entry point but couldn’t exploit it. Hours disappeared trying to break in, and by now I was almost 8 hours into the exam.</p><p>The dread started creeping in. This was my only shot, and the investment I’d invested was sitting in the back of my mind too. So I took another break. When I came back, I realized the entry point was something embarrassingly simple. No complex attack required.</p><blockquote><strong>Lesson:</strong> The OSCP isn’t an obscure technical exam. It won’t throw unknown exploits or weird attack chains at you. If a path seems overly complicated, it’s probably a rabbit hole. The real way in is usually simpler than you think.</blockquote><p>From there, the privesc fell into place and I got root.</p><h4>The Crossroads</h4><p>By this point I still didn’t have enough points to pass, and my eyes were seriously starting to droop. I had two options:</p><ul><li>Complete the Active Directory set, <strong>or</strong></li><li>Get root on the two standalones I already had shell access on.</li></ul><p>I made an estimated call: I had a better chance of finishing the AD set than rooting those standalones. So I decided to sleep for 5 to 6 hours, wake up the next day, and dedicate my final 4 hours to AD.</p><p>(You can imagine how restful that sleep was. 🫠)</p><h4>The Breakthrough</h4><p>I woke up still groggy and got back on. I started fresh on the second AD machine and threw every vector I could think of at it. Finally, with about 3 hours left, something clicked. I was in.</p><p>From there, it took just 30 minutes to get admin on the second machine and compromise the DC. My heart was racing. That single vector was the entire exam’s “<strong>Try Harder</strong>” moment. If I’d given up on it, I’d have been done.</p><p>That’s the 50 to 80 point swing in half an hour, after being stuck for the better part of a day.</p><h4>Wrapping Up</h4><p>Exhausted but relieved, I made sure all my screenshots were in order and went straight to sleep. The next day I used the official OSCP report format, finished writing it up, and submitted. My result came back a couple of days later.</p><p>A pretty wild couple of days. 🙂</p><blockquote><strong>One last thing:</strong> Take screenshots of <em>everything</em>. You never know when you’ll need them. Keep rough notes as you go too, don’t leave documentation until the end when you’re exhausted and trying to reconstruct what you did hours ago.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*zyWnXktTLfy4Z3a8.gif" /></figure><h3>Tools &amp; Resources Used</h3><ol><li><a href="https://www.revshells.com/">revshells</a> — An online reverse shell generator for quickly creating reverse shell payloads in just about any language or format.</li><li><a href="https://github.com/Pennyw0rth/NetExec">netexec</a> — People say this can practically one-shot the AD section of the OSCP if you master it. An absolute must for AD enumeration.</li><li><a href="https://github.com/specterops/bloodhound">bloodhound</a> — You’ve got to walk the dog. Gives you a clear overview of all the users, groups, and attack paths in your AD environment.</li><li><a href="https://github.com/gentilkiwi/mimikatz">mimikatz </a>— One of the most common tools for post-compromise credential dumping and lateral movement.</li><li><a href="https://github.com/brightio/penelope">penelope</a> —Catches reverse shells and auto-upgrades them, so you don’t have to do the hard work manually.</li><li><a href="https://github.com/DominicBreuker/pspy">pspy</a> — Gives you an inside look at Linux processes running on a machine that might not be visible from the outside.</li><li><a href="https://github.com/peass-ng/PEASS-ng/tree/master/linPEAS">linpeas</a> — The classic Linux enumeration script for privilege escalation.</li><li><a href="https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS">winPEAS</a>— A solid Windows enumeration script for privilege escalation.</li><li><a href="https://github.com/PowerShellMafia/PowerSploit/tree/master/Privesc">powerup</a> — A PowerShell script that hunts for common Windows privilege escalation misconfigurations.</li><li><a href="https://docs.google.com/spreadsheets/d/13YoNQuY6HC5ot-lZiX2tY9pR5mvwnp3xV6lHs78DlqQ/edit?gid=878934599#gid=878934599">LainKusanagi List with Ratings</a> — A modified version of the original OSCP machine list, this one with difficulty ratings to help you prioritize.</li><li><a href="https://t3rminux.medium.com/conquering-the-oscp-a-guide-to-the-mental-marathon-a9ae235a523f">Friend’s OSCP Medium Post </a>— A friend’s OSCP medium post which helped me prepare for the OSCP.</li></ol><h3>Final Thoughts</h3><p>Looking back, the OSCP taught me less about hacking and more about <strong>persistence</strong>. The technical skills matter, of course, but plenty of people with the right skills still walk away without a pass. What gets you through those 24 hours is the <strong>willingness to keep going when you’re stuck</strong>, <strong>exhausted</strong>, and convinced the path forward doesn’t exist.</p><p>What worked for me might not map perfectly onto your situation. I went in with a defensive background, prior CTF experience, and the PNPT under my belt, and I still got humbled for the better part of a day.</p><p>A few things I’d leave you with:</p><ul><li><strong>The exam rewards patience, not panic.</strong> Almost every wall I hit had a simpler answer than I was giving it credit for.</li><li><strong>Take breaks.</strong> Genuinely. Some of my clearer ideas came after stepping away from the screen.</li><li><strong>One breakthrough can change everything.</strong> I sat at 50 points for the better part of a day. Thirty minutes was all it took to get to 80. Don’t give up before that moment arrives.</li></ul><p>If you want to learn more or just chat about the OSCP journey, feel free to reach out to me on <a href="https://www.linkedin.com/in/gokulkarthik2001/">LinkedIn</a>. I’m always happy to help where I can.</p><p>Good luck, and go earn it. 🙂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6583fc6b20b" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/the-oscp-is-a-mental-game-d6583fc6b20b">The OSCP Is a Mental Game</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Passed the PNPT on My Second Attempt (2026): Review and Tips]]></title>
            <link>https://meetcyber.net/how-i-passed-the-pnpt-on-my-second-attempt-2026-review-and-tips-dcdd829cd591?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcdd829cd591</guid>
            <category><![CDATA[pnpt]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[certification]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 15:21:43 GMT</pubDate>
            <atom:updated>2026-02-13T07:13:38.339Z</atom:updated>
            <content:encoded><![CDATA[<h4>A certification that delivered a more realistic experience than any CTF I’ve taken</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*8AUEhxlJKoqdZEdQ7FnkyA.png" /></figure><p>If you’re here, you’re probably wondering whether this certification is actually worth it. Maybe you’re comparing it to the OSCP, questioning who the PNPT is really for, or asking yourself, <em>“</em><strong><em>Can I actually do this ?</em></strong><em>”</em></p><p>In this post, I’ll try to answer most of those questions by sharing what worked for me, what didn’t, the resources I used, and practical tips including what to do when you might hit a wall.</p><h3>Why I Chose the PNPT (and What Sets It Apart) ?</h3><p>The main reason I chose the PNPT was how closely its style<strong> mirrors a real world penetration testing engagement</strong>.</p><ul><li>You had to perform <strong>OSINT and external recon</strong> to get information and gain access into the network <br>(<em>Limited or overlooked in many other certifications</em>).</li><li>You are expected to dig deeper and <strong>pivot to the internal network</strong> and expand your access.</li><li>You compromise the domain controller by performing <strong>AD attacks</strong>, <strong>privilege escalation</strong> and <strong>lateral movement</strong>.</li><li>You must write a <strong>Professional Penetration Testing Report</strong> and then present your findings during a <strong>live debrief with a member of the TCM team <br></strong>(<em>Limited or overlooked in many other certifications</em>).</li></ul><p>There are no flags to capture. You’re given <strong>five days </strong>to conduct the assessment and <strong>two additional days </strong>to complete the report, which felt fair and realistic.</p><p>There was no time pressure like in traditional CTFs, making the experience feel far closer to a real-world engagement than an exam! 🙂</p><h3>My Personal Experience</h3><p>One of the things I had initially decided was that I was going to approach the PNPT as a <strong>real world engagement</strong>, not a CTF.</p><p>Instead of rushing to exploitation, I took quite a bit of time during recon and OSINT. <strong>I enumerated each possible attack vector broadly</strong>, before committing to a specific attack path. You’ve probably heard it countless times before: <strong><em>enumerate, enumerate, and enumerate</em></strong>. As cliché as it sounds, it’s true 🫠.</p><p>I also had a checklist of commands to readily run to save quite a bit of time. I will be sharing this in <a href="#4d4c">tips and resources section</a>.</p><p>Since I had plenty of time with the five-day exam, I made sure to take breaks and get proper rest. This helped more times than I can count, allowing me to come back with a clearer mindset and new perspectives.</p><blockquote>When you are stuck and hit a wall, maybe a walk or a good night’s sleep can do wonders.</blockquote><p>I kept track of everything which worked and didn’t work in my notes so that it was easy to identify missed details whenever I didn’t have enough information to move forward. <strong>For example</strong>:</p><ul><li>Every time I found new credentials, I immediately ran netexec to spray those credentials on previously enumerated users. I also updated my notes right away.</li><li>If I uncovered information that revealed <strong>information but didn’t immediately present a clear exploit path</strong>, I kept it in the “TO REVIEW” section of my notes. These details become useful later especially when I was stuck and needed to re-evaluate the environment with fresh eyes. <strong>Eg</strong>: <br>- Users with <strong>interesting group memberships</strong> that didn’t appear powerful initially but had indirect access.<br>- Shares containing <strong>scripts </strong>or <strong>configurations </strong>with important information.</li></ul><p>After plenty of head-scratching and several failed escalation attempts, I finally became Domain Admin, and boy was it a relief 🫡</p><h3>The Report Writing &amp; Client Debrief Experience</h3><p>This section was where I struggled the most on <strong>my first attempt</strong>. I didn’t provide enough depth in the <strong>OSINT section</strong>, as I focused too heavily on the external and internal penetration testing findings. The lack of information in the OSINT section made the overall report incomplete and I was <strong>unable to pass</strong> the first time around.</p><p><strong>On my second attempt</strong>, I made sure to include detailed explanations of how each finding fit into the overall attack path, and <strong>remediation guidance</strong> for every required issue (including the OSINT section).</p><p>Report writing has always been a <strong>weak point for me </strong>(this was harder than the actual exam 🙂), and PNPT turned that into a valuable learning experience.</p><p>Once my report was accepted, I moved on to the client debrief section. The <strong>client debrief</strong> was a 15-minute call with a member of the TCM Security team. During the debrief, I was expected to clearly explain the attack flow, technical findings, and recommended remediations. I practiced the debrief <strong>four to five times beforehand</strong> to stay within the time limit.</p><blockquote>While 15 minutes might sound like a lot, it goes by very quickly so being prepared will definitely help.</blockquote><p>These were the 2 sections where I learned a lot from this certification!</p><h3>Tips and Resources I Used</h3><h4><strong>1. What you actually need to study</strong></h4><ul><li>Practical Ethical Hacking<strong> (PEH)</strong></li><li>External Pentest Playbook</li><li>OSINT Fundamentals</li></ul><p>You <strong>don’t need</strong> any Linux or Windows Privilege Escalation courses. <strong>Everything you need</strong> are in the above courses.</p><p>If you’re looking for a note-style summary of the courses, a kind person has already put one together here: <a href="https://pnpt.adot8.com/">https://pnpt.adot8.com</a></p><h4>2. Have a Methodology / Checklist</h4><p>In the PEH course, listen to how Heath approaches each stage of the Penetration test (<strong>Eg:</strong> Initial attack vectors, Post compromise enumeration) and try incorporating that into your methodology (<strong>Eg:</strong> gather credentials, spray them, and iterate until progress is made).</p><p><strong>PNPT Prioritizes Methodology Over AD Complexity</strong>. So you don’t need to know any specific complex AD exploits other than the ones already taught in the course. If you’ve stuck and exhausted all options, <strong>revisiting and rewatching the AD section of the PEH course</strong> and following Heath’s process/methodology in each of those videos can often help in moving forward.</p><p>Having a go-to checklist of commands for different phases of a penetration test can be extremely valuable. I put one together for my own use and included the link below(can be used for different certifications as well). I’d love to hear your thoughts on it 🙂</p><p><strong>Windows Checklist</strong> — <a href="https://gokulkarthik.gitbook.io/pentesting-checklist/">https://gokulkarthik.gitbook.io/pentesting-checklist/</a></p><p>Additionally, Heath mentions a External Pentest checklist which can be used to map breached credentials, findings, scope etc. I used it in my exam and it was very helpful. I have linked it below:</p><p><strong>External Pentest Checklist</strong> — <a href="https://github.com/hmaverickadams/External-Pentest-Checklist/tree/main">External Pentest Checklist Link</a></p><h4>3. Take understandable notes</h4><p>Keep track of <strong>everything you do</strong> — what works and what doesn’t. Document any new findings as you go, whether that’s newly discovered credentials, potential attack paths, or interesting behaviors in the environment.</p><p>If something doesn’t work immediately, don’t discard it. Keep it <strong>under review</strong> and revisit it later, especially when you gain more context or privileges.</p><p>Your notes don’t need to be perfectly clean. They just need to <strong>make sense to you</strong>. Clarity is more important than formatting. I personally used basic Markdown, but tools like <strong>Notion, Joplin</strong>, or any note-taking system you’re comfortable with work just as well.</p><h4>4. Get to know your tools before the exam</h4><p>Make sure you understand <strong>what the tools are actually doing </strong>and<strong> </strong>not just how to run them. This is something Heath emphasizes throughout the course. Take the time to learn the <strong>important flags and options</strong>, and don’t ignore errors when they appear. Read the output carefully and try to understand why an error is happening.</p><p>Increasing the <strong>verbosity level</strong> can often reveal what’s going on under the hood. It’s also worth reviewing the <strong>default configurations</strong> of the tools so you know what assumptions they’re making on your behalf. <br><strong>For example</strong>: By default, netexec’s SMB module checks for domain accounts, not local accounts. To test local authentication, you need to explicitly use the -local-auth flag.</p><h4>5. Pivoting</h4><p>Pivoting is essential for moving between networks during the exam. While the PEH course covers this concept to an extent, I’d recommend working through the following TryHackMe room to become more comfortable operating in that type of environment.</p><p><strong>THM Room</strong> — <a href="https://tryhackme.com/room/wreath">https://tryhackme.com/room/wreath</a></p><h4>6. Take screenshots and be ready with a report template</h4><p>Take a screenshot of EVERYTHING (OSINT to Domain compromise). You never know what you might need in your report. You can use the same report template which TCM provides. I have linked it below.</p><p><strong>Report Template </strong>— <a href="https://github.com/hmaverickadams/TCM-Security-Sample-Pentest-Report/blob/master/TCMS%20-%20Demo%20Corp%20-%20Findings%20Report%20-%20Example%202.docx">Report Template Link</a></p><h4>7. Take breaks when needed</h4><p>Remember that the exam is 5 days. Take breaks when you need them and especially take them when you are stuck. <br>Go out with your friends. Relax and detach yourself from the exam. Trust me on this🙂</p><h3>Final Thoughts</h3><p>If you’re someone who:</p><ul><li><strong>Wants to pursue the OSCP</strong> but is looking for a solid build-up beforehand (like I was), PNPT is for you.</li><li>Is seeking a realistic <strong>beginner-to-intermediate</strong> Active Directory certification, PNPT is for you.</li><li>Wants something more than just <strong>labs and CTFs</strong>, PNPT is for you.</li></ul><p>Thank you for reading and scrolling this far down :)<br>If you have any questions regarding the PNPT or any of the tips/resources, drop a comment and I would be happy to help!</p><p>You can also connect with me on <strong>LinkedIn</strong> if you have any questions: <a href="https://www.linkedin.com/in/gokulkarthik2001/">https://www.linkedin.com/in/gokulkarthik2001/</a></p><p>Good luck on your PNPT journey 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcdd829cd591" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/how-i-passed-the-pnpt-on-my-second-attempt-2026-review-and-tips-dcdd829cd591">How I Passed the PNPT on My Second Attempt (2026): Review and Tips</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bypass the Microsoft Sign-In on Your New Laptop]]></title>
            <link>https://infosecwriteups.com/bypass-the-microsoft-sign-in-on-your-new-laptop-03c3afe74b8d?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/03c3afe74b8d</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[bypass]]></category>
            <category><![CDATA[windows-11]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 22:30:42 GMT</pubDate>
            <atom:updated>2025-09-18T07:24:48.806Z</atom:updated>
            <content:encoded><![CDATA[<h4>10 Workarounds Later, I Just Wanted a Local Account</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oU9POcxHxdgdan6tJL7WQg.jpeg" /><figcaption>Microsoft Account Sign In Page</figcaption></figure><p><em>You just bought a new laptop with Windows 11 and you are all ready to set it up and then you see Windows pestering you to sign in to your Microsoft email account. For many users this isn’t an issue, but if you’re like me and prefer not to sign in</em>, <em>whether for privacy, avoiding OneDrive, or simply personal choice, this guide is for you 🙂.</em></p><p>There have been a lot of bypasses and Microsoft seems to have patched a lot of the workarounds. This also includes the older <strong>BypassNRO</strong> option that previously allowed users to skip signing in to their Microsoft account.</p><p>This new method allows you to create a local account during setup without needing to connect to any Microsoft services ✌.</p><h3>Steps</h3><ol><li>When you are in the Microsoft account sign in screen, press <strong>Shift + F10 ( Fn + Shift + F10 ) </strong>on your keyboard. This should open up your command line on top of your setup.</li><li>In the Command Prompt, type the below command and press Enter. <strong>Command</strong> --&gt; start ms-cxh:localonly</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NLCM4w-j4KZBZZQO_DRLSQ.png" /><figcaption>Command Prompt</figcaption></figure><p>This will open up a window where you can create a new local user for your windows install.</p><p>3. In the <strong>Create a user for this PC</strong> screen that appeared, type the username you want for your local account. Add a password if you wish to or leave the field blank for no password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1NuxEVStUll2zn8JHu7NA.png" /><figcaption>Create a Local Account Page</figcaption></figure><p>4. Click <strong>Next</strong> and complete your install :)</p><p>And you have successfully set up a local account on your fresh Windows 11 install without signing in to Microsoft !</p><p>Now, you won’t have to worry about using OneDrive on your account and also keep a bit of your privacy to yourself. It’s possible that Microsoft may patch this bypass in the future, so take advantage of it while it’s still available 😊( Works currently in 2025 ) .</p><h3>Conclusion</h3><p>That’s a wrap on how to bypass Microsoft’s sign in page during a fresh Windows 11 install. I hope you found it helpful.</p><p>Let me know if you have any questions or any suggestions :)</p><p>Feel free to check out my <a href="https://medium.com/bugbountywriteup/htb-dog-walkthrough-2d840513f463"><strong>HTB walkthroughs</strong></a>, or explore some <a href="https://medium.com/bugbountywriteup/understanding-csrf-and-how-to-prevent-it-in-your-application-part-1-9178bbc828d7"><strong>Web Application Security</strong></a> if that’s more your interest.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03c3afe74b8d" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/bypass-the-microsoft-sign-in-on-your-new-laptop-03c3afe74b8d">Bypass the Microsoft Sign-In on Your New Laptop</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding CSRF and How to Prevent It in Your Application — Part 2]]></title>
            <link>https://infosecwriteups.com/understanding-csrf-and-how-to-prevent-it-in-your-application-part-2-4cfd2940e236?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cfd2940e236</guid>
            <category><![CDATA[csrf]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Sat, 16 Aug 2025 17:39:52 GMT</pubDate>
            <atom:updated>2025-09-09T06:52:17.640Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding CSRF and How to Prevent It in Your Application — Part 2</h3><p><em>This is the 2nd part in a two-part series on CSRF. If you haven’t read </em><a href="https://medium.com/bugbountywriteup/understanding-csrf-and-how-to-prevent-it-in-your-application-part-1-9178bbc828d7">Part 1</a> <em>of this series, I recommend checking that out first as this part discusses the ways in which we can prevent CSRF attacks!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l7JUSPXLR288gAhzFPy_yQ.png" /><figcaption>ChatGPT Generated Image</figcaption></figure><p>In this article, we will be looking into some major mitigation strategies that we can use to prevent CSRF attacks. We will also be doing a live demo for each of the mitigations to get a practical understanding.</p><h4>The Crux: Why does CSRF Occur</h4><p>CSRF arises from the combination of <strong>two core issues</strong>:</p><ol><li><strong>Browsers automatically attach credentials</strong> to every request (same-site <em>and</em> cross-site).</li><li><strong>Servers can’t distinguish</strong> whether a request was initiated by a trusted origin (unless additional checks is done).</li></ol><h4>Do We Need to Fix <em>Both Core Issues </em>to Prevent CSRF?</h4><p><strong>No, fixing either one can be sufficient to stop CSRF</strong>, but each comes with trade-offs. In most applications, properly addressing either one of the issues is sufficient for CSRF protection, but combining both is best practice, especially for sensitive apps like banks.</p><p>Lets deep dive into the major type of <strong>Mitigations</strong> below.</p><h3>1. SameSite Cookie Attribute</h3><p><strong>SameSite</strong> is a cookie attribute (similar to HTTPOnly, Secure etc.) which aims to mitigate CSRF attacks and is a <strong><em>browser defence</em></strong>. This attribute helps <strong><em>the browser</em></strong> decide whether to send cookies along with cross-site requests. The possible values for this attribute are Lax, Strict, or None.</p><p>✅<em>Mitigates</em> <em>Core Issue 1 (Browsers automatically attach credentials)<br></em>❌<em>Does not help with Core Issue 2</em>, <em>because it works at the browser level, not the server level.</em></p><h4>1.1 How does this cookie work with each of its values ?</h4><ol><li><strong>SameSite=Strict</strong></li></ol><ul><li>Cookies which have the Strict value set are sent <strong>only</strong> <strong>for same site requests</strong>. Cross site requests will be blocked 🙂</li><li>This is <strong>very secure</strong>, but it can break user experience. <br><strong>Eg</strong>: When the user clicks on a link from their email (an external origin), the browser <strong>won’t send the session cookie </strong>which would force the user to login again which does not make it very user friendly.</li></ul><p>2. <strong>SameSite=Lax</strong> <em>(Default in most modern browsers)</em></p><ul><li>Cookies are sent for <strong>same-site requests</strong> <em>and</em> <strong>cross site requests</strong> which use safe HTTP methods(GET, HEAD, OPTIONS, and TRACE) AND have <strong>top-level navigations.</strong></li><li>A <strong>top-level navigation</strong> is when the <strong>URL in the browser’s address bar changes. </strong>This can happen by clicking a link, submitting a form OR being redirected. This behavior helps block CSRF attacks that rely on <strong>POSTing from malicious sites(state changing attacks)</strong>, while still allowing normal links (like from emails) to work properly as they are <strong>GET</strong> requests 🥳.</li></ul><p>3. <strong>SameSite=None</strong></p><ul><li>Cookies are sent <strong>on all cross-site requests</strong>, but must be marked as Secure (i.e., sent only over a HTTPS connection). <br>Clearly not what we want for preventing CSRF 😶.</li></ul><h4>1.2 SameSite Mitigation Live Demo</h4><p><strong><em>Goal</em></strong><em>: We’ll set the session cookie with the </em><em>SameSite=Lax attribute to ensure that the attacker&#39;s phishing page cannot send a cross-site POST request to the transfer API.</em></p><p>In the index.js file of the app, the session middleware is updated to the below content.</p><pre>app.use(<br>  session({<br>    secret: &#39;csrf-demo-secret&#39;,<br>    resave: false,<br>    saveUninitialized: false,<br>    cookie: { <br>        httpOnly: true,<br>        sameSite: &#39;lax&#39;<br>        /* <br>        Setting SameSite attribute to LAX so the session cookie is<br>        not sent in a POST cross site request (Transfer API request) <br>        */ <br>    },<br>  })<br>);</pre><p>Lets clone our demo bank application <a href="https://github.com/goku007xx/csrf-demo-playground">https://github.com/goku007xx/csrf-demo-playground</a> and run it with the steps given on the <strong>README.</strong></p><p>We have our bank’s login page at http://samesite-bank.com. The victim will be the user alice who has <strong>1000$</strong> in her bank account. Lets simulate the victim authenticating to the bank with the username and password as alice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*5OgxoGudlBpvokUrkLFwow.png" /><figcaption>SameSite Bank’s Login Page</figcaption></figure><p>Now let’s simulate the <strong>phishing page</strong> that the attacker has sent to Alice at the link http://CatsThatHack.com/index-samesite.html. Alice clicks the Transfer Money button. This time, the attack fails — instead of triggering the transfer, Alice is simply redirected to the bank’s login page, as her session cookie was not sent with the cross-site request .</p><p>We can also see the transfer funds POST request in the network tab. We can see that the session cookie is not sent in the attacker’s request which means our mitigation has worked 🥳.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bqlm9yHRGQ5JCGYvIIXgtw.png" /><figcaption>Attacker’s SameSite Phishing Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxqekrHAz5wuWeIwYvW3NA.png" /><figcaption>SameSite Mitigation with the network tab</figcaption></figure><h3>2. CSRF Token — Synchronizer Token Pattern</h3><p><strong>CSRF Token — Synchronizer Token Pattern</strong> is a <strong>server-side mitigation</strong> which works by generating a unique, unpredictable token on the server once per session and embedding it in each form or page. When the user submits a form, the server verifies that the submitted token matches the one stored in the user’s session. Since an attacker’s site can’t access or guess this token, forged malicious requests will be rejected.</p><p>❌<em>Does not help with Core Issue 1 (Browsers automatically attach credentials)<br></em>✅<em>Mitigates Core Issue 2</em>, <em>because it gives the server a way to find out if the request is coming from a legitimate user or an attacker.</em></p><h4>2.1 Why can’t the attacker forge the CSRF token ?</h4><ul><li>Even if an attacker tricks the victim into visiting a <strong>malicious page</strong>, they can’t use JavaScript (e.g., fetch or XMLHttpRequest) to read the contents of the target page (like the bank’s form containing the CSRF token).</li></ul><blockquote>The <strong>Same-Origin Policy (SOP)</strong> ensures that JavaScript can’t access responses from other domains so the token cannot be accessed.</blockquote><ul><li>An attacker might try to fetch the login page using tools like curl, axios, or requests to scrape the CSRF token but that token would belong to <strong>their own session</strong>, not the victim’s.</li></ul><blockquote>Each CSRF token is unique to a specific session (and user), the attacker’s token is useless in the victim’s context.</blockquote><p>Here’s the mitigation workflow we’ll be implementing for our demo bank application. Take a quick look before we dive into the demo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nRw5l8qTxQTWFLGIcHFy7g.png" /><figcaption>Synchronizer Token Mitigation Workflow</figcaption></figure><h4>2.2 Synchronizer CSRF Token Mitigation Live Demo</h4><p><strong><em>Goal</em></strong><em>: We’ll generate a CSRF token and associate it with Alice’s session. This token will also be embedded within the transfer form. When a transfer is initiated, the server will compare the token from the form with the one stored in the session to validate the request and block any potential CSRF attacks.</em></p><p>In the index.js of the bank app, we add a generateCSRFToken function and we also map the the token to the user’s session during the login.</p><pre>// CSRF token generation function<br>function generateCSRFToken() {<br>    return crypto.randomBytes(32).toString(&#39;hex&#39;);<br>}<br><br>// POST /login<br>app.post(&#39;/login&#39;, (req, res) =&gt; {<br>    const { username, password } = req.body;<br>    /*<br>    IRRELEVANT CODE...<br>    */ <br>    req.session.csrfToken = generateCSRFToken();<br>    return res.redirect(&#39;/transfer&#39;);<br>});</pre><p>Next, we need to embed the CSRF token into the transfer form when the page loads. Then, when a transfer is submitted (via a POST request), we’ll validate the request by comparing the token from the form with the one stored in the user’s session. If the validation fails, return a <strong>csrf validation failed</strong> HTML page.</p><pre>// GET /transfer<br>app.get(&#39;/transfer&#39;, requireLogin, (req, res) =&gt; {<br>    const csrfToken = req.session.csrfToken<br>    const transferPath = path.join(__dirname, &#39;views&#39;, &#39;transfer.html&#39;);<br>    <br>    // Inject CSRF token into the transfer form when it is loaded.<br>    fs.readFile(transferPath, &#39;utf8&#39;, (err, data) =&gt; {<br>        const modifiedHtml = data.replace(<br>            &#39;&lt;form method=&quot;POST&quot; action=&quot;/transfer&quot;&gt;&#39;,<br>            `&lt;form method=&quot;POST&quot; action=&quot;/transfer&quot;&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;csrfToken&quot; value=&quot;${csrfToken}&quot;&gt;`<br>        );<br>        res.send(modifiedHtml);<br>    });<br>});<br><br>app.post(&#39;/transfer&#39;, requireLogin, (req, res) =&gt; {<br>    const { amount, to, coupon, csrfToken } = req.body;<br>    <br>    // Validate CSRF token when a transfer is done<br>    if (!csrfToken || csrfToken !== req.session.csrfToken) {<br>        return res.status(403).sendFile(path.join(__dirname, &#39;views&#39;, &#39;csrf-failed.html&#39;));<br>    }<br>    /*<br>    IRRELEVANT CODE...<br>    */ <br>});</pre><p>We have our bank’s login page at http://synchronizer-bank.com/login. Lets login with the user alice again to simulate a victim user logging in. Once done, lets go the <strong>phishing page</strong> that the attacker has sent to Alice at the link http://catsthathack.com/index-synchronizer.html.</p><p>Clicking the transfer money button does not trigger the money transfer and instead takes us to the CSRF validation page which blocks the attack 🥳. This happens because the attacker’s phishing page doesn’t have access to Alice’s CSRF token, so it isn’t included in the request. As a result, the transfer API call fails, which you can also confirm in the network tab, where the csrfToken field appears empty. Mitigation Successful :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1746RFCHtxU0fS_lMM6SFg.png" /><figcaption>Attacker’s Synchronizer Token Phishing Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NWrEoHCzgCPAmqgQ0h5h8Q.jpeg" /><figcaption>Synchronizer Token Mitigation and Network Tab</figcaption></figure><h3>3. CSRF Token — Double Submit Pattern</h3><p>Alright! We’ll be using the CSRF token again but in a slightly different way for the 3rd major mitigation🙂.</p><p><strong>CSRF Token — Double Submit Pattern</strong> is a server-side mitigation that works by generating a CSRF token on the server and sending it to the client (usually via a cookie). The same token is also embedded in each form or request as a hidden field or header. When the user submits a request, the server compares the token from the cookie with the one submitted in the form. It does seem a bit similar to the Synchronizer Pattern right ? 🤔</p><p>Unlike the Synchronizer Token Pattern, this method does <strong>not require server-side storage of the token</strong>, since validation is done by comparing two values sent by the client(the form’s token and the cookie’s token).</p><p>❌<em>Does not help with Core Issue 1 (Browsers automatically attach credentials)<br></em>✅<em>Mitigates Core Issue 2</em>, <em>because it gives the server a way to find out if the request is coming from a legitimate user or an attacker.</em></p><p>Here’s the mitigation workflow we’ll be implementing for our demo bank application. Take a quick look before we dive into the demo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*MaItlSabORQ5mH3wMT0gEw.jpeg" /><figcaption>Double Submit Token Mitigation Workflow</figcaption></figure><h4>3.1 Double Submit Token Mitigation Live Demo</h4><p><strong><em>Goal:</em></strong><em> We’ll generate a CSRF token on the server and send it to Alice’s browser via a cookie. This same token will also be embedded within the transfer form as a hidden field. When a transfer is initiated, the server will compare the token from the form with the one in the cookie to validate the request and prevent any potential CSRF attacks. This is done without storing the token on the server.</em></p><p>Alright so during our login, we generate our secure CSRF token and then set its value to the csrfToken cookie. The cookie must be httpOnly: false as our transfer page has to access the cookie’s contents from the JS. Once that’s in place, the <strong>Transfer API</strong> can compare the CSRF token from the request (hidden form field) with the one in the cookie. If they are not equal, then return a <strong>csrf validation failed</strong> HTML page. The index.js file’s snippets are given below.</p><pre>// CSRF token generation function<br>function generateCSRFToken() {<br>    return crypto.randomBytes(32).toString(&#39;hex&#39;);<br>}<br><br>// POST /login<br>app.post(&#39;/login&#39;, (req, res) =&gt; { <br>    /* ... */<br>    req.session.username = username;<br>    const csrfToken = generateCSRFToken();<br>    res.cookie(&#39;csrfToken&#39;, csrfToken , {<br>        httpOnly: false,      // Must be readable by client-side JavaScript<br>        secure: false         // Set to false due to HTTP<br>    });<br>    return res.redirect(&#39;/transfer&#39;);<br>});<br><br>// POST /transfer<br>app.post(&#39;/transfer&#39;, requireLogin, (req, res) =&gt; {<br>    const cookie = req.cookies.csrfToken;<br>    const tokenFromForm = req.body.csrfToken;<br><br>    // If the cookie or token from form is missing, send the CSRF failed page<br>    if (!cookie || !tokenFromForm) {<br>        return res.status(403).sendFile(path.join(__dirname, &#39;views&#39;, &#39;csrf-failed.html&#39;));<br>    }<br><br>    // If the cookie and token from form do not match, send the CSRF failed page<br>    if (cookie !== tokenFromForm) {<br>        return res.status(403).sendFile(path.join(__dirname, &#39;views&#39;, &#39;csrf-failed.html&#39;));<br>    }<br><br>    let amt = parseInt(amount, 10);<br>    /* ... */<br>});</pre><p>Also, we will have to make some modifications in <strong>transfer.html</strong> so that it can get the csrfToken from the cookie to the form’s hidden field. The getCookie function takes care of that 🙂.</p><pre>&lt;form method=&quot;POST&quot; action=&quot;/transfer&quot;&gt;<br>  &lt;label for=&quot;to&quot;&gt;Recipient Username&lt;/label&gt;<br><br>  &lt;!-- ....... --&gt;<br>  <br>  &lt;!-- This csrfToken field will be populated by the function below --&gt;<br>  &lt;input type=&quot;hidden&quot; name=&quot;csrfToken&quot; id=&quot;csrfToken&quot; value=&quot;&quot;&gt;<br><br>  &lt;button type=&quot;submit&quot;&gt;Send&lt;/button&gt;<br>&lt;/form&gt;<br><br>&lt;script&gt;<br>  // Get CSRF token from cookie and set it above.<br>  function getCookie(name) {<br>      const value = `; ${document.cookie}`;<br>      const parts = value.split(`; ${name}=`);<br>      if (parts.length === 2) {<br>          return parts.pop();<br>      }<br>  }<br>  document.getElementById(&#39;csrfToken&#39;).value = getCookie(&#39;csrfToken&#39;) || &#39;&#39;;<br>&lt;/script&gt;</pre><p>We have our bank’s login page at http://double-submit-bank.com/login. Lets login and then go the <strong>phishing page</strong> that the attacker has sent to Alice at the link http://catsthathack.com/index-doublesubmit.html .</p><p>Clicking the transfer money button does not trigger the money transfer and instead takes us to the CSRF validation page which blocks the attack 🥳.</p><p><em>It does seem similar to the last mitigation, but what’s different ?</em> 🤔</p><p>We see that both cookies(the session cookie and csrfToken cookie) are sent in the request because of the browser’s default behavior of sending cookies. But, the request fails because the hidden field in the form is empty because catsthathack.com could not use JS to get double-submit-bank.com ‘s cookie (Same Origin Policy).</p><p>Mitigation Successful :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XDx8nlDTUfROJTfxMoCuAg.jpeg" /></figure><h3>Conclusion</h3><p>And that’s a wrap! We covered three solid CSRF defenses each with its own strengths and weaknesses.</p><p>Of course, these aren’t the only ways to prevent CSRF. You can also use techniques like <strong>custom headers with CORS </strong>or rely on<strong> frameworks that have CSRF protection built-in</strong>. But hopefully this post helped you on the fundamentals of how to protect your application from CSRF attacks 🙂.</p><p>👉 <strong>Want to try these yourself?</strong> Check out this <a href="https://github.com/goku007xx/CSRF-Security-Lab">Github repository</a> to explore and play around with these CSRF mitigation scenarios hands-on.</p><p>Also check out <strong>Part 1</strong> of this article if you haven&#39;t already!</p><p><a href="https://infosecwriteups.com/understanding-csrf-and-how-to-prevent-it-in-your-application-part-1-9178bbc828d7">Understanding CSRF and How to Prevent It in Your Application — Part 1</a></p><h3>References</h3><ol><li><a href="https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html">https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html</a></li><li><strong>Workflow Image Idea</strong> — <a href="https://dev-academy.com/csurf-vulnerability/dsc.png">https://dev-academy.com/csurf-vulnerability/dsc.png</a></li><li><strong>Github Project </strong>— <a href="https://github.com/goku007xx/CSRF-Security-Lab">Github Link</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cfd2940e236" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/understanding-csrf-and-how-to-prevent-it-in-your-application-part-2-4cfd2940e236">Understanding CSRF and How to Prevent It in Your Application — Part 2</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding CSRF and How to Prevent It in Your Application — Part 1]]></title>
            <link>https://infosecwriteups.com/understanding-csrf-and-how-to-prevent-it-in-your-application-part-1-9178bbc828d7?source=rss-c6927af32ea1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9178bbc828d7</guid>
            <category><![CDATA[csrf]]></category>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Gokul Karthik]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 15:17:14 GMT</pubDate>
            <atom:updated>2025-08-19T14:32:40.294Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding CSRF and How to Mitigate It in Your Application — Part 1</h3><h4>No clicks. No alerts. Just your session doing the dirty work.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4J9577QWaBgWaLoUbcThw.png" /><figcaption>ChatGPT Generated Image</figcaption></figure><h4>Imagine This:</h4><p>You’re logged into your bank in one browser tab. Meanwhile, you’re casually browsing cat memes on a very suspicious website called <strong>CatsThatHack.com </strong>.</p><p>Suddenly, without clicking anything, a request is secretly sent from <strong>CatsThatHack.com </strong>to the bank that tells the bank to:<br><strong><em>“</em></strong><em>Transfer $1000 to Hacker”</em></p><p>Since you’re already logged in<em> </em>on<em> </em>your browser, <strong>your bank </strong>says:<br><em>“Oh, it’s you! Sure, transferring now!”</em></p><p>You never approved it. You never clicked anything. <br>But the hacker piggybacked on your bank’s login session to authorize a transaction on your behalf 😶.</p><p>In <strong>Part 1</strong> of this series, we’ll explore how <strong>CSRF(Cross site request forgery) </strong>works and the techniques attackers use to exploit it without the user’s knowledge.</p><h3>The Origin of CSRF Explained</h3><p><strong>Cross-Site Request Forgery (CSRF)</strong> is a type of attack that tricks a user’s browser into performing unwanted actions on a web application in which the user is already authenticated to.</p><p>But what is the core flaw that introduces the vulnerability ? 🤔<br>The 2 points below should answer this question:</p><h4>- Web Browsers Automatically Attach Credentials</h4><p>Lets talk a bit about the normal operation of a web browser. When you’re logged into a site, your browser stores a <strong>session cookie</strong> so you stay authenticated across multiple requests/tabs. Anytime your browser makes a request to that site from the same domain or a different domain, it automatically includes that cookie.</p><p>If browsers didn’t work like this, the user would need to start a new session every time they opened the same site in a new tab in their browser. That would be clearly a terrible user experience!</p><p>🤷‍♂️<strong>️Browsers don’t differentiate between same-site and cross-site requests and send credentials(cookies) for both of the requests.</strong></p><h4>- Servers Couldn’t Tell Where Requests Came From</h4><p>Historically, <strong>servers didn’t verify</strong> the source of incoming requests. If a request arrived with a valid session cookie, the server simply trusted it:<br><em>“Hey, this cookie checks out. This must be the real user.”</em></p><p>But that assumption allowed a issue to creep in .</p><p>A malicious site like CatsThatHack.com could trick the browser into sending a request to another site like bank.com. And the browser, doing what it’s supposed to, would <strong>attach the user’s </strong>bank.com<strong> session cookie</strong> — because the user was already logged in. Also from the web server’s point of view, it looks like:</p><ul><li>A valid request from a logged in user.</li><li>With valid credentials(Session Cookie)</li></ul><p>🤷‍♂️<strong>️Servers didn&#39;t know the difference between same-site and cross-site requests unless extra precautions were taken.</strong></p><h3>How does a CSRF attack work ?</h3><p>Here’s how it typically works:</p><ol><li>An attacker uses social engineering to send a message or link to lure the victim into clicking a crafted URL or visiting a malicious web page.</li><li>That page silently sends a forged request (like transferring money or changing settings) to a trusted site(Eg: bank).</li><li>Since the user is already authenticated on that site, the browser automatically includes session cookies, making the request look legitimate. The victim never realizes that the request was made.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McEPKAMYyX20paBiqaSB0w.jpeg" /></figure><h3>Working Demo</h3><p>Alright enough of the theory and diagrams, lets see this in action!</p><p>I have created a simple and generic bank app to demonstrate the attack. Yep, my creativity definitely failed me here 🫠.</p><h4>i. The Vulnerable Bank App</h4><p>To start with, lets clone our demo bank application from <a href="https://github.com/goku007xx/CSRF-Security-Lab"><strong>here</strong></a> and run it. Detailed steps on how to run it is given in the <strong>README</strong> if you would like to follow along.</p><p>We have our vulnerable bank’s login page at http://insecure-bank.com/login. The victim will be the user alice who has <strong>1000$</strong> in her bank account. Lets simulate the victim authenticating to the bank with the username and password as alice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*Z5SojcgJFodX4iBkV1GJ4w.png" /></figure><p>We have a simple form for transferring funds to other user accounts. Our goal will be to try to maliciously transfer this <strong>1000$</strong> amount to the attacker user using the CSRF attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*0pijD0DKLfWKkFOWbSgA0A.png" /></figure><h4>ii. The Attacker’s Phishing Page</h4><p>Now let’s simulate the <strong>phishing page</strong> which the attacker has sent to Alice at the link http://CatsThatHack.com/index-insecure.html. Well, Alice really seems to like cat pictures and she just had the sudden urge to click the Transfer Money button because the cats were urging her to (Of course, real phishing pages would not be like this 🙂).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkskECwviDYxnd-2aYa3Xg.png" /></figure><p>And boom, clicking on the button redirected alice to the bank with her balance of <strong>0$</strong> and saying that the transfer was successful 🫣.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*q0z3OWKjuOEZpcH164DlfA.png" /></figure><p>And just like that — with a single click, Alice’s money disappears. In fact, it doesn’t even have to be a button click , the form can be auto-submitted by the browser without any user interaction at all !!🫠.</p><h4>iii. Understanding how and why the attack worked</h4><p>Firstly, let’s look at the how the <strong>Bank App</strong> works.</p><pre>app.use(<br>  session({<br>    secret: &#39;csrf-demo-secret&#39;,<br>    resave: false,<br>    saveUninitialized: false, <br>    cookie: { httpOnly: true }, // &quot;SameSite&quot; attribute not set explicitly<br>  })<br>);<br><br>// Helper: Check if the user is logged in<br>const requireLogin = (req, res, next) =&gt; {<br>    if (!req.session.username || !users[req.session.username]) {<br>        return res.redirect(&#39;/login?mustlogin=1&#39;);<br>    }<br>    next();<br>};<br><br>// You can only transfer if the user is logged in first<br>app.post(&#39;/transfer&#39;, requireLogin, (req, res) =&gt; {<br>    const sender = req.session.username;<br>    const { to, amount, coupon } = req.body;<br>    let amt = parseInt(amount, 10); <br>    /*<br>    IRRELEVANT CODE...<br>    */<br>    users[sender].balance -= amt;<br>    users[to].balance += amt;<br>    res.redirect(redirectUrl);<br>});</pre><p>Some important points shown in the above code:</p><ul><li>The session cookie is set with the HttpOnly flag enabled. However, it does <strong>not</strong> explicitly set the SameSite attribute, so it defaults to Lax. You can learn more about what this attribute does in <a href="https://medium.com/@gokul_karthik/understanding-csrf-and-how-to-prevent-it-in-your-application-part-2-4cfd2940e236"><strong>Part 2</strong></a> of this series.</li><li>After a successful login, this session cookie(connect.sid) is issued to the user. The <strong>transfer API</strong> relies on the presence of a valid session cookie to proceed.</li><li>The <strong>transfer API </strong>POST request<strong> </strong>accepts the <strong>transfer amount</strong> and the <strong>receiver’s username</strong> in the request body, then updates the account balances of both the sender and receiver accordingly.</li></ul><p>Cool, now lets see how the attacker exploited this in his phishing page http://CatsThatHack.com/index-insecure.html. The attacker’s page code snippet is given below.</p><pre>&lt;!-- Sends a POST request with top level navigation. Since the cookie is <br>set as LAX implicitly by the browswer, the POST request is allowed to <br>be sent for the first 2 minutes  --&gt;<br>&lt;form id=&quot;csrfForm&quot; method=&quot;POST&quot; action=&quot;http://insecure-bank.com/transfer&quot;&gt;<br>    &lt;input type=&quot;hidden&quot; id=&quot;to&quot; name=&quot;to&quot; value=&quot;attacker&quot;&gt;<br>    &lt;input type=&quot;hidden&quot; id=&quot;amount&quot; name=&quot;amount&quot; value=&quot;1000&quot;&gt;<br>    &lt;input type=&quot;hidden&quot; id=&quot;coupon&quot; name=&quot;coupon&quot; value=&quot;&quot;&gt;<br>    &lt;button type=&quot;submit&quot;&gt;Transfer money!&lt;/button&gt;<br>&lt;/form&gt;</pre><p>The hidden form sets the receiver as attacker and amount as 1000$ and sends a <strong>POST</strong> request to http://insecure-bank.com/transfer when the button is clicked. <strong>Top Level Navigation</strong> and <strong>LAX</strong> cookies will be discussed in <a href="https://medium.com/@gokul_karthik/understanding-csrf-and-how-to-prevent-it-in-your-application-part-2-4cfd2940e236"><strong>Part 2</strong></a> of this series so we can ignore that for now 🙂.</p><p>Alice’s session cookie is sent with this request by default because the <a href="#04a5">browser automatically attached the session cookie</a> and the <a href="#30bc">web server could not tell that the request was a cross site request</a>. Since the session cookie was sent, this request was assumed to be a legitimate request by our server and the money was sent to the attacker🫠.</p><p>We can also verify that the cookie is sent by looking at the developer tools of the browser. Once the <strong>Transfer button</strong> is clicked on CatsThatHack.com, we can see the <strong>Transfer API</strong> request being sent with the session cookie highlighted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yjcJl0q8jz3viaAFvinV5g.png" /></figure><p>Welp, now you’ve seen how attackers can exploit CSRF vulnerabilities and how the browser’s default behavior plays a surprisingly big role in making these attacks possible 🫠.</p><h3>So, What’s next ?</h3><p>In <strong>Part 2</strong> of this series, we’ll dive into how you can actually defend against these type of CSRF attacks. We’ll cover things like SameSite cookies, different CSRF token strategies, top-level navigation , and a lot more!</p><p><a href="https://medium.com/@gokul_karthik/understanding-csrf-and-how-to-prevent-it-in-your-application-part-2-4cfd2940e236">Understanding CSRF and How to Prevent It in Your Application — Part 2</a></p><p>If you’re building anything that uses sessions, you won’t want to miss it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9178bbc828d7" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/understanding-csrf-and-how-to-prevent-it-in-your-application-part-1-9178bbc828d7">Understanding CSRF and How to Prevent It in Your Application — Part 1</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>