<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Crypto on Anthrace | CTF Writeups</title><link>https://anthr4ce.github.io/tags/crypto/</link><description>Recent content in Crypto on Anthrace | CTF Writeups</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 01 Jul 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://anthr4ce.github.io/tags/crypto/index.xml" rel="self" type="application/rss+xml"/><item><title>E-CTF-2025 - Crypto</title><link>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/crypto/ascii-everything-but-not-the-flag/</link><pubDate>Tue, 01 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/crypto/ascii-everything-but-not-the-flag/</guid><description>&lt;hr&gt;&#10;&lt;h2 id="step-1-analyzing-the-challenge"&gt;&#10; &lt;strong&gt;Step 1: Analyzing the Challenge&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-analyzing-the-challenge"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;&lt;img src="images/chall_screen.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;The challenge provides a series of &lt;strong&gt;ASCII numbers&lt;/strong&gt; along with an intriguing phrase:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;108 100 111 109 123 85 99 49 122 95 106 53 95 79 111 51 95 88 52 116 95 48 109 95 51 111 88 121 90 107 97 106 48 105 125 10 10 69 98 111 98 32 102 112 32 118 108 114 111 32 104 98 118 44 32 100 108 108 97 32 105 114 122 104 32 58 32 72 66 86 72 66 86 10 10 87 101 108 108 32 100 111 110 101 44 32 98 117 116 32 110 111 119 32 100 111 32 121 111 117 32 107 110 111 119 32 97 98 111 117 116 32 116 104 101 32 103 117 121 32 119 104 111 32 103 111 116 32 115 116 97 98 98 101 100 32 50 51 32 116 105 109 101 115 32 63&#10;&lt;/code&gt;&lt;/pre&gt;&lt;hr&gt;&#10;&lt;h2 id="step-2-decoding-ascii"&gt;&#10; &lt;strong&gt;Step 2: Decoding ASCII&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-2-decoding-ascii"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;I used &lt;strong&gt;DCode&lt;/strong&gt; to convert the ASCII numbers into text.&lt;/p&gt;</description></item><item><title>DVCTF 2025 - WEB LouvreArchives</title><link>https://anthr4ce.github.io/ctf-writeups/dvctf-2025/web-louvrearchives/</link><pubDate>Mon, 26 May 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/dvctf-2025/web-louvrearchives/</guid><description>&lt;hr&gt;&#10;&lt;p&gt;&lt;img src="images/img1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;In this challenge, the goal is to access &lt;code&gt;flag.webp&lt;/code&gt; as indicated in the source code.&lt;/p&gt;&#10;&lt;p&gt;While exploring the page, I noticed a long base64-encoded string. Once decoded and reorganized, it contained several &lt;code&gt;.webp&lt;/code&gt; images with unusual names like &lt;code&gt;1991781613.webp&lt;/code&gt;, &lt;code&gt;1273827392.webp&lt;/code&gt;, etc.&lt;/p&gt;&#10;&lt;p&gt;Checking the source code:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/img2.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;We understand that filenames are generated using Python&amp;rsquo;s &lt;code&gt;getrandbits(32)&lt;/code&gt;, which produces 32 random bits via the &lt;code&gt;random.getrandbits&lt;/code&gt; function.&lt;/p&gt;&#10;&lt;p&gt;The interesting point here is that this function uses the &lt;strong&gt;Mersenne Twister&lt;/strong&gt; generator, a PRNG (Pseudo-Random Number Generator) that is &lt;strong&gt;not cryptographically secure&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>THCon - Crypto</title><link>https://anthr4ce.github.io/ctf-writeups/thcon/crypto/</link><pubDate>Tue, 08 Apr 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/thcon/crypto/</guid><description>&lt;p&gt;&lt;img src="images/image1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;h1 id="overview-of-the-challenge"&gt;&#10; Overview of the Challenge&#10; &lt;a class="heading-link" href="#overview-of-the-challenge"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h1&gt;&#10;&lt;p&gt;In this challenge we are given a Python script that performs a one-time pad (OTP) encryption on a file and a crypted file.&lt;/p&gt;&#10;&lt;p&gt;Here’s what happens:&lt;/p&gt;&#10;&lt;h3 id="1otp-generation"&gt;&#10; 1.OTP Generation:&#10; &lt;a class="heading-link" href="#1otp-generation"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h3&gt;&#10;&lt;p&gt;A 10-byte pad is generated using random bytes.&lt;/p&gt;&#10;&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;-webkit-text-size-adjust:none;"&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;def&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;generate_OTP&lt;/span&gt;():&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; OTP &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;#39;&amp;#39;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &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;10&lt;/span&gt;):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;# Generates a random byte (0–255) and appends it to the OTP.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; OTP &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; int&lt;span style="color:#f92672"&gt;.&lt;/span&gt;to_bytes(randint(&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;,&lt;span style="color:#ae81ff"&gt;255&lt;/span&gt;), &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#39;big&amp;#39;&lt;/span&gt;)&#10;&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; OTP&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="2file-encryption"&gt;&#10; 2.File Encryption:&#10; &lt;a class="heading-link" href="#2file-encryption"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h3&gt;&#10;&lt;p&gt;The script reads the input file in binary mode and encrypts it by XORing each byte with a corresponding byte from the OTP (repeating the OTP cyclically).&lt;/p&gt;</description></item><item><title>Nullcon-Goa-HackIM-2025 - Web</title><link>https://anthr4ce.github.io/ctf-writeups/nullcon-goa-hackim-2025/web/crahp/</link><pubDate>Mon, 10 Feb 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/nullcon-goa-hackim-2025/web/crahp/</guid><description>&lt;hr&gt;&#10;&lt;h1 id="web-challenge---crc-hash-collision-exploit"&gt;&#10; Web Challenge - CRC Hash Collision Exploit&#10; &lt;a class="heading-link" href="#web-challenge---crc-hash-collision-exploit"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h1&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="challenge-description"&gt;&#10; Challenge Description&#10; &lt;a class="heading-link" href="#challenge-description"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;In this challenge, we are provided with the source code of a PHP script along with two hints:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Hint 1&lt;/strong&gt;: &lt;a href="https://www.php.net/manual/en/function.crc32.php#28012" class="external-link" target="_blank" rel="noopener"&gt;PHP documentation link for crc32()&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Hint 2&lt;/strong&gt;: &lt;a href="https://stackoverflow.com/questions/507041/crc8-check-in-php/73305496#73305496" class="external-link" target="_blank" rel="noopener"&gt;A PHP CRC8 implementation&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The goal is to retrieve the &lt;strong&gt;flag&lt;/strong&gt; by bypassing an authentication mechanism based on &lt;strong&gt;CRC hashes&lt;/strong&gt;.&lt;/p&gt;</description></item></channel></rss>