<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ctfs on</title><link>https://4ym3nn.github.io/ctfs/</link><description>Recent content in Ctfs on</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 28 Jul 2025 19:41:23 +0100</lastBuildDate><atom:link href="https://4ym3nn.github.io/ctfs/index.xml" rel="self" type="application/rss+xml"/><item><title>Emulator</title><link>https://4ym3nn.github.io/ctfs/worldwidectf2025/emulator/</link><pubDate>Mon, 28 Jul 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/worldwidectf2025/emulator/</guid><description>&lt;h1 id="worldwidectf-2025-revemulator">WorldWideCTF 2025: rev/Emulator&lt;/h1>
&lt;h2 id="team-trojeun">Team: TroJeun&lt;/h2>
&lt;p>&lt;strong>Challenge Details:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Points: 500&lt;/li>
&lt;li>Category: Mobile&lt;/li>
&lt;li>Author: em07robot&lt;/li>
&lt;/ul>
&lt;h2 id="description">Description&lt;/h2>
&lt;p>&amp;ldquo;Inside an emulator, reality bends—only shadows find the hidden truth.&amp;rdquo;&lt;/p>
&lt;p>We are provided with a large zstd-compressed file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>└─$ zstd -d chall_dist.zst 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>chall_dist.zst : &lt;span style="color:#ae81ff">10778972160&lt;/span> bytes 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="initial-analysis">Initial Analysis&lt;/h2>
&lt;p>After decompression, we get an Android Virtual Device (AVD) directory structure:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>└─$ tar -tvf chall_dist
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>drwxrwxr-x em07robot/em07robot &lt;span style="color:#ae81ff">0&lt;/span> 2025-07-10 17:16 chall.avd/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-r--r-- em07robot/em07robot &lt;span style="color:#ae81ff">69206016&lt;/span> 2025-07-10 17:16 chall.avd/cache.img
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-r--r-- em07robot/em07robot &lt;span style="color:#ae81ff">1966149&lt;/span> 2025-07-10 17:16 chall.avd/encryptionkey.img.qcow2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw------- em07robot/em07robot &lt;span style="color:#ae81ff">0&lt;/span> 2025-07-10 17:16 chall.avd/bootcompleted.ini
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-rw-r-- em07robot/em07robot &lt;span style="color:#ae81ff">1245&lt;/span> 2025-07-10 17:16 chall.avd/config.ini
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-rw-r-- em07robot/em07robot &lt;span style="color:#ae81ff">18&lt;/span> 2025-07-10 17:16 chall.avd/quickbootChoice.ini
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-rw-r-- em07robot/em07robot &lt;span style="color:#ae81ff">4227&lt;/span> 2025-07-10 17:16 chall.avd/hardware-qemu.ini
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>drwxr--r-- em07robot/em07robot &lt;span style="color:#ae81ff">0&lt;/span> 2025-07-10 17:16 chall.avd/snapshots/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&amp;lt;..SNIP..&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-rw-r-- em07robot/em07robot &lt;span style="color:#ae81ff">116&lt;/span> 2025-07-10 17:16 chall.ini
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-rw-r-- em07robot/em07robot &lt;span style="color:#ae81ff">939493689&lt;/span> 2025-07-10 17:10 chall.zst.bk
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rw-rw-r-- em07robot/em07robot &lt;span style="color:#ae81ff">76&lt;/span> 2025-07-10 17:13 chal
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This appears to be an Android emulator reverse engineering challenge. The first step is to set up and run the emulator using the &lt;a href="https://developer.android.com/tools" target="_blank">Android Command Line Tools&lt;/a>.&lt;/p></description></item><item><title>Nim Yong Un</title><link>https://4ym3nn.github.io/ctfs/worldwidectf2025/nimyongun/</link><pubDate>Sun, 27 Jul 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/worldwidectf2025/nimyongun/</guid><description>&lt;h1 id="worldwidectf-2025-revnim-yong-un">WorldWideCTF 2025: rev/Nim Yong Un&lt;/h1>
&lt;h2 id="challenge-description">Challenge Description&lt;/h2>
&lt;blockquote>
&lt;p>Our agents captured some North Korean military software. Your task: find the correct launch code!&lt;/p>&lt;/blockquote>
&lt;h2 id="approach--solution">Approach &amp;amp; Solution&lt;/h2>
&lt;h2 id="what-were-dealing-with">What We&amp;rsquo;re Dealing With&lt;/h2>
&lt;p>I got my hands on this Windows PE binary that was asking for a 42-character flag. Right off the bat, I could tell this wasn&amp;rsquo;t going to be your typical reverse engineering challenge when I threw some random input at it.&lt;/p></description></item><item><title>bilingual</title><link>https://4ym3nn.github.io/ctfs/downunderctf/bilingual/</link><pubDate>Mon, 21 Jul 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/downunderctf/bilingual/</guid><description>&lt;h1 id="downunderctf-2025-revbilingual">DownUnderCTF 2025: rev/bilingual&lt;/h1>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/59382842-e292-4ce3-883e-73180e9dbbed" alt="image">&lt;/p>
&lt;h2 id="challenge-description">Challenge Description&lt;/h2>
&lt;blockquote>
&lt;p>Two languages are better than one!&lt;/p>
&lt;p>Regards,
FozzieBear (cybears)&lt;/p>&lt;/blockquote>
&lt;h2 id="approach--solution">Approach &amp;amp; Solution&lt;/h2>
&lt;p>We are given this script &lt;a href="https://github.com/4ym3nn/4ym3nn.github.io/blob/main/content/posts/DownUnderCTF/bilingual.py" target="_blank">bilingual.py&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>DATA &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;eNrtfQt8k0XW96RNei8p0mBBxIDBFhAoTXUrpZp.........&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> argparse&lt;span style="color:#f92672">,&lt;/span> base64&lt;span style="color:#f92672">,&lt;/span> ctypes&lt;span style="color:#f92672">,&lt;/span> zlib&lt;span style="color:#f92672">,&lt;/span> pathlib&lt;span style="color:#f92672">,&lt;/span> sys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>PASSWORD &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;cheese&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>FLAG &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;jqsD0um75+TyJR3z0GbHwBQ+PLIdSJ+rojVscEL4IYkCOZ6+a5H1duhcq+Ub9Oa+ZWKuL703&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>KEY &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;68592cb91784620be98eca41f825260c&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>HELPER &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">None&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">decrypt_flag&lt;/span>(password):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> A &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;utf-8&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> flag &lt;span style="color:#f92672">=&lt;/span> bytearray(base64&lt;span style="color:#f92672">.&lt;/span>b64decode(FLAG))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> buffer &lt;span style="color:#f92672">=&lt;/span> (ctypes&lt;span style="color:#f92672">.&lt;/span>c_byte &lt;span style="color:#f92672">*&lt;/span> len(flag))&lt;span style="color:#f92672">.&lt;/span>from_buffer(flag)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> key &lt;span style="color:#f92672">=&lt;/span> ctypes&lt;span style="color:#f92672">.&lt;/span>create_string_buffer(password&lt;span style="color:#f92672">.&lt;/span>encode(A))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> result &lt;span style="color:#f92672">=&lt;/span> get_helper()&lt;span style="color:#f92672">.&lt;/span>Decrypt(key, len(key) &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>, buffer, len(buffer))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> flag&lt;span style="color:#f92672">.&lt;/span>decode(A)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">get_helper&lt;/span>():
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">global&lt;/span> HELPER
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> HELPER:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> HELPER
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> data &lt;span style="color:#f92672">=&lt;/span> globals()&lt;span style="color:#f92672">.&lt;/span>get(&lt;span style="color:#e6db74">&amp;#34;DATA&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> data:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> dll_path &lt;span style="color:#f92672">=&lt;/span> pathlib&lt;span style="color:#f92672">.&lt;/span>Path(__file__)&lt;span style="color:#f92672">.&lt;/span>parent &lt;span style="color:#f92672">/&lt;/span> &lt;span style="color:#e6db74">&amp;#34;hello.bin&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#f92672">not&lt;/span> dll_path&lt;span style="color:#f92672">.&lt;/span>is_file():
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">with&lt;/span> open(dll_path, &lt;span style="color:#e6db74">&amp;#34;wb&amp;#34;&lt;/span>) &lt;span style="color:#66d9ef">as&lt;/span> dll_file:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> dll_file&lt;span style="color:#f92672">.&lt;/span>write(zlib&lt;span style="color:#f92672">.&lt;/span>decompress(base64&lt;span style="color:#f92672">.&lt;/span>b64decode(data)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> HELPER &lt;span style="color:#f92672">=&lt;/span> ctypes&lt;span style="color:#f92672">.&lt;/span>cdll&lt;span style="color:#f92672">.&lt;/span>LoadLibrary(dll_path)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">else&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> HELPER
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">check_three&lt;/span>(password):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> check_ex(password, &lt;span style="color:#e6db74">&amp;#34;Check3&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">check_four&lt;/span>(password):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> check_ex(password, &lt;span style="color:#e6db74">&amp;#34;Check4&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">check_ex&lt;/span>(password, func):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> GetIntCallbackFn &lt;span style="color:#f92672">=&lt;/span> ctypes&lt;span style="color:#f92672">.&lt;/span>CFUNCTYPE(ctypes&lt;span style="color:#f92672">.&lt;/span>c_int, ctypes&lt;span style="color:#f92672">.&lt;/span>c_wchar_p)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">CallbackTable&lt;/span>(ctypes&lt;span style="color:#f92672">.&lt;/span>Structure):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> _fields_ &lt;span style="color:#f92672">=&lt;/span> [(&lt;span style="color:#e6db74">&amp;#34;E&amp;#34;&lt;/span>, GetIntCallbackFn)]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">@GetIntCallbackFn&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">eval_int&lt;/span>(v):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> int(eval(v))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> table &lt;span style="color:#f92672">=&lt;/span> CallbackTable(E&lt;span style="color:#f92672">=&lt;/span>eval_int)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> helper &lt;span style="color:#f92672">=&lt;/span> get_helper()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> helper[func]&lt;span style="color:#f92672">.&lt;/span>argtypes &lt;span style="color:#f92672">=&lt;/span> [ctypes&lt;span style="color:#f92672">.&lt;/span>POINTER(CallbackTable)]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> helper[func]&lt;span style="color:#f92672">.&lt;/span>restype &lt;span style="color:#f92672">=&lt;/span> ctypes&lt;span style="color:#f92672">.&lt;/span>c_int
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> helper[func](ctypes&lt;span style="color:#f92672">.&lt;/span>byref(table))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">check_two&lt;/span>(password):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">@ctypes.CFUNCTYPE&lt;/span>(ctypes&lt;span style="color:#f92672">.&lt;/span>c_int, ctypes&lt;span style="color:#f92672">.&lt;/span>c_int)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">callback&lt;/span>(i):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> ord(password[i &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span>]) &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> get_helper()&lt;span style="color:#f92672">.&lt;/span>Check2(callback)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">check_one&lt;/span>(password):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> len(password) &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#ae81ff">12&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">False&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> get_helper()&lt;span style="color:#f92672">.&lt;/span>Check1(password) &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">check_password&lt;/span>(password):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">global&lt;/span> PASSWORD
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> PASSWORD &lt;span style="color:#f92672">=&lt;/span> password
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> checks &lt;span style="color:#f92672">=&lt;/span> [check_one, check_two, check_three, check_four]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> result &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">True&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> check &lt;span style="color:#f92672">in&lt;/span> checks:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> result &lt;span style="color:#f92672">=&lt;/span> result &lt;span style="color:#f92672">and&lt;/span> check(password)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> result
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>():
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> parser &lt;span style="color:#f92672">=&lt;/span> argparse&lt;span style="color:#f92672">.&lt;/span>ArgumentParser(description&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;CTF Challenge&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> parser&lt;span style="color:#f92672">.&lt;/span>add_argument(&lt;span style="color:#e6db74">&amp;#34;password&amp;#34;&lt;/span>, help&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Enter the password&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> args &lt;span style="color:#f92672">=&lt;/span> parser&lt;span style="color:#f92672">.&lt;/span>parse_args()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> check_password(args&lt;span style="color:#f92672">.&lt;/span>password):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> flag &lt;span style="color:#f92672">=&lt;/span> decrypt_flag(args&lt;span style="color:#f92672">.&lt;/span>password)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;Correct! The flag is DUCTF{&lt;/span>&lt;span style="color:#e6db74">%s&lt;/span>&lt;span style="color:#e6db74">}&amp;#34;&lt;/span> &lt;span style="color:#f92672">%&lt;/span> flag)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">else&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;That is not correct&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">if&lt;/span> __name__ &lt;span style="color:#f92672">==&lt;/span> &lt;span style="color:#e6db74">&amp;#34;__main__&amp;#34;&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> sys&lt;span style="color:#f92672">.&lt;/span>exit(main())
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>When running this on Linux, I encountered an error due to an invalid ELF header. This suggests that hello.bin is not a native Linux binary, but rather a Windows DLL or some other non-ELF format. The script attempts to load it using ctypes.cdll.LoadLibrary, which confirms it&amp;rsquo;s expecting a shared library (DLL) to call functions . This behavior is evident in the &lt;strong>get_helper&lt;/strong> function.&lt;/p></description></item><item><title>Neon_Deceit</title><link>https://4ym3nn.github.io/ctfs/r3ctf/neon/</link><pubDate>Sun, 06 Jul 2025 22:29:05 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/r3ctf/neon/</guid><description>&lt;h1 id="neon-deceit">Neon Deceit&lt;/h1>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/06eaaa2f-5e52-4112-9111-3fc2e4019e77" alt="image">&lt;/p>
&lt;p>&lt;strong>15 solves | Reverse&lt;/strong>&lt;/p>
&lt;h2 id="challenge-description">Challenge Description&lt;/h2>
&lt;p>In the neon-lit underbelly of the city, even your tools are programmed to betray you. Trust nothing&amp;hellip; the lies are embedded in the code.&lt;/p>
&lt;hr>
&lt;h2 id="initial-analysis">Initial Analysis&lt;/h2>
&lt;p>Starting with the binary from R3CTF, I ran it to see what happens:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>➜ neon_deceit ./neon_deceit 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>hello world
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>➜ neon_deceit 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>That&amp;rsquo;s weird—a simple &amp;ldquo;hello world&amp;rdquo; program that&amp;rsquo;s 400 KB? Something&amp;rsquo;s definitely not right here.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>➜ neon_deceit ls -l neon_deceit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-rwxrwxrwx &lt;span style="color:#ae81ff">1&lt;/span> user user &lt;span style="color:#ae81ff">407640&lt;/span> Jul &lt;span style="color:#ae81ff">4&lt;/span> 15:40 neon_deceit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>➜ neon_deceit 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A basic hello world program shouldn&amp;rsquo;t be nearly half a megabyte. Time to dig into the decompilation and see what&amp;rsquo;s really going on.&lt;/p></description></item><item><title>Dna</title><link>https://4ym3nn.github.io/ctfs/smileyctf2025/dna/</link><pubDate>Thu, 19 Jun 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/smileyctf2025/dna/</guid><description>&lt;h1 id="smileyctf2025-">smileyCTF2025 :&lt;/h1>
&lt;h1 id="revdna">rev/DNA&lt;/h1>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/c0970c1c-7c7f-4e40-8804-b37e48199c73" alt="image">&lt;/p>
&lt;h1 id="description">Description&lt;/h1>
&lt;p>deoxy ribo nucleic acid deoxy meaning without oxygen ribo meaning the 5-carbon sugar backbone nucleic meaning of the nucleus acid meaning proton donor&lt;/p>
&lt;h1 id="solution">Solution&lt;/h1>
&lt;h2 id="initial-recon">Initial Recon&lt;/h2>
&lt;p>We start by looking at the challenge directory:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>➜ dna ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>main.cpython-310.pyc vm.dna
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>We can see that this is a virtual machine challenge, and the Python code has been compiled with Python 3.10 into a .pyc file ,Before diving into the challenge, let&amp;rsquo;s take a moment to understand what a virtual machine (VM) is.&lt;/p></description></item><item><title>brainrot</title><link>https://4ym3nn.github.io/ctfs/tamu2025/brainrot/</link><pubDate>Tue, 17 Jun 2025 22:29:05 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/tamu2025/brainrot/</guid><description>&lt;h1 id="tamu2025---rev-challenge-brainrot">tamu2025 - rev Challenge: brainrot&lt;/h1>
&lt;h2 id="description">Description&lt;/h2>
&lt;p>This challenge involves reverse engineering a custom &amp;ldquo;brain&amp;rdquo; simulation to extract a flag. The brain operates on a set of neurons and performs transformations using a combination of hashing, rotation, and matrix operations. The goal is to deduce the input that produces the required outputs.&lt;/p>
&lt;h2 id="solution">Solution&lt;/h2>
&lt;p>The solution involves implementing the brain simulation in Python and using the Z3 solver to reverse the transformations. Below is the code and explanation:&lt;/p></description></item><item><title>otp</title><link>https://4ym3nn.github.io/ctfs/tamu2025/otp/</link><pubDate>Tue, 17 Jun 2025 22:29:05 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/tamu2025/otp/</guid><description>&lt;h1 id="tamu2025---rev-challenge-otp">tamu2025 - rev Challenge: otp&lt;/h1>
&lt;h2 id="description">Description&lt;/h2>
&lt;p>This challenge involves reverse engineering and cryptographic analysis to extract keys and decrypt an encrypted flag. The solution uses GDB scripting to automate the extraction of keys from memory frames and applies XOR decryption to retrieve the original flag.&lt;/p>
&lt;h2 id="solution">Solution&lt;/h2>
&lt;h3 id="gdb-script-extractkeys">GDB Script: ExtractKeys&lt;/h3>
&lt;p>The following GDB script automates the extraction of keys from memory frames:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> gdb
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> re
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">ExtractKeys&lt;/span>(gdb&lt;span style="color:#f92672">.&lt;/span>Command):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">__init__&lt;/span>(self):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> super(ExtractKeys, self)&lt;span style="color:#f92672">.&lt;/span>&lt;span style="color:#a6e22e">__init__&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;extract_keys&amp;#34;&lt;/span>, gdb&lt;span style="color:#f92672">.&lt;/span>COMMAND_USER)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">parse_gdb_line&lt;/span>(self, line):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74"> Extracts byte values from a single line of GDB output.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74"> Example input: &amp;#34;0x7ffe603d0100: 0x45 0x65 0x41 0x15 0x57 0xc0 0xdb 0xda&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74"> Returns: [&amp;#34;45&amp;#34;, &amp;#34;65&amp;#34;, &amp;#34;41&amp;#34;, &amp;#34;15&amp;#34;, &amp;#34;57&amp;#34;, &amp;#34;c0&amp;#34;, &amp;#34;db&amp;#34;, &amp;#34;da&amp;#34;]
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74"> &amp;#34;&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">match&lt;/span> &lt;span style="color:#f92672">=&lt;/span> re&lt;span style="color:#f92672">.&lt;/span>search(&lt;span style="color:#e6db74">r&lt;/span>&lt;span style="color:#e6db74">&amp;#34;:\s+((?:0x[0-9a-f]&lt;/span>&lt;span style="color:#e6db74">{2}&lt;/span>&lt;span style="color:#e6db74">\s*)+)&amp;#34;&lt;/span>, line)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#66d9ef">match&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> re&lt;span style="color:#f92672">.&lt;/span>findall(&lt;span style="color:#e6db74">r&lt;/span>&lt;span style="color:#e6db74">&amp;#34;0x([0-9a-f]&lt;/span>&lt;span style="color:#e6db74">{2}&lt;/span>&lt;span style="color:#e6db74">)&amp;#34;&lt;/span>, &lt;span style="color:#66d9ef">match&lt;/span>&lt;span style="color:#f92672">.&lt;/span>group(&lt;span style="color:#ae81ff">1&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> []
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">parse_gdb_output&lt;/span>(self, gdb_output):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74"> Parses the entire GDB output to extract key bytes.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74"> Returns a single hex string.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74"> &amp;#34;&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> key_bytes &lt;span style="color:#f92672">=&lt;/span> []
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> line &lt;span style="color:#f92672">in&lt;/span> gdb_output&lt;span style="color:#f92672">.&lt;/span>split(&lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#ae81ff">\n&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> key_bytes&lt;span style="color:#f92672">.&lt;/span>extend(self&lt;span style="color:#f92672">.&lt;/span>parse_gdb_line(line))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&lt;/span>&lt;span style="color:#f92672">.&lt;/span>join(key_bytes)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">invoke&lt;/span>(self, arg, from_tty):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> start_frame, end_frame &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span>, &lt;span style="color:#ae81ff">1003&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">with&lt;/span> open(&lt;span style="color:#e6db74">&amp;#34;keys.txt&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;w&amp;#34;&lt;/span>) &lt;span style="color:#66d9ef">as&lt;/span> key_file:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> frame_id &lt;span style="color:#f92672">in&lt;/span> range(start_frame, end_frame &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">try&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> gdb&lt;span style="color:#f92672">.&lt;/span>execute(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;frame &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>frame_id&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>, to_string&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#66d9ef">True&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> key_output &lt;span style="color:#f92672">=&lt;/span> gdb&lt;span style="color:#f92672">.&lt;/span>execute(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;x/59bx key&amp;#34;&lt;/span>, to_string&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#66d9ef">True&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> key_hex_string &lt;span style="color:#f92672">=&lt;/span> self&lt;span style="color:#f92672">.&lt;/span>parse_gdb_output(key_output)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> key_hex_string:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> key_file&lt;span style="color:#f92672">.&lt;/span>write(key_hex_string &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#ae81ff">\n&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">except&lt;/span> gdb&lt;span style="color:#f92672">.&lt;/span>error:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;[-] Skipping frame &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>frame_id&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74"> (No key found)&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">continue&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;[✔] All keys extracted to keys.txt&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ExtractKeys()
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="decryption-process">Decryption Process&lt;/h3>
&lt;p>The decryption process involves loading the encrypted flag and the extracted keys, then applying XOR decryption in reverse order:&lt;/p></description></item><item><title>xorox</title><link>https://4ym3nn.github.io/ctfs/tamu2025/xorox/</link><pubDate>Tue, 17 Jun 2025 22:29:05 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/tamu2025/xorox/</guid><description>&lt;h1 id="tamu2025---rev-challenge-xorox">tamu2025 - rev Challenge: xorox&lt;/h1>
&lt;h2 id="description">Description&lt;/h2>
&lt;p>This challenge involves reverse engineering a binary to determine the required input that produces the desired output. The solution involves XOR operations and understanding the binary&amp;rsquo;s constants and register values.&lt;/p>
&lt;h2 id="solution">Solution&lt;/h2>
&lt;p>The following Python script demonstrates the solution:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> struct
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Constants from the binary&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>constant &lt;span style="color:#f92672">=&lt;/span> [
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0x2a8c7f3acdf36ffb&lt;/span>, &lt;span style="color:#75715e"># First 8 bytes of the constant&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0x8cc2eef32660caaa&lt;/span>, &lt;span style="color:#75715e"># Next 8 bytes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0xefa1fd61d7a3b592&lt;/span>, &lt;span style="color:#75715e"># Next 8 bytes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0xa9ddc2d22a90025e&lt;/span> &lt;span style="color:#75715e"># Last 8 bytes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># YMM7 register values from GDB (converted to 4x 64-bit integers)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ymm7 &lt;span style="color:#f92672">=&lt;/span> [
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0x1eca2043bfc01980&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0xd386a3ba753fbe9f&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0x87d5cc1688d185ea&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">0xd4aebbb741cf3001&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">qwords_to_bytes&lt;/span>(qwords):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#e6db74">b&lt;/span>&lt;span style="color:#e6db74">&amp;#39;&amp;#39;&lt;/span>&lt;span style="color:#f92672">.&lt;/span>join(struct&lt;span style="color:#f92672">.&lt;/span>pack(&lt;span style="color:#e6db74">&amp;#39;&amp;lt;Q&amp;#39;&lt;/span>, q) &lt;span style="color:#66d9ef">for&lt;/span> q &lt;span style="color:#f92672">in&lt;/span> qwords)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>constant_bytes &lt;span style="color:#f92672">=&lt;/span> qwords_to_bytes(constant)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ymm7_bytes &lt;span style="color:#f92672">=&lt;/span> qwords_to_bytes(ymm7)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>required_input &lt;span style="color:#f92672">=&lt;/span> bytes(a &lt;span style="color:#f92672">^&lt;/span> b &lt;span style="color:#66d9ef">for&lt;/span> a, b &lt;span style="color:#f92672">in&lt;/span> zip(constant_bytes, ymm7_bytes))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>flag &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">b&lt;/span>&lt;span style="color:#e6db74">&amp;#34;gigem&amp;#34;&lt;/span> &lt;span style="color:#f92672">+&lt;/span> required_input
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>print(&lt;span style="color:#e6db74">&amp;#34;Raw bytes:&amp;#34;&lt;/span>, flag)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Try to decode as ASCII (some bytes may not be printable)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">try&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;ASCII:&amp;#34;&lt;/span>, flag&lt;span style="color:#f92672">.&lt;/span>decode(&lt;span style="color:#e6db74">&amp;#39;ascii&amp;#39;&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">except&lt;/span> &lt;span style="color:#a6e22e">UnicodeDecodeError&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;Contains non-ASCII bytes&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="flag">Flag&lt;/h2>
&lt;p>The flag for this challenge is:&lt;/p></description></item><item><title>Rev/gateway</title><link>https://4ym3nn.github.io/ctfs/apocalypse-htb/gateway/</link><pubDate>Tue, 17 Jun 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/apocalypse-htb/gateway/</guid><description>&lt;h1 id="first-challenge-gateway">FIRST CHALLENGE: Gateway&lt;/h1>
&lt;h2 id="challenge-description">Challenge Description&lt;/h2>
&lt;p>Malakar has ensnared you with a dark spell, banishing you to the depths of the Nether world. Escape hinges on recalling the ancient enchantments of your forefathers. Wield their arcane power to shatter the Aether gateways and reclaim your freedom. Only the correct incantation—32 bytes of mystical precision—will unlock the path back to the mortal realm. Can you decipher the spell and blast through the barriers of this infernal trap?&lt;/p></description></item><item><title>Rev/imagepro</title><link>https://4ym3nn.github.io/ctfs/apocalypse-htb/imagepro/</link><pubDate>Tue, 17 Jun 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/apocalypse-htb/imagepro/</guid><description>&lt;h1 id="impossimaze-writeup">Impossimaze Writeup&lt;/h1>
&lt;h2 id="challenge-overview">Challenge Overview&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Name&lt;/strong>: Impossimaze&lt;/li>
&lt;li>&lt;strong>Difficulty&lt;/strong>: Medium&lt;/li>
&lt;li>&lt;strong>Category&lt;/strong>: Reverse Engineering / Exploitation&lt;/li>
&lt;/ul>
&lt;h2 id="initial-analysis">Initial Analysis&lt;/h2>
&lt;h3 id="challenge-description">Challenge Description&lt;/h3>
&lt;p>The challenge presents a seemingly simple ncurses-based program where the player navigates through a maze-like interface. The goal is to uncover a hidden flag by understanding the program&amp;rsquo;s intricate mechanics.&lt;/p>
&lt;h3 id="key-observations">Key Observations&lt;/h3>
&lt;ol>
&lt;li>The program uses ncurses library for terminal-based interaction&lt;/li>
&lt;li>Allows movement using arrow keys&lt;/li>
&lt;li>Displays terminal dimensions&lt;/li>
&lt;li>Contains a specific hidden mechanism when terminal is exactly 13x37&lt;/li>
&lt;/ol>
&lt;h2 id="reverse-engineering-approach">Reverse Engineering Approach&lt;/h2>
&lt;h3 id="code-breakdown">Code Breakdown&lt;/h3>
&lt;p>The main function reveals several interesting characteristics:&lt;/p></description></item><item><title>Rev/crackme</title><link>https://4ym3nn.github.io/ctfs/nexusftc-2025/crackme/</link><pubDate>Sat, 10 May 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/nexusftc-2025/crackme/</guid><description>&lt;h1 id="writeup-solving-the-reverse-engineering-challenge">Writeup: Solving the Reverse Engineering Challenge&lt;/h1>
&lt;p>This writeup details the process of solving a reverse engineering challenge involving an ELF64 x86-64 binary named &lt;code>chall&lt;/code>. The goal is to determine the correct input string that, when provided to the program via &lt;code>./chall&lt;/code>, results in the output:&lt;/p>
&lt;pre tabindex="0">&lt;code>Congratss!! you can now submit the flag
&lt;/code>&lt;/pre>&lt;p>Through disassembly, analysis of the &lt;code>.rodata&lt;/code> section, and reverse engineering, we derive the 40-character flag: &lt;code>nexus{vm_revers1ng_1s_f45c1n4t1ng_4nd_3xtremely_p41nful}&lt;/code>.&lt;/p>
&lt;hr>
&lt;h2 id="challenge-overview">Challenge Overview&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Binary&lt;/strong>: &lt;code>chall&lt;/code>, an ELF64 x86-64 executable.&lt;/p></description></item><item><title>Rev/crackmev2</title><link>https://4ym3nn.github.io/ctfs/nexusftc-2025/crackmev2/</link><pubDate>Sat, 10 May 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/nexusftc-2025/crackmev2/</guid><description>&lt;h1 id="ctf-writeup-virtual-machine-flag-extraction">CTF Writeup: Virtual Machine Flag Extraction&lt;/h1>
&lt;p>This writeup details the process of solving a Capture The Flag (CTF) challenge that involves reverse-engineering a virtual machine (VM) implemented in C. The VM reads instructions from a binary file (&lt;code>code.bin&lt;/code>), processes an input flag, and outputs &amp;ldquo;Correct!&amp;rdquo; if the flag is valid. The goal is to determine the correct flag by analyzing the VM&amp;rsquo;s behavior and extracting the necessary computations from &lt;code>code.bin&lt;/code>.&lt;/p></description></item><item><title>Rev/nativi</title><link>https://4ym3nn.github.io/ctfs/nexusftc-2025/nativi/</link><pubDate>Sat, 10 May 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/nexusftc-2025/nativi/</guid><description>&lt;h1 id="ctf-challenge-writeup-nativi">CTF Challenge Writeup: NATIVI&lt;/h1>
&lt;h2 id="challenge-overview">Challenge Overview&lt;/h2>
&lt;p>This challenge involves reverse-engineering a C++ program to uncover a hidden flag in the format &lt;code>nexus{...}&lt;/code>, commonly used in Capture The Flag (CTF) competitions. The program performs a series of bitwise transformations and XOR operations on provided byte arrays (&lt;code>fakeflag&lt;/code>, &lt;code>key&lt;/code>, &lt;code>affus&lt;/code>, and &lt;code>key2&lt;/code>) and attempts to read a file whose name and contents are derived from these arrays. A provided Python script replicates the necessary transformations to compute the flag directly.&lt;/p></description></item><item><title>Rev/pong.com</title><link>https://4ym3nn.github.io/ctfs/nexusftc-2025/pong.com/</link><pubDate>Sat, 10 May 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/nexusftc-2025/pong.com/</guid><description>&lt;h1 id="writeup-patching-pongcom-with-python-script">Writeup: Patching &lt;code>pong.com&lt;/code> with Python Script&lt;/h1>
&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>The provided Python script, &lt;code>patch_pong.py&lt;/code>, modifies the MS-DOS COM executable &lt;code>pong.com&lt;/code> to reveal a hidden flag in a Capture The Flag (CTF) challenge. The script applies two byte patches to ensure the program jumps directly to the flag-displaying routine and exits cleanly, displaying the flag when run in DOSBox. This writeup explains the problem, the script&amp;rsquo;s functionality, and its effect.&lt;/p>
&lt;hr>
&lt;h2 id="problem-context">Problem Context&lt;/h2>
&lt;p>The &lt;code>pong.com&lt;/code> binary is a DOS-based game (likely Pong) containing a hidden flag. The flag is displayed when the game state byte at memory address &lt;code>0x086B&lt;/code> (referred to as &lt;code>byte_1086B&lt;/code>, file offset &lt;code>0x086B - 0x0100 = 0x076B&lt;/code>) is set to &lt;code>0x03&lt;/code>. This triggers a routine at &lt;code>0x0796&lt;/code> that prints:&lt;/p></description></item><item><title>Rev/rusty</title><link>https://4ym3nn.github.io/ctfs/nexusftc-2025/rusty/</link><pubDate>Sat, 10 May 2025 19:41:23 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/nexusftc-2025/rusty/</guid><description>&lt;h2 id="rusty-steps-writeup">Rusty Steps Writeup&lt;/h2>
&lt;h3 id="overview">Overview&lt;/h3>
&lt;p>This writeup details the steps to reverse engineer and analyze the binary &lt;code>rustySteps&lt;/code>. The challenge has 7 solves and is tagged as &amp;ldquo;easy&amp;rdquo;. The flag is &lt;code>nexus{RusT_R3v_15_Fun_Right}&lt;/code>.&lt;/p>
&lt;hr>
&lt;h3 id="step-1-identifying-upx-packing">Step 1: Identifying UPX Packing&lt;/h3>
&lt;p>After running the &lt;code>strings&lt;/code> command on the binary, we observe indications of UPX packing:&lt;/p>
&lt;p>&lt;img src="./showingUPXpacking.png" alt="UPX Packing">&lt;/p>
&lt;p>To unpack the binary, we use the following command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>upx -d rustySteps
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h3 id="step-2-analyzing-with-strings-again">Step 2: Analyzing with &lt;code>strings&lt;/code> Again&lt;/h3>
&lt;p>After unpacking, running &lt;code>strings&lt;/code> again reveals more interesting strings. This gives us clues for further analysis.&lt;/p></description></item><item><title>Printer</title><link>https://4ym3nn.github.io/ctfs/ingehack/printer/</link><pubDate>Sun, 23 Feb 2025 22:24:57 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/ingehack/printer/</guid><description>&lt;h1 id="ingehack2k25---reversemjsc-write-up">IngeHack2k25 - reverse/mjsc Write-up&lt;/h1>
&lt;h2 id="challenge-overview">Challenge Overview&lt;/h2>
&lt;p>&lt;strong>Challenge Name&lt;/strong>: reverse/printer&lt;br>
&lt;strong>Category&lt;/strong>: Reverse Engineering&lt;br>
&lt;strong>Event&lt;/strong>: IngeHack 2k25&lt;br>
&lt;strong>Difficulty&lt;/strong>: Medium&lt;br>
&lt;strong>Flag&lt;/strong>: &lt;code>ingehack{...}&lt;/code>&lt;/p>
&lt;h2 id="fourier-transformation-based-image-decryption">Fourier Transformation-Based Image Decryption&lt;/h2>
&lt;h3 id="challenge-analysis">&lt;strong>Challenge Analysis&lt;/strong>&lt;/h3>
&lt;p>Upon analyzing the provided files, we observed the following directory structure:&lt;/p>
&lt;pre tabindex="0">&lt;code>➜ solver ls 
decrypted.png enc main reconstructed_data.txt sol.py
&lt;/code>&lt;/pre>&lt;p>The main objective is to decrypt the file &lt;code>enc&lt;/code> to retrieve an image. By inspecting &lt;code>main&lt;/code>, we determined that it applies a Fourier transformation, meaning the encryption likely involves transforming the image into the frequency domain.&lt;/p></description></item><item><title>Mjsc</title><link>https://4ym3nn.github.io/ctfs/ingehack/mjsc/</link><pubDate>Sun, 23 Feb 2025 22:24:52 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/ingehack/mjsc/</guid><description>&lt;h1 id="ingehack2k25---reversemjsc">ingehack2k25 - reverse/mjsc&lt;/h1>
&lt;h1 id="mjsc-ctf-challenge-write-up">MJSC CTF Challenge Write-up&lt;/h1>
&lt;p>&lt;strong>Challenge: reverse/mjsc&lt;/strong>&lt;br>
&lt;strong>Event: IngeHack 2k25&lt;/strong>&lt;br>
&lt;strong>Author: 4ymen&lt;/strong>&lt;br>
&lt;strong>Points: 469&lt;/strong>&lt;br>
&lt;strong>Solves: 4&lt;/strong>&lt;br>
&lt;strong>Difficulty: Medium&lt;/strong>&lt;br>
&lt;strong>Original Challenge Author: itskarudo&lt;/strong>&lt;/p>
&lt;h2 id="challenge-information">Challenge Information&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Category&lt;/strong>: Reverse Engineering&lt;/li>
&lt;li>&lt;strong>Type&lt;/strong>: Web/JavaScript&lt;/li>
&lt;li>&lt;strong>Flag&lt;/strong>: ingehack{i_hate_js_rev_chals_they_never_have_a_new_idea}&lt;/li>
&lt;/ul>
&lt;h2 id="initial-analysis">Initial Analysis&lt;/h2>
&lt;p>The challenge presented us with a web application that needed to be analyzed. The initial reconnaissance showed:&lt;/p>
&lt;ol>
&lt;li>Web interface requiring input validation&lt;/li>
&lt;li>Heavy use of JavaScript for validation&lt;/li>
&lt;li>Obfuscated code to hide the validation logic&lt;/li>
&lt;/ol>
&lt;h2 id="technical-environment">Technical Environment&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">Platform&lt;/span>: &lt;span style="color:#ae81ff">Web&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">Primary Language&lt;/span>: &lt;span style="color:#ae81ff">JavaScript&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">Key Components&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#ae81ff">React Application&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#ae81ff">Obfuscated JavaScript&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#ae81ff">Client-side validation&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="investigation-process">Investigation Process&lt;/h2>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Source Code Retrieval&lt;/strong>&lt;/p></description></item><item><title>Dados</title><link>https://4ym3nn.github.io/ctfs/ingehack/dados/</link><pubDate>Sun, 23 Feb 2025 22:24:46 +0100</pubDate><guid>https://4ym3nn.github.io/ctfs/ingehack/dados/</guid><description>&lt;h1 id="ingehack2k25---reversedados">ingehack2k25 - reverse/dados&lt;/h1>
&lt;ul>
&lt;li>
&lt;p>Write-Up Author : 4ymen&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Flag: ingehack{security_by_obscurity}&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="challenge-description">Challenge Description:&lt;/h2>
&lt;blockquote>
&lt;p>infinite luck in exchange for a flag&lt;/p>
&lt;p>&lt;a href="https://drive.google.com/file/d/1hMyVNwUrK-X0PvlPQIUjNnDt17W9gB_M/view?usp=sharing" target="_blank">dados.apk&lt;/a>&lt;/p>&lt;/blockquote>
&lt;pre tabindex="0">&lt;code>title: &amp;#34;Reverse Engineering Challenge &amp;#34;
difficulty: Easy
category: Reverse Engineering
platform: Android
tools: [&amp;#34;apktool&amp;#34;, &amp;#34;smali&amp;#34;, &amp;#34;Frida&amp;#34;, &amp;#34;adb&amp;#34;]
author : &amp;#34;godsword&amp;#34;
date: &amp;#34;2025-02-23&amp;#34;
tags: [&amp;#34;Reverse Engineering&amp;#34;, &amp;#34;Android&amp;#34;, &amp;#34;Frida&amp;#34;, &amp;#34;Smali&amp;#34;, &amp;#34;CTF&amp;#34;]
---
&lt;/code>&lt;/pre>&lt;h1 id="write-up">Write up&lt;/h1>
&lt;h3 id="step-1-identifying-the-main-activity">&lt;strong>Step 1: Identifying the Main Activity&lt;/strong>&lt;/h3>
&lt;p>&lt;img src="https://hackmd.io/_uploads/BkQItTO5Jg.png" alt="Screenshot From 2025-02-23 17-12-51">&lt;/p>
&lt;p>After decompiling &lt;code>dados.apk&lt;/code>, I checked &lt;code>AndroidManifest.xml&lt;/code>
to find the app&amp;rsquo;s entry point. The &lt;code>&amp;lt;activity&amp;gt;&lt;/code> tag with &lt;code>&amp;lt;intent-filter&amp;gt;&lt;/code> containing &lt;code>android.intent.action.MAIN&lt;/code> and &lt;code>android.intent.category.LAUNCHER&lt;/code> revealed that the main activity is:&lt;/p></description></item><item><title/><link>https://4ym3nn.github.io/ctfs/downunderctf/godot/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://4ym3nn.github.io/ctfs/downunderctf/godot/</guid><description/></item><item><title/><link>https://4ym3nn.github.io/ctfs/smileyctf2025/dna/readme/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://4ym3nn.github.io/ctfs/smileyctf2025/dna/readme/</guid><description>&lt;h1 id="smileyctf2025-">smileyCTF2025 :&lt;/h1>
&lt;h2 id="revdna">rev/DNA&lt;/h2>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/2a754db6-1251-435e-95e1-7e020437b0f0" alt="image">&lt;/p>
&lt;h2 id="flag--we_ought_to_start_storing_our_data_as_dna_instead">Flag : .;,;.{we_ought_to_start_storing_our_data_as_dna_instead}&lt;/h2>
&lt;h1 id="description">Description&lt;/h1>
&lt;p>deoxy ribo nucleic acid deoxy meaning without oxygen ribo meaning the 5-carbon sugar backbone nucleic meaning of the nucleus acid meaning proton donor&lt;/p>
&lt;h1 id="solution">Solution&lt;/h1>
&lt;h2 id="initial-recon">Initial Recon&lt;/h2>
&lt;p>We start by looking at the challenge directory:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>➜ dna ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>main.cpython-310.pyc vm.dna
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>➜ dna 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>We can see that this is a virtual machine challenge, and the Python code has been compiled with Python 3.10 into a .pyc file ,Before diving into the challenge, let&amp;rsquo;s take a moment to understand what a virtual machine (VM) is.&lt;/p></description></item></channel></rss>