<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>EchoCTF on Monish Kumar&#39;s Blog</title>
        <link>https://itsmonish.pages.dev/tags/echoctf/</link>
        <description>Recent content in EchoCTF on Monish Kumar&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-us</language>
        <lastBuildDate>Sun, 22 Jun 2025 13:45:21 +0530</lastBuildDate><atom:link href="https://itsmonish.pages.dev/tags/echoctf/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Run Run, Ember Run! - EchoCTF Writeup</title>
        <link>https://itsmonish.pages.dev/blog/echoctf-run-run-ember-run/</link>
        <pubDate>Sun, 22 Jun 2025 13:45:21 +0530</pubDate>
        
        <guid>https://itsmonish.pages.dev/blog/echoctf-run-run-ember-run/</guid>
        <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction
&lt;/h2&gt;&lt;p&gt;This writeup deals with the &lt;a class=&#34;link&#34; href=&#34;https://echoctf.red/challenge/9&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Run Run, Ember Run!&lt;/a&gt; challenge from &lt;a class=&#34;link&#34; href=&#34;https://echoctf.red/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;EchoCTF&lt;/a&gt;. This challenge focused on understanding the MBR boot record format and the bootstrap code it contains. A compressed gunzip archive &lt;a class=&#34;link&#34; href=&#34;https://echoctf.red/uploads/run_run_ember_run.gz&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;run_run_ember_run.img.gz&lt;/a&gt; contains challenge file.&lt;/p&gt;
&lt;p&gt;Challenge Statement:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;A small challenge with only four questions for you to answer.

An attacker gained access to one of the systems leaving behind the file attached to this challenge.

Not many details are known about the file but there are at least two ways to get what you want. Depending on the road you&amp;#39;ll take it can be as easy as walking in the park or hard as climbing the Himalayas.

You need to analyze the file and answer the following questions...

This is not a filesystem, even though you&amp;#39;ll find it on disks... and although its not executable you can still run it!!!

Q1: What is the first thing you&amp;#39;d see from running this image? (200 pts)
The first thing that would greet you is a flag. Give it for answer to this question.

Q2: What do you get from address 0? (300 pts)
What are the values of the first 16 bytes starting from address 0. Remove any spaces from your answer.

Q3: What is the address backdoored by the attacker? (400 pts)
The attacker seemed to have added a backdoor at a certain address. When you try to print this address you will get a flag. What is the backdoored address in hex (prefixed by 0x).

Q4: What is the flag from the backdoored address? (500 pts)
What is the flag being displayed from the backdoored address?
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;writeup&#34;&gt;Writeup
&lt;/h2&gt;&lt;p&gt;The question makes it look like the challenge has something to do with a binary reverse engineering analysis. But also there are points that suggest that it a disk? So first we need to understand what it is we are given.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/1.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;file utility output&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;It says that the file is a DOS/MBR boot sector. So we can&amp;rsquo;t &amp;ldquo;run&amp;rdquo; a boot sector right? That&amp;rsquo;s what I thought and decided to take a look at the hex dump of the file.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/2.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;hex dump&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s all of the hex dump. So taking a preliminary look at it revealed nothing. I mean no hidden files, no corrupted data, nothing. But what caught my attention is how it is exactly 512 bytes. The boot partitions are indeed 512 bytes. So that suggested we really do have a MBR boot sector at our hands. Hence we should be able to look at the entries using something like &lt;code&gt;fdisk&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/3.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;fdisk output&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;So we have something. The partition data that the sector holds. But this is of no use without the actual disk (except for now we know what kinda partitions the computer this record belonged to had). But that can&amp;rsquo;t be it. I was missing something. And then looking at the wikipedia page for &lt;a class=&#34;link&#34; href=&#34;https://en.wikipedia.org/wiki/Master_boot_record&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;MBR boot record&lt;/a&gt; had the following table:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/4.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;mbr wikipedia&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Huh, so there IS something that I was missing. There is an entire 446 bytes of &amp;ldquo;Bootstrap code area&amp;rdquo;. That should have been obivous but it wasn&amp;rsquo;t for me. After all this code region is usually targetted by malicious softwares called &lt;a class=&#34;link&#34; href=&#34;https://en.wikipedia.org/wiki/Rootkit#bootkit&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Bootkits&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;According to the wiki at &lt;a class=&#34;link&#34; href=&#34;https://wiki.osdev.org/MBR_%28x86%29&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;OSDev&lt;/a&gt; (not explicitly mentioned, the example provided there indicated it), this code is of 16-bit x86 instruction set. So all I have to do is disassemble the image provided. Easy.&lt;/p&gt;
&lt;p&gt;But before going head first into assembly, recall that the challenge statement explicitly stated to &amp;ldquo;run&amp;rdquo; the image. Since we have a valid boot sector image, perhaps we can? Quick search on the internet showed &lt;a class=&#34;link&#34; href=&#34;https://www.qemu.org/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;QEMU&lt;/a&gt; is good for it. Using the command,&lt;/p&gt;
&lt;p&gt;&lt;code&gt;qemu-system-i386 -drive format=raw,file=run_run_ember_run.img&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;we are able to boot into the boot sector on a virtualized machine console.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/6.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;first boot and answer&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Yeah we are indeed greeted with a message. Hence our answer for Q1. It looks like a prompt waiting for input.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/7.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;second answer&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Hitting enter on the prompt gave some interesting output. It displays the memory dump of the sector. Since our second question is literally what are the values of first 16 bytes of address 0, we have our answer for that as well.&lt;/p&gt;
&lt;p&gt;And for Q3, we apparently have a backdoor of sorts. I saw no other option than having to dive into the assembly code. We can dump the entire image using &lt;code&gt;objdump&lt;/code&gt;, I specifically used the following command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;objdump -D -b binary -mi386 -Maddr16,data16 -Mintel run_run_ember_run.img&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The options being:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-D : Disassemble the file
-b binary : target object is binary
-mi386 : target architecture is x86
-Maddr16,data16 : Disassembler options
    addr16 : Addresses are in 16-bit
    data16 : Data is in 16-bit
-Mintel : Use intel style assembly code
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/5.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;disassembly&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;There was a lot of disassembly. As a matter of fact, we have dumped the entire image file, but the actual code is only 446 bytes, which would mean the offset upto 1bd is the valid code.&lt;/p&gt;
&lt;p&gt;And now we read assembly.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/8.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;backdoor&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Skimming through the assembly dump, the instruction at offset 86 caught my attention. A compare statement that compares the value at the register &lt;code&gt;bx&lt;/code&gt; with &lt;code&gt;0x3750&lt;/code&gt;. As far as I could tell &lt;code&gt;0x3750&lt;/code&gt; is nothing special. But the instruction checks for it, and then branches. So the question arises, what are the two branches?&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;86:   81 fb 50 37             cmp    bx,0x3750
8a:   75 30                   jne    0xbc
8c:   b0 6d                   mov    al,0x6d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Assuming the likely case that &lt;code&gt;bx&lt;/code&gt; won&amp;rsquo;t be equal to 0x3750, it seems the code we want to execute is at &lt;code&gt;bc&lt;/code&gt; offset. That begs the next question, how could &lt;code&gt;bx&lt;/code&gt; be set to &lt;code&gt;0x3750&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;74:   e8 c5 00           call   0x13c    
77:   72 05              jb     0x7e     
79:   93                 xchg   bx, ax   
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A little above the offset of 86, at offset 74, we can see that a call is made to the address &lt;code&gt;0x13c&lt;/code&gt;. In x86 convention a call&amp;rsquo;s return value is usally found in &lt;code&gt;ax&lt;/code&gt; register (if it returns). Then instruction &lt;code&gt;xchg&lt;/code&gt; exchanges or swaps the value between &lt;code&gt;bx&lt;/code&gt; and &lt;code&gt;ax&lt;/code&gt; registers. So bx depends on whatever is returned from the instructions at &lt;code&gt;0x13c&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;13c:   e8 04 00                call   0x143
13f:   72 15                   jb     0x156
141:   88 c4                   mov    ah,al
143:   ac                      lods   al,BYTE PTR ds:[si]
144:   e8 10 00                call   0x157
147:   72 0d                   jb     0x156
149:   c0 e0 04                shl    al,0x4
14c:   88 c2                   mov    dl,al
14e:   ac                      lods   al,BYTE PTR ds:[si]
14f:   e8 05 00                call   0x157
152:   72 02                   jb     0x156
154:   08 d0                   or     al,dl
156:   c3                      ret
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To be quite honest, I don&amp;rsquo;t exactly understand what&amp;rsquo;s going in here. The call to &lt;code&gt;0x13c&lt;/code&gt; in turn makes a call to &lt;code&gt;0x143&lt;/code&gt; which is 3 instruction away and kinda confusing and we are missing a ret instruction.&lt;/p&gt;
&lt;p&gt;But in a gist the instruction at &lt;code&gt;0x143&lt;/code&gt; loads a string, an input string to be specific, and calls to another &lt;code&gt;0x157&lt;/code&gt;. It does the same set of instruction twice, but the instruction &lt;code&gt;shl al, 0x4&lt;/code&gt; (shift the contents of al[lower 8 bits of ax] to the left by 4 places), suggests it just processes an input of 16 bits, 8 bits each time. And then the processed contents is stored at the register &lt;code&gt;ax&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So looking at &lt;code&gt;0x157&lt;/code&gt; we have:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;                    ; turns strings to ascii. Like &amp;#39;0&amp;#39; -&amp;gt; 0
157:   2c 30                   sub    al,0x30    
                    ; jump to ret if subtraction is negative. For cases less than &amp;#39;0&amp;#39;
159:   72 0e                   jb     0x169      
                    ; compare al and 10(in decimal)
15b:   3c 0a                   cmp    al,0xa
                    ; compliment carry bit, not sure why
15d:   f5                      cmc
                    ; jump to ret(0x169) if al is above or equal to 10.
                    ; so al must have value between 0 and 9
15e:   73 09                   jae    0x169
160:   2c 31                   sub    al,0x31
162:   72 05                   jb     0x169
164:   04 0a                   add    al,0xa
166:   3c 10                   cmp    al,0x10
168:   f5                      cmc
169:   c3                      ret
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now just looking at the first few lines of the routine, we can see that the call converts the string input to number input. So if we want &lt;code&gt;0x3750&lt;/code&gt; as value of &lt;code&gt;ax&lt;/code&gt; register, we just need to input it?&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_runrunemberrun/9.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;backdoor&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Yes. We just had to put it there and the flag is given. Could&amp;rsquo;ve tried that first, nevertheless it was good. So we have our answer for Q4.&lt;/p&gt;
&lt;p&gt;We still need answer for Q3. Now this part, I think the question is kinda misleading. It asks for the &amp;ldquo;backdoored address&amp;rdquo;. Technically, the backdoor is at offset 86. MBR base address starts at 0x7c00, making the &amp;ldquo;backdoored address&amp;rdquo; as 0x7c86. But this is not it. The answer is the value we need to meet at this address. That is our answer for Q3. Or maybe I&amp;rsquo;m mistaken, but as far as I can tell, that is not an address.&lt;/p&gt;
&lt;h3 id=&#34;note&#34;&gt;Note
&lt;/h3&gt;&lt;p&gt;You can actually find the both of the flags in the hex dump from the beginning if you look for it (with some &amp;lsquo;pattern recognition&amp;rsquo;). I didn&amp;rsquo;t.But it&amp;rsquo;s just the flags.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;It did take me quite some time to figure out Q3, but nevertheless, the challenge was fun and unique. There ain&amp;rsquo;t many challenges that require you to boot a boot sector. So all things considered it was a solid.&lt;/p&gt;
</description>
        </item>
        <item>
        <title>The Bin in the Dump - EchoCTF Writeup</title>
        <link>https://itsmonish.pages.dev/blog/echoctf-the-bin-in-the-dump/</link>
        <pubDate>Mon, 21 Apr 2025 22:27:44 +0530</pubDate>
        
        <guid>https://itsmonish.pages.dev/blog/echoctf-the-bin-in-the-dump/</guid>
        <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction
&lt;/h2&gt;&lt;p&gt;This writeup deals with the &lt;a class=&#34;link&#34; href=&#34;https://echoctf.red/challenge/8&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;The bin in the dump&lt;/a&gt; challenge from &lt;a class=&#34;link&#34; href=&#34;https://echoctf.red/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;EchoCTF&lt;/a&gt;. This challenge focused on forensic examination of a filesystem image. A compressed gunzip archive &lt;a class=&#34;link&#34; href=&#34;https://echoctf.red/uploads/the_bin_in_the.dump.gz&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;the_bin_in_the.dump.gz&lt;/a&gt; contains the filesystem image to be examined.&lt;/p&gt;
&lt;p&gt;Challenge Statement:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;This forensics exercise is about demonstrating some basic tasks that are required in order to trace an attack on a compromised system.

The actual data are illustrative and no actual trojans or exploits exist in any of the files

You are given a filesystem dump and you are tasked to find and report the following details...
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;writeup&#34;&gt;Writeup
&lt;/h2&gt;&lt;p&gt;First things first. Before jumping into the questions we need to understand what kind of file system we are dealing with.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/1.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;file command output&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;So the output of file command tells us this is a linux-based EXT3 file system. Now we can try to list some contents of the file system using &lt;code&gt;fls&lt;/code&gt; from &lt;a class=&#34;link&#34; href=&#34;https://sleuthkit.org/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;The Slueth Kit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/2.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;fls output&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;It looks like we got a root file system at our hands.&lt;/p&gt;
&lt;p&gt;Now the questions. The questions are not answered in order as a single output command can give more than one.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Q3. What is the UUID of the filesystem? (100 pts)
Analyze the file and provide the UUID of the filesystem as an answer
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As from the file command, we already know the UUID. So that&amp;rsquo;s one.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Q1. What is the filesystem LABEL? (100 pts)
Analyze the file and provide the filesystem LABEL as an answer

Q2. What is the last folder this file system was mounted under? (100 pts)
Analyze the file and find what was the last folder this file system was mounted under. Provide the folder name verbatim as an answer.

Q4. When was the filesystem created? (100 pts)
Analyze the filesystem and report what was its creation date and time in UTC. The date format is: YYYY-MM-DD HH:MM:SS

Q5. When was the filesystem last write time? (100 pts)
Analyze the filesystem and report what was the last write date and time in UTC. The date format is: YYYY-MM-DD HH:MM:SS.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now, all this information can be obtained in a number of ways. Here we use &lt;code&gt;debugfs&lt;/code&gt;. Using the tool with the &lt;code&gt;-R&lt;/code&gt; option allows us to execute a single &amp;ldquo;request&amp;rdquo; command. Otherwise the tool is interactive. It&amp;rsquo;s quite the loaded tool for debugging and examining EXT2/3/4 file systems.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/3.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;debugfs output&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Now we have a lot of information on the screen. We have our filesystem label as the volume name, Last mounted on folder name, file system creation date, last write date among them. Note that there is a matter of localization in the dates. The question specifies we need it in UTC, but I&amp;rsquo;m on IST, so I had to convert the time.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Q6. What is the file modified by the attacker? (150 pts)
Analyze the filesystem and report what was the full path of the filename that was modified by the attacker?
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now it&amp;rsquo;s time to get a little creative. Assuming that the file system dump was created after the supposed &amp;ldquo;attack&amp;rdquo;, the file modified by attacker needs to have the most recent last modified date. Now I&amp;rsquo;m not familiar with ways to directly find out the most recently modified file directly.&lt;/p&gt;
&lt;p&gt;So I dumped all the files in to my local file system using a tool called &lt;code&gt;testdisk&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;https://www.cgsecurity.org/wiki/TestDisk&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;about the tool&lt;/a&gt;). This can also be used to recover recently deleted files.&lt;/p&gt;
&lt;p&gt;The tool has a ncurses-like interface with nice hints. So it is pretty self-explanatory. One can also use &lt;code&gt;tsk_recover&lt;/code&gt; tool from TSK for the same purpose as well. But the problem is &lt;code&gt;tsk_recover&lt;/code&gt; does not preserve the modification date from the original file.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/4.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;recovering&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Now you can use the basic &lt;code&gt;ls&lt;/code&gt; command in long list mode to find the most recently modified one manually. But we can use &lt;code&gt;find&lt;/code&gt; tool with some pipeline magic to do that for us. The following is the command I ended up going with:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;find output -type f -exec stat --format &amp;#39;%Y |%y %n &amp;#39; &amp;#39;{}&amp;#39; \; | sort -nr | awk -F&amp;#39;|&amp;#39;&amp;#39; &amp;#39;{print $2}&amp;#39; | head -10
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/5.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;recently modified&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;On top of the list we have our answer which seems to have modified in 2006. The others are from 2002. So that&amp;rsquo;s our answer.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Q7. What is the full path of the ETSCTF binary that got deleted? (250 pts)
Analyze the filesystem and report what was the full path of the ETSCTF file (the file may have extension)?
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now any file we delete is not actually wiped from the disk by default. Their inodes are declared as free and will be overwritten eventually. But until that happens the data is still present in the same location. Most data recovery programs use this.&lt;/p&gt;
&lt;p&gt;Parsing through all the inodes can be a tedious task. Lucky for us, TSK provides a tool &lt;code&gt;fls&lt;/code&gt; that is used to list all the files in a file system image. One can make it to return only deleted entries with the &lt;code&gt;-d&lt;/code&gt; option.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/6.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;deleted entries&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Above is a snippet of the output. Note that we have a few entries with a non-zero number and others with a 0. As far as I know we can only recover the non-zero entries. The numbers are nothing but the inode numbers of that particular file or directory. So I think a zero means overwritten inode.&lt;/p&gt;
&lt;p&gt;Among the entries we have a peculiar directory &lt;code&gt;w0W_d1s_iz_a_hidden_f0ld3r&lt;/code&gt;. Yes it is a directory. Notice the &amp;rsquo;l&amp;rsquo;s, &amp;lsquo;r&amp;rsquo;s and &amp;rsquo;d&amp;rsquo;s? That&amp;rsquo;s what kind of data was stored in that inode. &amp;rsquo;d&amp;rsquo; means directory.&lt;/p&gt;
&lt;p&gt;But the question is for a file. So maybe it is in the directory? But if it was in the directory and if it was recoverable it should be in the dumped files right?&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/7.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;no file&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Nope. Not there. It&amp;rsquo;s an empty directory. But let&amp;rsquo;s not give up just yet. There is tool called &lt;code&gt;extundelete&lt;/code&gt;(&lt;a class=&#34;link&#34; href=&#34;https://extundelete.sourceforge.net/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;about the tool&lt;/a&gt;) that is specific for recovering data from EXT partitions. Using the &lt;code&gt;--restore-all&lt;/code&gt; option we can see 2 inodes are recovered.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/8.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;undelete&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Listing the files recovered, we have:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/9.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;recovered list&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;So there is our deleted file and the answer.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; Q8: What is the flag that would have been displayed by the ETSCTF binary? (300 pts)
Analyze the filesystem and restore the deleted ETSCTF file. If you only change the first 2 bytes you may be able to run this... If you run this you will be able to get a flag. Give it as an answer here verbatim
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/10.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;hex dump&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;By looking at the hex dump, we can say it is not a JPEG. But it doesn&amp;rsquo;t have any other known file signature as well. But the question says we have to modify the first 2 bytes. So what should we change to? The third and fourth bytes are &amp;lsquo;L&amp;rsquo; and &amp;lsquo;F&amp;rsquo; respectively. So it is safe to assume that this may be an ELF binary.&lt;/p&gt;
&lt;p&gt;Open the binary in a hex editor of choice and change the first two bytes to &amp;ldquo;7F 45&amp;rdquo; as the file signature for ELF is &amp;ldquo;7F 45 4C 46&amp;rdquo; according to &lt;a class=&#34;link&#34; href=&#34;https://en.wikipedia.org/wiki/List_of_file_signatures&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;wikipedia&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Do that and slap on the executable bit on the binary with &lt;code&gt;chmod +x&lt;/code&gt;, we can execute it. Executing it yields:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/echoctf_thebininthedump/11.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;flag&#34;
	
	
&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;And that brings the challenge to an end. I wouldn&amp;rsquo;t say it as easy as the challenge description puts it. But if you&amp;rsquo;re strong with the fundamentals and know how to search for tools to do things, it is doable.&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
