<?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 GentleVandal on Medium]]></title>
        <description><![CDATA[Stories by GentleVandal on Medium]]></description>
        <link>https://medium.com/@thwalkde?source=rss-90b555bdc477------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SJyxpED6nWgBCVKb.jpg</url>
            <title>Stories by GentleVandal on Medium</title>
            <link>https://medium.com/@thwalkde?source=rss-90b555bdc477------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 08:49:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thwalkde/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[Enriching Fuzzing with Symbolic Execution: LibPNG Setup]]></title>
            <link>https://medium.com/@thwalkde/enriching-fuzzing-with-symbolic-execution-libpng-setup-3dbeddc57739?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dbeddc57739</guid>
            <category><![CDATA[fuzzing]]></category>
            <category><![CDATA[symbolic-execution]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Mon, 08 Sep 2025 22:38:04 GMT</pubDate>
            <atom:updated>2025-09-08T22:38:04.271Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I want to tell you my steps for setting up SymCC + AFL to fuzz libpng. Just a little backstory first:</p><p>I usually leave my computer on, even when I’m sleeping. So I thought I might as well put that to use by leaving a fuzzer running. LibPNG seemed to be a good choice since lots of projects use it to parse PNGs. However, it is being fuzzed at OSS-Fuzz already with <strong>way stronger</strong> machines and latest *serious* vulnerability was at 2020; so I needed to be smart. For a long time, I’d wanted to toy with symbolic execution for a long time. I’ve used the Z3 solver before for CTFs, but I wanted to try symbolic execution for other use cases. So I combined symbolic execution with fuzzing to create more interesting test cases!</p><p>Get LibPNG from its offical repository and give below command:</p><pre>$ CC=/path/to/AFL/afl-gcc ./configure --disable-shared -CFLAGS=&quot;--coverage&quot;<br>$ make</pre><p>I have not used generated coverage files by <em>coverage </em>flag myself ; but AFL might have been used it. Next, I have created a corpus directory inside cloned project. Conveniently, LibPNG has different PNG files for us to use as corpus files.</p><p>This will be the first build we will use for 2 AFL processes (AFL distributed fuzzing mode). Note that our target process is pngtest binary.</p><p>SymCC is a compiler pass that instruments about-to-be-compiled code to do symbolic execution. It comes with a support library and — more importantly for us — a symbolic fuzzing helper written in Rust. That helper feeds AFL new test cases that explore different code paths in the target binary. A slightly smarter way to fuzz!</p><p>Next, I cloned libpng again to a folder called symcc_build:</p><pre>$ CC=/path/to/symcc/build/symcc ./configure --disable-shared<br>$ make</pre><p>This builds a binary with symbolic execution baked in. Because of SymCC’s design, we need to run three processes in three shells:</p><pre>$ /path/to/AFL/afl-fuzz -M afl-master -i corpus/ -o afl_out/ -m none -- ./pngtest @@</pre><pre>$ /path/to/AFL/afl-fuzz -S afl-secondary -i corpus/ -o afl_out/ -m none -- ./pngtest @@</pre><pre># change directory to symcc_build/libpng/ OR give full paths<br>$ ~/.cargo/bin/symcc_fuzzing_helper -o afl_out -a afl-secondary -n symcc -- ./pngtest @@</pre><p>And voila!:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZI74lDK4E2MiLc1CNpUoA.png" /><figcaption>Three processes work together to find crashes!</figcaption></figure><h3>Resources</h3><ul><li><a href="https://kelloggm.github.io/martinjkellogg.com/teaching/cs684-sp24/projects/hw3.html">Homework 3: Fuzzing with AFL</a></li><li><a href="https://github.com/eurecom-s3/symcc/blob/master/docs/Fuzzing.txt">symcc/docs/Fuzzing.txt at master · eurecom-s3/symcc</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dbeddc57739" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Reverse Engineering and Low-Level Computery can Improve You as an Engineer]]></title>
            <link>https://medium.com/@thwalkde/how-reverse-engineering-and-low-level-computery-can-improve-you-as-an-engineer-ad63dc7ce9bc?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad63dc7ce9bc</guid>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[site-reliability-engineer]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Tue, 14 May 2024 22:44:16 GMT</pubDate>
            <atom:updated>2024-05-14T22:44:48.236Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Disclaimer:</em></strong><em> I don’t distinguish between DevOps and Site Reliability Engineering. Professionally, I am a Site Reliability Engineer, although I have also had the opportunity to do security research.<br></em><strong><em>Shameless Self-plug:</em></strong><em> I’m writing a newsletter called AnythingComputery on Substack where I share interesting low-level computing projects and reverse engineering. Read it here: </em><a href="https://anythingcomputery.substack.com/">https://anythingcomputery.substack.com/</a></p><p>A few years ago, I was in an interview with the head of a team responsible for developing compilers for codebases to obfuscate the resulting binary. During our conversation, he mentioned, somewhat dismissively, that security is not a skill transferable to other fields. I could not disagree more, of course! In IT nowadays, I observe that reductionism and a focus on tooling are increasing at a dangerous pace. Many posts are published in DevOps/SRE circles about how to use a tool or technology to do ‘X’. As someone with a longstanding interest in reverse engineering, low level programming and cybersecurity, I have utilized and transferred many skills I gained from these fields to <a href="https://www.linkedin.com/feed/update/urn:li:activity:7191016995574685697?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7191016995574685697%2C7191493061196034049%29&amp;dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287191493061196034049%2Curn%3Ali%3Aactivity%3A7191016995574685697%29">my professional career as I also stated in my comment on a Linkedin post a few days ago.</a></p><p>Recalling my interview and observing how IT has become increasingly tool-focused led me to write this blog post. I want to provide you with a more holistic view of computers with some use cases I’ve encountered. <strong>After all, whatever we do in IT, we deal with computers!</strong></p><ul><li><strong>Developing faster <em>‘ls’</em>:<em> </em></strong>When I was employed at a bank as a SRE, we faced a problem that required the use of a Bash one-liner to recursively list and examine file contents. I don’t remember all the details, but using grep recursively was not an option,either. Realizing that ‘ls’ was inadequate, I decided to use the Linux kernel API. My extensive reading of LWN posts, books like <strong>‘A Heavily-Commented Linux Kernel Source Code’</strong> (which is an excellent book, by the way), and driver codes, equipped me to think, “Yes, we can handle this with the kernel’s APIs.” My understanding of the kernel’s capabilities enabled me to develop a quicker alternative to ‘ls’.</li><li><strong>Diving into legacy code:</strong> Working with someone else’s code is a familiar challenge. Most of us would rather start from scratch than navigate existing code. It’s a valuable skill, but remember, <em>a skilled reverse engineer does minimal reversing</em>. We had an old internal web application that was essential for developers to access middleware request details. Instead of reading the entire codebase, I focused on likely relevant sections and uncovered the core functionality amidst some messy code: a series of Bash scripts. The performance was terrible, taking nearly three minutes in production. In urgent situations, this became a major hindrance, and I had to act. <a href="https://www.brendangregg.com/blog/2014-05-11/strace-wow-much-syscall.html">Given that the application wasn’t critical for business,</a> I began by monitoring the system calls made by the Bash scripts using strace, noting frequent calls to gzip. Upon reviewing the scripts, I discovered they were decompressing each file in a directory, searching for a specific ID in the large text files via grep, and then recompressing them. The directories contained numerous compressed files! Although I couldn’t start on a new solution immediately — which would involve using the inotify API to pre-process information — I experimented with alternative decompression methods to see if we could efficiently replace gzip.</li><li><strong>Noticing Version Mismatch:</strong> After our third-party middleware was updated, we encountered issues with the NFS share used to store compressed log files. My former colleague monitored the network traffic and shared the findings with the storage team. They suggested some experimental fixes, but as I was new to the team, I initially held back. However, driven by frustration, I decided to examine the network capture myself. Drawing on my past experience with network captures from reverse-engineering games and participating in capture-the-flag contests, I launched Wireshark and filtered for NFS traffic. It quickly became clear that the issue was a protocol version mismatch: the middleware was using a newer version, while the NFS share was stuck on an older one.</li><li><strong>Turning Debugger into a Fuzzer:</strong> Since fuzzers for iOS/MacOS are rare and difficult to find — especially for system components — I had to develop a hacky fuzzer using LLDB, which can debug higher-privileged processes unlike Frida, which cannot be injected even with the right permissions…. I needed a fuzzer to test the window subsystem of MacOS since graphics and audio stacks are rarely tested. To find the right calls into the stack, I had to determine the structure sent via <a href="https://dennisbabkin.com/blog/?t=interprocess-communication-using-mach-messages-for-macos">mach messages</a>. I intercepted a couple of calls while moving a window on a VM and determined the structure such as location of window coordinates in the message. Then, I proceeded to develop the fuzzer using the debugger’s scripting capabilities. Since there are few resources on scripting a debugger, it was a somewhat painful process. In the end, I had a fuzzer that was fairly fast!</li></ul><p>And these cases are just scratching the surface!</p><p>I hope to make my point clear and influence your thinking. Consider broadening your focus beyond just one area to gain a more expansive view. The field of IT requires more problem solvers, and given the incredible technology that computers represent, embracing a wider perspective can only enhance our contributions to this fascinating domain. By moving beyond a singular focus and embracing a holistic view of technology, we can better address the complex problems that arise in the field. Computers are indeed a remarkable human creation, and a broad understanding enhances our ability to innovate and solve challenges.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad63dc7ce9bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Double-Free That Apocalypse]]></title>
            <link>https://medium.com/@thwalkde/double-free-that-apocalypse-ddfb1ea43bf5?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddfb1ea43bf5</guid>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[root-me]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Fri, 05 Aug 2022 15:27:51 GMT</pubDate>
            <atom:updated>2022-08-05T15:27:51.349Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Let’s start with an awful -and incomplete- mindmap for the challenge:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*6bITCE8opaNp0koaxnz48A.png" /><figcaption>Draft for the challenge</figcaption></figure><p>Challenge is on Root-Me if you want to get your hands on it. It is assigned medium difficulty and have protections like ASLR and NX (not that it matters anyway). I like to do a recon first at all challenges I solved and we have a source code for the challenge.</p><h3><strong>Reading Source</strong></h3><p>Looking at structures, we can see Zombie’s eatBody and Human’s pray for Chuck collides. This immediately got me thinking. We somehow have to allocate our Human instead of a zombie and call eatBody method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*oNrkOBUzC0M3dxCsruX_Ow.png" /></figure><p>Since challenge is all about free, let’s search for frees! All methods are freeing responsively except for suicide function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*Kfz0H1e3QWAzs7BY8B-Mxg.png" /><figcaption>nice free there</figcaption></figure><p>Let’s try:</p><ol><li>Create a character</li><li>Make it suicide</li><li>Try to create another human (spoiler: will not work)</li></ol><h3><strong>Exploitation</strong></h3><p>I go like this for my strategy:</p><ol><li>Create 2 zombies on slots 1 and 2.</li><li>Take a new character</li><li>Suicide</li><li>Create another zombie on 3rd slot. Human pointer points to this. To verify it, you can simply choose to suicide and make a zombie attack you instead :)</li><li>“Pray to Chuck”. Now 3rd zombie is freed and 3rd slot is empty.</li><li>Take a new character. This puts our character into 3rd slot if you wish to imagine it like that.</li><li>Eat a body with zombie in 3rd slot.</li><li>PROFIT (or solve <a href="https://www.root-me.org/fr/Challenges/App-Systeme/ELF-x86-Use-After-Free-basic">ELF x86 — Use After Free — basic</a> after that; fun challenge I promise.)</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddfb1ea43bf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lua Bytecode Challenge Root-me]]></title>
            <link>https://medium.com/@thwalkde/lua-bytecode-challenge-root-me-e5125ebad1f7?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5125ebad1f7</guid>
            <category><![CDATA[root-me]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[lua]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Sat, 23 Jul 2022 12:26:38 GMT</pubDate>
            <atom:updated>2022-07-23T13:59:40.321Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Long time no see! I’m planning to write about my absence later but it’s good to be back.</p><p>Challenge is assigned medium difficulty on Root-Me. It’s not that difficult if you ask me; but it’s what it is.</p><h3>Challenge</h3><p>I did not know anything about Lua reversing but I was sure someone on the Net already has some tools for disassembling/decompiling or reference for Lua bytecode. It would be fun to try and build my own tooling by a reference but I’m away from my main workstation for a month now; so it’s easier to use existing tools to solve the challenge.</p><p>I found <a href="https://sourceforge.net/projects/unluac/">unluac</a>. It is easy to use and generate disassembly from Lua bytecode. Generated output is not that great readibility-wise but helped me solve the challange. Let’s further investigate this disassembly:</p><pre>function L0_1(A0_2)<br>  local L1_2, L2_2, L3_2, L4_2, L5_2, L6_2, L7_2, L8_2, L9_2, L10_2, L11_2, L12_2, L13_2, L14_2, L15_2, L16_2, L17_2, L18_2, L19_2, L20_2, L21_2, L22_2, L23_2, L24_2<br>  L1_2 = {}<br>  start_array = L1_2<br>  L1_2 = string<br>  L1_2 = L1_2.len<br>  L2_2 = A0_2<br>  L1_2 = L1_2(L2_2)<br>  if L1_2 ~= 23 then<br>    L1_2 = false<br>    return L1_2<br>  end</pre><p>L0_1 is our check function. In above snippet, we can already see that our function should be 23 characters long. We can also see below that the function construct arrays named <em>shift_array </em>and <em>end_array </em>which are hardcoded and important to solve this challenge. There is also start_array that represents our input string.</p><pre>L1_2 = {}<br>  L2_2 = 33<br>  L3_2 = 1<br>  L4_2 = 84<br>  L5_2 = -104<br>  L6_2 = -65<br>  L7_2 = 46<br>  L8_2 = -28<br>  L9_2 = -49<br>  L10_2 = 15<br>  L11_2 = 110<br>  L12_2 = -18<br>  L13_2 = 40<br>  [...] // cut for brevity<br>  L1_2[1] = L2_2<br>  L1_2[2] = L3_2<br>  L1_2[3] = L4_2<br>  L1_2[4] = L5_2<br>  L1_2[5] = L6_2<br>  L1_2[6] = L7_2<br>  L1_2[7] = L8_2<br>  L1_2[8] = L9_2<br>  L1_2[9] = L10_2<br>  L1_2[10] = L11_2<br>  L1_2[11] = L12_2<br>  L1_2[12] = L13_2<br>  L1_2[13] = L14_2<br>  L1_2[14] = L15_2<br>  L1_2[15] = L16_2<br>  L1_2[16] = L17_2<br>  L1_2[17] = L18_2<br>  L1_2[18] = L19_2<br>  L1_2[19] = L20_2<br>  L1_2[20] = L21_2<br>  L1_2[21] = L22_2<br>  L1_2[22] = L23_2<br>  L1_2[23] = L24_2<br>  shift_array = L1_2 <br>  L1_2 = {}<br>  L2_2 = 99<br>  L3_2 = 96<br>  L4_2 = 192<br>  L5_2 = 201<br>  L6_2 = 45<br>  L7_2 = 53<br>  L8_2 = 73<br>  L9_2 = 144<br>  L10_2 = 99<br>  L11_2 = 1<br>  L12_2 = 92<br>  L13_2 = 55<br>  L14_2 = 22<br>  L15_2 = 142<br>  L16_2 = 111<br>  L17_2 = 89<br>  L18_2 = 33<br>  L19_2 = 199<br>  L20_2 = 78<br>  L21_2 = 92<br>  L22_2 = 167<br>  L23_2 = 155<br>  L24_2 = 162<br>  L1_2[1] = L2_2<br>  L1_2[2] = L3_2<br>  L1_2[3] = L4_2<br>  L1_2[4] = L5_2<br>  L1_2[5] = L6_2<br>  L1_2[6] = L7_2<br>  L1_2[7] = L8_2<br>  L1_2[8] = L9_2<br>  [...] // cut for brevity<br>  L1_2[18] = L19_2<br>  L1_2[19] = L20_2<br>  L1_2[20] = L21_2<br>  L1_2[21] = L22_2<br>  L1_2[22] = L23_2<br>  L1_2[23] = L24_2<br>  end_array = L1_2</pre><p>There is a main while loop but I will not show all of it since I don’t want this post to be that long with irrelevant parts. There is an iterator variable increasing with every loop and it’s checked for parity.</p><pre>[...]<br>L1_2 = L1_2 % 2<br>    if L1_2 == 1 then<br>      L1_2 = start_array<br>      L2_2 = iterator<br>      L1_2 = L1_2[L2_2]<br>      L2_2 = shift_array<br>      L3_2 = iterator<br>      L2_2 = L2_2[L3_2]<br>      L1_2 = L1_2 + L2_2<br>      L2_2 = end_array<br>      L3_2 = iterator<br>      L2_2 = L2_2[L3_2]<br>      // when iterator is odd<br>      // start_array + shift_array = end array<br>      // start array[i] = end_array[i] - shift_array[i]<br>      if L1_2 ~= L2_2 then<br>        L1_2 = false<br>        return L1_2<br>      end<br>    else<br>      L1_2 = start_array<br>      L2_2 = iterator<br>      L1_2 = L1_2[L2_2]<br>      L2_2 = shift_array<br>      L3_2 = iterator<br>      L2_2 = L2_2[L3_2]<br>      L1_2 = L1_2 - L2_2<br>      L2_2 = end_array<br>      L3_2 = iterator<br>      L2_2 = L2_2[L3_2]<br>      // when iterator is even<br>      // start_array[i] - shift_array[i] == end_array[i]<br>      // start_array[i] = end_array[i] + shift_array[i]<br>      if L1_2 ~= L2_2 then<br>        L1_2 = false<br>        return L1_2<br>      end</pre><p>If iterator is odd, our string’s corresponding char is substraction of end_array char and shift_array char. If iterator is even, then opposite of that held true.</p><p>Let’s write a Python script to do all the math for us:</p><pre># Pre-processing phase to arrange arrays programmatically<br># ====================================</pre><pre>with open(&quot;arrays.txt&quot;) as f:<br>    c = f.read()</pre><pre>c = c.split(&quot;\n&quot;)</pre><pre>end_array = c[1:24]<br>shift_array = c[25:49]</pre><pre>for i in range(len(end_array)):<br>    end_array[i] = end_array[i].split(&quot;=&quot;)[-1].strip()</pre><pre>for i in range(len(shift_array)):<br>    shift_array[i] = shift_array[i].split(&quot;=&quot;)[-1].strip()<br># ====================================</pre><pre>result = []<br>for i in range(1,24):<br>    if i % 2 == 1:<br>        result.append(abs(int(end_array[i - 1]) - int(shift_array[i -1 ])))<br>        print(result[i -1])<br>    else:<br>        result.append(int(end_array[i-1]) + int(shift_array[i-1]))</pre><pre>print(&quot;&quot;.join(chr(i) for i in result ))</pre><p>That’s it.</p><h3>Q.E.D.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5125ebad1f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I solve basic ARM binary crackme with Z3 Theorem Prover]]></title>
            <link>https://medium.com/@thwalkde/how-i-solve-basic-arm-binary-crackme-with-z3-theorem-prover-84bb49f7999b?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/84bb49f7999b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[z3]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Fri, 27 Sep 2019 18:49:39 GMT</pubDate>
            <atom:updated>2019-09-27T18:49:39.419Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you know <a href="https://github.com/Z3Prover/z3">z3</a>? A theorem prover from Microsoft that has <a href="https://ericpony.github.io/z3py-tutorial/guide-examples.htm">nice Python API</a>? It can be used for many cases including reverse engineering(for a little example,see talk from <a href="https://twitter.com/zetatwo">@ZetaTwo</a> called <a href="https://www.youtube.com/watch?v=b92CW-NZ3l0">“SMT in reverse engineering, for dummies”</a>) Is that an overkill? I don’t know;but it worked…</p><p><a href="https://www.root-me.org/en/Challenges/Cracking/ELF-ARM-basic-crackme">ELF ARM — Basic Crackme</a> is a challenge from Root-Me. It’s difficulty level is 2 which is easy (like its name suggests). You can see all conditions and understand how binary works easily. I don’t know ARM assembly and very lazy to look at long pages of manuals. Here it is,decompiled condition(from Ghidra with love!) of a password is this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*ZaB8cwQgjv0uaLIjxPLsjQ.jpeg" /></figure><p>So…What do we know? First of all, password must be 6-chars long and <em>local_14</em> is zero(-6+6=0 ;) ). Now,if you look at <em>__status_00</em> down below,you can see that <em>__status_00 </em>must be zero in order for us to get a compliment! In every condition above that check, <em>local_14</em> is incremented. To conclude, every one of those if conditions should not be matched.</p><p>Our conditions are:</p><ol><li>s[0] must be equal to s[5]</li><li>s[0] + 1 must be equal to s[1]</li><li>s[3] (fourth char) + 1 must be equal to s[0]</li><li>s[2] +4 must be equal to s[5]</li><li>s[4] + 2 must be equal to s[2]</li></ol><p>If these conditions are met, <em>local_14</em> stays zero and we want it to be zero. There is one more thing to consider:</p><pre>((uint)__s[3]^0x72)</pre><p>For <em>__status_00</em> to stay zero, above statement must be zero. If you remember XOR, you can already see that s[3] must be 0x72 (or 114 in decimal).</p><p>Now the fun part: Z3Py!</p><pre>from z3 import *</pre><pre>x = Int(&quot;x&quot;)<br>y = Int(&quot;y&quot;)</pre><pre>z = Int(&quot;z&quot;)<br>a = Int(&quot;a&quot;)<br>b = Int(&quot;b&quot;)<br>c = Int(&quot;c&quot;)</pre><p>My string is xyzabc. x is first char,y is second char and so on…(I assume password consists of ascii character by the way)</p><p>Now, just give our conditions to <em>solve</em> function:</p><pre>solve(a==114,x&gt;48,y&gt;48,z&gt;48,a&gt;48,b&gt;48,c&gt;48,x == c,x+1 == y,a+1==x,z+4==c,b+2==z)</pre><p>And that’s it! All you need to do is decode each integer to ASCII characters. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84bb49f7999b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Root-Me ELF-x86 PTrace]]></title>
            <link>https://medium.com/@thwalkde/root-me-elf-x86-ptrace-ade685c17c8e?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/ade685c17c8e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cracking]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Thu, 29 Aug 2019 20:37:24 GMT</pubDate>
            <atom:updated>2019-08-29T20:37:24.807Z</atom:updated>
            <content:encoded><![CDATA[<p>I don’t write here much I know. Most of the challenges I solved is easy;so I didn’t see them as a writing material. I also try to work on projects such as looking for vulnerabilities in real-world products and develop some tools. But one day, I thought to myself:</p><p>“ I also use this blog as a portfolio. It is literally in my CV!”</p><p>Hence,I decide to write about one. Our victim of my terrible writing skill is <a href="https://www.root-me.org/en/Challenges/Cracking/ELF-x86-Ptrace">Ptrace challenge</a>. Next victim will be about Cryptanalysis challenge “PID Encryption” hehe…</p><p>After downloading it, I run the binary,obviously! It asks for password and you type it. Simple! Like its name suggests, it has anti-debugging(!) feature. I actually patched conditional branch instruction jns with jmp to bypass ptrace but there were no screenshot taken. You can find how to patch a binary in radare2 with little bit of googling ;)</p><p>I used gdb-pwndbg for debugging. Since I patched the binary, I don’t have to care about ptrace. Program pushes address to eax and jump there;no other function is used. I put a breakpoint on all four cmp instructions to check register and stack content. I typed “AAAA” as password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*--vw6bWx3A2_Eht5CgnE6Q.jpeg" /></figure><p>Can you see something here? I know this is not efficient but it works. Actually, dl is least significany byte of EDX register and al is least significant byte of EAX register. I could also solve it this way. But anyhow, cheating is okay,too ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*Y6c0C5O7T2YmCDArUsBPTg.jpeg" /></figure><p>I run program and iterate every error I get until I learn all four checks. Program accepts any flag starts with REDACTED.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ade685c17c8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MalwareTech Beginner Malware Challenge — strings3]]></title>
            <link>https://medium.com/@thwalkde/malwaretech-beginner-malware-challenge-strings3-59f56429efd8?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/59f56429efd8</guid>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Mon, 25 Mar 2019 18:34:58 GMT</pubDate>
            <atom:updated>2019-03-25T18:34:58.079Z</atom:updated>
            <content:encoded><![CDATA[<h3>MalwareTech Beginner Malware Challenge — strings3</h3><p>MalwareTech is one of these coolest guys in InfoSec whose identity revealed when he “accidentally” stop infamous WannaCry Ransomware. He has a <a href="https://www.malwaretech.com/">personal blog</a>. In his blog, we can see beginner malware challenges. I thought I could look into them before dive into analysis of real-life malwares. This one is easy (as MalwareTech already stated with 2 stars).</p><p>Static Analysis is enough for this challenge; so we only use IDA Free and Resource Hacker for it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*rdtHgtqaKCTtI_tdkZJ31Q.jpeg" /></figure><p><em>FindResourceA </em>got my attention,immediately. Resource scripts are Windows’ way of using resources in C++. Like Android application’s structure, resource script also has Manifests.</p><p>Anyhow, we can also see some bitwise operations: <em>Shift-left</em>,<em>xor </em>and <em>or </em>respectively. If you shift decimal 1 by 8 bits, you get decimal 256. Later, edx xor’ed with itself and is incremented. If we shift 1 by 4 bits this time, we get decimal 16. After that, eax is or’ed with edx and result is assigned to eax which is 272. This 272 is our identifier of string to load to buffer.</p><p>Taken from Microsoft’s document for <a href="https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-loadstringa">LoadStringA</a>:</p><blockquote>Loads a string resource from the executable file associated with a specified module and either copies the string into a buffer with a terminating null character or returns a read-only pointer to the string resource itself.</blockquote><p>uID 272 is given to <em>LoadStringA </em>function. When we check resources via Resource Hacker, we can get the flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H146fFfD0fq-HDYdsiO6Kg.jpeg" /><figcaption>FLAG{RESOURCES-ARE-POPULAR-FOR-MALWARE}</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59f56429efd8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Pentesting: Basic Pentesting 1]]></title>
            <link>https://medium.com/@thwalkde/my-first-pentesting-basic-pentesting-1-e7a9eaad4f54?source=rss-90b555bdc477------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7a9eaad4f54</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[GentleVandal]]></dc:creator>
            <pubDate>Wed, 13 Mar 2019 14:47:33 GMT</pubDate>
            <atom:updated>2019-03-13T14:51:05.765Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello friends,</p><p>This is my first blog post and want to tell you about my first pentesting experience. VM is <a href="https://www.vulnhub.com/entry/basic-pentesting-1,216/">here</a>. After completion, I checked and see a lot of write-ups about it but hey, forget about it!</p><p>Let’s dive right in!</p><p>First,we scan our network to learn IP address of the machine. It is “192.168.1.105” in my network:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*GADb-jVnkYquqyEex9_4Cw.jpeg" /></figure><p>I saw some opportunities here! I read a lot of pentesting posts;so I think that is the reason. Anyways, as you can see, ports 21,22 and 80 are open. I checked port 80 on a web browser because why not?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*9ESvK0-XVMj7f2h_a-t9_A.jpeg" /></figure><p>We are all good! Now, time to learn version details of these services:</p><blockquote>nmap -Pn -sV 192.168.1.105 -p 21,22,80</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*w9-UspP3Vps3Zjaxl2ugww.jpeg" /></figure><p>FTP service on port 21 looks good (or evil!). When I search for ProFTPD 1.3.3c, I learned that it was backdoored back in 2010. I guess it was a huge disaster back then because Google instantly recommend me its exploit. Fortunately,they fixed it fast ;) Also, it has Metasploit module,great! (Link is <a href="https://www.aldeid.com/wiki/Exploits/proftpd-1.3.3c-backdoor">here</a>) I tested it just like in that website and saw root! Awesome!</p><p>Open msfconsole. Then:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*-Rvw6EtYzSCJJtEs3na_RQ.jpeg" /></figure><p>LHOST is my Kali VM’s address. RHOST is vulnerable VM’s address. After <strong><em>exploit </em></strong>command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*spYtmpeHS57MOYSe90C1hw.jpeg" /></figure><p>I’m not gonna lie to you. I struggled with payloads because I had never used <strong>Metasploit </strong>before. First, I tried to execute single-line command to change passwords of root and marlinspike on vulnerable machine (I know,I know it was a wrong move.I am not supposed to do that on actual pentesting) via <strong><em>cmd/unix/generic</em></strong> payload but it didn’t work.</p><p>In its description, the author wrote “Once you’ve finished, try to find other vectors you might have missed!”. I’m going to do that next! Thanks to Josiah Pierce for this VM.</p><p>See you later!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7a9eaad4f54" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>