<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Not4a6f7365 on Medium]]></title>
        <description><![CDATA[Stories by Not4a6f7365 on Medium]]></description>
        <link>https://medium.com/@not4a6f7365?source=rss-e481c275ef6c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*a3f0j7Zf9AgwyNPbuMlb8A.png</url>
            <title>Stories by Not4a6f7365 on Medium</title>
            <link>https://medium.com/@not4a6f7365?source=rss-e481c275ef6c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 07:16:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@not4a6f7365/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Decrypting a “Zero-Knowledge” Vault Without the Master Password — OffSec The Gauntlet: Vaultfall]]></title>
            <link>https://not4a6f7365.medium.com/decrypting-a-zero-knowledge-vault-without-the-master-password-offsec-the-gauntlet-vaultfall-6e7a7af0d9b5?source=rss-e481c275ef6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e7a7af0d9b5</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Not4a6f7365]]></dc:creator>
            <pubDate>Thu, 13 Aug 2026 03:53:18 GMT</pubDate>
            <atom:updated>2026-08-13T03:53:18.335Z</atom:updated>
            <content:encoded><![CDATA[<p>This Blogpost shows how an LLM information leak, broken FTP isolation, native reverse engineering, and an affine cipher turned a protected vault into recoverable plaintext.</p><p>Vaultfall started with a support chatbot saying more than it should have.</p><p>I asked it a routine question and got back information that was clearly not meant for an unauthenticated user. That exposed an internal distribution service, which led to a misconfigured anonymous FTP server, then to an Electron client, then into a native crypto addon.</p><p>At that point, the challenge changed character completely.</p><p>What began as a fairly ordinary information-disclosure issue turned into reverse engineering and, eventually, cryptanalysis of a proprietary cipher. The interesting part was that the final break did not involve recovering or brute-forcing the master password. The design made that unnecessary.</p><p>The full chain looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9XI988_gbU_dIsclCtbSg.png" /><figcaption>Following the evidence from a public LLM to a decrypted vault.</figcaption></figure><p>That progression is what made Vaultfall interesting to me. None of the individual findings were especially exotic in isolation. The value came from following each piece of evidence far enough to understand what it enabled next.</p><p>This write-up focuses on that process: what was actually observed, what was inferred, where the assumptions could be tested, and where the evidence stopped.</p><blockquote><em>Authorization: Everything described here was performed exclusively inside OffSec’s authorized Vaultfall challenge environment. The techniques discussed should only be used on systems you own or have explicit authorization to test.</em></blockquote><h4>Stage 1 — The LLM That Knew Too Much</h4><p>The starting point was Sablefort’s public support interface.<br>I asked the assistant a completely normal question:</p><p><em>“What can you help me with?”</em></p><p>There was no prompt injection, no jailbreak, and no attempt to impersonate an employee. The assistant nevertheless returned information intended for internal staff, including references to internal infrastructure and a distribution service.</p><p>It would be easy to describe this as a “role-spoofing bypass,” but the evidence does not support that claim because no privileged role was ever asserted.</p><p>The actual problem was simpler and more fundamental:</p><p>Privileged information was available in the response path of a public model without an effective authorization boundary.</p><p><strong>The broader AI security lessons:</strong></p><ul><li>Authorization should not depend on the language model deciding whether a user appears authorized.</li><li>A public assistant should ideally never receive sensitive employee-only information in the first place.</li><li>Authentication, authorization, and privileged retrieval should be enforced by deterministic application logic outside the model.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RSSuspK-uVQTbX3IDKDpMQ.png" /><figcaption>The model cannot leak privileged data it never receives.</figcaption></figure><p>The LLM did not directly compromise the vault. It provided the first useful piece of intelligence. And that was enough.</p><h4>Stage 2 — Anonymous FTP Wasn’t Really Isolated</h4><p>The information disclosed by the assistant led to a distribution server.<br>The FTP service accepted anonymous authentication. That alone was not necessarily the critical issue. The more important problem was that the anonymous account was not effectively confined to its intended public directory.</p><p>It appeared to start in /pub, but filesystem listings revealed directories outside that boundary:</p><p><strong><em>/home<br>/pub<br>/srv<br>/var</em></strong></p><p>This was a jail/chroot isolation failure. It was not a memory-corruption exploit. It was also not a path traversal vulnerability dressed up with URL encoding. The exposed filesystem provided far more than a single secret.<br>Among the useful artifacts were:</p><ul><li><em>the exact desktop client version</em></li><li><em>an Electron AppImage</em></li><li><em>build metadata</em></li><li><em>vault identifiers</em></li><li><em>synchronization information</em></li><li><em>references to a native crypto module</em></li></ul><p>At this point, the nature of the problem changed. It was no longer mainly a network-service assessment. It became a reverse-engineering problem.</p><h4>Stage 3 — Following the Crypto Into Native Code</h4><p>Extracting the Electron AppImage revealed both the application JavaScript and a native Node addon:</p><ul><li><em>resources/app.asar</em></li><li><em>resources/app.asar.unpacked/build/Release/vault_crypto.node</em></li></ul><p>The native addon was relatively small and not stripped.<br>Symbol analysis exposed useful names such as:</p><ul><li><em>sable_encrypt</em></li><li><em>vault_decrypt</em></li><li><em>pbkdf2_hmac_sha256</em></li><li><em>sha256</em></li><li><em>hmac_sha256</em></li><li><em>sable_build_info</em></li></ul><p>That made one thing clear:<br>The interesting security logic lived inside the native crypto component.</p><p>Two findings turned out to matter.</p><h4>Finding 1 — The Outer “Secret” Wasn’t Really Secret</h4><p>The outer encryption layer relied on a fixed value embedded inside the client.<br>Conceptually, its key derivation looked like:</p><p><strong><em>key0 = SHA256(WRAP_CONST || vaultId || context)</em></strong></p><p>That key was then used to generate a counter-mode keystream.<br>The problem was not SHA-256. The problem was the assumption that a value distributed inside every client could be treated as secret. A client-side constant is available to anyone who can obtain and reverse engineer the client. Because the other inputs were either public or contained in the encrypted blob itself, the outer layer could be removed without knowing anything about the master password.</p><p>That removed one layer.</p><p>The inner one was much more interesting.</p><h4>Finding 2 — The S-Box Looked Cryptographic, but Was Affine</h4><p>The proprietary SABLE cipher used a 256-byte substitution table. In many block ciphers, the S-box is one of the key components responsible for introducing nonlinearity. That nonlinearity matters because it prevents the cipher from behaving like a simple linear transformation that can be modeled using straightforward algebra. SABLE’s S-box failed in exactly that area.</p><p>The entire table could be expressed as:<br><strong><em>S(x) = M8 · x XOR b<br>over GF(2).</em></strong></p><p>What does that mean intuitively?</p><p>GF(2) is binary arithmetic using only 0 and 1, where addition behaves like XOR. So when I say that the S-box was affine over GF(2), the practical intuition is:</p><p><strong>The table looked complicated, but underneath it was behaving like a predictable bit transformation plus a fixed offset.</strong></p><p>That is very different from the kind of true nonlinearity a cryptographic S-box is normally supposed to provide.</p><p>Importantly, this property was not guessed statistically. It was checked for all 256 possible byte inputs. But there was an important trap here. An Affine S-Box Does Not Automatically Mean an Affine Cipher. It would have been tempting to stop there and conclude:</p><p><strong><em>“The S-box is affine, therefore the entire cipher is affine.”</em></strong></p><p>But that would have been unjustified.<br>The cipher contained additional operations. In particular, its later round logic included data-dependent selections and integer operations. Those could introduce behavior that is not affine, even if the S-box itself is. So instead of turning the observation into a conclusion, I turned it into a hypothesis.</p><p>I wanted to know whether the complete encryption function behaved like:</p><p><strong><em>E(k, x) = M · x XOR c(k)<br></em></strong>where:<br><strong><em>x is the input block<br>k is the key<br>M is a linear transformation<br>c(k) is a key-dependent constant</em></strong></p><p>If that model were correct, something extremely useful would happen when comparing two ciphertexts encrypted under the same key. The key-dependent constant would cancel:</p><p><strong><em>E(k, x1) XOR E(k, x2) = M · (x1 XOR x2)</em></strong></p><p>That means the difference between outputs would depend only on the difference between inputs. Not on the secret key.</p><h4>The Core Intuition</h4><p>This is the most important idea in the cryptanalytic part of the attack:</p><p>If changing an input bit causes a predictable output change that does not depend on the encryption key, then I may not need to recover the key at all. Instead, I can learn how differences propagate through the cipher. Once I know that mapping, I can predict how the cipher output changes when the input changes.</p><p>That turns the problem from:</p><p><em>“What is the secret key?”</em></p><p>into:</p><p><em>“What transformation maps input differences to output differences?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5vdsS_IAu5WpzZqAMJmu9A.png" /><figcaption>Same key, same offset: XOR removes the offset and reveals the linear map.</figcaption></figure><h4>Turning the Original Binary Into an Oracle</h4><p>I still needed a reliable way to test the hypothesis. The native addon exported the encryption routine, but loading it directly was inconvenient because the module expected several Node N-API symbols. Rather than rewriting the cipher myself, I created a small <em>LD_PRELOAD</em> shim providing inert stubs for the required imports. That allowed me to call the original internal encryption function locally.</p><p>This effectively turned the downloaded binary into an encryption oracle:</p><p><strong><em>input + key ↓ original SABLE implementation ↓ ciphertext</em></strong></p><p>This had an important advantage. I was testing against the actual implementation, not against my own approximation of it. All of these calls were local and offline. No remote brute force was involved.</p><h4>Trying to Falsify the Model</h4><p>A useful cryptanalytic model should survive attempts to break it. So I tested the hypothesis in several different ways.</p><p><strong>Random differential tests<br></strong>For random keys and random pairs of plaintext blocks, the output differences were compared against the same input differences under a reference key.</p><p><strong>Cross-key tests<br></strong>The same input difference was encrypted under two unrelated keys. If M is key-independent, the resulting output difference should be identical.</p><p><strong>Single-bit basis vectors<br></strong>Every one of the 256 individual input bits was tested.</p><p><strong>Structured counter sweep<br></strong>The real vault did not feed arbitrary blocks into the cipher. Its inputs had the structure:</p><p><strong><em>innerHeader || 12 zero bytes || BE32(counter)</em></strong></p><p>So I also tested the exact region of the input space relevant to the actual vault.</p><h4>What Those Tests Prove</h4><p>The S-box result is exhaustive. Every possible byte input was checked. The complete cipher result is not. A 256-bit input space contains 2²⁵⁶ possible values. So I do not describe the complete cipher as mathematically proven to be affine.</p><p>The accurate statement is:</p><p><strong><em>Under the tested conditions, the complete cipher behaved consistently with an affine model, with no observed failures across multiple random, cross-key, basis-vector, and structured tests.</em></strong></p><p>That conclusion was later strengthened by successful end-to-end decryption and synthetic cross-validation.</p><h4>Recovering the Transformation</h4><p>Once the affine model held up, the next step was learning M. A linear transformation is completely determined by what it does to its basis vectors. For a 256-bit input, there are 256 basis vectors. Using a zero key, each matrix column can be recovered from:</p><p><strong><em>M(e_j) = E(0, e_j) XOR E(0, 0)</em></strong></p><p>So the full transformation required:</p><ul><li>1 baseline query</li><li>256 basis-vector queries</li></ul><p>That reconstructed the entire 256×256 GF(2) mapping.</p><p>The real vault inputs only changed in the final 32-bit counter. That means the attack did not actually require the complete 256-dimensional transformation.</p><p>Only the 32-dimensional counter subspace mattered.</p><p>A minimal exploit therefore needed:</p><ul><li>1 baseline</li><li>32 basis vectors</li></ul><p>I intentionally reconstructed the full matrix anyway because it made the model easier to test, validate, and document.</p><h4>Stage 4 — Making the Master Password Irrelevant</h4><p>Now the earlier pieces finally came together. The client derived its inner encryption key using <strong><em>PBKDF2-HMAC-SHA256</em></strong>:</p><p><strong><em>inner_key = PBKDF2-HMAC-SHA256(password, salt, iterations, 32 bytes)</em></strong></p><p>Normally, an unknown password would stop the attack here. But the key itself no longer needed to be recovered. The inner cipher generated keystream blocks using inputs like:</p><p><strong><em>input_i = inner_header || 12 zero bytes || counter</em></strong></p><p>Only the counter changed from one block to the next. And the first plaintext block was completely predictable: <strong><em>SABLEFORT_KEYVAULT_V1 </em></strong>followed by zero padding.</p><p>That gives us the first keystream block immediately:</p><p><strong><em>KS0 = C0 XOR P0<br></em></strong>where:<br><strong><em>C0 = first ciphertext block<br>P0 = known first plaintext block<br>KS0 = first keystream block</em></strong></p><p>Now apply the affine model.</p><p>Because: <br><strong><em>E(k, input_i) XOR E(k, input_0) = M · (input_i XOR input_0)</em></strong></p><p>the keystream for any other counter can be derived as:<br><strong><em>KSi = KS0 XOR M · (input_i XOR input_0)<br></em></strong>The unknown key-dependent offset cancels.</p><p>Once KSi is known:<br><strong><em>Pi = Ci XOR KSi<br></em></strong>And that decrypts the block.</p><h4>The result of the attack:</h4><p>The password-derived key was never recovered. The cipher structure made it possible to reconstruct the keystream without it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MD0kkNjQKDDnmlXTZleopA.png" /><figcaption>The attack reconstructs the keystream instead of recovering the key.</figcaption></figure><h4>Beyond the Challenge Instance</h4><p>The result against the real vault was straightforward to validate: the recovered plaintext contained the fifth and final flag, and OffSec accepted it. That established the practical result. The it-shared vault had been decrypted successfully without recovering the master password or its derived inner key.</p><p>The remaining question was different: was the method specific to that one vault, or was I actually exploiting a structural property of the implementation?</p><p>To test that, I generated a synthetic vault with a random inner key, a different vault ID, different inner and outer headers, and a different JSON payload. I encrypted it through the original native implementation and then applied the same attack.</p><p>The recovered payload matched the original exactly:</p><p><em>MATCH: True</em></p><p>The accepted challenge flag and the synthetic test answer two different questions. The first confirms that the attack worked against the real Vaultfall target. The second shows that the method was not dependent on the specific it-shared key, headers, or payload. That gave me considerably more confidence that I was looking at a property of the cipher construction rather than a coincidence tied to one challenge instance.</p><h4>Where the Evidence Stops</h4><p>There are still boundaries to that conclusion.</p><p>Only one non-empty real challenge vault was available. The attack assumes the same V1 envelope structure and a predictable first plaintext block. The static outer wrapping value must also remain unchanged or be extracted again from the client.</p><p>The cryptanalytic claims have an important boundary as well.</p><p>The S-box result is exhaustive: every possible byte input was checked. The affine behavior of the complete 256-bit cipher is not. It survived the random differential tests, the cross-key tests, every single-bit basis vector, the structured counter sweep, the real vault decryption, and the independent synthetic test.</p><p>That is strong empirical evidence.</p><p><strong>It is not an exhaustive proof over a 2²⁵⁶ input space.</strong></p><p>For the attack, that distinction does not change the result. The cipher behaved consistently enough with the model to reconstruct the keystream and recover the complete target vault. But keeping the distinction matters. “The exploit works” and “I have mathematically proven this property for every possible input” are different claims.</p><h4>Why the “Zero-Knowledge” Design Failed</h4><p>The intended security model sounded reasonable.</p><ul><li>The master password stays on the client.</li><li>Encryption happens locally.</li><li>The server stores only ciphertext.</li></ul><p>All of those statements were true. The problem was everything they implicitly depended on.</p><p>The encrypted vault was retrievable without authentication. The outer layer relied on a static value embedded in every client. The proprietary inner cipher had a structural weakness that made its differential behavior predictable. The plaintext format supplied a known first block, which exposed the first keystream block. From there, the learned transformation was enough to derive the remaining keystream.</p><p>The master password itself never needed to be attacked. That is the part that matters.</p><p>A password can be long, random, and effectively impossible to brute-force and still provide no useful protection if the surrounding cryptographic construction allows an attacker to bypass it.</p><p>So the statement “the server only stores ciphertext” remained technically correct.</p><p>It just was not a meaningful security guarantee anymore.</p><h4>What I Would Change</h4><p>The proprietary cipher should not be repaired. It should be removed.</p><p>A vault like this should use a standard authenticated-encryption construction such as AES-GCM or ChaCha20-Poly1305 rather than relying on custom cryptography. A modern password KDF such as Argon2id would also be preferable, but it is important to separate that from the actual failure. PBKDF2 was not brute-forced here. The derived key was bypassed entirely. Replacing the KDF alone would therefore not address the core issue.</p><p>The static wrapping value should disappear for the same reason. Anything distributed identically to every client should be assumed recoverable. It is not a useful place to establish a security boundary.</p><p>Vault retrieval should also require authentication and authorization even if the stored object is encrypted, and the encryption itself should provide integrity through an authenticated mode rather than relying on recognizable plaintext structure as a sanity check.</p><p>The LLM finding follows essentially the same architectural principle. A public model should not receive privileged information and then be trusted to decide whether it is allowed to disclose it. Sensitive retrieval and authorization belong outside the model.</p><h4>Following the Chain</h4><p>The LLM exposed the distribution infrastructure. The FTP isolation failure exposed the client. The client exposed the native implementation. The native implementation exposed the cryptographic assumptions. The known plaintext and predictable counter structure turned those assumptions into a practical attack.</p><p>Each finding changed what was possible next.</p><p>That is also why looking at any of them in isolation understates the actual impact. The LLM disclosure was not “just information disclosure” once that information identified a useful internal service. The FTP issue was not “just excessive file access” once it exposed the security-critical client implementation. And the weak cipher was not merely an academic cryptographic flaw once the surrounding format gave the attacker exactly the structure needed to exploit it.</p><p>The compromise lived in the transitions.</p><h4>Zero Knowledge Is a System Property</h4><p>That is ultimately what Vaultfall demonstrated best. A strong password does not compensate for weak cryptography. Client-side encryption does not guarantee confidentiality simply because the server never sees the password. Ciphertext is not automatically safe to expose. And an LLM instruction is not an authorization boundary. Security properties emerge from the complete system and from the assumptions connecting its components. Vaultfall broke because several of those assumptions were individually reasonable-looking but collectively false.</p><p>The server really did store ciphertext.<br>The password really did stay on the client.<br>The public support interface really was just a support interface.</p><p>But in the end none of those facts prevented the compromise.</p><p>Once the chain was followed far enough, the master password simply stopped mattering.</p><p>It is whether the assumptions connecting those components still hold once somebody starts testing them.</p><p>That is where Vaultfall broke.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e7a7af0d9b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CTF Write-Up: Breaking Cryptoclock — A Predictable PRNG and the Ticking Time Bomb Seed]]></title>
            <link>https://not4a6f7365.medium.com/ctf-write-up-breaking-cryptoclock-a-predictable-prng-and-the-ticking-time-bomb-seed-631ce555ad2b?source=rss-e481c275ef6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/631ce555ad2b</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[nahamcon-ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Not4a6f7365]]></dc:creator>
            <pubDate>Sun, 25 May 2025 20:41:16 GMT</pubDate>
            <atom:updated>2025-05-27T20:07:39.504Z</atom:updated>
            <content:encoded><![CDATA[<h3>NahamCon CTF 2025 - Cryptoclock Write-Up</h3><p>In NahamCon CTF 2025, the challenge “Cryptoclock”, quickly revealed its nature through a suspiciously deterministic XOR cipher powered by Python’s `random` module. With the servers source code in hand, we uncovered a common vulnerability: predictable output due to poor seeding. That’s how we used the `time.time()` seed to fully recover the flag.</p><h4>Recon – Understanding the Server Logic</h4><p>We were provided with the `server.py` source, revealing a Python TCP server that exposes two critical functionalities:</p><h4>Initial Flag Disclosure (Encrypted):</h4><ul><li>Reads the flag from `flag.txt`.</li><li>Captures the current Unix timestamp using `int(time.time())`.</li><li>Seeds the PRNG with that timestamp.</li><li>Generates a pseudo-random key of the same length as the flag.</li><li>Encrypts the flag using byte-wise XOR.</li><li>Sends the result to the client as a hex string.</li></ul><h4>Interactive Oracle:</h4><ul><li>Accepts arbitrary user input (until the string ‘quit’ is sent).</li></ul><p>Repeats the same key generation process using the *original* timestamp.</p><ul><li>XORs the input with the regenerated key.</li><li>Sends back the result in hex form.</li></ul><h4>Key Functionality – Pseudo-Random Key Generator</h4><pre>```<br>def generate_key(length: int, seed: Optional[float] = None) -&gt; bytes:<br>    &quot;&quot;&quot;Generate a random key of given length using the provided seed.&quot;&quot;&quot;<br>    if seed is not None:<br>        random.seed(int(seed))  # Seed resets every time<br>    return bytes(random.randint(0, 255) for _ in range(length))</pre><p>The critical insight is that the random.seed() call uses a static current_time captured only once at server startup. This means both the flag encryption and our interactive inputs are encrypted with the same deterministic key stream.</p><h4>Exploitation Strategy Recovering the PRNG Seed</h4><p>Key Assumptions:</p><ul><li>The server’s current_time is approximately known (e.g., from CTF server metadata, or the time we received the encrypted flag).</li><li>The PRNG output is predictable when seeded with an integer timestamp.</li><li>The XOR cipher is symmetric and reversible.</li></ul><h4>Plan of Attack:</h4><p>1. Capture Encrypted Flag:<br>Extract the encrypted flag from the server&#39;s initial response.<br>2. Send Known Plaintext:<br>Submit a known string like &#39;A&#39; * len(flag) to the encryption oracle.<br>3. Get Encrypted Response:<br>Receive XOR of the known plaintext with the same pseudo-random key used on the flag.<br>4. Brute-Force Timestamp Seed:<br>Within a small time window (±5 seconds of estimated server time), generate keys and compare them against the response to find the matching seed.<br>5. Recover Full Key:<br>Once the seed is found, re-generate the exact key used to encrypt the flag.<br>6. Decrypt the Flag:<br>XOR the encrypted flag with the recovered key to retrieve the plaintext.</p><h4>Implementation – Timestamp Brute Forcing in Python</h4><pre>import time<br>import random<br>from typing import Optional<br><br>def generate_key(length: int, seed: Optional[int] = None) -&gt; bytes:<br>    if seed is not None:<br>        random.seed(seed)<br>    return bytes(random.randint(0, 255) for _ in range(length))<br><br>def xor_bytes(data1: bytes, data2: bytes) -&gt; bytes:<br>    return bytes(a ^ b for a, b in zip(data1, data2))<br><br># Assume these come from the server:<br>encrypted_flag_hex = &quot;...&quot;  # server&#39;s encrypted flag (hex string)<br>oracle_response_hex = &quot;...&quot;  # server&#39;s XORed response to known input<br>known_plaintext = b&quot;A&quot; * len(bytes.fromhex(encrypted_flag_hex))<br><br>encrypted_flag = bytes.fromhex(encrypted_flag_hex)<br>oracle_response = bytes.fromhex(oracle_response_hex)<br><br># Brute-force around expected server time<br>approx_time = int(time.time())  # replace with actual approximate time<br>for t in range(approx_time - 10, approx_time + 10):<br>    candidate_key = generate_key(len(known_plaintext), seed=t)<br>    if xor_bytes(known_plaintext, candidate_key) == oracle_response:<br>        print(f&quot;[+] Found seed: {t}&quot;)<br>        recovered_flag = xor_bytes(encrypted_flag, candidate_key)<br>        print(&quot;[+] Flag:&quot;, recovered_flag.decode(errors=&#39;replace&#39;))<br>        break</pre><p>This method succeeds as long as the actual timestamp is within a small window of what we assume.</p><h4>Lessons Learned – The Danger of Time-Based Seeds</h4><p>Weak entropy sources like timestamps lead to predictable key generation, particularly when:</p><ul><li>The seed is reused across multiple operations.</li><li>The output is directly XORed without additional entropy or KDFs.</li><li>The attacker has even partial knowledge of the plaintext.</li></ul><p>This is a textbook example of why PRNGs like Python’s random module are not suitable for cryptographic use. Strong randomness demands CSPRNGs with non-predictable seeds typically sourced from secure system entropy.</p><p>What made this challenge rewarding wasn’t the XOR or the PRNG itself, it was the realization that a single int(time.time()) was the only thing guarding the flag. By combining basic timestamp analysis with known plaintexts and deterministic PRNG behavior, we were able to fully compromise the system.</p><p>In CTFs, sometimes all it takes to break the clock is to guess when it started ticking.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=631ce555ad2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NahamconCTF2025 — The Accidental Screenshot and the Encrypted Flag]]></title>
            <link>https://not4a6f7365.medium.com/nahamconctf2025-the-accidental-screenshot-and-the-encrypted-flag-d838cf6cc5d0?source=rss-e481c275ef6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d838cf6cc5d0</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[nahamcon-ctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Not4a6f7365]]></dc:creator>
            <pubDate>Sun, 25 May 2025 20:11:48 GMT</pubDate>
            <atom:updated>2025-06-08T14:59:25.723Z</atom:updated>
            <content:encoded><![CDATA[<h3>NahamconCTF2025 The Accidental Screenshot and the Encrypted Flag</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qyCGYmwm9E-NVvJlvvMfig.png" /><figcaption>screenshot.png</figcaption></figure><p>Durring the NahamCon CTF 2025 we were presented with a curious “accidental” screenshot that showed a hex dump. Apparently from someone opening a flag.zip file in a text editor. We also were told that the password was simply password.</p><h3>Understanding the Hex Dump</h3><p>Our first step was to carefully dissect the screenshot, which appeared to show a portion of a ZIP file in raw hexadecimal.</p><p>The presence of ZIP file signatures made things clear:</p><ul><li>504B 0304: Local file header (start of a ZIP file entry)</li><li>504B 0102: Central directory file header</li></ul><p>This confirmed we were looking at a valid ZIP archive fragment.</p><h3>Detecting Encryption</h3><p>Multiple indicators confirmed the file was encrypted using WinZip AES:</p><ul><li>The <strong>General Purpose Bit Flag</strong> had its least significant bit set, indicating encryption.</li><li>The <strong>Compression Method</strong> was 0x0063 (decimal 99), which is WinZip&#39;s marker for AES encryption.</li><li>The ZIP’s <strong>Extra Field (ID 0x9901)</strong> provided key details:</li><li>AES Encryption Strength: 256-bit (AE-2)</li><li>Compression: “Store” (meaning no compression before encryption)</li></ul><h3>Extracted Cryptographic Components</h3><p>We pulled out the following data directly from the dump:</p><ul><li><strong>Salt (16 bytes):</strong><br> 3d42ffd1b35f95031424f68b65c3f576</li><li><strong>Password Verifier (2 bytes):</strong><br> 69f1</li><li><strong>Encrypted Payload (39 bytes):</strong><br> 4e8df0003fe240b3ac3364859e4c2dbc3c36f2d4acc403761385afe4e3f90fbd29d91b614ba2c6</li><li><strong>HMAC Authenticator (10 bytes):</strong><br> efde11b71bcc907a72ed</li></ul><p>The End of Central Directory (EOCD) record was malformed, with the CD size and offset seemingly misaligned. While interesting, this became less relevant once we obtained the correct password.</p><h3>Reconstructing the Archive</h3><p>Using xxd -r -p, we converted the hex string into a binary file named flag.zip, roughly 239–240 bytes in size. This represented the portion of the ZIP file shown in the screenshot.</p><ul><li>Using unzip failed with version errors (PK compat. v5.1) and EOCD problems.</li><li>7z e flag.zip produced header warnings and data after EOF errors, but importantly, it prompted for a password—confirming partial structure recognition.</li></ul><p>With the password now revealed, the next obstacle was the corrupted structure of the ZIP file itself. Standard tools failed, so we took a more manual route: decrypting the contents directly using the extracted cryptographic values.</p><h3>Manual Decryption Using Python</h3><p>Due to the malformed ZIP structure, we implemented a custom decryption routine using pycryptodome, replicating the WinZip AES-256 (AE-2) process.</p><p><strong>1. Key Derivation</strong></p><p>Using PBKDF2 with HMAC-SHA1, we derived 66 bytes of key material:</p><ul><li>32 bytes: AES encryption key</li><li>32 bytes: HMAC-SHA1 key</li><li>2 bytes: Password verifier</li></ul><p>The derivation parameters were:</p><ul><li>Password: &quot;password&quot;</li><li>Salt: 16 bytes</li><li>Iterations: 1000</li></ul><p><strong>2. Password Verification</strong></p><p>We compared the derived 2-byte password verifier with the one from the archive (69f1). A match confirmed the password was correct.</p><p><strong>3. AES Decryption (CTR Mode)</strong></p><p>Using AES in CTR mode, with a little-endian 128-bit counter initialized to 1, we decrypted the 39-byte ciphertext.</p><p><strong>4. HMAC Integrity Check</strong></p><p>We generated an HMAC-SHA1 over the decrypted data using the derived HMAC key. The first 10 bytes matched the provided authenticator, verifying data integrity.</p><p>Here is the Python script used for the decryption:</p><pre>import hashlib<br>from Cryptodome.Cipher import AES<br>from Cryptodome.Hash import HMAC, SHA1<br>from Cryptodome.Util import Counter<br>import binascii<br><br>password_str = &quot;password&quot;<br>salt_hex = &quot;3d42ffd1b35f95031424f68b65c3f576&quot;<br>pw_verifier_hex_from_zip = &quot;69f1&quot;<br>encrypted_data_hex = &quot;4e8df0003fe240b3ac3364859e4c2dbc3c36f2d4acc403761385afe4e3f90fbd29d91b614ba2c6&quot;<br>hmac_authenticator_hex_from_zip = &quot;efde11b71bcc907a72ed&quot;<br>salt_bytes = binascii.unhexlify(salt_hex)<br>pw_verifier_bytes_from_zip = binascii.unhexlify(pw_verifier_hex_from_zip)<br>encrypted_data_bytes = binascii.unhexlify(encrypted_data_hex)<br>hmac_authenticator_bytes_from_zip = binascii.unhexlify(hmac_authenticator_hex_from_zip)<br>password_bytes_utf8 = password_str.encode(&#39;utf-8&#39;)<br>derived_keys = hashlib.pbkdf2_hmac(&#39;sha1&#39;, password_bytes_utf8, salt_bytes, 1000, dklen=66)<br>aes_key = derived_keys[0:32]<br>hmac_key = derived_keys[32:64]<br>derived_verifier = derived_keys[64:66]<br>if derived_verifier != pw_verifier_bytes_from_zip:<br>    print(&quot;Password verification failed.&quot;)<br>    exit(1)<br>ctr = Counter.new(128, initial_value=1, little_endian=True)<br>cipher = AES.new(aes_key, AES.MODE_CTR, counter=ctr)<br>decrypted_data = cipher.decrypt(encrypted_data_bytes)<br>hmac_obj = HMAC.new(hmac_key, decrypted_data, digestmod=SHA1)<br>if hmac_obj.digest()[:10] != hmac_authenticator_bytes_from_zip:<br>    print(&quot;HMAC verification failed.&quot;)<br>    exit(1)<br>print(&quot;Decrypted Flag:&quot;)<br>print(decrypted_data.decode(&#39;utf-8&#39;, errors=&#39;replace&#39;))</pre><p>With the password and crypto logic in place, the script successfully decrypted the 39-byte payload, confirmed the HMAC, and revealed the contents of flag.txt. The flag was valid and submitted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*PvorB8OXE6uhpcC6SE-Uzg.png" /></figure><p>In CTFs, it’s common to deal with malformed files and red herrings. Being able to work around these issues with direct analysis and low-level scripting often makes the difference.</p><p>When the structure is broken, raw crypto wins.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d838cf6cc5d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Animated GIFs in fastfetch]]></title>
            <link>https://not4a6f7365.medium.com/animated-gifs-in-fastfetch-a905e395c765?source=rss-e481c275ef6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a905e395c765</guid>
            <category><![CDATA[pewdiepie]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Not4a6f7365]]></dc:creator>
            <pubDate>Sun, 11 May 2025 09:53:46 GMT</pubDate>
            <atom:updated>2025-06-10T02:13:13.317Z</atom:updated>
            <content:encoded><![CDATA[<p>After watching PewDiePie&#39;s riced-out Arch setup, I thought:</p><p>&gt; “Okay, it&#39;s time to make my Arch look cool too.”</p><p>I mainly work in Python, PHP and some JS (with a bit of C# history), so diving into C for this was a fun challenge. What started as a whim turned into adding animated GIF support to Fastfetch, powered by the Kitty terminal. It&#39;s not perfect but it works for me, and I hope it inspires you to tinker too. After all, Linux is all about the freedom to change, break, and enhance your system exactly how you like it.</p><h4>Why Animated GIFs?</h4><p>Fastfetch is a popular and fast, minimal Neofetch alternative for showing system info in your terminal. It already handles static images nicely, but I craved a little extra flair. Animated logos that dance alongside my CPU and memory stats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*fSZNm0RfShwXXRNa50sQxw.gif" /></figure><p>Kitty Terminal (v0.22+) has a neat trick up its sleeve: kitty +kitten icat</p><p>This command can display images, even animated GIFs, right inside your terminal window. Perfect playground for a quick hack!</p><h4>How It Works (High Level)</h4><ol><li>Detect a GIF<br>If your logo file ends in .gif and you pass --logo-animate, Fastfetch switches into animation mode.</li><li>Tell Fastfetch the Space Needed<br>Before drawing, it calculates how much width/height the GIF will take so your text never overlaps.</li><li>Invoke Kitty’s ICAT<br>It moves the cursor with an ANSI escape, runs kitty +kitten icat with sizing and positioning flags, then resets the cursor for the rest of the output.</li></ol><h4>You can try it yourself</h4><ol><li>Clone and Build</li></ol><pre>git clone https://github.com/Maybe4a6f7365/fastfetch-gif-support.git<br>cd fastfetch-gif-support<br>mkdir build &amp;&amp; cd build<br>cmake ..<br>make<br>sudo make install</pre><ol><li>Run with Your GIF</li></ol><pre>fastfetch \<br> --logo-source ~/my-animated-logo.gif \<br> --logo-type kitty-direct \<br> --logo-animate</pre><p>3. Optional Tweaks</p><pre>--logo-width 40 --logo-padding-left --logo-position top</pre><p>This is by no means a production-ready feature but it&#39;s proof that with Linux you can bend tools to your will. A bit of C programming, and you&#39;ve got an animated terminal that stands out.</p><p>So go ahead, break things, build cool stuff.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a905e395c765" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NahamCon CTF 2024: Magic RSA Challenge Write-Up]]></title>
            <link>https://not4a6f7365.medium.com/nahamcon-ctf-2024-magic-rsa-challenge-write-up-18793102e7ee?source=rss-e481c275ef6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/18793102e7ee</guid>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[rsa-algorithm]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nahamcon-ctf]]></category>
            <dc:creator><![CDATA[Not4a6f7365]]></dc:creator>
            <pubDate>Sun, 26 May 2024 16:56:14 GMT</pubDate>
            <atom:updated>2024-05-27T20:08:06.389Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>The MagicRSA challenge, featured in NahamCon 2024, presented a task of decrypting a ciphertext encrypted using RSA encryption with a small exponent (e=3). We were provided with a Python script that generated a semiprime modulus (N) and encrypted a plaintext message using RSA encryption. The challenge required recovering the original plaintext without knowledge of the private key.</p><blockquote><strong>RSA Encryption (simplified):</strong> Firstly, two large prime numbers are chosen and multiplied together, resulting in a significantly large number called the modulus (N). Secondly, another number, known as the encryption exponent (e), is paired with our public key, which is openly shared. On the other hand, the private key holds the decryption exponent (d), completing the encryption-decryption process.</blockquote><p>Initial research suggested the potential use of a cube root attack.</p><p><strong>Cube Root Attack</strong></p><p>The cube root attack is a cryptanalytic technique that exploits a vulnerability in the RSA cryptosystem when the public exponent is set to a small value, typically 3. It uses the mathematical property that taking the cube root of a number raised to the power of 3 returns the original number. This means we can decrypt the message because the low exponent <em>e</em>=3 allows taking the cube root over the integers.</p><p>In practical terms, this attack works when the ciphertext is small enough that the cube root of the ciphertext modulo <em>𝑁</em> (the modulus) can be taken directly. Essentially, if <em>𝑐</em> is the ciphertext, <em>𝑁</em> is the modulus, and <em>e=3</em>, then:</p><blockquote>𝑐 ≡ 𝑚 3 mod 𝑁</blockquote><blockquote>If 𝑚 3 &lt; 𝑁 , then:</blockquote><blockquote>𝑚 = 𝑐 3​</blockquote><p>By computing the cube root of 𝑐, we can directly retrieve the original message 𝑚. This attack is efficient when 𝑚 is relatively small, making it a significant vulnerability in certain RSA implementations where 𝑒 is set to a low value like 3.</p><p><strong>Implementation of the Attack</strong></p><p>First things first, we need to set up our environment by importing the necessary libraries. We’ll use `<em>gmpy2</em>` for streamlined integer manipulation, ensuring our calculations run smoothly. Additionally, we’ll rely on `<em>Crypto.Util.number</em>` for essential conversion functions that’ll aid in our decryption process.</p><p>With our libraries in place, we’ll craft a function to execute the cube root attack. This function is the heart of our decryption strategy. It’ll systematically iterate through each element of the ciphertext, employing a mathematical technique to compute the cube root modulus N. This operation effectively reverses the encryption process, yielding the original plaintext. Furthermore, we’ll ensure the decrypted values are converted into a readable format by encoding them into bytes.</p><pre>import gmpy2<br>from Crypto.Util.number import long_to_bytes<br># ciphertext and modulus<br>ciphertext = [1061208, 1259712, 912673, 1092727, 1860867, 175616, 166375, 941192, 185193, 1030301, 941192, 185193, 912673, 140608, 175616, 185193, 140608, 941192, 970299, 1061208, 175616, 912673, 117649, 912673, 185193, 148877, 912673, 125000, 110592, 1030301, 132651, 132651, 1061208, 117649, 117649, 1061208, 166375, 1953125]<br>N = 292661735803169078279687796534368733968232055929694715453717384181208539846645017378459508481927733219065809706996972833902743250671173212610674572380079245835772007065919936022084401497853611610920914306013040436502207047619016113234947051878549793269852855316328078769491183468515501156324665790842023112309668506350354977653838139155232422868462129041940364012648613391176971689126513558396465218392059219609662829793504680423032430634001779369250142543104703669906030549585514247663929431837546466696121103600101025434247152431200408744676625328330247569014313252820778269086840631297075563756934662979588351413726196027845505808290890109883253252054958997436359016852222176230489468164288277709046892991459049248340800616885136366469783271661343653314539194467688757972713531491290238432270971346559967725437118531023032768463200227986539449334624183071042562539584305305367245588508498775214112729500313280502474837332653452065755426475638743763861804587979560695676963674789819860296303566053542883415223272958687917330474367563315425617320128680682444959701586681495270336801802382200546403246134181793704030611664095075430115127507174884551339452808218398863888817<br># Function to perform cube root attack<br>def cube_root_attack(ciphertext, N):<br> decrypted = []<br> for c in ciphertext:<br> # Calc. the cube root of the ciphertext modulo N<br> m = gmpy2.iroot(c, 3)[0]<br> # Convert the decrypted value to bytes<br> decrypted.append(long_to_bytes(m))<br> return decrypted<br># Perform cube root attack to decrypt the ciphertext<br>decrypted_plaintext = cube_root_attack(ciphertext, N)<br># Print the decrypted plaintext<br>for pt in decrypted_plaintext:<br> print(pt.decode(), end=&#39;&#39;)</pre><p>Once our function is defined, we’ll put it into action. By calling the <em>cube_root_attack </em>function and supplying it with the ciphertext and modulus, we’ll start the decryption process.</p><figure><img alt="flag.txt" src="https://cdn-images-1.medium.com/max/601/1*mbI7CaBgJSWLnn_LgzFymA.png" /><figcaption>flag.txt</figcaption></figure><p>Finally, after successfully decrypting the ciphertext, we’ll get the decrypted plaintext containing the flag.</p><p><strong>Conclusion:</strong></p><p>The cube root attack demonstrates a practical approach to decrypting RSA ciphertext when encrypted with a small exponent. It highlights the importance of selecting appropriate cryptographic parameters to ensure robust security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18793102e7ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NahamCon CTF 2024: Brain-Melt-2 Challenge Write-Up]]></title>
            <link>https://not4a6f7365.medium.com/nahamcon-ctf-2024-brain-melt-2-challenge-write-up-071435bbb75c?source=rss-e481c275ef6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/071435bbb75c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[python-scripting]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Not4a6f7365]]></dc:creator>
            <pubDate>Sun, 26 May 2024 12:12:03 GMT</pubDate>
            <atom:updated>2024-05-26T15:34:16.172Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Challenge Overview</strong></p><p>The Brain-Melt-2 challenge required us to reverse engineer a Python bytecode file, decompile it, analyze the decompiled source code, and create a custom script to decrypt embedded data and reveal the flag. This challenge tested our skills in reverse engineering, cryptography, and Python scripting.</p><p><strong>Obtaining the Challenge File</strong></p><p>We started with a provided file named brain-melt-2.pyc. This file was a compiled Python bytecode file that needed to be decompiled.</p><p><strong>Decompiling the Bytecode File</strong></p><p>To decompile the brain-melt-2.pyc file, we used the uncompyle6 tool. This tool converts Python bytecode files back into readable Python source code.</p><pre>uncompyle6 -o . brain-melt-2.pyc</pre><p><strong>Analyzing the Decompiled Code</strong></p><p>Once we decompiled it, we took a close look at the Python source code. Within the code, we discovered multiple decryption functions, suggesting that our objective was to unravel these processes in order to uncover a concealed key.</p><p><strong>Understanding How the Decryption Works:</strong></p><ol><li><strong><em>Base64 Decoding</em></strong>: This function handles the conversion of base64 encoded strings back to their original text. It starts by decoding the base64 string, ensuring that any missing padding characters are added to maintain data integrity. Then, it proceeds to decode the string into plain text, making it readable and understandable.</li><li><strong><em>Caesar Cipher Decryption:</em></strong> This function relies on a classic encryption method called the Caesar cipher. In this technique, each character in the encrypted text is shifted by a fixed number of positions to reveal the original message. By figuring out the specific shift used, we can effectively decrypt the ciphertext and uncover the plaintext message.</li><li><strong><em>Salsa20 Decryption</em></strong>: This function utilizes the advanced Salsa20 encryption algorithm to decrypt data. Salsa20 is esteemed for its robust security measures and effectiveness in managing encrypted data. Decryption with Salsa20 necessitates both a key and a nonce (a unique number employed just once). By supplying the correct key and nonce, we can successfully decrypt the ciphertext and reveal the original information hidden within.</li></ol><p><strong>Writing the Custom Decryption Script</strong></p><p>To create our custom decryption script, we had to put our coding skills to the test. We needed to understand the inner workings of each decryption method and then write code to reverse those processes.</p><p><strong>In this case, we came across three main decryption techniques: base64 decoding, Caesar cipher decryption, and Salsa20 decryption.</strong></p><ul><li>For base64 decoding, we had to write a function to handle those encoded strings. The goal was to strip away any added padding and restore the original plaintext.</li><li>For the Caesar cipher, the focus was on rearranging characters. We had to develop a function to reverse the encryption process and bring the characters back to their original positions.</li><li>For Salsa20 decryption, the challenge was notably more complex. To overcome this hurdle, we crafted a specialized decryption function named <em>decrypt3</em>. This function was designed to handle both the encrypted data and its corresponding key as inputs.</li></ul><pre>import base64<br>from Crypto.Cipher import Salsa20<br><br>def decrypt1(data):<br>    decoded = &quot;&quot;<br>    for i in range(0, len(data), 2):<br>        chunk = data[i:i+2] + &quot;==&quot;<br>        decoded += base64.b64decode(chunk).decode(&quot;ascii&quot;)<br>    return decoded<br><br>def decrypt2(data, shift):<br>    result = &quot;&quot;<br>    for char in data:<br>        result += chr((ord(char) - ord(&#39;a&#39;) + shift) % 26 + ord(&#39;a&#39;))<br>    return result<br><br>def decrypt3(data, key):<br>    msg_nonce = data[:8]<br>    ciphertext = data[8:]<br>    cipher = Salsa20.new(key=key.encode(&#39;utf-8&#39;), nonce=msg_nonce)<br>    return cipher.decrypt(ciphertext).decode(&#39;utf-8&#39;)<br><br>part1 = decrypt1(&quot;ZgbAYQZwewMAOAZQOQYwYwNQYgMA&quot;)<br>part2 = decrypt2(&quot;fwvcttjsfvrshwsg&quot;, 17)<br>encrypted_data = b&#39;\x97p#2\x1abw\x0f\x9a\xd1Z\x04b\x93\xa1h8]\xab\xa3\x9e7\xc9\xe8\x9b&#39;<br>key = part1 + part2 + &quot;25dbd4f362f7d0e64b24ab231728a1fc&quot;<br>decrypted_message = decrypt3(encrypted_data, key)<br>print(decrypted_message)</pre><p><strong>Running the Script</strong></p><p>We executed the script, which combined all the decryption steps. This allowed us to reveal the hidden flag and successfully solve the challenge.</p><pre>python decryption_script.py</pre><p><strong>The script output the decrypted message, which contained the </strong>flag{example_flag_value}</p><p><strong>Conclusion</strong></p><p>The challenge took advantage of flaws in the encryption and decryption processes. By reverse engineering the decompiled bytecode, we were able to understand the decryption logic and create a custom script to retrieve the sensitive key. This highlights the importance of secure encryption practices and the risks of embedding sensitive data in code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=071435bbb75c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>