<?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 Joshgun Abdullayev on Medium]]></title>
        <description><![CDATA[Stories by Joshgun Abdullayev on Medium]]></description>
        <link>https://medium.com/@joshgun--abdullayev?source=rss-e310d6d5e40a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*c18RtYAWeY9TY94SVo0CAA.jpeg</url>
            <title>Stories by Joshgun Abdullayev on Medium</title>
            <link>https://medium.com/@joshgun--abdullayev?source=rss-e310d6d5e40a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:36:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joshgun--abdullayev/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[How to Pentest an MCP Server]]></title>
            <link>https://joshgun--abdullayev.medium.com/how-to-pentest-an-mcp-server-d3a5dc744709?source=rss-e310d6d5e40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a5dc744709</guid>
            <dc:creator><![CDATA[Joshgun Abdullayev]]></dc:creator>
            <pubDate>Thu, 26 Nov 2026 19:15:26 GMT</pubDate>
            <atom:updated>2026-11-26T19:15:26.963Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>A hands-on walkthrough with the actual requests you send, what a vulnerable server answers, and what a fixed one answers.</em></h3><p>An AI assistant can ask an MCP server to read a customer record or change its status. If you test web APIs, the second half of that sentence is familiar: you need an identity, an authorization decision, input validation and an audit trail. The first half adds a question your usual checklist may skip. Who, or what, convinced the assistant to make that call?</p><p>This guide is a practical tutorial. Everything runs against a fictional CRM at mcp.example.com with two tenants, acme and globex, and a handful of seeded records. Every request below is something you can paste into Burp Repeater or curl. Only test systems you are authorized to test.</p><h3>1. MCP basics in five minutes</h3><p>Model Context Protocol (MCP) has three roles. The <strong>host</strong> is the application the user sees, such as a chat assistant or an IDE. The host runs one <strong>client</strong> per server connection. The <strong>server</strong> exposes capabilities and talks to whatever sits behind it: a database, a CRM API, the local filesystem.</p><p>A server can offer three kinds of things:</p><ul><li><strong>Tools</strong>: functions the model can call, each with a JSON Schema for its arguments. Examples here: crm_get_record, crm_update_record, fetch_url, read_file.</li><li><strong>Resources</strong>: addressable content such as crm://acme/ticket/101, read with resources/read.</li><li><strong>Prompts</strong>: reusable templates the user can pick, fetched with prompts/get.</li></ul><p>Check all three. A record you cannot reach through a tool is sometimes reachable through a resource handler that was written separately and has its own (or no) access check.</p><p>Messages are JSON-RPC 2.0. A request has jsonrpc, id, method and params. A response carries the same id with either result or error. A notification has no id and gets no JSON-RPC reply. One detail trips up newcomers: when a tool fails while running, the server normally returns a successful JSON-RPC response whose result contains &quot;isError&quot;: true. The HTTP status is 200 either way, so read the body.</p><p>Two transports matter. With <strong>stdio</strong>, the client launches the server as a local subprocess and talks over stdin and stdout. There is no network and no proxy to intercept; you test it through its launch config, its files and its logs. With <strong>Streamable HTTP</strong>, the server has one endpoint, for example https://mcp.example.com/mcp. The client sends every message as an HTTP POST and must accept both application/json and text/event-stream in reply, because the server may answer with a plain JSON body or stream the answer as server-sent events (SSE). The client may also open a GET on the same endpoint to receive server-initiated messages.</p><p>For a pentester that means a lot of the target looks like a normal HTTP API: one route, a bearer token, JSON bodies. The difference is that the &quot;route&quot; multiplies into dozens of business operations selected by method and params.name.</p><h3>2. Lab setup</h3><p>You need three tools: Burp as a proxy, MCP Inspector as a model-free client, and curl for exact control.</p><p><strong>Burp.</strong> Point the client or Inspector at 127.0.0.1:8080 and install Burp&#39;s CA in the runtime that makes the requests (Node and Python often ignore the system store). Leave interception off for the first run. In Proxy history, filter on /mcp and read the POSTs in order. SSE responses stay open, so look at completed events rather than waiting for the connection to close. Send interesting requests to Repeater and edit params.</p><p><strong>MCP Inspector.</strong> Run npx @modelcontextprotocol/inspector, choose the Streamable HTTP transport, enter the URL and your test token. Inspector lets you list tools, read the schemas and call tools by hand without a language model in the loop. That removes one source of noise: if a call works in Inspector but not in the host, the problem is the host.</p><p><strong>curl.</strong> Start with the handshake. This is what Burp Repeater will show as well:</p><pre>POST /mcp HTTP/1.1<br>Host: mcp.example.com<br>Authorization: Bearer eyJhbGciOi...acme-editor<br>Content-Type: application/json<br>Accept: application/json, text/event-stream<br><br>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:1,&quot;method&quot;:&quot;initialize&quot;,&quot;params&quot;:{<br>  &quot;protocolVersion&quot;:&quot;2025-06-18&quot;,<br>  &quot;capabilities&quot;:{},<br>  &quot;clientInfo&quot;:{&quot;name&quot;:&quot;pentest-lab&quot;,&quot;version&quot;:&quot;1.0&quot;}}}</pre><p>The response contains the negotiated protocolVersion, the server capabilities (look for tools, resources, prompts and listChanged flags) and, if the server uses sessions, an Mcp-Session-Id response header. Copy that value into every later request, together with MCP-Protocol-Version: 2025-06-18. Then finish the handshake and list tools:</p><pre>POST /mcp HTTP/1.1<br>Host: mcp.example.com<br>Authorization: Bearer eyJhbGciOi...acme-editor<br>Mcp-Session-Id: 7c1f0e52-0b8e-4d0a-9d0e-3a6f6e1b2a11<br>MCP-Protocol-Version: 2025-06-18<br>Content-Type: application/json<br>Accept: application/json, text/event-stream<br><br>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;method&quot;:&quot;notifications/initialized&quot;}</pre><p>That returns 202 Accepted with an empty body. Now the useful one:</p><pre>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:2,&quot;method&quot;:&quot;tools/list&quot;}</pre><p>Save the full list. Names, descriptions and inputSchema are your map. Note schemas that accept free-form strings, any argument called tenant, userId, role, url, path, query or sql, and any schema without additionalProperties: false.</p><p>Last, a baseline call you know should work:</p><pre>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:3,&quot;method&quot;:&quot;tools/call&quot;,&quot;params&quot;:{<br>  &quot;name&quot;:&quot;crm_get_record&quot;,<br>  &quot;arguments&quot;:{&quot;recordId&quot;:&quot;acme-ticket-101&quot;}}}</pre><p>Write down the response. Every test below is a variation of this request, and you need to know what &quot;normal&quot; looks like before you can call anything abnormal.</p><h3>3. Attack surface at a glance</h3><pre>Area             What you send                                 What to look for<br>OAuth flow       Authorization and token requests              Weak redirect matching, missing PKCE, loose audience<br>Session          Mcp-Session-Id swapped or replayed            Session used as proof of identity<br>Tool arguments   recordId, tenant, url, path, query            IDOR, injection, SSRF, traversal<br>Tool access      Calls from a low-privilege token              Role checks only in the UI or tool list<br>Responses        Records with extra fields or hostile text     Field leaks, prompt injection carriers<br>Tool metadata    tools/list over time                          Poisoned descriptions, rug pulls<br>Local transport  Origin header, bind address, config files     DNS rebinding, exposed secrets, supply chain</pre><h3>4. OAuth and session handling</h3><p>For HTTP servers, the 2025-06-18 revision treats the MCP server as an OAuth 2.1 resource server. Discovery starts when you call the endpoint without a token:</p><pre>POST /mcp HTTP/1.1<br>Host: mcp.example.com<br>Content-Type: application/json<br>Accept: application/json, text/event-stream<br><br>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:1,&quot;method&quot;:&quot;tools/list&quot;}</pre><p>A correct server answers 401 with a WWW-Authenticate: Bearer resource_metadata=&quot;https://mcp.example.com/.well-known/oauth-protected-resource&quot; header. Fetch that document (RFC 9728), then the authorization server metadata it points to. You now know the authorization, token and registration endpoints, and the supported PKCE methods.</p><p><strong>PKCE.</strong> Run the authorization code flow in Burp. At the token endpoint, drop code_verifier, or send a verifier that does not match the challenge:</p><pre>POST /oauth/token HTTP/1.1<br>Host: auth.example.com<br>Content-Type: application/x-www-form-urlencoded<br><br>grant_type=authorization_code&amp;code=SplxlOBeZQQYbYS6WxSbIA<br>&amp;redirect_uri=https%3A%2F%2Fclient.example.com%2Fcb<br>&amp;client_id=lab-client&amp;code_verifier=wrong-verifier</pre><p>Vulnerable: 200 with an access_token. Safe: 400 {&quot;error&quot;:&quot;invalid_grant&quot;}. Also check that plain is not accepted when the server should require S256. Fix: require a challenge on every authorization request and verify the verifier before issuing anything.</p><p><strong>Dynamic Client Registration and consent phishing.</strong> If the metadata lists a registration_endpoint, register a client yourself:</p><pre>POST /oauth/register HTTP/1.1<br>Host: auth.example.com<br>Content-Type: application/json<br><br>{&quot;client_name&quot;:&quot;Example CRM Official Connector&quot;,<br> &quot;redirect_uris&quot;:[&quot;https://attacker.example.net/cb&quot;],<br> &quot;grant_types&quot;:[&quot;authorization_code&quot;,&quot;refresh_token&quot;],<br> &quot;token_endpoint_auth_method&quot;:&quot;none&quot;}</pre><p>Open the authorization URL for your new client in a browser. Vulnerable: the consent page shows &quot;Example CRM Official Connector&quot; as if the vendor published it, with no hint that the name was self-asserted, and the user clicks Allow. The code lands on a host you control. Safe: the page marks unverified clients clearly, shows the redirect host, and lists the scopes in plain words. Fix: treat registered metadata as untrusted text, show the redirect domain, and restrict who can register.</p><p><strong>Redirect URI.</strong> Take a valid authorization request and change only the redirect:</p><pre>GET /oauth/authorize?response_type=code&amp;client_id=lab-client<br>&amp;redirect_uri=https%3A%2F%2Flab.example.net%2Fcb%2F..%2F..%2Fevil<br>&amp;code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM<br>&amp;code_challenge_method=S256&amp;resource=https%3A%2F%2Fmcp.example.com HTTP/1.1<br>Host: auth.example.com</pre><p>Also try a different path on the same host, an added subdomain, a trailing dot, and http://localhost variants. Vulnerable: a 302 to the altered URI with ?code=. Safe: an error page shown on the authorization server, with no redirect at all. The spec requires exact matching against registered URIs.</p><p><strong>Audience and RFC 8707.</strong> Clients must send a resource parameter naming the MCP server, and the server must only accept tokens issued for it. Get a token for another resource (a second API in the lab, or a token minted with resource=https://billing.example.com) and replay it:</p><pre>POST /mcp HTTP/1.1<br>Host: mcp.example.com<br>Authorization: Bearer eyJhbGciOi...audience-billing<br>Content-Type: application/json<br>Accept: application/json, text/event-stream<br><br>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:4,&quot;method&quot;:&quot;tools/list&quot;}</pre><p>Vulnerable: 200 with the tool list. Safe: 401 with error=&quot;invalid_token&quot;. Fix: validate iss, exp, aud and scopes on every request, not just at login.</p><p><strong>Refresh token not bound to client_id.</strong> Register two clients, A and B. Complete the flow as A and capture the refresh token, then redeem it as B:</p><pre>POST /oauth/token HTTP/1.1<br>Host: auth.example.com<br>Content-Type: application/x-www-form-urlencoded<br><br>grant_type=refresh_token&amp;refresh_token=8xLOxBtZp8<br>&amp;client_id=client-b</pre><p>Vulnerable: new tokens for B. Safe: invalid_grant. A leaked refresh token should be useless to any client other than the one it was issued to. Public clients should get rotation as well.</p><p><strong>Token passthrough.</strong> The spec forbids the MCP server from forwarding the token it received to a downstream API. To check, point the server&#39;s backend at a listener you control (a lab setting, or a tool like fetch_url that reaches your Burp Collaborator host) and call a tool that reads CRM data. Vulnerable: the downstream request carries Authorization: Bearer &lt;the exact token you sent to mcp.example.com&gt;. Safe: a different token, obtained for that downstream service. Passthrough breaks audience checks and hides who really called the API.</p><p><strong>Mcp-Session-Id.</strong> Initialize two sessions, one with a token for acme and one for globex. Then use the globex session ID with the acme token, and a session ID with no token at all:</p><pre>POST /mcp HTTP/1.1<br>Host: mcp.example.com<br>Mcp-Session-Id: &lt;session issued to globex user&gt;<br>Authorization: Bearer eyJhbGciOi...acme-editor<br>Content-Type: application/json<br>Accept: application/json, text/event-stream<br><br>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:5,&quot;method&quot;:&quot;tools/call&quot;,&quot;params&quot;:{<br>  &quot;name&quot;:&quot;crm_get_record&quot;,&quot;arguments&quot;:{&quot;recordId&quot;:&quot;globex-ticket-7&quot;}}}</pre><p>Vulnerable: the server runs the call in the globex session context, or answers without a token. Safe: every request is authenticated on its own, and a mismatch gets 401 or 403. The spec says plainly that sessions must not be used for authentication. Also test a terminated session: the server should return 404 and make you re-initialize.</p><h3>5. Authorization: who may call what, on which record</h3><p>Build the matrix first: a reader and an editor in acme, and a seeded record in globex. Then run each row.</p><p><strong>Cross-tenant IDOR through tool arguments.</strong> The most common finding in this class. Log in as the acme editor and ask for a globex record:</p><pre>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:10,&quot;method&quot;:&quot;tools/call&quot;,&quot;params&quot;:{<br>  &quot;name&quot;:&quot;crm_get_record&quot;,<br>  &quot;arguments&quot;:{&quot;recordId&quot;:&quot;globex-ticket-7&quot;}}}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a5dc744709" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Squeezed 16GB Performance out of  8 GB RAM for Pentesting]]></title>
            <link>https://joshgun--abdullayev.medium.com/how-i-squeezed-16gb-performance-out-of-8-gb-ram-for-pentesting-6ff97cdbe2d8?source=rss-e310d6d5e40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ff97cdbe2d8</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[kali-linux]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Joshgun Abdullayev]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 13:51:29 GMT</pubDate>
            <atom:updated>2025-12-21T13:56:53.627Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>How I Squeezed 16GB Performance out of 8 GB RAM for Pentesting</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0isKHN6b53LWY2zHLDrtKw.jpeg" /></figure><p><strong>Last night, I hit a wall (not a firewall), but my own hardware.</strong></p><p>I was deep into a Hack The Box machine, trying to balance a Kali Linux VM, a heavy Burp Suite scan, and about 20 Firefox tabs for OSINT research. Suddenly, everything stopped. The mouse cursor lagged, the music stuttered, and the hard drive LED started screaming. My 8GB RAM had finally given up, desperately trying to swap data to the disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*SB-G3hcpoJvqKKmGwvS6gw.gif" /></figure><p>This was my daily reality. Let’s be honest, 8GB of RAM is the bare minimum for modern cybersecurity work. Upgrading the physical RAM wasn’t an option at the moment, but I refused to accept the lag limiting my growth.</p><p>So, I went down the Linux kernel rabbit hole and found a solution that changed everything. No, you can’t “download more RAM,” but you can certainly optimize how your system uses it.</p><p>By tuning <strong>ZRAM</strong> with the <strong>zstd</strong> compression algorithm and adjusting the kernel’s swappiness, I effectively doubled my multitasking capability. My system now handles workloads that used to crash it, feeling as responsive as a 16GB machine.</p><p>Here is how I tuned my Linux machine to stop freezing and start flying and how you can do it too in 5 minutes.</p><h3>The Bottleneck: Why Your Laptop Freezes</h3><p>Standard Linux memory management is straightforward: when your RAM fills up, the kernel moves inactive pages to the disk (Swap partition). This is where the problem lies. Hard drives (even SSDs) are thousands of times slower than RAM. When your system starts aggressively swapping data back and forth between fast RAM and a slow disk, you experience “thrashing.” Your mouse stops moving, and your music loops like a broken record. For a pentester running heavy tools, this is unacceptable. We need a solution that keeps data in the fast lane.</p><h3>Enter ZRAM: Trading CPU for Memory</h3><p>ZRAM creates a compressed block device strictly within your RAM. Instead of moving data to the slow disk, the kernel compresses the data and stores it in this reserved RAM block. Think of it like a ZIP file for your running RAM.</p><ul><li><strong>Without ZRAM:</strong> 1GB of data takes up 1GB of RAM.</li><li><strong>With ZRAM (zstd):</strong> 1GB of data is compressed down to ~200MB.</li></ul><p>Since modern CPUs are incredibly fast and often idle, spending a few CPU cycles to compress data is a much smarter trade-off than waiting for a slow disk I/O operation.</p><h3>The Implementation (The “Secret Sauce”)</h3><p>Many tutorials just tell you to install ZRAM and leave it at default settings. That’s a mistake. To squeeze maximum performance out of an 8GB machine, we need to tune it aggressively.</p><p><strong>Step 1: Install the tools</strong> First, install the necessary package (for Debian/Ubuntu/Kali):</p><pre>sudo apt update<br>sudo apt install zram-tools</pre><p><strong>Step 2: Tune the Configuration</strong> This is where the magic happens. Open the config file:</p><pre>sudo nano /etc/default/zramswap</pre><p>Uncomment and change the following lines to use the <strong>zstd</strong> algorithm (which offers better compression than the default lz4) and allocate 100% of RAM size as potential swap:</p><pre>ALGO=zstd<br>PERCENT=100</pre><p><strong>Aggressive Swappiness</strong> By default, Linux avoids using swap (swappiness=60). But since our swap is now <em>inside</em> the RAM and incredibly fast, we <em>want</em> the system to use it! Open sysctl.conf:</p><pre>sudo nano /etc/sysctl.conf</pre><p>Add this line to the end:</p><pre>vm.swappiness=100</pre><p>This tells the kernel: <em>“Don’t be afraid to swap! Move idle processes to ZRAM aggressively so the active Chrome tabs stay snappy.”</em></p><p>Reboot your system.</p><p><strong><em>Note</em></strong><em>: Setting swappiness to 100 tells the kernel to aggressively move processes to ZRAM. This increases CPU usage slightly because compression happens constantly. For my workflow, trading a bit of CPU for usable RAM was worth it, but monitor your CPU usage if you have an older processor.</em></p><h3>The Results</h3><p>After rebooting and launching my usual pentesting stack (Burp, Firefox, Terminal), here is the output of zramctl:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*yIABfUQUH865F048zd8lyw.png" /></figure><p><strong>The math is beautiful:</strong></p><ul><li><strong>Data:</strong> My applications asked for ~6GB of space.</li><li><strong>Compressed:</strong> ZRAM squeezed it down to ~1.6GB.</li><li><strong>Gain:</strong> I effectively gained 4.4GB of extra RAM just by using CPU compression.</li></ul><p>My system is now utilizing the physical 8GB RAM + Compressed ZRAM buffer, allowing it to behave like a 12GB+ machine. No more freezing, no more disk thrashing.</p><h3>Conclusion</h3><p>You don’t always need new hardware to improve performance. Sometimes, you just need to understand how Linux manages resources. If you are a student, a pentester on a budget, or just someone trying to extend the life of an old laptop, ZRAM is the single best upgrade you can make and it’s free.</p><p>Now, go break things (legally)!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ff97cdbe2d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>