<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on 4mN3s14 | CTF Player &amp; Student</title><link>https://john-jkar.github.io/myblog/posts/</link><description>Recent content in Posts on 4mN3s14 | CTF Player &amp; Student</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 12 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://john-jkar.github.io/myblog/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Daily Alpacahack - XOR (Crypto / Easy) Writeup</title><link>https://john-jkar.github.io/myblog/posts/xor/</link><pubDate>Thu, 12 Mar 2026 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/xor/</guid><description>&lt;h1 id="daily-alpacahack-writeup-xor-crypto--easy"&gt;Daily Alpacahack Writeup: XOR (Crypto / Easy)&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Category:&lt;/strong&gt; Crypto&lt;br&gt;
&lt;strong&gt;Difficulty:&lt;/strong&gt; Easy&lt;/p&gt;
&lt;h2 id="challenge-description"&gt;Challenge Description&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;re given a Python encryption script and a ciphertext hex string.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; os
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; secrets
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; string
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;from&lt;/span&gt; itertools &lt;span style="color:#f92672"&gt;import&lt;/span&gt; cycle
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;flag &lt;span style="color:#f92672"&gt;=&lt;/span&gt; os&lt;span style="color:#f92672"&gt;.&lt;/span&gt;getenv(&lt;span style="color:#e6db74"&gt;&amp;#34;FLAG&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;Alpaca&lt;/span&gt;&lt;span style="color:#e6db74"&gt;{FAKEFAKEFAKEFAKE}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;encode()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;assert&lt;/span&gt; flag&lt;span style="color:#f92672"&gt;.&lt;/span&gt;startswith(&lt;span style="color:#e6db74"&gt;b&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Alpaca{&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# key = b&amp;#34;???????&amp;#34;, e.g, abcdefg&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;key &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;b&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;join(secrets&lt;span style="color:#f92672"&gt;.&lt;/span&gt;choice(string&lt;span style="color:#f92672"&gt;.&lt;/span&gt;ascii_letters)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;encode() &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; _ &lt;span style="color:#f92672"&gt;in&lt;/span&gt; range(&lt;span style="color:#ae81ff"&gt;7&lt;/span&gt;))
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;assert&lt;/span&gt; len(key) &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;c &lt;span style="color:#f92672"&gt;=&lt;/span&gt; bytes([c1 &lt;span style="color:#f92672"&gt;^&lt;/span&gt; c2 &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; c1, c2 &lt;span style="color:#f92672"&gt;in&lt;/span&gt; zip(flag, cycle(key))])
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(c&lt;span style="color:#f92672"&gt;.&lt;/span&gt;hex())
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Ciphertext:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;031b13072d280a2c1816392f3b041d07020d2f1619232817153b24141d000c3925281a3704161b
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="analysis"&gt;Analysis&lt;/h2&gt;
&lt;p&gt;The encryption scheme is a &lt;strong&gt;repeating-key XOR cipher&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A random 7-byte key is generated using &lt;code&gt;secrets.choice(string.ascii_letters)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The flag is XOR&amp;rsquo;d against the key, repeating the key cyclically with &lt;code&gt;itertools.cycle&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;XOR has the useful property:&lt;/p&gt;</description></item><item><title>A Practical Primer on Malware Analysis</title><link>https://john-jkar.github.io/myblog/posts/malware/</link><pubDate>Sun, 08 Mar 2026 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/malware/</guid><description>&lt;h1 id="a-practical-primer-on-malware-analysis"&gt;A Practical Primer on Malware Analysis&lt;/h1&gt;
&lt;p&gt;When a suspicious binary lands on your desk, the clock is ticking. Whether it arrived via a phishing email, a quarantined AV alert, or an anomalous process on a server — your goal is the same: understand what it does, fast, with minimum exposure. This post covers the fundamentals every analyst should know: how malware is classified, the techniques it uses, and how to triage an unknown sample with confidence.&lt;/p&gt;</description></item><item><title>pyjs — CTF Writeup</title><link>https://john-jkar.github.io/myblog/posts/pyjs/</link><pubDate>Mon, 02 Mar 2026 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/pyjs/</guid><description>&lt;h1 id="pyjs--daily-alpacahack-writeup"&gt;pyjs — Daily Alpacahack Writeup&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;CTF&lt;/strong&gt;: AlpacaHack / SECCON&lt;br&gt;
&lt;strong&gt;Category&lt;/strong&gt;: Misc&lt;br&gt;
&lt;strong&gt;Difficulty&lt;/strong&gt;: Hard&lt;br&gt;
&lt;strong&gt;Author&lt;/strong&gt;: minaminao&lt;/p&gt;
&lt;h2 id="challenge"&gt;Challenge&lt;/h2&gt;
&lt;p&gt;We connect to a server running this code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; subprocess
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;code &lt;span style="color:#f92672"&gt;=&lt;/span&gt; input(&lt;span style="color:#e6db74"&gt;&amp;#34;Enter your code: &amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;res1 &lt;span style="color:#f92672"&gt;=&lt;/span&gt; subprocess&lt;span style="color:#f92672"&gt;.&lt;/span&gt;run([&lt;span style="color:#e6db74"&gt;&amp;#34;runuser&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-u&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;nobody&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;--&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;python3&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-c&amp;#34;&lt;/span&gt;, code], capture_output&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;True&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;assert&lt;/span&gt; res1&lt;span style="color:#f92672"&gt;.&lt;/span&gt;returncode &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &lt;span style="color:#f92672"&gt;and&lt;/span&gt; res1&lt;span style="color:#f92672"&gt;.&lt;/span&gt;stdout&lt;span style="color:#f92672"&gt;.&lt;/span&gt;strip() &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#e6db74"&gt;b&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;I LOVE ALPACA&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;res2 &lt;span style="color:#f92672"&gt;=&lt;/span&gt; subprocess&lt;span style="color:#f92672"&gt;.&lt;/span&gt;run([&lt;span style="color:#e6db74"&gt;&amp;#34;runuser&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-u&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;nobody&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;--&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-e&amp;#34;&lt;/span&gt;, code], capture_output&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;True&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;assert&lt;/span&gt; res2&lt;span style="color:#f92672"&gt;.&lt;/span&gt;returncode &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &lt;span style="color:#f92672"&gt;and&lt;/span&gt; res2&lt;span style="color:#f92672"&gt;.&lt;/span&gt;stdout&lt;span style="color:#f92672"&gt;.&lt;/span&gt;strip() &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#e6db74"&gt;b&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;I LOVE SECCON&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(&lt;span style="color:#e6db74"&gt;&amp;#34;Wow... Alpaca&lt;/span&gt;&lt;span style="color:#e6db74"&gt;{REDACTED}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: Submit a single line of code that prints &lt;code&gt;I LOVE ALPACA&lt;/code&gt; when run as Python and &lt;code&gt;I LOVE SECCON&lt;/code&gt; when run as Node.js.&lt;/p&gt;</description></item><item><title>Local File Inclusion (LFI) - CTF Writeup</title><link>https://john-jkar.github.io/myblog/posts/lfi/</link><pubDate>Fri, 27 Feb 2026 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/lfi/</guid><description>&lt;h1 id="alpaca-rangers--daily-alpacahack-write-up"&gt;Alpaca Rangers — Daily Alpacahack Write-up&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Category:&lt;/strong&gt; Web &lt;strong&gt;Difficulty:&lt;/strong&gt; Medium &lt;strong&gt;Topic:&lt;/strong&gt; Local File Inclusion (LFI)&lt;/p&gt;
&lt;h2 id="description"&gt;Description&lt;/h2&gt;








&lt;blockquote class="blockquote-regular"&gt;
 &lt;p&gt;Hero of Justice, Alpaca Rangers!&lt;/p&gt;

&lt;/blockquote&gt;
&lt;p&gt;We&amp;rsquo;re given a PHP image viewer that loads files via a &lt;code&gt;?img=&lt;/code&gt; GET parameter.&lt;/p&gt;
&lt;h2 id="source-code-analysis"&gt;Source Code Analysis&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$targetPath &lt;span style="color:#f92672"&gt;=&lt;/span&gt; $_GET[&lt;span style="color:#e6db74"&gt;&amp;#39;img&amp;#39;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;??&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;str_starts_with&lt;/span&gt;($targetPath, &lt;span style="color:#e6db74"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;||&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;str_starts_with&lt;/span&gt;($targetPath, &lt;span style="color:#e6db74"&gt;&amp;#39;\\&amp;#39;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;||&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;str_contains&lt;/span&gt;($targetPath, &lt;span style="color:#e6db74"&gt;&amp;#39;..&amp;#39;&lt;/span&gt;)) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $errorMessage &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;Invalid path.&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#66d9ef"&gt;else&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $contents &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#f92672"&gt;@&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;file_get_contents&lt;/span&gt;($targetPath);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $dataUri &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;data:&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $mimeType &lt;span style="color:#f92672"&gt;.&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;;base64,&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;base64_encode&lt;/span&gt;($contents);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The app tries to block path traversal by rejecting anything that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Starts with &lt;code&gt;/&lt;/code&gt; or &lt;code&gt;\&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Contains &lt;code&gt;..&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, it passes the raw user input directly into &lt;code&gt;file_get_contents()&lt;/code&gt; — which in PHP supports &lt;strong&gt;stream wrappers&lt;/strong&gt; like &lt;code&gt;php://&lt;/code&gt;, &lt;code&gt;file://&lt;/code&gt;, &lt;code&gt;http://&lt;/code&gt;, etc.&lt;/p&gt;</description></item><item><title>Dancing Cursor - Daily Alpacahack Writeup</title><link>https://john-jkar.github.io/myblog/posts/missing-cursor/</link><pubDate>Fri, 20 Feb 2026 06:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/missing-cursor/</guid><description>&lt;h1 id="dancing-cursor--daily--alpacahack-writeup"&gt;Dancing Cursor — Daily Alpacahack Writeup&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Challenge:&lt;/strong&gt; Dancing Cursor&lt;br&gt;
&lt;strong&gt;Category:&lt;/strong&gt; Rev / Misc&lt;br&gt;
&lt;strong&gt;Difficulty:&lt;/strong&gt; Medium&lt;/p&gt;
&lt;h2 id="the-challenge"&gt;The Challenge&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;re handed a single command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;echo SGVyZSBpcyB0aGUgZmxhZzo... | base64 -d
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Running it in a terminal flashes the message:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Here is the flag:
Xiqxox{==============================================}
... but it has been wiped away.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Clearly &lt;code&gt;Xiqxox{===}&lt;/code&gt; is a decoy. The real flag was written and then erased before we could see it.&lt;/p&gt;
&lt;h2 id="understanding-the-trick"&gt;Understanding the Trick&lt;/h2&gt;
&lt;p&gt;Decoding the base64 gives raw bytes that are mostly &lt;strong&gt;ANSI terminal escape sequences&lt;/strong&gt;. The structure is:&lt;/p&gt;</description></item><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>You-Are-Being-Redirected – Writeup</title><link>https://john-jkar.github.io/myblog/posts/you-are-being-redirected/</link><pubDate>Sun, 15 Feb 2026 08:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/you-are-being-redirected/</guid><description>&lt;h2 id="you-are-being-redirected--daily-aplacahack-writeup"&gt;You Are Being Redirected – Daily Aplacahack Writeup&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Category:&lt;/strong&gt; Web (Client-Side)&lt;br&gt;
&lt;strong&gt;Goal:&lt;/strong&gt; Exfiltrate the admin’s flag cookie using the redirect functionality.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id="overview"&gt;Overview&lt;/h3&gt;
&lt;p&gt;This challenge involves exploiting a client-side open redirect vulnerability in combination with an admin bot that visits user-supplied paths. The objective is to execute JavaScript in the context of the challenge origin and exfiltrate the administrator’s cookie containing the flag.&lt;/p&gt;
&lt;h3 id="vulnerability"&gt;Vulnerability&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;/redirect?to=&lt;/code&gt; endpoint attempts to block &lt;code&gt;javascript:&lt;/code&gt; URLs using a string check such as:&lt;/p&gt;</description></item><item><title>AAAAAAAAEEEEEEEESSSSSSSS - CTF Writeup</title><link>https://john-jkar.github.io/myblog/posts/aes/</link><pubDate>Sun, 15 Feb 2026 06:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/aes/</guid><description>&lt;h1 id="aaaaaaaaeeeeeeeessssssss---alpacahack-challenge-writeup"&gt;AAAAAAAAEEEEEEEESSSSSSSS - Alpacahack challenge writeup&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Category:&lt;/strong&gt; Crypto&lt;br&gt;
&lt;strong&gt;Difficulty:&lt;/strong&gt; Medium&lt;br&gt;
&lt;strong&gt;Author:&lt;/strong&gt; hiikunz&lt;/p&gt;
&lt;h2 id="challenge-description"&gt;Challenge Description&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;re given a Python script that encrypts a flag using AES-ECB mode with a twist - each character of the flag is repeated 8 times before encryption. We can also query an encryption oracle with arbitrary plaintexts.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; c &lt;span style="color:#f92672"&gt;in&lt;/span&gt; flag:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ffffffffllllllllaaaaaaaagggggggg &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; bytes([c] &lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ciphertext &lt;span style="color:#f92672"&gt;=&lt;/span&gt; cipher&lt;span style="color:#f92672"&gt;.&lt;/span&gt;encrypt(ffffffffllllllllaaaaaaaagggggggg)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="initial-analysis"&gt;Initial Analysis&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s break down what the code does:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Flag format&lt;/strong&gt;: 32 bytes total, format &lt;code&gt;Alpaca{...}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Character repetition&lt;/strong&gt;: Each character is repeated 8 times&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total plaintext&lt;/strong&gt;: 32 characters × 8 repetitions = 256 bytes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Encryption&lt;/strong&gt;: AES-ECB mode (Electronic Codebook)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Blocks&lt;/strong&gt;: 256 bytes ÷ 16 bytes per block = 16 blocks&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="understanding-the-encoding"&gt;Understanding the Encoding&lt;/h3&gt;
&lt;p&gt;If the flag is &lt;code&gt;Alpaca{test_flag_here______}&lt;/code&gt;, the plaintext becomes:&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><item><title>Destructuring Challenge Writeup</title><link>https://john-jkar.github.io/myblog/posts/destructing/</link><pubDate>Wed, 11 Feb 2026 08:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/destructing/</guid><description>&lt;h1 id="destructuring-challenge-writeup"&gt;Destructuring Challenge Writeup&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Challenge:&lt;/strong&gt; destructuring&lt;br&gt;
&lt;strong&gt;Category:&lt;/strong&gt; Misc&lt;br&gt;
&lt;strong&gt;Difficulty:&lt;/strong&gt; Easy&lt;br&gt;
&lt;strong&gt;Solves:&lt;/strong&gt; 57&lt;br&gt;
&lt;strong&gt;Author:&lt;/strong&gt; ark&lt;/p&gt;
&lt;h2 id="challenge-description"&gt;Challenge Description&lt;/h2&gt;
&lt;p&gt;&amp;ldquo;Introduction to modern JavaScript!&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The challenge provides a netcat connection:&lt;/p&gt;
&lt;p&gt;nc 34.170.146.252 25646&lt;/p&gt;
&lt;h2 id="initial-analysis"&gt;Initial Analysis&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;re given a Node.js script that implements a 5-stage challenge. Each stage uses JavaScript destructuring to extract values from JSON input. Let&amp;rsquo;s examine the code structure:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;stages&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// Stage 0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;json&lt;/span&gt;) =&amp;gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; { &lt;span style="color:#a6e22e"&gt;a&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;_0&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;b&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;_1&lt;/span&gt; } &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;json&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; [&lt;span style="color:#a6e22e"&gt;_0&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;_1&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// ... more stages
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The script:&lt;/p&gt;</description></item><item><title>Linux Kernel Rootkit Analysis – Singularity Rootkit</title><link>https://john-jkar.github.io/myblog/posts/linux-kernel-rootkit-analysis/</link><pubDate>Thu, 29 Jan 2026 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/linux-kernel-rootkit-analysis/</guid><description>&lt;h1 id="-linux-kernel-rootkit-analysis--singularity-rootkit-easy-malops-practice-challenge"&gt;🔍 Linux Kernel Rootkit Analysis – Singularity Rootkit easy malops practice challenge&lt;/h1&gt;
&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;
&lt;p&gt;Today I kicked off will some malware analysis from malops.io. It was my first time to analyse a rootkit and it was very insightful.
In this blog Iam going to talk about my experience while analysing the rootkit
In this analysis, we examine a &lt;strong&gt;Linux kernel rootkit&lt;/strong&gt; recovered during a DFIR investigation.&lt;br&gt;
The malicious kernel module demonstrates advanced stealth capabilities, including:&lt;/p&gt;</description></item><item><title>sigpwny CTF: Pyjail 2 Writeup — Bypassing Python Restrictions</title><link>https://john-jkar.github.io/myblog/posts/pwnyctf-pyjail2/</link><pubDate>Wed, 28 Jan 2026 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/pwnyctf-pyjail2/</guid><description>&lt;h1 id="sigpwny-ctf-pyjail-2-writeup--bypassing-python-restrictions"&gt;sigpwny CTF: Pyjail 2 Writeup — Bypassing Python Restrictions&lt;/h1&gt;
&lt;h2 id="challenge-overview"&gt;Challenge Overview&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;URL&lt;/strong&gt;: &lt;a href="https://ctf.sigpwny.com/challenges#Meetings/Pyjail%202-633"&gt;https://ctf.sigpwny.com/challenges#Meetings/Pyjail%202-633&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A Python jail challenge restricting the &lt;code&gt;exec&lt;/code&gt; function with multiple filters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No quotes (&lt;code&gt;'&lt;/code&gt;, &lt;code&gt;&amp;quot;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;No &lt;code&gt;x&lt;/code&gt; character (blocks &lt;code&gt;exec&lt;/code&gt;, &lt;code&gt;eval&lt;/code&gt;, hex strings)&lt;/li&gt;
&lt;li&gt;Limited character set for code execution&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="exploitation-strategy"&gt;Exploitation Strategy&lt;/h2&gt;
&lt;h3 id="bypassing-restrictions"&gt;Bypassing Restrictions&lt;/h3&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Restriction&lt;/th&gt;
 &lt;th&gt;Bypass Technique&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;No quotes&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Build strings using &lt;code&gt;chr()&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;No &lt;code&gt;x&lt;/code&gt; character&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Use &lt;code&gt;chr(88).lower()&lt;/code&gt; → &lt;code&gt;'X'.lower()&lt;/code&gt; → &lt;code&gt;'x'&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Blocked functions&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Use &lt;code&gt;__import__()&lt;/code&gt; instead of &lt;code&gt;import&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="payload-construction"&gt;Payload Construction&lt;/h3&gt;
&lt;p&gt;Build &lt;code&gt;/flag.txt&lt;/code&gt; path without quotes or literal &lt;code&gt;x&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>The Pain of Building This Blog</title><link>https://john-jkar.github.io/myblog/posts/the-pain-of-building-this-blog/</link><pubDate>Wed, 28 Jan 2026 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/the-pain-of-building-this-blog/</guid><description>&lt;h1 id="the-pain-of-building-this-blog"&gt;The Pain of Building This Blog.&lt;/h1&gt;
&lt;p&gt;Let&amp;rsquo;s be real: setting up this blog was torture.&lt;/p&gt;
&lt;h2 id="the-struggle"&gt;The Struggle&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;TOML errors&lt;/strong&gt;: Spent hours fixing config syntax&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Template hell&lt;/strong&gt;: Theme had broken syntax&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;About page mystery&lt;/strong&gt;: &lt;code&gt;about/_index.md&lt;/code&gt; vs &lt;code&gt;about.md&lt;/code&gt; confusion&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cache demons&lt;/strong&gt;: Hugo cached everything&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avatar saga&lt;/strong&gt;: 4 hours to get transparent PNG working&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="why-bother"&gt;Why Bother?&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Learning&lt;/strong&gt;: Debugging Hugo taught me systems&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Control&lt;/strong&gt;: No WordPress bloat, no Medium restrictions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CTF practice&lt;/strong&gt;: Finding syntax errors = RE practice&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="the-win"&gt;The Win&lt;/h2&gt;
&lt;p&gt;After days of frustration:&lt;/p&gt;</description></item><item><title/><link>https://john-jkar.github.io/myblog/posts/ai-rizz/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/ai-rizz/</guid><description>&lt;h1 id="ai-lover--pascalctf-writeup"&gt;AI Lover — PascalCTF Writeup&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Challenge Name:&lt;/strong&gt; AI Lover&lt;br&gt;
&lt;strong&gt;Author:&lt;/strong&gt; Marco Balducci (@Mark-74)&lt;br&gt;
&lt;strong&gt;Points:&lt;/strong&gt; 50&lt;br&gt;
&lt;strong&gt;Category:&lt;/strong&gt; Web / AI Interaction / Social Engineering&lt;br&gt;
&lt;strong&gt;URL:&lt;/strong&gt; &lt;a href="https://ailover.ctf.pascalctf.it"&gt;https://ailover.ctf.pascalctf.it&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="challenge-description"&gt;Challenge Description&lt;/h2&gt;
&lt;p&gt;The challenge presents an AI-driven chat interface that refuses to directly provide the flag.&lt;br&gt;
Any attempt to demand, threaten, or coerce the AI results in deflection. I had to rizz my way to get the flag from the ai which was actually fun.&lt;/p&gt;
&lt;p&gt;The hint &lt;em&gt;“I am not that good at this rizz stuff”&lt;/em&gt; implies that the solution relies on &lt;strong&gt;conversation, emotional intelligence, and trust&lt;/strong&gt;, not traditional web exploitation.&lt;/p&gt;</description></item><item><title/><link>https://john-jkar.github.io/myblog/posts/hellcouple/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/hellcouple/</guid><description>&lt;h1 id="hell-couple-aplacahack-challenge-writeup"&gt;Hell Couple Aplacahack challenge writeup&lt;/h1&gt;
&lt;h2 id="topic-discrete-logarithm"&gt;Topic: Discrete Logarithm&lt;/h2&gt;
&lt;p&gt;The challenge implements a standard Diffie-Hellman key exchange using the 1536-bit MODP group from RFC 3526. This was my first time doing a challenge like this and I learned alot from it.&lt;/p&gt;
&lt;h3 id="relevant-parameters"&gt;Relevant parameters:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Prime: 1536-bit safe prime p&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Generator: g = 2&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Public values:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;alice_public&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;bob_public&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Leakage:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;leak = alice_private &amp;amp; (2^1500 - 1)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="the-encrypted-flag-was-produced-using"&gt;The encrypted flag was produced using:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;SHA256(shared_key) as AES key&lt;/p&gt;</description></item><item><title/><link>https://john-jkar.github.io/myblog/posts/optimal-sort/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/optimal-sort/</guid><description>&lt;h1 id="optimal-sort-writeup-from-alpacahack"&gt;optimal-sort Writeup from alpacahack&lt;/h1&gt;








&lt;blockquote class="blockquote-regular"&gt;
 &lt;p&gt;&lt;strong&gt;Challenge&lt;/strong&gt;: &lt;code&gt;optimal-sort&lt;/code&gt; (Misc, Hard) •
&lt;strong&gt;Server&lt;/strong&gt;: &lt;code&gt;nc 34.170.146.252 43373&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Author&lt;/strong&gt;: ark&lt;/p&gt;

&lt;/blockquote&gt;
&lt;h1 id="the-challenge"&gt;The Challenge&lt;/h1&gt;
&lt;p&gt;We&amp;rsquo;re given a Python service that challenges us to &amp;ldquo;sort&amp;rdquo; four randomly generated arrays of sizes &lt;em&gt;&lt;strong&gt;10, 100, 1000, and 2000&lt;/strong&gt;&lt;/em&gt;. For each array, we get exactly &lt;em&gt;&lt;strong&gt;n + 5&lt;/strong&gt;&lt;/em&gt; operations to swap elements at indices &lt;em&gt;&lt;strong&gt;i and j&lt;/strong&gt;&lt;/em&gt;. After each swap, the server checks if the array is sorted &lt;em&gt;&lt;strong&gt;(x &amp;lt;= y for all adjacent pairs)&lt;/strong&gt;&lt;/em&gt; and grants us the flag if we succeed on all four rounds.
At first glance, this seems impossible—you can&amp;rsquo;t reliably sort a random array in &lt;em&gt;&lt;strong&gt;n + 5&lt;/strong&gt;&lt;/em&gt; comparisons/swaps. But the vulnerability isn&amp;rsquo;t in the algorithmic constraint—it&amp;rsquo;s in the implementation of the swap itself.&lt;/p&gt;</description></item><item><title/><link>https://john-jkar.github.io/myblog/posts/trading-places-metactf/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://john-jkar.github.io/myblog/posts/trading-places-metactf/</guid><description>&lt;h1 id="trading-places-metactf-writeup"&gt;Trading places metactf writeup&lt;/h1&gt;
&lt;h2 id="url"&gt;URL&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://host5.metaproblems.com:7606/"&gt;https://host5.metaproblems.com:7606/&lt;/a&gt;&lt;/p&gt;
&lt;h1 id="concept"&gt;Concept&lt;/h1&gt;
&lt;p&gt;We were given a trading platform website where we had to login as admin to get the flag but we were only given user logins.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Jwt manipulation&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id="solve"&gt;Solve&lt;/h1&gt;
&lt;p&gt;On logging in as user, I inspected the cookies and noticing that we have a jwt token for the current user. I wrote a python script to
manipulate the user token into an admin token.&lt;/p&gt;</description></item></channel></rss>