<?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 FPanda on Medium]]></title>
        <description><![CDATA[Stories by FPanda on Medium]]></description>
        <link>https://medium.com/@FPandaZ?source=rss-dbfe0747ef36------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AhiM1jnQPSTUDCqt</url>
            <title>Stories by FPanda on Medium</title>
            <link>https://medium.com/@FPandaZ?source=rss-dbfe0747ef36------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 19:55:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@FPandaZ/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[PMAT Malware Analysis — Malware.unknown.exe]]></title>
            <link>https://medium.com/@FPandaZ/pmat-malware-analysis-malware-unknown-exe-a518f6a9e02a?source=rss-dbfe0747ef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/a518f6a9e02a</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[FPanda]]></dc:creator>
            <pubDate>Sat, 10 Jun 2023 07:12:42 GMT</pubDate>
            <atom:updated>2023-06-10T07:12:42.705Z</atom:updated>
            <content:encoded><![CDATA[<h3>PMAT Malware Analysis — Malware.unknown.exe</h3><p>This is my attempt at analyzing one of the bonus binaries from the PMAT-Malware Analysis course “Malware.unknonwn.exe”.</p><h3>Executive Summary</h3><p>Malware.unknown.exe is an info stealer malware that was first identified on 5th June 2023. It is a NIM compiled malware that runs on Windows-based operating systems. This malware consists of three different stages that would lead to DNS exfiltration.</p><h3>Technical Summary</h3><p>Analysis of Malware.unknown.exe was met with some level of obfuscation within their code. The URL that is used to do callback was initially obfuscated. Deobfuscating these strings was not that difficult, as it was only obfuscated with some letters of the alphabet.</p><p>Malware.unknown.exe consists of three stages. The first stage of the malware is to connect to a callback URL “http://hey.youup.local”, if the connection is unreachable the malware simply stops. After connecting to their callback URL, the connection will continue until “http://hey.youup.local” goes down, next stage is the malware will make DNS query to “auth.ns.local” and if reachable it will start DNS exfiltration using “cosmosfurootsemporium.local”. From Wireshark we can see that the data being exfiltrated is Cosmo.jpeg. One last note, if Cosmo.jpeg does not exist, the program will not run.</p><h3>Static Analysis</h3><p>Initial analysis of Malware.unknown.exe strings we found out that there are a lot of nim keywords within the strings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*nyDMyMqecgOEW3IpRiKnMg.png" /><figcaption>Figure 1 nim Strings found inside the malware</figcaption></figure><p>Further down we found some odd-looking strings that we suspect to be obfuscated. Deobfuscating these strings gave us an URL and DNS that would later be used during the malware execution process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*fnsVUZEos2OTYv5ixtyDQw.png" /><figcaption>Figure 2 Obfuscated strings</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*VDPHSQjKYK-igirL1mkl3g.png" /><figcaption>Figure 3 Deobfuscated strings</figcaption></figure><h3>Dynamic Analysis</h3><p>By setting up a fake DNS server using INetSim and using Wireshark to capture the live traffic, we got the first callback by the malware to “<a href="http://hey.youup.local/">http://hey.youup.local</a>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*1Y3KeCRDPh-rnFx3VJ7VMQ.png" /><figcaption>Figure 4 first URL call</figcaption></figure><p>Stopping InetSim midway through the execution will make “<a href="http://hey.youup.local/">http://hey.youup.local</a>” to be unreachable</p><p>Once the connection to “<a href="http://hey.youup.local/">http://hey.youup.local</a>” become unreachable it will start the DNS connection to “auth.ns.local”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*SRj3VfSNUbaevB7vAmQd0Q.png" /><figcaption>Figure 5 DNS connection to “auth.ns.local”</figcaption></figure><p>Starting the InetSim again will start DNS exfiltration using .cosmosfurootsemporium.local</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*pZfueuVzWuNCrnrs7w2mDQ.png" /><figcaption>Figure 6 DNS exfiltration using “.cosmosfurootsemporium.local”</figcaption></figure><p>Looking at Procmon it looks like it is doing DNS exfiltration to Cosmo.jpeg</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*tJhW3k7wZ7SvcPYysF6Ryw.png" /><figcaption>Figure 7 Procmon read the file on Cosmo.jpeg</figcaption></figure><p>Comparing the output from DNS exfiltration and base64 of Cosmo.jpeg shows that it is the same hex decimal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*HPW8tP3RKcTi1iv9wQ8LBg.png" /><figcaption>Figure 8 hex strings on wireshark and on cosmo.jpeg compared</figcaption></figure><h3>Indicators of Compromise</h3><h3>Network Indicators</h3><blockquote>http://hey.youup.local</blockquote><p>First callback of the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*TBJJkOiwWoEcuE3yfQ0yQQ.png" /><figcaption>Figure 9 wireshark of first callback</figcaption></figure><blockquote>auth.ns.local</blockquote><p>DNS used as a second callback</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*D9aGcK-LcE5fjmg4HXdpNQ.png" /><figcaption>Figure 10 wireshark of second callback</figcaption></figure><blockquote>.cosmosfurootsemporium.local</blockquote><p>DNS used to exfiltrate data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*D_LRbsq3lG0WWp48B0AVdQ.png" /><figcaption>Figure 11 Wireshark for DNS tunneling</figcaption></figure><h3>Yara Rules</h3><pre>rule MalwareStealer {<br>    <br>    meta: <br>        last_updated = &quot;2023-06-06&quot;<br>        author = &quot;FPanda&quot;<br>        description = &quot;A sample Yara rule for PMAT&quot;<br>    strings:<br>        $URL1 = &quot;hwtwtwpw:w/w/whwewyw.wywowuwuwpw.wlwowcwawlw&quot; ascii<br>        $URL2 = &quot;axuxtxhx.xnxsx.xlxoxcxaxlx&quot; ascii<br>        $URL3 = &quot;.BcBoBsBmBoBsBfBuBrBbBoBoBtBsBeBmBpBoBrBiBuBmB.BlBoBcBaBlB&quot; ascii<br>        $cosmoPath = &quot;Desktop\\cosmo.jpeg&quot; ascii<br>        $nim = &quot;nim&quot;<br>        $PE_magic_byte = &quot;MZ&quot;<br><br>    condition:<br>        ($PE_magic_byte at 0 and $nim) and<br>        ($URL1 and $URL2 and $URL3) and<br>        $cosmoPath<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a518f6a9e02a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FLARE-ON 9 (2022) Writeups]]></title>
            <link>https://medium.com/@FPandaZ/flare-on-9-2022-writeups-11f4f02d3872?source=rss-dbfe0747ef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/11f4f02d3872</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[flare-on]]></category>
            <dc:creator><![CDATA[FPanda]]></dc:creator>
            <pubDate>Sat, 17 Dec 2022 06:00:54 GMT</pubDate>
            <atom:updated>2022-12-17T06:00:54.305Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my CTF attempt on Flare-On 9, in this CTF due to my limited skill and constrained time I only managed to solve the first 2 challenges. Nonetheless, I would still want to create a write-up for the challenge I solved for future reference and documentation purposes.</p><h4><strong>Challenge 1 — Flaredle</strong></h4><p>Challenge 1 contains a webpage to Flaredle which is a reference to the infamous internet game Wordle, in which the player needs to gues the correct word within the amount of given chances. However, in this case the Word is 11 letters long which make this extra difficult.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpwHUXNB7v02AwiN11KNcA.png" /></figure><p>Typing in random letters word will result in “Word not in list!” error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1CWDoFk-Fz-qiLKMXZVPyQ.png" /></figure><p>The key to solving most web-based CTF challenges is to check on the page source. Sure enough, the source has script.js which contains the logic of the wordle game. It also has words.js file which contains the all of the accepted word list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qbcjofeW5UcGsd9EyW7uUw.png" /></figure><p>From here we can either check each word one by one to find our flag, or we can also CTRL + F with a specific keyword. In my case, I typed in “flare” since most Flare-On flags will usually contain the word flare in them. To my luck, one of the word list “flareonisallaboutcats” exist and it is the only word list that contains multiple words instead of just one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RW8GitH1WdopAkWkQibtQQ.png" /></figure><p>After typing the keyword into the wordle box, the web page return me the correct flag prompt and it also gave me the flag to this challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QddNKpEzz1qz-MAwWCH1XQ.png" /></figure><blockquote><strong>Flag : flareonisallaboutcats@flare-on.com</strong></blockquote><p><strong>Challenge 2 — PixelPoker</strong></p><blockquote>Welcome to PixelPoker ^_^, the pixel game that’s sweeping the nation!</blockquote><blockquote>Your goal is simple: find the correct pixel and click it</blockquote><blockquote>Good luck!</blockquote><p>For the second challenge we are given a 32-bit executable game “Pixel Poker” where the goal of this game is to click on the correct pixel which will give us the flag. In total there are 741x641 possible pixels.</p><p>The program is a Windows GUI where in the window’s title bar it will show the selected coordinate and the leftover guesses that the player have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*3sEuN5YSiiLJFiLCNEGwDw.png" /></figure><p>Once the counter reach 10 out of 10, the program will generate a pop up of “Womp womp…”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*dC-LQigZNjIExJzj98KqPw.png" /></figure><p>To start of we can use IDA to find out where the counter comparison logic is being called.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*lSsiAICCLAoV8JBI5IPCAA.png" /></figure><p>To further understand the dataflow of the program we can do some dynamic analysis, in my case I use WinDbg to do the job. Cross matching the assembly between IDA and WinDbg lead me to the conclusion that, the program will take on the Width and the Height of the window and then it will do modulo operation of these values with a pre-define variable dword_412004 and dword_412008. The results will be then compared with the selected (X, Y) coordinate that we have chosen previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*m_snu73sUrheugZvasbtrQ.png" /></figure><p>Therefore, to get the flag we need to click on 95x, 313y coordinate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*rjG3U2-0NMyiP-Towxe-nA.png" /></figure><blockquote><strong>Flag : w1nN3r_W!NneR_cHick3n_d1nNer@flare-on.com</strong></blockquote><p>Overall, although I only manage to solve two challenge for this year Flare-On, it was still quite a fun experience and it taughts me a lot about windows application in general.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11f4f02d3872" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PMAT Malware Analysis — SillyPutty]]></title>
            <link>https://medium.com/@FPandaZ/pmat-malware-analysis-sillyputty-222ff0605c96?source=rss-dbfe0747ef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/222ff0605c96</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[FPanda]]></dc:creator>
            <pubDate>Sun, 25 Sep 2022 01:41:40 GMT</pubDate>
            <atom:updated>2022-09-25T01:41:40.571Z</atom:updated>
            <content:encoded><![CDATA[<h3>PMAT Malware Analysis — SillyPutty</h3><p>This is my walkthrough of how I solved PMAT Malware Analysis challenge number 1 the SillyPutty.</p><p>Challenge description:</p><blockquote>Hello Analyst,</blockquote><blockquote>The help desk has received a few calls from different IT admins regarding the attached program.They say that they’ve been using this program with no problems until recently. Now, it’s crashing randomly and popping up blue windows when its run. I don’t like the sound of that. Do your thing!</blockquote><blockquote>IR Team</blockquote><p>Challenge Question:</p><blockquote>### Basic Static Analysis<br> — -</blockquote><blockquote>- What is the SHA256 hash of the sample?<br>- What architecture is this binary?<br>- Are there any results from submitting the SHA256 hash to VirusTotal??<br>- Describe the results of pulling the strings from this binary. Record and describe any strings that are potentially interesting. Can any interesting information be extracted from the strings?<br>- Describe the results of inspecting the IAT for this binary. Are there any imports worth noting?<br>- Is it likely that this binary is packed?<br> — -</blockquote><blockquote>### Basic Dynamic Analysis<br> — Describe initial detonation. Are there any notable occurances at first detonation? Without internet simulation? With internet simulation?<br> — From the host-based indicators perspective, what is the main payload that is initiated at detonation? What tool can you use to identify this?<br> — What is the DNS record that is queried at detonation?<br> — What is the callback port number at detonation?<br> — What is the callback protocol at detonation?<br> — How can you use host-based telemetry to identify the DNS record, port, and protocol?<br> — Attempt to get the binary to initiate a shell on the localhost. Does a shell spawn? What is needed for a shell to spawn?</blockquote><p>At first glance looking at the binary name “PuTTY” this program looks like a legitimate PuTTY program that is used as <strong>SSH, Telnet, and SFTP client for Windows</strong>.</p><p>The challenge description also mentions that a blue windows pop up every time the program start running. This may suggest that the legitimate PuTTY program has been compromised and it allows a certain command execution every time the PuTTY program is executed.</p><h3><strong>Static Analysis</strong></h3><p>Using HashSum to get the hash value of the sample:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*GYh5a_YARVi9iH_-gZ_ZWw.png" /><figcaption>getting the hash value</figcaption></figure><blockquote>Md5 “334a10500feb0f3444bf2e86ab2e76da”</blockquote><blockquote>Sha256 “0c82e654c09c8fd9fdf4899718efa37670974c9eec5a8fc18a167f93cea6ee83”</blockquote><p>Using PE Studio we can get a better analysis of our unknown binary. It seems that the binary is using 32-bit Windows architecture. The report also shows that PE Studio captures 52 functions that have malicious flags. However, this information does not tell us much about the capabilities of the malware since this sample used to be a legitimate program. Other things to take note of are the raw and virtual size of the binary, PE studio shows that the raw and virtual sizes are somewhat similar, this indicates that the sample is very unlikely to be packed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8j5yvJLAv8Zfu5cDWHK7hw.png" /><figcaption>PE Studio report (1/3)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*Iyar4LTyBJdW6llYKa6dKg.png" /><figcaption>PE Studio report (2/3)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n9Qj6_wsfSycP0495r05bA.png" /><figcaption>PE Studio report (3/3)</figcaption></figure><p>VirusTotal report shows that the sample is detected by 58 different security vendors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*mdFUKICy_o64S5WjuTzb4Q.png" /><figcaption>VirusTotal report</figcaption></figure><p>The community report shows the YARA rule for the sample. It suggests that the sample has something to do with PowerShell and ShellCode execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*qygzzKcfXbPT_0tnqPuumA.png" /><figcaption>YARA rule from community comment</figcaption></figure><p>Because this sample is a huge sample, and it is also a legitimate program, there will be a lot of confusing and irrelevant strings. However, based on the challenge description and some VirusTotal reports, it seems that the blue pop-up window is actually a PowerShell terminal. Therefore, using Floss we can filter the strings to grep only for PowerShell. Doing so will return one string that looks like an obfuscated PowerShell script. Using a simple trick of printing the obfuscated strings using PowerShell will help us understand the script better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DBHDBq9du4BGfbn3Ufpk7Q.png" /><figcaption>Floss strings the sample</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*8s7Bh5Ieagl8R6yNi2id3w.png" /><figcaption>Deobfuscating the script</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*ejnbHeczQWmycDCIUUQ81w.png" /><figcaption>Deobfuscated script (1/2)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*ApGPzk3_2N0pyd4Nh7vczA.png" /><figcaption>Deobfuscated Script (2/2)</figcaption></figure><p>It turns out the script is actually a Powerfun code. A simple web search shows that the code is available on GitHub and is part of the Metasploit ShellCodes. From this code, we got information about the domain and port number.</p><blockquote>DNS: bonus2.corporatebonusapplication.local</blockquote><blockquote>Port: 8443</blockquote><h3>Dynamic Analysis</h3><p>Upon initial detonation of the malware, the program will spawn a blue window into the screen, which we assume before is a PowerShell. Further investigation using Procmon proved that our theory was right. Inside Procmon we can see that the parent process of PuTTY.exe will spawn in a new child process “powershell.exe”, additionally we can also see that the PowerShell is executing a command that was found previously during string analysis of the sample.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*texAsKOlX0pPeHgwPizFxg.png" /><figcaption>Procmon PowerShell child process</figcaption></figure><p>The DNS record can also be seen inside WireShark if we filter out for DNS protocol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2o_FIOX5-_6U3rlznvu8A.png" /><figcaption>DNS record “bonus2.corporatebonusapplication.local”</figcaption></figure><p>Wireshark also shows that the malware sample created a TLS Client Hello message this indicates that the sample is using TLS protocol to initiate their shell terminal. This also means that it is impossible for us to create our own shell within our local host since we require a proper TLS handshake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vK6-IiQVkSGJKXxKNbwglA.png" /><figcaption>Wireshark SSL/TLS Protocol</figcaption></figure><h3>Conclusion</h3><p>At the end of the analysis, we can say that this malware sample is backdoor malware. It uses a legitimate program to hide itself and will get executed every time PuTTY is opened. This malware contains a malicious PowerShell script that purpose is to initiate a shell terminal for the attacker to gain access and information over the system.</p><p>Overall, this challenge is fun to do and is actually my first legitimate malware analysis challenge that I have ever done, and through this challenge, I have learned a lot of new things, especially PowerShell obfuscation and some TLS-based shell terminal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=222ff0605c96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[APU Battle of Hacker 2021 Reverse Engineering Writeups]]></title>
            <link>https://medium.com/@FPandaZ/apu-battle-of-hacker-2021-reverse-engineering-writeups-37b30179259d?source=rss-dbfe0747ef36------2</link>
            <guid isPermaLink="false">https://medium.com/p/37b30179259d</guid>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[FPanda]]></dc:creator>
            <pubDate>Sat, 20 Aug 2022 05:03:23 GMT</pubDate>
            <atom:updated>2022-08-20T05:03:23.052Z</atom:updated>
            <content:encoded><![CDATA[<p>Battle of Hacker (BOH) 2021 Reverse Engineering Writeups</p><p>Written by: FPanda || Muhammad Zhafran</p><p>Table of Contents:</p><p><a href="#2bda">1 — A friend in need</a></p><p><a href="#a202">2 — 100%Secure</a></p><p><a href="#0b0f">3 — BestChallenge</a></p><p><a href="#9dc4">4 — NotSoDifficult</a></p><p><a href="#38e1">5 — TheRoundAboutTunnel</a></p><p><a href="#b6cf">6 — The Locker</a></p><h3>1 – A friend in need</h3><p>Challenge Description:</p><p>“Lucky you!!! You have such a good friend that will give you the flag for free…. or is it?”</p><p><strong>Using the File command showed that it is an ELF-64 Bit file:</strong></p><figure><img alt="Executable is an ELF File format" src="https://cdn-images-1.medium.com/max/934/1*Xo5Sw1O7cyS1IWOH7a5KDg.png" /><figcaption>file format of the challenge</figcaption></figure><p><strong>Running the binary will prompt for an input:</strong></p><figure><img alt="Running the binary" src="https://cdn-images-1.medium.com/max/943/1*b7JVzJPvPdwAoNvL45BgUw.png" /><figcaption>running the binary</figcaption></figure><p>We can use <strong>Radare2 </strong>or other tools to discover the right input, or we can try printing all of the strings <strong>using the Linux “strings” command</strong>.</p><figure><img alt="Running the file with the right input" src="https://cdn-images-1.medium.com/max/690/1*ih8cn5Xj84hpLkz1dVTFIA.png" /><figcaption>Running the file with the right input</figcaption></figure><blockquote>Flag: BOH21{Axolotl_Periwinkle_Supremacy}</blockquote><h3>2 – 100%Secure</h3><p>Challenge Description:</p><p>“I hide the flag inside this highly secure binary that no one in this world can ever break it.”</p><p>Running the binary will ask for an argument, wrong argument will give “<strong>Access Denied” </strong>output.</p><figure><img alt="Access Denied" src="https://cdn-images-1.medium.com/max/761/1*2Jtbv5Fe4-U5IcAituzVXw.png" /><figcaption>Access Denied</figcaption></figure><p>By using Radare2, inside the program <strong>main </strong>function shows that the function will call another function called <strong>ReadPassword</strong>. It will pass the user input argument as another argument to the ReadPassword function.</p><figure><img alt="Radare2 main function" src="https://cdn-images-1.medium.com/max/947/1*EiQ741yHRBbGPwcc62QuJw.png" /><figcaption>Radare2 main function</figcaption></figure><p>Inside the <strong>ReadPassword </strong>function, we can see that it calls <strong>strlen </strong>function which will check the length of the user input argument. Then it will compare the result with 20. If it is equal it will continue, if not it will print “Access Denied”. <strong>At this point, we know that the correct input length is 20 characters.</strong></p><figure><img alt="ReadPassword function" src="https://cdn-images-1.medium.com/max/936/1*hXujfIjO_BYVKgKZqECDoQ.png" /><figcaption>ReadPassword function (1/2)</figcaption></figure><p>Then it will call <strong>strrev function </strong>which use offset variable [var_20h] (rbp-0x20) as their argument. The function itself is to reverse the strings of the passed argument.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*5Q6MVh-_ZaQz4QW-zItoUw.png" /><figcaption>ReadPassword function (2/2)</figcaption></figure><p>Therefore, before the function call, the variable var_20h will be “@Gyd&gt;Y9j8Yzoi7mPs12K”, then after the strrev function it will become “K21sPm7iozY8j9Y&gt;dyG@”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*cdEWpypoPvj3BmBCXR1Dzg.png" /><figcaption>strrev function</figcaption></figure><p>Back to ReadPassword function, the program continues, and judging by the amount of jump instruction and the existence of a loop counter which is the variable var_24h that is continuously being incremented by one, we can make an educated guess that this is a <strong>loop function</strong>.</p><p>The program will then take the <strong>reversed var_20h index by index and will do a XOR with var_24h (loop counter, initially 0)</strong>. Then it will <strong>compare the result with the user input argument (var_38h)</strong>. If the result is wrong or different it will move 0 to eax which means it will return 0, otherwise, it will continue looping and at the end, it will move 1 to eax which means the program will return 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*8mbsu0wiT2-yokh0ZcutIA.png" /><figcaption>ReadPassword function continues</figcaption></figure><p>We can either xor the reversed key one by one or create a script to do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*O24fc8bTJG_CeZo7b1ahxw.png" /><figcaption><em>Simple C script</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*PmlCQ6l3CBG6uNoL6IgDhQ.png" /><figcaption>The Output</figcaption></figure><blockquote>Flag: BOH21{K33pTh1ngsS3f4W1thUS}</blockquote><h3>3 – BestChallenge</h3><p>Challenge Description:</p><p>“Welcome to BOH21, I created this binary just for you, and maybe I hide a things or two inside it :)”</p><p>Running the challenge will prompt the User for an argument. After running it again with an argument this time it will ask for a password. Apparently, if the password is false it will give “<strong>Wrong Password, sadge” </strong>output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*fQ8vv8xgGlKu0XBO3XAvQQ.png" /><figcaption>Running the file</figcaption></figure><p>Using Ghidra we can decompile the binary into a rough pseudo C code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*FBxpWJBSrXODw6qzuWcp8g.png" /><figcaption>Ghidra BestChallenge main function output</figcaption></figure><p>Inside the main function, we can see it uses scanf to get user input and later on will use the variable from scanf as an argument to checkPassword function. Inside the checkPassword we can see that it compares with strings “BOH12345678”. <strong>So now we know the password is BOH12345678.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*sAiBuEzXeKEhXi57CyPgAA.png" /><figcaption>strcmp function</figcaption></figure><p>However, when we put in “BOH12345678” as the password it still does not give us the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*lwcKNppcCPZuBT738x_Ofg.png" /><figcaption>Running the program with the collect password</figcaption></figure><p>Further reversing shows that the program gets the length of our argument using <strong>strlen</strong>. It will then check if the result is between 2 to 40. If it matches it will move the strings from our arguments into a different variable (we name this <strong>variable input</strong>) using strcpy. It will then compare our input with the variable key XORed with the length of our input. If it does not match it will quit else it will continue looping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*BlIF8VN0wf2Q0fmwHeH4TQ.png" /><figcaption>Ghidra BestChallenge main function output continues</figcaption></figure><p>Since the key is most probably the obfuscated flag, what we can do is to take the key and XOR it with their own length.</p><p>The value of the key variable can be found at the beginning of the main function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*x30rm5C2XKo3La47tbwDVA.png" /><figcaption>the key variable</figcaption></figure><p>And since the binary is in the little-endian format it means that the Least Significant Bit (LSB) is stored up front.</p><p>Therefore, the value of key should be <strong>“0x55, 0x58, 0x5f, 0x25, 0x26, 0x6c, 0x60, 0x23, 0x63, 0x64, 0x63, 0x27, 0x73, 0x27, 0x60, 0x26, 0x63, 0x7f, 0x27, 0x62, 0x63, 0x42, 0x6a”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*NRwjfDn0pZOprYp83l8tqA.png" /><figcaption>Binary is in the LSB format</figcaption></figure><p>A simple C script should be able to do the job to get the flag.</p><blockquote>#include &lt;stdio.h&gt;<br>#include &lt;string.h&gt;</blockquote><blockquote>int main()<br>{<br> char key[] = {0x55, 0x58, 0x5f, 0x25, 0x26, 0x6c, 0x60, 0x23, 0x63, 0x64, 0x63, 0x27, <br> 0x73, 0x27, 0x60, 0x26, 0x63, 0x7f, 0x27, 0x62, 0x63, 0x42, 0x6a};</blockquote><blockquote>int length = strlen(key);<br> <br> for(int i = 0; i&lt;strlen(key); i++)<br> {<br> printf(“%c”, key[i] ^ length);<br> }<br> printf(“\n”);<br>}</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*kQDDOZGceWyxuwYJTQ_sQA.png" /><figcaption>BestChallenge Script</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*7oNl0rQmcMCL3Vy-fVUzEg.png" /><figcaption>Script output</figcaption></figure><blockquote>Flag: BOH21{w4tst0d0w1th0utU}</blockquote><h3>4 – NotSoDifficult</h3><p>Challenge Description:</p><p>“Do not fear, this one will not be that difficult. But, no promise though. You just have to work smarter.”</p><p>If we print the strings of the binary using the Linux “strings” command, within the output it will show a bunch of <strong>“cpython” </strong>words. This indicates that this binary is written in python. This means that we can try to decompile the binary to get back the source code fully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*cFzPIxiV_CASI5CJ21iZbA.png" /><figcaption>Strings command on NotSoDifficult</figcaption></figure><p>Currently, the binary is in the format of executable, we can use multiple python tools/Script to extract the pyc file. In this case, we can use pyinstxtractor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*E2Y5H7g6epmHoL3Y3K6g4Q.png" /><figcaption>using pyinstxtractor</figcaption></figure><p>Next, we can use a decompiler to get back the source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*VtwGK77TbLuB2sTPJgkSpQ.png" /><figcaption>output of pyinstxtractor</figcaption></figure><p>As of this writing, the most recent native Python decompiler is uncompyle6. Therefore, we can use the same decompiler to get back the source code of the python. To make things easier we going to put down the output into “Source.py” so we can easily read the source code through a text editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*8QxQD-0fPiq6CNIvxl8mkQ.png" /><figcaption>using uncompyle6</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*cu4L8bqb2kdnXLuLBFS4YQ.png" /><figcaption>main function</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*FM57cVAjX1aUU9snONCy_Q.png" /><figcaption>checkInput function</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*lpZJTyRFEM2_MgqIy_SvPg.png" /><figcaption><em>convert function</em></figcaption></figure><p>At this point, things should be straightforward. From the main function, it will check the length of our input with 16. <strong>Now we know the correct input is 16 characters</strong>. Next, the program will take the characters of the input 4 at a time and convert it with a pre-initialized string that is in the format of different bases. <strong>We can solve this challenge by taking each of the strings and decoding it based on their encoding base. (base16, base32, base64, base85).</strong></p><blockquote>Flag: BOH21{1T1sS1mpl34sTh4t}</blockquote><h3>5 – TheRoundAboutTunnel</h3><p>Challenge Description:</p><p>“People of Today Think Deeply Instead of Clearly. Perhaps the answer is right in front of us.”</p><p>Running the binary gives us an output of some conversation between two people.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*Y31m4ulglk8a5QwvbAH9aw.png" /><figcaption>Running the binary</figcaption></figure><p>Opening it on Ghidra we can see that it calls a function called <strong>Answer </strong>and use a variable called local_58 as its argument.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*4_T64sF1sEk35E21Wo4jCg.png" /><figcaption>GhidraTheRoundAboutTunnel output</figcaption></figure><p>Inside the Answer function, we can see that it will do a while loop while it will print a character depending on the condition inside the if statement. We can see that the condition of the While loop is set to less than 0x19.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*OU24nLnoRrbTvVz6fs86kQ.png" /><figcaption>Ghidra AnswerFunction</figcaption></figure><p>However, we can see that the input parameter length (local_58 length) is more than 0x19 Which means it might not be printing all of the possible characters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*nkgRMwVFxJt6mWsI3eiW8A.png" /><figcaption>Obfuscated Strings</figcaption></figure><p>To solve this challenge, we can either take the obfuscated strings and create some Script to deobfuscate them or we can patch / dynamically run the program and change the condition of the while loops.</p><p>If we want to deobfuscate the strings manually we can see that the program will do a nested if statement and check the current index of the strings. It will in order check if the index is the multiple of 5, 4, 3, 2, or 1. Depending on that the value of which it will be XORed will be different. On top of that in some cases, it will call a Log2 function and will use the output of that as the XORed number. The Log2 function itself is just to do Logarithm by 2 to the input parameter.</p><p>An alternative solution, we can use Radare2 or any other debugger to do the job. To make it easier we going to set up a second terminal to get the stdout output of our binary program.</p><p>On the second terminal, we use “<strong>tty” </strong>command to get the name of the terminal. We then need to put it to sleep so that it will not interfere with the program output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*Bz5Wi25qF7v7dEVtgMCyDw.png" /><figcaption>tty command</figcaption></figure><p>Then we going to create <strong>“rarun” </strong>(RadareRun) script and put the name of our terminal there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*7h_0si5igtd6YurV9uVMmw.png" /><figcaption>setting up .rr2 file</figcaption></figure><p>Then we can just run the binary using the extra -e argument and specify our rr2 script file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*Zb5XT1uDXavKgBdR_SDYpw.png" /><figcaption>running the binary again using rr2 profile</figcaption></figure><p>Next, we just need to change the value of the loop variable limit, in this case, the name is <strong>var_14h</strong>. We must set a breakpoint right after the variable value has been initialized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*7pF7J5t8eAOQZ_ovYnILVA.png" /><figcaption>changing the binary loop counter</figcaption></figure><p>As can be seen below, if we print the register it will show 0x19. Then we use the <strong>write </strong>command to change the register value to 0x32. Then we print the register again we can see that now it is 0x32. After this, we just need to let the program run until the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*o65HueEc9putT5U2_C1LMQ.png" /><figcaption>Radare2 debug output</figcaption></figure><p>After running the program, we can see that on our second terminal we will get the stdout output of the binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*l1BqlQ06v8mGjX5MIUXtwQ.png" /><figcaption>Radare2 patched output</figcaption></figure><blockquote>Flag: BOH21{R0und&amp;R1ght&amp;L3ft}</blockquote><h3>6 – The Locker</h3><p>Challange Description:</p><p>“The rise of the Virtual Locker has gaining attention over people from the internet. Legend said opening the locker will give the unlocker something immeasurable in value.”</p><p>Running the program will prompt us for a number. After we give a number it will then ask for a String. Then it will just give us a fail output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*0fhbdisViPf5Uln8XzxQDQ.png" /><figcaption>Running the binary</figcaption></figure><p>Opening it on Ghidra we will see that the program will print a String that is used for the main menu. It will then ask us to enter a number and will store the value in a variable called <strong>NumberInput</strong>. We can see that in case we did not enter a valid number the program will keep on looping until we enter a valid one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*MmpUCj1AhL8cJ3ZanFhbrw.png" /><figcaption>Ghidra main function output</figcaption></figure><p>The next part of the program will ask us for strings and then it will create a loop where it will <strong>XOR our input with the number that we use as input before subtracting by 55 decimals</strong>. Our goal now is to find out what value must be XORed with our input so that it will match with our Obfuscated Strings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*t43haU109a4ZiDR83jbZrw.png" /><figcaption>Ghidra main function output continues</figcaption></figure><p>Through Ghidra we can see what our Obfuscated Strings are. Since it is in Little Endian we need to reverse it.</p><blockquote>404d4a303379566a315d4636747b5d48326c31715d4e32616931707f</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*EogOZg36V0JzPL6hzTj_-A.png" /><figcaption>Obfuscated Strings</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*eyaNEPlYK1r6zL7COb0mkQ.png" /><figcaption>Obfuscated Strings equation</figcaption></figure><p>Although as far as my algebra knowledge goes, the equation above is mathematically impossible to solve since there are two values that we do not know the <strong>input </strong>and <strong>n</strong>. In reality, however, we can just create a simple script that can brute force the answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*_5gVfCEhGuP_DEfaFpemPA.png" /><figcaption>TheLocker Challenge Script</figcaption></figure><blockquote>Flag: BOH21{Th3_D4vy_J0n3s_L0ck3r}</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37b30179259d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>