<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Writeup on Anthrace | CTF Writeups</title><link>https://anthr4ce.github.io/tags/writeup/</link><description>Recent content in Writeup on Anthrace | CTF Writeups</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 11 Jan 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://anthr4ce.github.io/tags/writeup/index.xml" rel="self" type="application/rss+xml"/><item><title>UofTCTF 2026 - WEB Pasteboard</title><link>https://anthr4ce.github.io/ctf-writeups/uoftctf-2026/</link><pubDate>Sun, 11 Jan 2026 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/uoftctf-2026/</guid><description>&lt;hr&gt;&#10;&lt;h1 id="web-challenge-----dom-clobbering--csp-bypass--rce-of-seleniums-webdriver-bidi-protocol"&gt;&#10; Web Challenge - - DOM clobbering + CSP bypass + RCE of Selenium&amp;rsquo;s WebDriver BiDi protocol&#10; &lt;a class="heading-link" href="#web-challenge-----dom-clobbering--csp-bypass--rce-of-seleniums-webdriver-bidi-protocol"&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;It&amp;rsquo;s been a while since I had that much fun with a client-side challenge.&lt;/p&gt;&#10;&lt;p&gt;Pasteboard is a note-sharing web application where users can create and view notes. The challenge includes an admin bot that visits reported notes, so right off the bat I knew we were dealing with some client-side shenanigans.&lt;/p&gt;</description></item><item><title>BrunnerCTF 2025 - WEB Recipe for Disaster</title><link>https://anthr4ce.github.io/ctf-writeups/brunnerctf-2025/web/</link><pubDate>Sun, 24 Aug 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/brunnerctf-2025/web/</guid><description>&lt;hr&gt;&#10;&lt;p&gt;This challenge demonstrates a classic prototype pollution vulnerability that leads to remote code execution through PATH hijacking. We exploit a dangerous &lt;code&gt;deepMerge&lt;/code&gt; function to pollute &lt;code&gt;Object.prototype.env&lt;/code&gt;, hijack the system&amp;rsquo;s PATH variable, and execute a malicious binary disguised as the legitimate &lt;code&gt;zip&lt;/code&gt; command.&lt;/p&gt;&#10;&lt;h2 id="overview--attribution"&gt;&#10; Overview &amp;amp; Attribution&#10; &lt;a class="heading-link" href="#overview--attribution"&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;When I first tackled this challenge, I had a gut feeling we were dealing with prototype pollution. But the real “enlightment” moment came when I found an epic writeup &lt;strong&gt;Mizu&lt;/strong&gt; at &lt;a href="https://mizu.re/post/infinite-mario" class="external-link" target="_blank" rel="noopener"&gt;mizu.re&lt;/a&gt;. This absolute legend in the web security game, and his breakdown of a similar exploit was like finding the perfect recipe for this challenge. If you’re into this stuff, you have to check out Mizu’s work. His DOMPurify research is really insane.&#10;Huge props to them for sharing knowledge that helps us all level up!&lt;/p&gt;</description></item><item><title>HackDay - Stegano</title><link>https://anthr4ce.github.io/ctf-writeups/hackday/stegano/</link><pubDate>Wed, 30 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/hackday/stegano/</guid><description>&lt;hr&gt;&#10;&lt;p&gt;In this challenge, we are provided with a &lt;code&gt;.wav&lt;/code&gt; file that, at first glance, appears to be a simple audio file. Our task is to analyze the file and uncover a hidden flag.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h4 id="step-1-playing-the-audio"&gt;&#10; &lt;strong&gt;Step 1: Playing the Audio&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-playing-the-audio"&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;/h4&gt;&#10;&lt;p&gt;I started by playing the audio, expecting something unusual—perhaps some hidden message or distortion—but everything sounded normal. There was no apparent clue in the audio playback.&lt;/p&gt;</description></item><item><title>HackDay - Stegano &amp; Forensic</title><link>https://anthr4ce.github.io/ctf-writeups/hackday/forensic/</link><pubDate>Wed, 30 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/hackday/forensic/</guid><description>&lt;hr&gt;&#10;&lt;h3 id="forensic-challenge---hidden-flag-extraction"&gt;&#10; &lt;strong&gt;Forensic Challenge - Hidden Flag Extraction&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#forensic-challenge---hidden-flag-extraction"&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;In this challenge, we have a &lt;strong&gt;ZIP file&lt;/strong&gt; containing a &lt;strong&gt;log file&lt;/strong&gt; and &lt;strong&gt;two images&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h3 id="step-1-log-file-analysis"&gt;&#10; &lt;strong&gt;Step 1: Log File Analysis&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-log-file-analysis"&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;I began by analyzing the log file and found &lt;strong&gt;five encoded words&lt;/strong&gt;. I used &lt;strong&gt;dcode.fr&lt;/strong&gt; to decode them:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;ercbafr&lt;/code&gt; (ROT13) → &lt;strong&gt;reponse&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;img src="images/forensic_1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;c29sdXRpb24=&lt;/code&gt; (Base64) → &lt;strong&gt;solution&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;img src="images/forensic_2.png" alt="Screenshot"&gt;&lt;/p&gt;</description></item><item><title>HackDay - Web</title><link>https://anthr4ce.github.io/ctf-writeups/hackday/web/internal-blog/</link><pubDate>Wed, 30 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/hackday/web/internal-blog/</guid><description>&lt;h3 id="exploiting-an-xss-vulnerability-in-a-blog-with-moderator-visit"&gt;&#10; &lt;strong&gt;Exploiting an XSS Vulnerability in a Blog with Moderator Visit&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#exploiting-an-xss-vulnerability-in-a-blog-with-moderator-visit"&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;&lt;img src="images/blog_chall.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;In this challenge, we have a blog with a user registration and login system.&lt;br&gt;&#10;We know that the &lt;strong&gt;admin (or the moderator bot) will visit our profile&lt;/strong&gt; when we register and when we post an article.&lt;/p&gt;&#10;&lt;p&gt;A &lt;strong&gt;source code leak&lt;/strong&gt; is also available.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/blog_leak.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h3 id="step-1-analyzing-the-source-code"&gt;&#10; &lt;strong&gt;Step 1: Analyzing the Source Code&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-analyzing-the-source-code"&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;Looking at the leaked source code, we notice an &lt;strong&gt;attempt at sanitization&lt;/strong&gt; of the fields, but it is performed &lt;strong&gt;after the .save()&lt;/strong&gt;, meaning that &lt;strong&gt;even if an error is displayed, the data is already stored in the database&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>HackDay - Web</title><link>https://anthr4ce.github.io/ctf-writeups/hackday/web/open-the-door/</link><pubDate>Wed, 30 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/hackday/web/open-the-door/</guid><description>&lt;h3 id="flask-web-challenge---template-injection-analysis"&gt;&#10; &lt;strong&gt;Flask Web Challenge - Template Injection Analysis&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#flask-web-challenge---template-injection-analysis"&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;In this challenge, we have a downloadable folder containing several files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/door_files.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h3 id="step-1-identifying-the-web-framework"&gt;&#10; &lt;strong&gt;Step 1: Identifying the Web Framework&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-identifying-the-web-framework"&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;By examining the &lt;code&gt;requirements.txt&lt;/code&gt; and &lt;code&gt;app.py&lt;/code&gt; files, we confirm that the application is built using &lt;strong&gt;Flask&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/door_flask_infos.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h3 id="step-2-examining-the-docker-configuration"&gt;&#10; &lt;strong&gt;Step 2: Examining the Docker Configuration&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-2-examining-the-docker-configuration"&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;Looking into the &lt;code&gt;docker-compose.yaml&lt;/code&gt; file, we notice that the application is using &lt;strong&gt;templates&lt;/strong&gt; as an environment variable, which could be a potential security risk.&lt;/p&gt;</description></item><item><title>HackDay - Web</title><link>https://anthr4ce.github.io/ctf-writeups/hackday/web/the-analytical-engine-leak/</link><pubDate>Wed, 30 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/hackday/web/the-analytical-engine-leak/</guid><description>&lt;hr&gt;&#10;&lt;p&gt;&lt;strong&gt;SQL Injection and Sensitive Data Retrieval&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;In this challenge, we are given a form with two fields: &lt;code&gt;username&lt;/code&gt; and &lt;code&gt;password&lt;/code&gt;. Our goal is to exploit a SQL Injection vulnerability to extract sensitive data from the database.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/web_chall_description.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h4 id="step-1-testing-basic-injection"&gt;&#10; &lt;strong&gt;Step 1: Testing Basic Injection&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-testing-basic-injection"&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;/h4&gt;&#10;&lt;p&gt;I started by testing a simple SQL injection in the &lt;code&gt;password&lt;/code&gt; field. Here&amp;rsquo;s the payload I used:&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;username=admin&amp;amp;password='OR''='&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&#10;The server returns a list of users present in the database:&lt;/p&gt;</description></item><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>E-CTF-2025 - Forensic</title><link>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/forensic/capture-the-hidden/</link><pubDate>Tue, 01 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/forensic/capture-the-hidden/</guid><description>&lt;hr&gt;&#10;&lt;p&gt;&lt;img src="images/hidden_1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;h2 id="step-1-opening-the-zip-file"&gt;&#10; &lt;strong&gt;Step 1: Opening the ZIP File&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-opening-the-zip-file"&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;The challenge provides a &lt;strong&gt;ZIP file&lt;/strong&gt; containing a &lt;strong&gt;PCAP file&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Objective:&lt;/strong&gt;&#10;Analyze the &lt;strong&gt;PCAP&lt;/strong&gt; to identify &lt;strong&gt;data exfiltration&lt;/strong&gt; and retrieve the &lt;strong&gt;flag&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-2-initial-pcap-analysis"&gt;&#10; &lt;strong&gt;Step 2: Initial PCAP Analysis&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-2-initial-pcap-analysis"&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 opened the &lt;strong&gt;PCAP file&lt;/strong&gt; with &lt;strong&gt;Wireshark&lt;/strong&gt; and began analyzing the packets.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Main observations:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Evidence of data exfiltration&lt;/strong&gt; within network traffic.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Interesting endpoints&lt;/strong&gt; used for file transfer.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;A suspicious POST request&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;&lt;img src="images/hidden_2.png" alt="Screenshot"&gt;&lt;/p&gt;</description></item><item><title>E-CTF-2025 - Forensic</title><link>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/forensic/image-stolen/</link><pubDate>Tue, 01 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/forensic/image-stolen/</guid><description>&lt;hr&gt;&#10;&lt;h2 id="challenge-description"&gt;&#10; &lt;strong&gt;Challenge Description&lt;/strong&gt;&#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;&lt;img src="images/stolen1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;We are provided with a &lt;strong&gt;.zip&lt;/strong&gt; file containing a &lt;strong&gt;.pcap&lt;/strong&gt; file. The instructions indicate &lt;strong&gt;an image has been stolen&lt;/strong&gt;, and we must recover it from the &lt;strong&gt;PCAP file&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-1-pcap-file-analysis"&gt;&#10; &lt;strong&gt;Step 1: PCAP File Analysis&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-pcap-file-analysis"&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 opened the &lt;strong&gt;&lt;code&gt;.pcap&lt;/code&gt; file&lt;/strong&gt; with &lt;strong&gt;Wireshark&lt;/strong&gt; to inspect the network traffic.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/stolen2.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Observations:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;I noticed &lt;strong&gt;suspicious DNS requests&lt;/strong&gt; sent to &lt;strong&gt;&lt;code&gt;data.exfil.attacker.com&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;This &lt;strong&gt;suggests data exfiltration via DNS&lt;/strong&gt; by encoding the image within domain names.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-2-extracting-exfiltrated-data"&gt;&#10; &lt;strong&gt;Step 2: Extracting Exfiltrated Data&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-2-extracting-exfiltrated-data"&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;To extract all &lt;strong&gt;DNS queries&lt;/strong&gt; from the PCAP, I used &lt;strong&gt;Tshark&lt;/strong&gt;:&lt;/p&gt;</description></item><item><title>E-CTF-2025 - Forensic</title><link>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/forensic/my-dearest/</link><pubDate>Tue, 01 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/forensic/my-dearest/</guid><description>&lt;hr&gt;&#10;&lt;p&gt;&lt;img src="images/dearest1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;h2 id="step-1-downloading-the-zip-file"&gt;&#10; &lt;strong&gt;Step 1: Downloading the ZIP File&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-downloading-the-zip-file"&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;The challenge provides a &lt;strong&gt;ZIP file&lt;/strong&gt; containing a &lt;strong&gt;DOCX file&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/dearest2.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Hypothesis:&lt;/strong&gt;&#10;A &lt;strong&gt;DOCX file&lt;/strong&gt; is actually a &lt;strong&gt;ZIP archive&lt;/strong&gt;, meaning we can &lt;strong&gt;extract&lt;/strong&gt; its internal content.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-2-extracting-the-docx-content"&gt;&#10; &lt;strong&gt;Step 2: Extracting the DOCX Content&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-2-extracting-the-docx-content"&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/dearest3.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;I used &lt;strong&gt;unzip&lt;/strong&gt; to &lt;strong&gt;extract&lt;/strong&gt; the content of the &lt;strong&gt;DOCX file&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Several folders and XML files.&lt;/li&gt;&#10;&lt;li&gt;A folder named &lt;strong&gt;&lt;code&gt;word/&lt;/code&gt;&lt;/strong&gt; containing metadata and content.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-3-analyzing-extracted-files"&gt;&#10; &lt;strong&gt;Step 3: Analyzing Extracted Files&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-3-analyzing-extracted-files"&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 explored &lt;strong&gt;all the files&lt;/strong&gt; extracted from the &lt;strong&gt;DOCX&lt;/strong&gt;, looking for hidden information.&lt;/p&gt;</description></item><item><title>E-CTF-2025 - Web</title><link>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/web/chatroom/</link><pubDate>Tue, 01 Jul 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/e-ctf-2025/web/chatroom/</guid><description>&lt;hr&gt;&#10;&lt;h2 id="chatroom"&gt;&#10; &lt;strong&gt;Chatroom&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#chatroom"&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/chatroom_1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;In this challenge, we are provided with access to a &lt;strong&gt;chatroom&lt;/strong&gt;, where a message indicates that the &lt;strong&gt;admin will read our message in 30 seconds&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Upon seeing this, I immediately suspect a possible &lt;strong&gt;XSS (Cross-Site Scripting) vulnerability&lt;/strong&gt;, as if the message is stored and executed in the admin’s browser, we could potentially &lt;strong&gt;inject malicious JavaScript&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-1---testing-for-xss-injection"&gt;&#10; &lt;strong&gt;Step 1 - Testing for XSS Injection&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1---testing-for-xss-injection"&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;To verify if the input is vulnerable to &lt;strong&gt;XSS&lt;/strong&gt;, I test a &lt;strong&gt;simple payload&lt;/strong&gt;:&lt;/p&gt;</description></item><item><title>Midnight-Flag-Finals - Osint</title><link>https://anthr4ce.github.io/ctf-writeups/midnight-flag-finals/osint/</link><pubDate>Sat, 21 Jun 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/midnight-flag-finals/osint/</guid><description>&lt;h1 id="operation-silent-hunt"&gt;&#10; Operation Silent Hunt&#10; &lt;a class="heading-link" href="#operation-silent-hunt"&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;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;blockquote&gt;&#10;&lt;p&gt;During the theft of a hard drive containing sensitive data, the attacker made a mistake: they lost their phone at the scene.&lt;br&gt;&#10;&lt;strong&gt;Your mission:&lt;/strong&gt; follow the clues and locate the &lt;strong&gt;exact address&lt;/strong&gt; where the hard drive is hidden.&lt;/p&gt;&#10;&lt;p&gt;But be careful&amp;hellip; getting caught could compromise the entire operation.&lt;/p&gt;&#10;&lt;p&gt;🔍 Only use the following websites for your investigation:&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>RootMeCTF-20K - WEB-TraineeTrainee</title><link>https://anthr4ce.github.io/ctf-writeups/rootmectf-20k/web-traineetrainee/</link><pubDate>Mon, 12 May 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/rootmectf-20k/web-traineetrainee/</guid><description>&lt;p&gt;Description:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/trainee-desc.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;The trainee made a weird commit that’s flooding the server with requests—and eventually blocking connections. We’re hinted that something strange is lurking in their Nginx setup.&lt;/p&gt;&#10;&lt;p&gt;As soon as we connect we have a file reader form.&#10;I stared with a whatweb&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/trainee-whatweb.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;With this we know the backend runs a Nginx 1.24.0.&#10;I tried to research for a file like a file.txt, example.txt localhost and /etc/nginx because of what could be a nginx misconfiguration.&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>LA-CTF - I spy...</title><link>https://anthr4ce.github.io/ctf-writeups/la-ctf/web/i-spy.../</link><pubDate>Mon, 10 Feb 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/la-ctf/web/i-spy.../</guid><description>&lt;hr&gt;&#10;&lt;h2 id="challenge-description"&gt;&#10; &lt;strong&gt;Challenge Description&lt;/strong&gt;&#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, there is a form where we must submit tokens.&#10;The description and hints indicate that multiple tokens are hidden in different parts of the web application.&#10;The objective is to &lt;strong&gt;find and submit all the tokens to obtain the flag&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-1-understand-where-to-look-for-tokens"&gt;&#10; &lt;strong&gt;Step 1: Understand Where to Look for Tokens&lt;/strong&gt;&#10; &lt;a class="heading-link" href="#step-1-understand-where-to-look-for-tokens"&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;Tokens are scattered across several common locations where hidden data may reside:&lt;/p&gt;</description></item><item><title>LA-CTF - Lucky flag</title><link>https://anthr4ce.github.io/ctf-writeups/la-ctf/web/lucky-flag/</link><pubDate>Mon, 10 Feb 2025 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/la-ctf/web/lucky-flag/</guid><description>&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, I was presented with a &lt;strong&gt;web page filled with thousands of buttons&lt;/strong&gt;, all labeled &amp;ldquo;flag&amp;rdquo;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="images/flag1.png" alt="Screenshot"&gt;&lt;/p&gt;&#10;&lt;p&gt;The goal was to &lt;strong&gt;find the correct button that reveals the flag&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="step-1-inspecting-the-source-code"&gt;&#10; Step 1: Inspecting the Source Code&#10; &lt;a class="heading-link" href="#step-1-inspecting-the-source-code"&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;Instead of clicking every single button, I looked into the &lt;code&gt;main.js&lt;/code&gt; file which controls the behavior of the buttons.&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><item><title>Huntress-CTF - DontBelieveEverythingOnTheInternet</title><link>https://anthr4ce.github.io/ctf-writeups/huntress-ctf/</link><pubDate>Fri, 01 Nov 2024 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/huntress-ctf/</guid><description>&lt;hr&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-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Don&amp;#39;t believe everything you see on the Internet! &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Anyway, have you heard this intro soundtrack from Half-Life 3?&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The challenge starts by downloading an &lt;code&gt;.mp3&lt;/code&gt; file. While trying to process it in Python to extract metadata, I encountered errors. After several attempts, I started to wonder if it was actually an MP3 file—or something else. I wrote a function to determine the real file type:&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:#f92672"&gt;import&lt;/span&gt; filetype&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&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;def&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;check_file_type&lt;/span&gt;(filename): &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; kind &lt;span style="color:#f92672"&gt;=&lt;/span&gt; filetype&lt;span style="color:#f92672"&gt;.&lt;/span&gt;guess(filename) &#10;&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; kind &lt;span style="color:#f92672"&gt;is&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;None&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; &lt;span style="color:#e6db74"&gt;&amp;#34;unknown file type.&amp;#34;&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; &lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;type: &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;kind&lt;span style="color:#f92672"&gt;.&lt;/span&gt;mime&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;, extension: &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;kind&lt;span style="color:#f92672"&gt;.&lt;/span&gt;extension&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;filename &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;src/Half-Life_3_OST.mp3&amp;#39;&lt;/span&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(check_file_type(filename))&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Thanks to this script, I found out that the file was actually a PNG:&lt;/p&gt;</description></item><item><title>HeroCTF - DataScience</title><link>https://anthr4ce.github.io/ctf-writeups/heroctf/</link><pubDate>Mon, 28 Oct 2024 00:00:00 +0000</pubDate><guid>https://anthr4ce.github.io/ctf-writeups/heroctf/</guid><description>&lt;hr&gt;&#10;&lt;p&gt;In this challenge, we had to sort data and calculate specific values.&#10;After several attempts, I arrived at the following code:&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:#f92672"&gt;import&lt;/span&gt; pandas &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; pd &#10;&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; math &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;df &lt;span style="color:#f92672"&gt;=&lt;/span&gt; pd&lt;span style="color:#f92672"&gt;.&lt;/span&gt;read_csv(&lt;span style="color:#e6db74"&gt;&amp;#34;orders.csv&amp;#34;&lt;/span&gt;, parse_dates&lt;span style="color:#f92672"&gt;=&lt;/span&gt;[&lt;span style="color:#e6db74"&gt;&amp;#34;date&amp;#34;&lt;/span&gt;]) &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;df &lt;span style="color:#f92672"&gt;=&lt;/span&gt; df[df[&lt;span style="color:#e6db74"&gt;&amp;#34;date&amp;#34;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;2023-01-01&amp;#34;&lt;/span&gt;] &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;initial_balance &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;10000&lt;/span&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;user_balances &lt;span style="color:#f92672"&gt;=&lt;/span&gt; {} &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;unique_users &lt;span style="color:#f92672"&gt;=&lt;/span&gt; pd&lt;span style="color:#f92672"&gt;.&lt;/span&gt;concat([df[&lt;span style="color:#e6db74"&gt;&amp;#34;buyer_id&amp;#34;&lt;/span&gt;], df[&lt;span style="color:#e6db74"&gt;&amp;#34;seller_id&amp;#34;&lt;/span&gt;]])&lt;span style="color:#f92672"&gt;.&lt;/span&gt;unique() &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;user_balances &lt;span style="color:#f92672"&gt;=&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; user_id &lt;span style="color:#f92672"&gt;in&lt;/span&gt; unique_users:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; user_balances[user_id] &lt;span style="color:#f92672"&gt;=&lt;/span&gt; initial_balance&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;total_discount_spared &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&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; _, row &lt;span style="color:#f92672"&gt;in&lt;/span&gt; df&lt;span style="color:#f92672"&gt;.&lt;/span&gt;iterrows(): &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; buyer_id &lt;span style="color:#f92672"&gt;=&lt;/span&gt; row[&lt;span style="color:#e6db74"&gt;&amp;#34;buyer_id&amp;#34;&lt;/span&gt;] &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; seller_id &lt;span style="color:#f92672"&gt;=&lt;/span&gt; row[&lt;span style="color:#e6db74"&gt;&amp;#34;seller_id&amp;#34;&lt;/span&gt;] &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; price &lt;span style="color:#f92672"&gt;=&lt;/span&gt; row[&lt;span style="color:#e6db74"&gt;&amp;#34;price&amp;#34;&lt;/span&gt;] &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; discount &lt;span style="color:#f92672"&gt;=&lt;/span&gt; row[&lt;span style="color:#e6db74"&gt;&amp;#34;discount&amp;#34;&lt;/span&gt;] &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; discounted_price &lt;span style="color:#f92672"&gt;=&lt;/span&gt; price &lt;span style="color:#f92672"&gt;*&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt; discount &lt;span style="color:#f92672"&gt;/&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;) &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; amount_spared &lt;span style="color:#f92672"&gt;=&lt;/span&gt; price &lt;span style="color:#f92672"&gt;-&lt;/span&gt; discounted_price &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; total_discount_spared &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; amount_spared &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; user_balances[buyer_id] &lt;span style="color:#f92672"&gt;-=&lt;/span&gt; discounted_price &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; user_balances[seller_id] &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; discounted_price &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&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;# resp 1 &lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;richest_user &lt;span style="color:#f92672"&gt;=&lt;/span&gt; max(user_balances, key&lt;span style="color:#f92672"&gt;=&lt;/span&gt;user_balances&lt;span style="color:#f92672"&gt;.&lt;/span&gt;get) &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&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;# resp 2 &lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;total_discount_spared &lt;span style="color:#f92672"&gt;=&lt;/span&gt; math&lt;span style="color:#f92672"&gt;.&lt;/span&gt;floor(total_discount_spared) &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&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;# resp 3 &lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;negative_balance_count &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&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; balance &lt;span style="color:#f92672"&gt;in&lt;/span&gt; user_balances&lt;span style="color:#f92672"&gt;.&lt;/span&gt;values():&#10;&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; balance &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; negative_balance_count &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&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;#print the flag &lt;/span&gt;&#10;&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; &lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Hero&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;{{&lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;richest_user&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;_&lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;total_discount_spared&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;_&lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;negative_balance_count&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;}}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(flag)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&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;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-t" data-lang="t"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Hero{&lt;span style="color:#ae81ff"&gt;732669_188098001_3468&lt;/span&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item></channel></rss>