<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Binary Exploitation on 4mN3s14 | CTF Player &amp; Student</title><link>https://john-jkar.github.io/myblog/tags/binary-exploitation/</link><description>Recent content in Binary Exploitation on 4mN3s14 | CTF Player &amp; Student</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 18 Feb 2026 06:00:00 +0000</lastBuildDate><atom:link href="https://john-jkar.github.io/myblog/tags/binary-exploitation/index.xml" rel="self" type="application/rss+xml"/><item><title> Disappeared (Daily Alpacahack) Writeup</title><link>https://john-jkar.github.io/myblog/posts/diappeared/</link><pubDate>Wed, 18 Feb 2026 06:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/diappeared/</guid><description>&lt;h1 id="disappeared--daily-alpacahack-writeup"&gt;Disappeared — Daily Alpacahack Writeup&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Category:&lt;/strong&gt; Pwn · &lt;strong&gt;Difficulty:&lt;/strong&gt; Medium ·&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;re given source code and a netcat address. The code looks safe at first glance — there&amp;rsquo;s a bounds check on the array index before any write. The trick is in the compile command:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcc -DNDEBUG -o chal main.c -no-pie
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Two flags matter: &lt;code&gt;-DNDEBUG&lt;/code&gt; and &lt;code&gt;-no-pie&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="the-vulnerability"&gt;The Vulnerability&lt;/h2&gt;
&lt;h3 id="-dndebug-silently-deletes-assert"&gt;&lt;code&gt;-DNDEBUG&lt;/code&gt; silently deletes &lt;code&gt;assert()&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The C standard specifies that when &lt;code&gt;NDEBUG&lt;/code&gt; is defined, every &lt;code&gt;assert()&lt;/code&gt; call is &lt;strong&gt;completely removed by the preprocessor&lt;/strong&gt; — not weakened, not skipped at runtime. Deleted.&lt;/p&gt;</description></item><item><title>Simple ROP Writeup</title><link>https://john-jkar.github.io/myblog/posts/rop/</link><pubDate>Sun, 15 Feb 2026 06:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/rop/</guid><description>&lt;h1 id="simple-rop-alpacahack--writeup"&gt;Simple ROP Alpacahack — Writeup&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Category:&lt;/strong&gt; Pwn&lt;br&gt;
&lt;strong&gt;Difficulty:&lt;/strong&gt; Hard&lt;br&gt;
&lt;strong&gt;Goal:&lt;/strong&gt; Call&lt;/p&gt;
&lt;p&gt;&lt;code&gt;win(0xdeadbeefcafebabe, 0x1122334455667788, 0xabcdabcdabcdabcd)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;to spawn a shell and read &lt;code&gt;/flag.txt&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id="understanding-the-binary"&gt;Understanding the Binary&lt;/h1&gt;
&lt;p&gt;The vulnerable code:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;char buffer[64]; gets(buffer);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gets()&lt;/code&gt; allows unlimited input → &lt;strong&gt;buffer overflow vulnerability&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;win()&lt;/code&gt; function checks 3 arguments:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;param1 == 0xdeadbeefcafebabe param2 == 0x1122334455667788 param3 == 0xabcdabcdabcdabcd&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If all pass → &lt;code&gt;/bin/sh&lt;/code&gt; is executed.&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id="security-protections"&gt;Security Protections&lt;/h1&gt;
&lt;p&gt;From &lt;code&gt;checksec&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Arch: amd64 RELRO: Full RELRO Stack: No canary NX: Enabled PIE: Enabled SHSTK: Enabled IBT: Enabled&lt;/code&gt;&lt;/p&gt;</description></item></channel></rss>