<?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 NtTeam21 on Medium]]></title>
        <description><![CDATA[Stories by NtTeam21 on Medium]]></description>
        <link>https://medium.com/@lielomer76?source=rss-3cde41622532------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8UDrl-iUXtDww13F</url>
            <title>Stories by NtTeam21 on Medium</title>
            <link>https://medium.com/@lielomer76?source=rss-3cde41622532------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 00:39:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lielomer76/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[Bypassing AV Solution Using Simple Evasion Techniques -Part 1]]></title>
            <link>https://medium.com/@lielomer76/bypassing-av-solution-using-simple-evasion-techniques-part-1-160cf90751c0?source=rss-3cde41622532------2</link>
            <guid isPermaLink="false">https://medium.com/p/160cf90751c0</guid>
            <dc:creator><![CDATA[NtTeam21]]></dc:creator>
            <pubDate>Sat, 02 Sep 2023 18:18:09 GMT</pubDate>
            <atom:updated>2023-09-02T18:18:09.371Z</atom:updated>
            <content:encoded><![CDATA[<p>Authors: Liel Ben Yehuda and Omer Golan.</p><p><strong>Hi everyone, this is the 1 of 5 articles that we will publish.</strong></p><p>In our opinion, <strong>BitDefender</strong> Total AV Security is the closest AV today to an EDR/XDR solution in terms of defending capabilities.</p><p>This article will show an example of how to bypass an AV solution such as BitDefender and run Sliver C2 shellcode.</p><p>Why <strong>Sliver</strong>?</p><p>From https://www.cybereason.com</p><p><strong>Silver C2</strong> is gaining popularity due to these reasons:</p><p>· Open-source alternative to Cobalt Strike and Metasploit</p><p>· Modularity of the platform with Armory</p><p>· Cross-platform : OS X, Linux and Windows</p><p>The framework provides all core capabilities for adversary simulation and most notables are:</p><p>· Dynamic code generation</p><p>· Compile-time obfuscation</p><p>· Multiplayer-mode</p><p>· Staged and Stageless payloads</p><p>· Secure C2 over mTLS, WireGuard, HTTP(S), and DNS</p><p>· Windows process migration, process injection, user token manipulation, etc.</p><p>· Let’s Encrypt integration</p><p>· In-memory .NET assembly execution</p><p>· COFF/BOF in-memory loader</p><p>· TCP and named pipe pivots</p><p>· Armory, alias and extension package manager</p><p>The technique we used in this article is called “<strong>Early Bird</strong>”.</p><p>This technique abuses Asynchronous Procedure Calls to execute the payload in memory in a stealthier way other than creating a new thread (QueueUserApc API).</p><p><strong>What is APC?</strong></p><p>Asynchronous Procedure Call or APC is a function to run code in the context of another thread. every thread has its own queue of APCs. If the thread enters an <strong>alertable</strong> state it starts to do APC jobs in the form of first in first out (FIFO). A thread can enters an alertable state by using <strong>SleepEx</strong>, <strong>SignalObjectAndWait</strong>, <strong>MsgWaitForMultipleObjectsEx</strong>, <strong>WaitForMultipleObjectsEx</strong>, or <strong>WaitForSingleObjectEx</strong> functions.</p><p>It’s important to note that only threads that are in “<strong>alertable state</strong>” can be executed by QueueUserApc.</p><p><strong>Early Bird</strong> creates our own process in a “<strong>SUSPENDED STATE</strong>”, queues an APC to the main thread, and resumes the thread afterward, so it can run the malicious code before the AV/EDR has a chance to place its hook.</p><ul><li>We also used PPID Spoofing technique to hide our newly created process.</li></ul><p>In addition to the techniques above we used Indirect System calls to avoid BitDefender hooking capabilities and to execute our payload without being detected.</p><p><strong>Steps:</strong></p><p><strong>1. The first step</strong> will be to generate a sliver payload.</p><p><strong>Creating the Sliver C2 payload:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*JmkBs5VrtBdHPv9ontrSvg.png" /><figcaption>Sliver C2 Payload</figcaption></figure><p>To avoid the static detection we used an encryption algorithm and decrypted the payload at runtime.</p><p>It is possible to use XOR, RC4, or any other encryption algorithms but in this article, we decided to use AES.</p><p><strong>Encrypting the shellcode with AES using HellShell.exe tool</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*qO2KauGC9sws3f2_Y-29Cg.png" /><figcaption>HellShell Tool From Maldev Academy <a href="https://github.com/NUL0x4C/HellShell">https://github.com/NUL0x4C/HellShell</a></figcaption></figure><p><strong>The Encrypted shellcode (output from HellShell.exe)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*1QxbRtmcNDdTXnGQAFAGEw.png" /><figcaption>Encrypted ShellCode</figcaption></figure><p><strong>AesCipherText[] </strong>— The encrypted shellcode.</p><p><strong>AesKey[] </strong>— The AES encryption key.</p><p><strong>AesIv[] </strong>— Initialization Vector, to ensure that the same plaintext doesn’t encrypt to the same ciphertext when using the same key.</p><p><strong>Decrypting The Payload at Runtime:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*YtbZ4sQ-HuuOHx3rPo1--Q.png" /><figcaption>The simpeDecryption function will decrypt the shellcode at runtime and save the decrypted payload into the “payload” variable.</figcaption></figure><p>2. <strong>The second step</strong> is to generate Indirect Syscalls, in this article we chose to use Syswhisper3.</p><p>The Windows APIs we are using for this type of injection are <strong>NtAllocateVirtualMemory</strong>, <strong>NtProtectVirtualMemory</strong>, <strong>NtWriteVirtualMemory, </strong>and <strong>NtQueueApcThread.</strong></p><p><strong>Indirect Syscalls</strong> — The technique aims to replace the original syscall instruction with a jump instruction pointing to a memory address of <strong>NTDLL</strong> where it stores the syscall instruction.</p><p><strong>SysWhispers3</strong> is a tool designed to generate header/ASM pairs for any system call in the core kernel image (ntoskrnl.exe), which can then be integrated and called directly from C/C++ code, evading user-lands hooks</p><p><strong>Generating Indirect Syscalls with syswhisper3 command:</strong></p><p><em>python syswhispers.py -a x64 -c msvc -m jumper_randomized -f NtAllocateVirtualMemory,NtProtectVirtualMemory,NtWriteVirtualMemory,NtQueueApcThread -o SysWhispers -v</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*n621CAnTbQA6wbYpV5bTuw.png" /><figcaption>syswhispers.py will automatically create the necessary files to use the Indirect Syscalls APIs.</figcaption></figure><p><strong>Indirect Syscalls asm file:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*KlFf3GzNVC-t6N9b85EfJw.png" /></figure><p><strong>What is an ASM file?</strong></p><p>An ASM file is a program written in the low level programming language known as assembly language. It is primarily used for writing hardware related code such as for programming micro-controllers. program is written using simple assembly language syntax that includes operators and operands to carry out different operations. ASM files are written and edited in text editors and are executed using an assembler program such as HLA, MASM, FASM, NASM, or GAS.</p><p>3. <strong>The third step</strong> is creating a process in a “<strong>SUSPENDED STATE</strong>” and injecting our payload into that process.</p><p>So, before the thread starts to execute the main code it calls the <strong>NtTestAlert</strong> function to empty the <strong>APC</strong> queue of the current thread and run the queued jobs.</p><p>We also used “<strong>EXTENDED_STARTUP_INFO_PRESENT</strong>” to use PPID Spoofing.</p><p>Modern EDR solutions track process parent-child relationships to determine if suspicious activity is taking place. For instance, Microsoft Word launching cmd.exe would likely trigger an alarm.</p><p>When calling <strong>CreateProcess</strong>, it’s possible to set the attribute <strong>PROC_THREAD_ATTRIBUTE_PARENT_PROCESS</strong> to define the parent process.</p><p><strong>Creating process in SUSPENDED STATE with PPID Spoofing.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rTR2JcwXvfZSZ0Ym3VCGfQ.png" /><figcaption>CREATE_SUSPENDED Flag is required to start the process in a “SUSPENDED STATE”</figcaption></figure><p>4. <strong>The fourth step </strong>is to inject our payload into our newly created process using a simple injection technique but without creating a new thread.</p><p><strong>Injecting the payload into our newly created process:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*W3yU0xkx43AN7zB7JxL4qQ.png" /><figcaption>Basic process injection with indirect syscalls</figcaption></figure><p><strong>NtAllocateVirtualMemory</strong> — Allocate virtual memory within the remote process.</p><p><strong>NtWriteVirtualMemory</strong> — The shellcode (<strong>pShellcode</strong>) is then written to the allocated memory in the remote process.</p><p><strong>NtProtectVirtualMemory</strong> — The memory protection is changed to <strong>PAGE_EXECUTE_READWRITE</strong>. This change in protection allows the shellcode to be executed in the remote process.</p><p>5. <strong>The fifth step </strong>is executing the payload using Asynchronous Procedure Call.</p><p>We will call the <strong>NtQueueApcThread</strong> and set our payload address in memory as an argument.</p><p>Because the process is in “<strong>SUSPENDED STATE</strong>” once we will resume the process using “<strong>ResumeThread</strong>” API the Asynchronous Procedure Call will execute our payload.</p><p><strong>Abusing Asynchronous Procedure Calls to execute the payload.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*QoYKBzmc2phKfeNq9zyraw.png" /><figcaption>The ResumeThread to execute our shellcode</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPO_vnKmD68MHiiqOAkZrA.png" /><figcaption>Sliver C2 ShellCode Executed</figcaption></figure><p><strong>Proof Of Concept</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ocrTKskvMFbTKLOlgBWSkQ.gif" /><figcaption>Proof Of Concept</figcaption></figure><ul><li>This article is for educational purposes only.</li><li>References and Special Thanks:</li></ul><p>mr.d0x</p><p>klezVirus — Syswhisper3</p><p><a href="https://github.com/klezVirus/SysWhispers3">GitHub - klezVirus/SysWhispers3: SysWhispers on Steroids - AV/EDR evasion via direct system calls.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=160cf90751c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>