<?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 JustAnother-Engineer on Medium]]></title>
        <description><![CDATA[Stories by JustAnother-Engineer on Medium]]></description>
        <link>https://medium.com/@justanother-engineer?source=rss-160c05845c2a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8cx3MzPOnSFgw3VNZEef3A.jpeg</url>
            <title>Stories by JustAnother-Engineer on Medium</title>
            <link>https://medium.com/@justanother-engineer?source=rss-160c05845c2a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 07:40:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@justanother-engineer/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[What’s the Secret? Unpacking Command-Line Argument Manipulation]]></title>
            <link>https://infosecwriteups.com/whats-the-secret-unpacking-command-line-argument-manipulation-fd215510191a?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd215510191a</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 15:46:50 GMT</pubDate>
            <atom:updated>2025-02-22T07:09:45.683Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dLQYF20tXYutvRQ_82t_2Q.jpeg" /></figure><p>Adversaries continually evolve their tactics to evade security defenses, and <strong>command-line argument spoofing</strong> is a particularly stealthy technique. By altering the reported command-line arguments of processes, attackers can disguise malicious activities as benign, effectively bypassing detection by conventional security tools. This deception enables malware and malicious scripts to operate undetected within compromised systems.</p><p>In this blog, we will explore the mechanics of <strong>command-line argument spoofing on Windows</strong>, demonstrating how attackers manipulate Windows APIs to mislead security monitoring solutions. Specifically, we’ll examine how this technique <strong>circumvents detection</strong> by <strong>Security Information and Event Management (SIEM) systems</strong> and <strong>Sysmon logging</strong>, which rely heavily on process command-line data for threat analysis. While Sysmon is a powerful tool for tracking process activity, its reliability is significantly undermined when attackers deliberately falsify command-line arguments.</p><h3>API Abuse: How Command-Line Arguments Are Falsified</h3><p>The Windows API’s CreateProcess function is the standard method for launching new processes, allowing you to specify command-line arguments directly. For instance, executing powershell -c “Write-Host ‘Hello World’” will create a PowerShell process with that precise string as its argument. Security solutions, including Sysmon, log these arguments meticulously, offering valuable insights for analysts and automated detection rules. The following image illustrates the command-line arguments associated with such an execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*E1FgrNXUmtVMoaC6IGoGuw.png" /><figcaption>Process observed in Taskmanager</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*1CMO292E1GkXGbwqGN2hIw.png" /><figcaption>Sysmon log</figcaption></figure><p>However, attackers can employ command-line spoofing to mask their true intentions. Essentially, the process involves:</p><ol><li><strong>Creating a Process in a Suspended State</strong> — The attacker starts a new process but keeps it <strong>paused</strong> before execution begins.</li><li><strong>Using Fake Command-Line Arguments</strong> — The process is given <strong>benign-looking</strong> arguments, which are logged by security tools.</li><li><strong>Modifying Process Memory</strong> — Before resuming execution, the attacker <strong>directly manipulates memory</strong> to replace the fake arguments with the actual malicious commands.</li><li><strong>Resuming Execution</strong> — The process is now running with hidden arguments, but security logs only contain the original harmless ones.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*IsvECY2kfmObvv79jQTvmw.png" /><figcaption>Flow Chart describing the attack ( Command-Line Argument Spoofing )</figcaption></figure><p>This technique is particularly dangerous because <strong>Sysmon and similar tools rely on event logging during process creation</strong> — which captures only the initial, deceptive arguments. The actual malicious execution happens later, leaving defenders blind to the real intent of the process</p><h3>Example</h3><p>While this attack demonstration leverages Cobalt Strike’s C2 framework, it’s important to note that command-line argument spoofing is achievable using a wide range of tools and techniques. In Cobalt Strike’s Beacon agent, the “argue” command provides control over this specific spoofing functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkWrqQxCg-pQgKyqabNpNA.png" /><figcaption>Setting fake arguments using ‘argue’ in Cobalt Strike</figcaption></figure><p>The screenshot highlights a key aspect of the attack, the initial use of a misleading command-line argument “This is just a harmless PowerShell command!…” which prefixes every PowerShell command. This ensures that any newly created PowerShell processes are initially logged with this benign string, creating a deceptive facade. The real trick, however, occurs after process creation. The forged arguments are then overwritten with the legitimate, and likely malicious, arguments; in our example “sleep 6000,” effectively hiding the process’s true purpose from standard logging.</p><p>Below same fake arguments can be observed in the SIEM logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*IPWemaWg80vn8OiYRKoeCQ.png" /><figcaption>SIEM logs for the passed fake arguments.</figcaption></figure><p>Even though command-line spoofing attempts to hide the true arguments, it’s possible to validate the <em>real</em> arguments being used by examining the process directly within Task Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*vRISmTlZGFwkW69pwzWGfg.png" /><figcaption>Actual arguments viewing from taskmanger.</figcaption></figure><h3>Mitigation : Defending Against Command-Line Spoofing</h3><p>To effectively counter <strong>command-line spoofing</strong>, security teams must adopt a <strong>multi-layered detection and response approach</strong>. Below are key <strong>mitigation strategies and takeaways</strong>:</p><h4>Deep Memory Inspection</h4><ul><li>Use <strong>Event Tracing for Windows (ETW)</strong> and <strong>EDR solutions</strong> to compare <strong>logged</strong> vs. <strong>actual in-memory</strong> command-line arguments.</li><li>Regularly scan process memory for suspicious modifications.</li></ul><h4>SIEM-Based Anomaly Detection</h4><ul><li>Implement <strong>correlation rules</strong> in <strong>SIEM/XDR platforms</strong> to detect mismatched command-line data vs. actual execution behavior.</li><li>Cross-check process arguments with parent-child relationships to identify inconsistencies.</li><li><strong>Sysmon Config Tweaks:</strong> Enable <strong>Event ID 10 (Process Access)</strong> to detect process modifications.</li></ul><h4>Monitor Suspicious API Calls &amp; Syscalls</h4><ul><li>Flag <strong>NtWriteVirtualMemory</strong>, <strong>NtResumeThread</strong>, and similar process manipulation functions.</li><li>Track <strong>remote thread injection</strong> and <strong>memory tampering</strong> techniques.</li></ul><h3>Key Takeaways</h3><ul><li><strong>Command-line spoofing is an advanced evasion technique</strong> that manipulates how security tools log process execution</li><li><strong>Standard logging solutions like Sysmon have blind spots</strong>, making memory inspection and API monitoring crucial.</li><li><strong>A proactive SIEM strategy</strong> using <strong>event correlation, anomaly detection, and threat intelligence</strong> can significantly enhance visibility and automating response by leveraging SOAR.</li><li><strong>Continuous threat hunting and logging enhancements </strong>are necessary to stay ahead of evolving attacker techniques.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd215510191a" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/whats-the-secret-unpacking-command-line-argument-manipulation-fd215510191a">What’s the Secret? Unpacking Command-Line Argument Manipulation</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey with RTO 2 ( CRTL ): A Review]]></title>
            <link>https://infosecwriteups.com/my-journey-with-rto-2-crtl-a-review-2f32a463effb?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f32a463effb</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Thu, 09 Jan 2025 21:00:50 GMT</pubDate>
            <atom:updated>2025-01-10T18:08:56.517Z</atom:updated>
            <content:encoded><![CDATA[<p>Having successfully passed the RTO I exam in early April 2024, I was driven to further my education in cybersecurity. I began preparing for the CRTO 2, but soon recognized significant gaps in my knowledge. To address this, I delved into malware development and defense evasion techniques while juggling my day job. In October 2024, I invested in the RTO II course and exam. I completed the course and took the exam during the last week of 2024, clearing all 6 machine at 4 am on December 31st. In this blog, I’ll share my insights and experiences with the course, offering an opinion on whether it’s worth considering for others interested in advancing their cybersecurity skills.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*4Mew6Zkp8eX64dTYM_WNQQ.png" /></figure><h3><strong>Course </strong>Overview</h3><p>The RTO 2 course serves as an extension of RTO I, deepening the foundational knowledge already acquired. While not strictly required, completing RTO I first is strongly advised. RTO II concentrates on advanced operational security (OPSEC) tactics adversary simulation, emphasizing defense evasion and bypassing hardened systems. Designed for red teamers aiming to refine their skills, the course dives deep into Cobalt Strike, infrastructure setup, and custom payload development.</p><p>It begins with advanced infrastructure setup, including building redirectors from scratch to hide the C2 servers. Also it discuss on the guard-lines that can be implemented to prevent from detonation payloads in wrong environment.</p><p>Having basic knowledge of programming is highly use full as the course cover a section on windows API and leveraging them to build a shell code injector. The Course provides example code and discuss on the use cases which is very insightful.</p><p>Later the course also discuss on other techniques such as process injection , remote process injection , command line spoofing etc..</p><p>The course dives into Windows defenses like Attack Surface Reduction (ASR) and Windows Defender Application Control (WDAC), breaking down their pros, cons, and how to sidestep them.</p><p>The last bit on EDR evasion was gold , it’s all about outsmarting modern EDR’s. Testing our payloads against EDR driver, getting into the nitty-gritty of evasion tactics, from syscalls to ArtifactKit hacks. Sure, some old tricks are getting caught by signatures now, but understanding the core of EDR systems and how they tick is key for anyone building payloads.</p><h3><strong>Exam</strong></h3><p>The exam provides ample time, offering 96 hours of runtime within an 8-day window, and requires securing at least 5 out of 6 flags to pass. With sufficient lab practice and completing all the preparation steps, success is well within reach!</p><p><strong>Tips</strong></p><ul><li>Setup one re-director , i recommend HTTP and dont spend much time on getting it on HTTPS.</li><li>Have a working custom loader , C2 profile would be helpful. ( recommend going through cobalt-strike docs )</li><li>The tools provided on the attacker machine can offer clues about the attack path for compromising the domain.</li><li>Highly recommend going through RTO I once before attempting exam.</li><li>Although it’s advised to minimize the use of fork &amp; run or remote injection during post-exploitation, these techniques can still be utilized during the exam if necessary.</li><li>Be ready to research when you get stuck.</li></ul><h3><strong>Conclusion</strong></h3><p>I had an absolute blast with the course and exam! It was a rollercoaster of ups and downs, but every twist and turn made the journey exciting and rewarding. If you’re aspiring to dive into the world of Red Teaming, I can’t recommend RTO I and RTO II enough , they’re total game-changers. Hopefully, this post helps anyone teetering on the edge of enrolling to take the leap. Trust me, it’s worth it!</p><p>Please feel free to reachout to me on <a href="https://www.linkedin.com/in/justanother-engineer/">LinkedIn</a> if you have any questions!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f32a463effb" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/my-journey-with-rto-2-crtl-a-review-2f32a463effb">My Journey with RTO 2 ( CRTL ): A Review</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reading Between the Lines of Code: Ziraat_Stealer]]></title>
            <link>https://infosecwriteups.com/reading-between-the-lines-of-code-ziraat-stealer-68f4971d0e85?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/68f4971d0e85</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Mon, 29 Apr 2024 01:32:39 GMT</pubDate>
            <atom:updated>2024-04-29T14:20:33.801Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MGD8H3Sz6dCgtlvqJLbaUw.png" /></figure><p>Hello Everybody! Today i will be conducting an analysis of a .NET information stealer.</p><pre>MD5 hash: DC4200AC514006F084EAD7F83B84C928<br>Virus Total Link: https://www.virustotal.com/gui/file/a850de0705c0f6095910aa1d5ed0e73a49581aa7427fcfaf2ff5144e93b047c1/community</pre><p><strong>Analysis</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*FDNESteLvd0s8rsdtevywg.png" /><figcaption>File version/name information</figcaption></figure><p>The sample effectively disguises itself as a Data Recovery tool to bypass user detection. It is a 32-bit .NET binary, which allows for the conversion of the binary back to Intermediate Language (IL). This can be done using tools designed for such purposes, with DNSpy being a prime example.</p><p>Upon closer examination of the binary, several intriguing strings and imports were discovered. These findings are particularly significant because the binary is built on the .NET framework. To delve deeper into the initial data, the next step involves placing the file into DNSpy.</p><p>DNSpy is a powerful tool that enables users to inspect, de-compile, and debug .NET binaries. It is especially useful for analysing executable like the one in question. By loading the binary into DNSpy, one can gain insights into the code structure, dependencies, and other critical aspects that might reveal the true nature and intent of the binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*KzxneonZ5cImRUHLpyGhwQ.png" /><figcaption>Information about the malware</figcaption></figure><p>The entry-point is the “GonnyCam.Main” main function. Here we see multiple Function start as different thread , where function names indicate them to achieve persistence , start keylogger , Password recovery etc..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*7l18IRFoOef8l4W-0S4iBA.png" /><figcaption>Main Function starting different functionalities.</figcaption></figure><p>Upon examining the Main function, it is evident that the threat actor has crafted a bespoke Remote Access Trojan (RAT) that allows for selective activation of desired functionalities within the executable. Of the numerous functions available, only the following have been enabled:</p><p>GetCurrentWindow : Gets the current window name where user is working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*zdV6zVOQc5srHYeMGTvA2A.png" /><figcaption>GetCurrentWindow</figcaption></figure><p>RecordKeys : Keylogger function where keystrokes are logged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*yyH-onUle3n2FukngYyS4g.png" /><figcaption>Record Keys</figcaption></figure><p>ClipboardLogging : Captures the clipboard information</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*WGQ01LX7baicnFy5a35mKQ.png" /><figcaption>ClipboardLogging</figcaption></figure><p>PasswordRecover : This function is designed to recover password from multiple sources such as email clients , downloaders , social media and browsers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*pww0t7BRcgmwWD78SZhgNg.png" /><figcaption>PasswordRecovery function</figcaption></figure><p>Further during the review of the function’s mentioned , we noticed that majority of the functions make a call to a function named “fandS”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*gut5Xrw0l8VcLj15irgWAw.png" /><figcaption>FandS function being called for recovery</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*l_n2QcdR-TZpU8trGMhwFA.png" /><figcaption>Fands Function body</figcaption></figure><p>In the function Fands we see it comparing “R_list” value. This value calls a function named ReadMail(). Reviewing the function call , we see that its loading resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*oJu2j0BXlJqdSyAS82J-NA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*0CpMxFy-uqpflvDI9puf2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*9ucFUyVVXPi3D1cEQJshcw.png" /><figcaption>ReadMail function body and deobfuscating</figcaption></figure><p>The function “ReadMail” has a obfuscated function call , Hence i deobfuscated the binary with “de4dot” and after analyzing the decoded function its renamed to “GClass0&quot;.</p><p>Going through “ReadMail” function ,it make a call to function “RSMDecrypt” where a byte array is passed by recovering it from the resource section of the binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*OsxkQ2g6E7jo5FEPsJVvnQ.png" /><figcaption>Decrypt Function</figcaption></figure><p>By the review we can see that this is a AES decryption , where bytes are loaded from the resource section and decrypted. By setting a breakpoint at the return of the function , we can dump the decoded binary from memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*PxXPW3FdhYVbT44rcqyeLQ.png" /><figcaption>Data before decryption</figcaption></figure><p>During debugging we can see that the initial bytes in the return value as “4D5A”. Which indicates that the decrypted bytes are of a windows PE file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*s3BUWkEgZRcEZJV9tIRPwQ.png" /><figcaption>Run-time debugging and extracting the dump</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*ThB25ecGx5PJ7i2qwbSltQ.png" /><figcaption>Decoded dump</figcaption></figure><p>Further , downloading the newly decrypted binary , we notice it to be a email-password recovery tool designed by “nirsoft”. The threat actor designed the RAT on a existing tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*JL2CD3yRTCt7W6d6DwW4Mg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*wNnLd5UTEVh4lQyeWaBc1w.png" /><figcaption>Decrypted email password recovery tool.</figcaption></figure><p>Now , going back to the function obfuscated function, where this decrypted binary is passed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*Mw0Qw7OxTEGmG3jBCyg1vg.png" /><figcaption>De-obfuscated function</figcaption></figure><p>During the review we see certain values being passed to multiple highlighted function. However , based on the parameters passed , i taught them to be Windows API calls. Reviewing further revealed that these function names are encrypted and only decrypt at run time to bypass any static detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*w7nZw9v7MAtWaLgk-bxgGQ.png" /><figcaption>Encrypted Function Call</figcaption></figure><p>later , I wrote a simple python script to replicate the decrypt function and passed the function values. below are list of decrypted windows API names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*sI8QU5O-RxLWcMLsKc4WIA.png" /><figcaption>Decrypted windows API calls</figcaption></figure><h3><strong>Command and Control</strong></h3><p>During the review of multiple core functionalities above we notice function “SendLog” which is used to send to a command and control sever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*s-CiTqWipQZY54bWv1u0Nw.png" /><figcaption>command and control function</figcaption></figure><p>We see that this function takes , a argument “Link” to which a variable named P_Link as highlighted below. The C2 domain here is “ziraat-helpdesk[.]com”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*-p5qg_czGJ66O8CQ7X1iVw.png" /><figcaption>C2 domain</figcaption></figure><p>The data is sent over a POST request , there are different type of POST request designed are for clipboard , Passwords , Keystrokes etc..</p><h3>Conclusion</h3><p>The analysis revealed that the .NET malware functions as a key-logger and is engineered to pilfer or retrieve passwords from a variety of email applications and browsers, including Outlook, NetScape, Thunderbird, Eudora, Firefox, Chrome, Internet Explorer, Opera, and Safari. It is characterized as a specialised Remote Access Trojan (RAT) with capabilities to extract sensitive information from infected systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68f4971d0e85" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/reading-between-the-lines-of-code-ziraat-stealer-68f4971d0e85">Reading Between the Lines of Code: Ziraat_Stealer</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Typo Trouble: Exploring the Telegram Python RCE Vulnerability]]></title>
            <link>https://infosecwriteups.com/typo-trouble-exploring-the-telegram-python-rce-vulnerability-b7bc8a12c9ba?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7bc8a12c9ba</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[technology-news]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Sat, 20 Apr 2024 21:08:34 GMT</pubDate>
            <atom:updated>2024-04-23T06:48:42.098Z</atom:updated>
            <content:encoded><![CDATA[<p>Telegram’s Windows application was recently updated to address a critical zero-day flaw that permitted the execution of Python scripts without triggering security alerts, due to a typo in processing certain file extensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vgl7rMaw_Dfyc-CMQLHeSg.png" /></figure><p>This vulnerability first surfaced on online forums later proof of concept shared on the XSS forum. The issue centered around Python <strong>“.pyzw”</strong> files which, due to a typo let attackers to evaded Telegram’s security protocols and ran immediately upon user interaction, provided Python was present on the device. Cyber adversaries could cloak these scripts as innocuous video files, duping users into running them.</p><p>As of now Telegram has deployed a server-side remedy by tagging “<strong>.pyzw”</strong> files with the “<strong>.untrusted</strong>” suffix, thereby requiring user deliberation to execute them. Telegram has also rectified the original coding error and will be pushed in upcoming updates.</p><h3>Exploring the vulnerability</h3><p>The Telegram Desktop app keeps a record of file extensions associated with hazardous elements, such as executables. If a user attempts to access one of these file types shared through Telegram, the related Windows application won’t start by itself. Rather, Telegram presents a security warning message. As shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*pMTSQhLu4FT-MR6gFqnIVw.png" /><figcaption>Telegram Error Message</figcaption></figure><p>Conversely, if a file type that is not recognized is shared via Telegram, Windows will initiate its opening automatically, deferring to the operating system to determine the suitable program to use.</p><p>The recent commit history reveals that an error occurred during the initial phase of whitelisting file extensions. A misspelling was made where “<strong>pyzw</strong>” was incorrectly entered as “<strong>pywz</strong>”. This typo was the cause of the Remote Code Execution (RCE) vulnerability within the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*AuZO4BzHBMPXMgo2krZYdg.png" /><figcaption>Telegram commit to update the extension List.</figcaption></figure><h3>Demonstration</h3><p>First, we create a python zip application(.pyzw) to open a cmd.exe as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*YJbaYVh6pt1r_XHsCCf-bw.png" /><figcaption>Simple python zipper app to open cmd.exe upon execution.</figcaption></figure><p>Then we upload the file to the victim, due to the typo the security measures implemented by telegram would be bypassed. So when victim clicks on the message(file) the command would be executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cvsRsjVX_crcSjdZ2v0bdQ.png" /><figcaption>RCE exploit</figcaption></figure><p>As a fix Telegram has deployed a service side fix where all .pyzw files are tagged with. untrusted extension. Which again gives a pop-up asking user to confirm if they want to run the application or not as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*TxUx39e9ifu8GyW3B2MDsw.png" /><figcaption>Server-side Fix</figcaption></figure><p>Telegram has said they are working a fix so that in future versions of the Telegram Desktop app would include the security warning message rather than appending the “.untrusted” extension, adding a bit more security to the process.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7bc8a12c9ba" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/typo-trouble-exploring-the-telegram-python-rce-vulnerability-b7bc8a12c9ba">Typo Trouble: Exploring the Telegram Python RCE Vulnerability</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey with CRTO: A Review]]></title>
            <link>https://infosecwriteups.com/my-journey-with-crto-a-review-b6fc36134f4d?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6fc36134f4d</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[azure-active-directory]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Thu, 11 Apr 2024 16:04:57 GMT</pubDate>
            <atom:updated>2024-04-17T17:29:23.173Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m excited to announce my recent achievement: successfully passing the Red Team Operator (RTO) exam offered by Zero Point Security. This journey has been both challenging and rewarding, and I’m eager to share my experiences, insights, and tips with you. The CRTO certification, provided by Zero Point Security, equips individuals with the skills needed to conduct Active Directory (AD) penetration testing using the Cobalt Strike C2 framework. While the course materials and techniques are akin to those discussed in the CRTP course offered by AlteredSecurity, the RTO exam stands out for its integration of the C2 framework, offering a unique opportunity to delve deeper into the realm of Red Teaming.</p><h3>Course Structure</h3><p>The course structure is a marvel in itself.</p><p>Participants get access to Cobalt Strike through browser-based Snap Labs, eliminating the need for a separate license. The labs serve as a personal Red Team playground, private and customizable. The course encompasses different sections covering various topics, such as pre-engagement, host/domain persistence and post exploitation.</p><h3>Prerequisites</h3><p>While the course materials adequately cover exam content, it’s advisable to possess a foundational understanding of Windows authentication mechanisms and concepts such as Domains ,Forests, powershell and basics of C#. Lacking this baseline knowledge may lead to a significant learning curve when engaging with the course material.</p><h3>Exam Experience</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*Go66MT2dWC4iQDw7_JhxBQ.png" /></figure><p>The exam spans 48 hours over four days, allowing you to start and stop at your convenience. While all the challenges are discussed in the course material but with a twist.</p><p>Balancing my day job alongside daily responsibilities limited the time I could dedicate to the exam. Despite this, on the initial day, I managed to secure the first three flags after investing around 4–5 hours. Initially, I faced challenges setting up the beacon, but after some troubleshooting, I identified and rectified the error. Subsequently, compromising the first three machines became relatively straightforward.</p><p>On the second day, approaching the task with renewed focus, I dedicated approximately 7–8 hours to the challenges. This effort led to the compromise of three additional machines and the retrieval of their respective flags, bringing my total to six. With this accomplishment, I successfully passed the exam and concluded my efforts for the day. I then planned to tackle the remaining two machines on the following day, taking advantage of my scheduled week off.</p><p>By the third day, I had a solid understanding of the tasks at hand through thorough enumeration. However, as I initiated the attack, I encountered multiple errors from the tool I was utilizing. Following my usual procedure, I conducted extensive research online to find solutions. After modifying the source code of the binary, I managed to achieve domain admin privileges and acquire the remaining two flags. This endeavor took around 6–7 hours of persistent effort.</p><p>Right after clearing 6 flags I had my RTO badge and certificate sent to my inbox. Finally I can say “ This was FUN!! ”.</p><h3>Takeaways / Tips</h3><ul><li>subscribe to RTO labs with the course so that you can battle test yourself before going to exam.</li><li>manage your exam lab and course lab time wisely.</li><li>In the RTO lab, Windows Defender is initially disabled. I suggest completing the course with Defender turned off first, then enabling it and going through the course again. This approach will better prepare you for the exam since Defender will be enabled during the examination.</li><li>While every aspect of the course holds significance, I recommend placing particular emphasis on host persistence, host lateral movement, Forest/domain enumeration, Kerberos, and ADCS.</li><li>Prepare yourself to utilize Google and search for solutions whenever you encounter errors while performing attacks.</li></ul><h3><strong>Conclusion</strong></h3><p>Following the exam, I’ve resumed my preparations for CRTO2. Yet, I strongly advocate for RTO to anyone seeking entry into red-teaming or aiming to understand the attack aspects of Microsoft AD.</p><p>I trust that sharing my journey and insights will benefit those planning for RTO. Best of luck to all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6fc36134f4d" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/my-journey-with-crto-a-review-b6fc36134f4d">My Journey with CRTO: A Review</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows Security: Using AMSI to Analyze Malicious JavaScript]]></title>
            <link>https://infosecwriteups.com/windows-security-using-amsi-to-analyze-malicious-javascript-c765ec755f40?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c765ec755f40</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Wed, 21 Feb 2024 10:19:00 GMT</pubDate>
            <atom:updated>2024-02-27T19:46:30.472Z</atom:updated>
            <content:encoded><![CDATA[<h3>AMSI : Anti-Malware Scan Interface</h3><p>AMSI (Anti-malware Scan Interface) is a flexible interface standard that enables your applications and services to work with any anti-malware product installed on a machine. Microsoft launched it in 2015 to offer a standard interface for solutions to scan files, memory, and other data for malware. AMSI is part of various components of Windows 10, such as User Account Control, PowerShell, Windows Script Host, JavaScript, VBScript, and Office VBA macros. As an application developer, you can join the fight against malware by using AMSI to scan script content for possible threats before running it. This adds an extra level of security for the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*VOoxpO1656WDNZsb.png" /><figcaption>Simple working of AMSI in windows</figcaption></figure><h3>Analyzing Malicious JS file via AMSI</h3><p>For our analysis we will user a tool named “<a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/logman">Logman</a>” which is developed by microsoft which is a built-in tool for handling ETW and Event Tracing Sessions.</p><p>As a example , we are analyzing a JS script which is being propagated as secure document via phishing campaigns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EGvxaiIwynZa4ueA.png" /><figcaption>Malicious site hosting malicious JS file.</figcaption></figure><p>Upon clicking on download a JS file would be download , upon review in notepad we see that the file highly obfuscated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*4CS28h-CBM5e91za.png" /><figcaption>Obfuscated JS file</figcaption></figure><p>One method is to sit and manually de-obfuscate the entire code , but this process would take a eternity. As AMSI can be used in scanning of JS files hence we will leverage its logs to review this file. Then we spawn a powershell as administrator and run the below command to start logging in AMSI logs.</p><pre>logman start AMSITrace -p Microsoft-Antimalware-Scan-Interface Event1 -o AMSITrace.etl -ets</pre><p>Once we sucessfully execute our payload and we stop the logging with below command.</p><pre>logman stop AMSITrace -ets</pre><p>As the logs are stored in file named “AMSITrace.etl” which is of type etl we use a script written by “<a href="https://gist.github.com/mattifestation/e179218d88b5f100b0edecdec453d9be">mattifestation/AMSIScriptContentRetrieval.ps1</a>”. below is a snip of the logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*3NRQvcqlkETGL_kn.png" /><figcaption>AMSI Scan Logs</figcaption></figure><p>As Highlighted above we see that the malware is performing activities such as searching for startup and AppData folder which would be used for persistence. We also see activities w.r.t to WMI for enumerations. Also we see persistence via registry</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*vAw2bJuUhz8tMTQk.png" /><figcaption>Registry based persistence</figcaption></figure><p>Further reviewing logs , we also see connection to C2C server which was down during the time of analysis. Also we see that the malware trying to communicate (share data) in User-Agent field in the headers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kK7efEpYSqm4pSzr.png" /><figcaption>Connection to C2C and Data ex-filtration over User-Agent.</figcaption></figure><p>Using AMSI is a better approch to understand what a malware is doing rather than deobfucation it manually. But the down side of this is that it requires execution of the malware.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c765ec755f40" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/windows-security-using-amsi-to-analyze-malicious-javascript-c765ec755f40">Windows Security: Using AMSI to Analyze Malicious JavaScript</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ping of Death: How ICMP Packets Can Be Used for Data Ex-filtration]]></title>
            <link>https://infosecwriteups.com/the-ping-of-death-how-icmp-packets-can-be-used-for-data-ex-filtration-9ceb511657ed?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ceb511657ed</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[soc]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Thu, 01 Feb 2024 04:53:03 GMT</pubDate>
            <atom:updated>2024-02-02T04:16:11.029Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBiqPgcD_192446uXg_Wug.jpeg" /></figure><p>Suppose you are a system administrator for a big business and you just found out that a third party has obtained some of your confidential information. You want to know how the virus, which you believe to be infecting one of your computers, took advantage of the opportunity to steal data without your network security tools noticing. A significant amount of ICMP packets delivered from the compromised system to an external IP address are seen when you first examine the network traffic logs. You wonder: what is ICMP, and how can it be used for data ex-filtration?</p><p><strong><em>ICMP ( Internet Control Message Protocol )</em></strong></p><p>ICMP stands for Internet Control Message Protocol, and it is a network layer protocol that is used for error handling and diagnostic purposes. ICMP packets are normally used to communicate information about the status of the network, such as:</p><ul><li>Ping utility tests connectivity and latency with echo request and reply.</li><li>Destination unreachable tells sender about routing, firewall, or port issues.</li><li>Time exceeded tells sender that packet expired due to TTL or MTU.</li><li>Parameter problem tells sender that packet header is invalid or missing.</li><li>Redirect tells sender to update routing table with better route.</li><li>Source quench tells sender to reduce transmission rate due to congestion.</li></ul><p><strong>How Data ex-filtration is achieve via ICMP ?</strong></p><p>ICMP packets have a simple format, consisting of an IP header followed by an ICMP header and a data field. The ICMP header contains the following fields:</p><ul><li>Type (8 bits)</li><li>Code (8 bits)</li><li>Checksum ( 16 bits)</li><li>Data : is a variable-length field that holds extra information about the ICMP message.</li></ul><p>The data field of ICMP packets is not used for any application-layer communication, and it is usually ignored by most network devices and security tools. However, this field can be abused by malicious actors to carry data.</p><p>ICMP for data ex-filtration is used due to its :</p><ul><li><strong>Stealthiness</strong>: It can hide in normal network traffic and avoid detection by security tools.</li><li><strong>Simplicity</strong>: It can be done with simple tools and scripts, without complex infrastructure or protocols.</li><li><strong>Versatility</strong>: It can be used for various purposes, such as sending commands, transferring files, or creating tunnels.</li><li><strong>Reliability</strong>: It can handle network disruptions and ensure data integrity via checksum and completeness.</li></ul><p><strong><em>Disclaimer : </em></strong><em>This blog post and its content are for educational purposes only. The information provided here is intended to for educational purpose</em></p><p>For a simple demonstration for C&amp;C communication , i am using <a href="https://github.com/bdamele/icmpsh">icmpsh</a> (tool written both in C and python to simulate C&amp;C via ICMP protocol).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*bzMhwNmhlnsqdsfvdPGYJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Hw8_fnGZv0T2QL9w6uMkg.png" /><figcaption>Normal ICMP communication</figcaption></figure><p>In a normal ICMP communication we can see that the Data field contain the timestamp.</p><p>Upon setting up icmpsh master ( attacker server ) and slave ( victim ),we could see C&amp;C capability over ICMP protocol , where we can see that the remote code execution / data is being ex-filtrated via ICMP protocol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*S0L6OUmKBcr4wlkMESOkdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cx4Z_wozVywlDTWfPmO8oA.png" /><figcaption>ICMP C&amp;C communication</figcaption></figure><p>As ICMP is a established protocol , used daily by network teams to troubleshoot things hence , it is hard to pin point the malicious communications. But preventive measures can be taken as mentioned below.</p><ul><li>Monitoring and analyzing ICMP packets , for unusual ICMP codes or kinds, such type 8 (echo request) or type 0 (echo reply), which don’t have a matching request or reply.</li><li>ICMP packets that are large or frequent might be a sign of tunnelling or data transfer.</li><li>Data fingerprints or patterns in the ICMP payload that might point to encryption or encoding techniques.</li><li>fluctuations in the ICMP packets timing or frequency, which might point to noise or modulation techniques.</li></ul><p>etc…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ceb511657ed" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/the-ping-of-death-how-icmp-packets-can-be-used-for-data-ex-filtration-9ceb511657ed">The Ping of Death: How ICMP Packets Can Be Used for Data Ex-filtration</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Code caving attacks: How Hackers Stitch Together Code]]></title>
            <link>https://infosecwriteups.com/code-caving-attacks-how-hackers-stitch-together-code-659f43b103b3?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/659f43b103b3</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[it]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Fri, 12 Jan 2024 00:48:33 GMT</pubDate>
            <atom:updated>2024-01-17T14:47:46.852Z</atom:updated>
            <content:encoded><![CDATA[<p>Code caving attacks usually exploit unused memory areas in legitimate programs, by concealing malicious code with sophistication. This form of cyber attack manipulates the existing code structure, allowing threat actors to operate discreetly within the concealed spaces of a program’s memory. Usually it is observed that attackers spread these type of malware via ads on web by impersonating legit software.</p><p><strong><em>Disclaimer : </em></strong><em>This blog post and its content are for educational purposes only. The information provided here is intended to raise awareness about code caving attacks and cyber security threats. It should not be interpreted as condoning, promoting, or providing instructions for illegal or malicious activities.Furthermore, the information presented here is for general knowledge only.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fmp5HvTaX0xtcPsb2-n7hQ.png" /><figcaption>Code caving attack can be divided into above steps</figcaption></figure><p>Let me take legitimate Anydesk.exe ( Remote desktop software ) binary and explain how the above attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AaP5BRZeJLyC6pNYqN_qpQ.png" /></figure><p>Our final goal here would be to create a binary which can work as a legit binary with malicious activity ( here we will use a simple msfvenom calc.exe payload to spawn calculator when user runs the binary ).</p><h3><strong>Finding The Caves</strong></h3><p>Caves are the empty regions in a binary which are ideally unused. This can be either one of the below <br>1. Unused code sections<br>2. Padding<br>3. Data sections<br>4. Import tables</p><p>Upon opening the Anydesk legit binary in X86 debugger at the end we see a chunk of empty space (unused code section ). This is where we can load our malicious code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHDm7eazIsmZ_Cp2WN_dWg.png" /><figcaption>Unused code section in signed Anydesk.exe binary</figcaption></figure><h3>Injecting The Payload</h3><p>The idea here is that upon program execution , we jump from entry point to the malicious code which is written by us and then jump back to the entry point so that first the malicious code is executed and then other intended part is executed ( in our example , upon execution first calc.exe would be loaded and then Anydesk would be loaded ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c7GyOR9p2FgteZDvb78TNA.png" /><figcaption>Control Flow of normal execution and after injecting payload</figcaption></figure><p>Using msfvenom we have generated a shell-code payload to spawn calc.exe upon execution. However please note that this shellcode can be to do anything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XhL8WCz55LXf9gXkLqNjaw.png" /><figcaption>Msfvenom shell code</figcaption></figure><p>Right before injecting the malicious code , we shall push all data available in all registers on stack and also we do the same for flags (this can be done using instruction “<strong>pushad</strong>” and “<strong>pushfd</strong>” ). The reason for doing this is that once after execution of malicious code , we can pop these out and proceed with normal execution of the binary. Also make sure to modify the entry point to jump to the modified code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_mxe7rlfH9j9UlhHkM3ImQ.png" /><figcaption>Malicious code entered in unused code section</figcaption></figure><p>Later once we finish the execution of malicious code then we pop both registers and flags and jump back to entry point so that the code can do its intended function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XJtCeBbiB17wdh_57ZrkMQ.png" /><figcaption>Poping registers and flags and jumping back to entry point</figcaption></figure><p>That’s it we patch and export the binary, we now have a malicious binary which upon execution first opens calc.exe and then runs anydesk as usual.( instead of calc.exe it can be anything ).</p><h3><strong>Executing the Attack</strong></h3><p>Again , This may be done in N number of ways few of them are below.<br>1. Tricking the user<br>2. Modifying program logic<br>3. Exploiting vulnerabilities and executing the program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*GpNfPqyvQUV9F8wDGRQSUg.png" /><figcaption>Upon execution of the program , first calc.exe is executed and then anydesk is loaded.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*sx_wialeJRvdy476Y9JnOw.png" /><figcaption>process tree for the above execution</figcaption></figure><h3>Post Exploitation</h3><p>This is a very border step where its left to attackers imagination. Few of the which attacker might proceed to do from here may be as below.</p><p>1. Evade detection<br>2. Maintain control on victim machine<br>Or proceed to achieve other objectives.</p><h3>Why Code Caving is Dangerous ?</h3><p><strong>1. Evasion of detection</strong>: Code caves blend seamlessly into existing programs, making them difficult to detect using traditional antivirus and security tools.<br><strong>2. Bypassing security measures</strong>: They can circumvent firewalls, intrusion detection systems, and other security measures that focus on external threats.<br><strong>3. Persistence</strong>: Code cave attacks can establish a persistent presence within a system, even after reboots or software updates.<br><strong>4. Diverse attack vectors</strong>: They can be used to launch various attacks, including data theft, malware deployment, system sabotage, and more.</p><p>Be aware of what you are downloading and running. always validate the application signature!</p><p>Thank you for your time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=659f43b103b3" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/code-caving-attacks-how-hackers-stitch-together-code-659f43b103b3">Code caving attacks: How Hackers Stitch Together Code</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Obfuscation: Evading Static Malware Detection]]></title>
            <link>https://infosecwriteups.com/the-art-of-obfuscation-evading-static-malware-detection-f4663ae4716f?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4663ae4716f</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Mon, 25 Dec 2023 12:57:41 GMT</pubDate>
            <atom:updated>2024-01-15T13:25:14.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bWHNEDvAIqsDCwHZv8b7Ag.png" /></figure><p>Obfuscation is a technique that makes malware harder to detect and analyze by hiding its code and data. It can use encryption, compression, encoding to conceal the malicious behavior of the malware. Obfuscation can help malware evade static analysis by antivirus software and security solutions.</p><p>Traditionally we have seen threat actors using different encoders,custom separators and encryption to evade static detection by AV/EDR’s. In this blog i am gonna discuss few of the newly discover/observed techniques used by threat actors which were observed in malware’s such as <a href="https://www.sentinelone.com/blog/hive-ransomware-deploys-novel-ipfuscation-technique/">Hive Ransomware</a></p><h3>IP based obfuscation</h3><p>This is a technique where the data / the critical part of the malware is converted to IPv4 or IPv6 strings. So during execution this part is again converted back and executed. <br>For an example , we are taking a msfvenom shellcode payload which can spawn calc.exe upon execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vBfxAxOLynv053SXs94wyA.png" /><figcaption>Defender removing the file as soon as we compile it.</figcaption></figure><p>As soon we compile the malware with obtained shellcode from msfvenom we see defender shouting it as malware. <br>So the idea here is to convert all of the shellcode bytes to decimals and group them to look like IP’s. In IPv4 obfuscation , we see that 4 bytes of data form a IP.For example “<strong>FC 48 83 E4”</strong> ( bytes from below image). Upon meticulous conversion, FC assumes a decimal value of 252, 48 manifests as 72, 83 emerges as 131, and E4 culminates in 228. Consequently, the initial four bytes of the specified shellcode “<strong>FC 48 83 E4</strong>” is transformed into the IPv4 address <strong>252.72.131[.]228 .</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*UHwFoQf_T-paPyPFjW-1ew.png" /><figcaption>Shell code before obfuscation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*XbxMpUqANN8a1dNU1e_5CQ.png" /><figcaption>Malicious Shell code after obfuscation</figcaption></figure><p>After obfuscating the shell-code as IP’s we are able to evade defender and run the program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*dORI0gcrQirhkudBx9dOlw.png" /><figcaption>calc.exe running after obfuscation</figcaption></figure><p>Similar to its IPv4 counterpart, IPv6 obfuscation leverages a strategic approach to transform its underlying structure into a seemingly innocuous form. However, a subtle adjustment arises due to the difference in address length — IPv6 utilizes 16 bytes compared to IPv4’s 4 bytes. Importantly, the conversion to decimal values, necessary for IPv4 obfuscation, becomes redundant for IPv6 addresses as hexa-decimals can be directly included. For example the initial bytes of the sample show above would be obfuscated as <br>“<strong>FF48:83E4:F0E8:C000:0000:4151:4150:5251</strong>”</p><p>Deobfuscating the obfuscated IP strings can be done using NTDLL API functions “<a href="https://learn.microsoft.com/en-us/windows/win32/api/ip2string/nf-ip2string-rtlipv4stringtoaddressa"><strong>RtlIpv4StringToAddressA</strong></a><strong>” </strong>for IPv4 and using “<strong>RtlIpv6StringToAddressA</strong>” for IPv6 obfuscated string.</p><h3><strong>MAC Based Obfuscation</strong></h3><p>The implementation of MAC based obfuscation is similar to what we have observed above. As a MAC address is made up of 6 bytes, therefore the shell code is divided into such individual strings to bypass AV/EDR’s static detection. If a shellcode size is not multiple of 6 then it can be padded with null bytes to make it work.</p><p>Deobfuscating the obfuscated MAC strings can be done using NTDLL API function “<a href="https://learn.microsoft.com/en-us/windows/win32/api/ip2string/nf-ip2string-rtlethernetstringtoaddressa"><strong>RtlEthernetStringToAddressA</strong></a>”.</p><h3>UUID Based Obfuscation</h3><p>A UUID is a universally unique identifier that is used for information in computer systems. It is a 128-bit number that can be represented as 36 characters, consisting of 32 hexadecimal digits and 4 hyphens. <br>Converting to shellcode to UUID is bit tricky as first 3 segments are using little-endian. Hence the bytes might look reverse.</p><p>Taking the above shellcode as example , the representation of the same in UUID would be “<strong>E48348FF-E8F0–00C0–0000–415141505251</strong>”. Are you able to find the difference between this and IPv6 obfuscated string ?</p><p>Even though obfuscation is bit tricky but deobfuscation is take care by winAPI “<a href="https://learn.microsoft.com/en-us/windows/win32/api/rpcdce/nf-rpcdce-uuidfromstringa"><strong>UuidFromStringA</strong></a><strong>”</strong>.</p><p>Above 3 scenarios are just few of the techniques that I recently came across during a research upon which i whipped up some code and tested it out, However these techniques can be still modified and improvised to evade detection&#39;s.</p><p>Thank you for your time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4663ae4716f" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/the-art-of-obfuscation-evading-static-malware-detection-f4663ae4716f">The Art of Obfuscation: Evading Static Malware Detection</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unmasking NJRAT: A Deep Dive into a Notorious Remote Access Trojan Part2]]></title>
            <link>https://infosecwriteups.com/unmasking-njrat-a-deep-dive-into-a-notorious-remote-access-trojan-part2-7b41a3669d9a?source=rss-160c05845c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b41a3669d9a</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[JustAnother-Engineer]]></dc:creator>
            <pubDate>Sun, 26 Nov 2023 00:05:27 GMT</pubDate>
            <atom:updated>2023-11-26T18:43:48.874Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unmasking NjRAT: A Notorious Remote Access Trojan Part2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*l3Q1mTbkSpjjZ-PN2BTAeA.png" /><figcaption>Credit : Pedro Henrique Andrade ( <a href="https://playgroundai.com/post/clmwrdcjh03ims601z3a9d99d">https://playgroundai.com/post/clmwrdcjh03ims601z3a9d99d</a> )</figcaption></figure><p>In the <a href="https://medium.com/bugbountywriteup/part1-static-code-analysis-of-the-rat-njrat-2f273408df43">first part</a> of this blog series, we discussed how the malware NjRAT is built , its capabilities and more.In this blog we will continue our discussion by looking into few of the functions this notorious remote access trojan (RAT) offers and how it infects and controls its victims’ computers. We will also learn how to detect this malware from our systems.</p><p>Lets start with continuing the review of C&amp;C command/features offered by the RAT.</p><ul><li>We see the RAT downloading a file named “pass.exe” from Dropbox and starts the downloaded file as a new process. Upon executing the process “pass.exe” it creates a text file named “pass.txt” in temp directory and this is sent back to the threat actor. However , the malicious file is now disabled from Dropbox at the time of this analysis hence no further investigation was performed on this.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oR-HcAtdOj52zfhutARjFg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*nJRCRNfVzKjLugmGq-ZG2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PmeVQFA3ro-aIAH8Bvfb_g.png" /><figcaption>downloading and executing pass.exe</figcaption></figure><ul><li>Further we see the malware has capability to handle Zip data stream. Where it receive data and store it to temp directory and executes it after unzipping the file.</li><li>Has capability to add extra plugin’s into existing one to extend the features.</li><li>Has capability for screen capture and sending it back to C&amp;C server.</li><li>Further we see a command “un” this is interesting as we see 3 sub command for this , where “un” stands for uninstall but each sub command perform different functions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*1HiDSyiGlAWtzbttSR70Gg.png" /><figcaption>Uninstall command with 3 different functions</figcaption></figure><ul><li>The “~” sub commands executes a function OK.UNS() which first removes all the modification’s done by the malware like persistence , registry changes etc.. and self deletes and terminates the running process. This is the Clean up job so that no trace of the malware is left on the disk.<br>Next we see the sub command “!” where fist a function OK.pr(0) is executes (we will discuss this later in this blog) and end the process , no clean up is performed. <br>Sub command “@” spawn’s a new process of the malware and kills the current process.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*dLemllrCa7SVS10HNmG_lw.png" /><figcaption>OK.pr() Function</figcaption></figure><ul><li>Function OK.pr(int i) is used to protect the malware process from being terminated by setting the ProcessBreakOnTermination flag to 1. This flag determines whether a system debug break occurs when the process terminates abnormally. If the flag is set to 1 then the computer will <strong>crash with blue screen of death</strong> if the malware process is killed. ( if someone try to kill the process then the system would crash and they need to restart the machine , due to multiple persistence mechanisms the malware will spawn up again)<br>Hence , as we observed above, value “0” is passed during the execution of uninstall command.</li><li>We also see the RAT has capability to update itself with new code .</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zg5jSxRR8nMKrqZMYJ00iA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*bU_QCLf10mzwkeAdpGgoqQ.png" /><figcaption>Updating Capability</figcaption></figure><p>We see that the NjRAT has also capability to be a key-logger and store the entered keystrokes with process name and date so that the threat actor can view where the key’s were entered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*k3putREGPAr3jkstk46onw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4Thus10l81Ba3w59vl5hg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AK0nsZ108JGfvQKF68KVzg.png" /><figcaption>Key-logger Capability</figcaption></figure><p>Further reviewing the main function , we see one more thread being started where a function mgr.protect is being passed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*R27x5iaGz4ZrQZPC80MwOQ.png" /><figcaption>New thread starting for Malware protection</figcaption></figure><ul><li>In function mgr.protect we see that the malware tries to see if any of the following process are running and if yes then kills itself to prevent detection. <br>- taskmgr<br>- processviewer<br>- processhacker<br>- process explorer<br>And we also see that the function ok.pr(1) is being executed , which sets the ProcessBreakOnTermination flag to 1. As discussed earlier this flag when set will make computer <strong>crash with blue screen of death</strong> if the malware process is killed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fo4GeaLJ4EB7Uz5astK3vA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*qV1IxtVPSK7ZRAgFNzhZsQ.png" /><figcaption>Preventing detection mechanisms.</figcaption></figure><p>At last in the main function we see registry persistence being achieved by adding it under both current user and local machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gSsqEXnZ10hIpe_81stFTg.png" /><figcaption>Registry persistence</figcaption></figure><p>Below are few of the IOC’s observed after detonating the malware in a sandbox environment. We are not discussing them in details as we already know how the malware functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*r5JqO91QiTIE7o1Ifn-vBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6DnAGGfI8pAYBKOiZpZYHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*X5HuSspaenOY3QJGe0ajdg.png" /><figcaption>Registry , firewall rule change and adding file to C:\Windows</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*aNSCcvWXkog25qX74VZOdQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*uvWnVzNMMrGOiZTS8-UTKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*NF6Ed8gEVfEUUpZyaRZZtg.png" /><figcaption>Few of the IOC’s observed in SIEM</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qyY9PSWSEJob3r7TJXUi8A.png" /><figcaption>Data sent to attacker C&amp;C on successful detonation</figcaption></figure><p>Above is a image of the fist data pack sent to attacker C&amp;C on successful detonation and below is one of the communication sample between C&amp;C server and the infected host.</p><pre>201.ll|&#39;|&#39;|SGFjS2VkXzIwOTNFMkJD|&#39;|&#39;|DESKTOP-MJJ9KE5|&#39;|&#39;|jae|&#39;|&#39;|23-11-22|&#39;|&#39;||&#39;|&#39;|Win 10 ProSP0 x64|&#39;|&#39;|No|&#39;|&#39;|im523|&#39;|&#39;|..|&#39;|&#39;|UHJvY2VzcyBNb25pdG9yIC0gU3lzaW50ZXJuYWxzOiB3d3cuc3lzaW50ZXJuYWxzLmNvbQA=|&#39;|&#39;|164.inf|&#39;|&#39;|SGFjS2VkDQowLnRjcC5ldS5uZ3Jvay5pbzoxODgwMQ0KV2luRGlyDQpNaWNyb3NvZnQgc3lzdGVtLmV4ZQ0KVHJ1ZQ0KRmFsc2UNCkZhbHNlDQpGYWxzZQ0KRmFsc2UNCkZhbHNlDQpGYWxzZQ0KRmFsc2U=</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*6Jm62rO3hG2Z9hhaRot-vw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*6h3gylpTGKXVo-HUkTk9QA.png" /><figcaption>Network IOC’s</figcaption></figure><h3>IOC’s</h3><ul><li>b02c3cc8be9da55c745c60521c8dc3d2c0a1494cfc8127b6785b58496a779383</li><li>18.158.249.75</li><li>18.192.31.165</li><li>3.125.102.39</li><li>3.125.223.134</li><li>3.124.142.205</li><li>hxxps[:]//dl.dropboxusercontent[.]com/s/p84aaz28t0hepul/Pass.exe?dl=0</li><li>pass.exe ( under temp directory )</li><li>Microsoft System.exe ( under C:\Windows , validated the hash )</li></ul><h3>Detection</h3><ul><li>Experimental <a href="https://github.com/Justanother-engineer/malware/blob/master/NjRAT/NjRAT.yaml">Sigma Rule</a></li></ul><h3>Conclusion</h3><p>In these series of blogs we have discussed the techniques , methods used by NjRAT even though its not devastating , but this can be leveraged to cause more harm to a environment. <br>I am still learning to write detection rules , so the write detection rules are still crude.</p><p>Thank you for your time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b41a3669d9a" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/unmasking-njrat-a-deep-dive-into-a-notorious-remote-access-trojan-part2-7b41a3669d9a">Unmasking NJRAT: A Deep Dive into a Notorious Remote Access Trojan Part2</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>