<?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 Bartu Kılıçkaya on Medium]]></title>
        <description><![CDATA[Stories by Bartu Kılıçkaya on Medium]]></description>
        <link>https://medium.com/@bartukilickaya?source=rss-b11c68af8db4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Bartu Kılıçkaya on Medium</title>
            <link>https://medium.com/@bartukilickaya?source=rss-b11c68af8db4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:05:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bartukilickaya/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[Lockbit 3.0 Anti-Analysis Techniques]]></title>
            <link>https://medium.com/@bartukilickaya/lockbit-3-0-anti-analysis-techniques-fc74a326c30a?source=rss-b11c68af8db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc74a326c30a</guid>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[lockbit]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[ransomware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Bartu Kılıçkaya]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 20:47:01 GMT</pubDate>
            <atom:updated>2025-03-25T13:25:30.040Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Abstract</em> — Ransomware continues to pose a significant threat to cybersecurity, with LockBit 3.0 being a prominent variant leveraging sophisticated anti-analysis techniques to evade detection and hinder forensic investigations. This research focuses on the systematic reverse engineering of the LockBit 3.0 executable using tools such as debuggers, disassemblers, and decompilers to identify and catalog its anti-analysis techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*36UH8V4iN_qbwrts.jpg" /></figure><h3>1. Introduction</h3><p>LockBit ransomware, which was first observed in 2019, has rapidly evolved into one of the most formidable threats in the cyber threat landscape. Known for its highly adaptable codebase and rapid deployment capabilities, LockBit has undergone several iterations, with LockBit 3.0 representing its most sophisticated version so far. This variant incorporates advanced anti-analysis techniques, such as dynamic obfuscation, sandbox detection, and debugger evasion, which make it a significant challenge for cybersecurity professionals and researchers.</p><p>Since the Lockbit builder is leaked, we will use <em>Build.bat</em> file to create necessary files such as decryptor, ransomware types (dll, exe, passwordless).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rVF-QEhbW8Gmdlk9KBpc3A.png" /><figcaption>Fig. 1.1. Lockbit builder</figcaption></figure><p><em>Build.bat</em> file uses public and private keys that reside in <em>Build </em>folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqZotJycUzbkQHe8DnJR_w.png" /><figcaption>Fig. 1.2. Build.bat file</figcaption></figure><p>Eventually, all of the files will be created in <em>Build</em> folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFrlnjRpTeeMsIDf5oF8mQ.png" /><figcaption>Fig. 1.3. Running batch file</figcaption></figure><p>We will analyze <em>LB_pass.exe </em>file which needs a password that resides in <em>Password_exe.txt</em>. The password should be provided to the executable as a command line argument otherwise ransomware will terminate itself without any activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RRNRg40oWiK6uh34JzeskQ.png" /><figcaption>Fig. 1.4. Entire build</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*2Q_3kKODyb1e14i_mB4_OA.png" /><figcaption>Fig 1.5. Entrypoint</figcaption></figure><h3>2. Reversing the Executable</h3><p>In this section, we will examine each anti-analysis technique one by one starting with the deobfuscation routine.</p><h3>2.1. Deobfuscation Routine</h3><p>Initially, when we check the import table, we see only a few functions imported.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jGtChXjnSdWMeuDkiFRpFg.png" /><figcaption>Fig. 2.1. Import address table (IAT)</figcaption></figure><p>Checking ghidra for function references, these imported functions are not referenced at all which is suspicious. That also means functions would be dynamically loaded during runtime. (If the reference count is 1 for a function, that means it has only data reference and no call reference.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*cTkR9ugDlZb7oWT9j3qOoQ.png" /><figcaption>Fig 2.2. Function references in ghidra</figcaption></figure><p>Checking the entry point, the first function <strong><em>FUN_</em>00419000</strong> is responsible for deobfuscating the following called functions. For instance, by checking the function <strong>FUN_0040639c’s </strong>initial state we see unresolved instructions, but after the deobfuscation routine the bytes are altered and valid instructions can be distinguished.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*Ae5-QjVh66kaQc0hjmc6ZQ.png" /><figcaption>Fig 2.3. Initial state of <strong>FUN_0040639c</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*LsxqPCnXTYnXu-JMIdBbxQ.png" /><figcaption>Fig. 2.4<strong>. After calling FUN_00419000 the state of FUN_0040639c</strong></figcaption></figure><p>Another way to find that the first function is responsible for deobfuscating other functions is by checking section entropy values. Our deobfuscator function (<strong>FUN_00419000</strong>) resides in the <strong>.itext </strong>section but the following functions that are called after this function reside in the <strong>.text</strong> section. This hints to us that functions that reside in the <strong>.text </strong>section will be deobfuscated after the end of the <strong>FUN_00419000 </strong>function call which is in the <strong>.itext</strong> section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*E7AHsNnynaqYrdgGXkodeA.png" /><figcaption>Fig. 2.5. Section entropy values</figcaption></figure><h3>2.2. Dynamic API Resolving</h3><p>Previously I have mentioned that IAT doesn’t contain interesting functions and imported ones are not referenced at all. This hints to us that dynamic API resolving can be in place. The second function (<strong>FUN_0040639c</strong>) after the entry point is used for this purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*kOwQOuzlevL0NWMU8K0n4g.png" /><figcaption>Fig. 2.6 Decompiled view of <strong>FUN_0040639c</strong></figcaption></figure><p>After investigating sub-functions inside <strong>FUN_0040639</strong>, <strong>FUN_00405aec</strong> is used for API name resolving. Depending on the parameter passed, this function resolves the function names based on the hexadecimal value passed to it as a parameter. In order to dynamically resolve functions, first the necessary dll must be imported, and then the needed functions inside that dll. To achieve this, we need a Windows API that loads the dll into memory and also Windows API that finds the function’s virtual address in that loaded dll. In general, we see LoadLibrary and GetModuleHandle (if dll is already loaded into memory) for dll loading and GetProcAddress for retrieving exported function pointers. In our case, since ntdll.dll is automatically loaded in memory during program initialization, LdrLoadDll and LdrGetProcedureAddress are resolved using ntdll.dll’s export directory table recursively in <strong>FUN_00405aec.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*33SdT-5uyIPKww91Zb46TQ.png" /><figcaption>Fig. 2.7 Resolving LdrLoadDll</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*fdhyF4UwhsVxoJJz_iKCaQ.png" /><figcaption>Fig 2.8. Resolving LdrGetProcedureAddress</figcaption></figure><p>Eventually, these two functions are used to resolve other functions using their either ordinals or names inside <strong>FUN_004059d4.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*zZ7UXVzTRghF4SlZgwV7JQ.png" /><figcaption>Fig. 2.9. Finding addresses of functions</figcaption></figure><p>As previously mentioned, in order to find LdrLoadDll and LdrGetProcedureAddress, they must find ntdll.dll’s export directory and traverse it. To achieve this, they first need to PEB(The Process Environment Block) structure using fs register’s 0x30 offset. To make this stealthier, they don’t reference it directly like FS:[0x30] instead they use XOR, INC, and SHIFT operations to eventually get 0x30 value and indirectly reference it using EAX register.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*OCjYZlN5MXYPVPyFi1_cAQ.png" /><figcaption>Fig. 2.10. Reaching PEB using FS register</figcaption></figure><p>Then they use 0xc offset of PEB to reach LDR and 0xc offset of LDR to reach InLoadOrderModuleList. Then DllBase and export_directory are resolved respectively to traverse each dll’s export directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*OVr8bmUkGzN0gdNz70yp8g.png" /><figcaption>Fig. 2.11. Reaching export directory</figcaption></figure><p>Coming back to our main function <strong>FUN_0040639c, </strong>we see function <strong>FUN_00405da0 </strong>is called repetitively (Fig. 2.6). Apparently second parameter of this function is checksum values of API’s that they need to resolve during runtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*anMQqEr5rcOYFUsv93_DPQ.png" /><figcaption>Fig. 2.12. Checksum values</figcaption></figure><p><strong>0xCCCCCCCCh</strong> hexadecimal value is used inside <strong>FUN_00405da0 </strong>to detect the end of the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*dbc8dRmMxZBhr51az7Lu1A.png" /><figcaption>Fig. 2.13. End of checksum list detection</figcaption></figure><p>The function uses <strong>RtlAllocateHeap </strong>to traverse checksum_list and write an address list into the newly allocated memory region. Each 4 bytes comprises a memory location that will be called later to resolve API. One of the addresses in the list is <strong>0x045D3DC8</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*7M5lB_WmedITPeoc7q9O1w.png" /><figcaption>Fig. 2.14. Address list</figcaption></figure><p>If we check the address <strong>0x045D3DC8</strong>, it resolves the desired API address using rotate and xor and eventually jumps to that address, in our case it is RtlHeapSetInformation which is a native API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*vOYUKaedniTA7ElT5iGYvQ.png" /><figcaption>Fig. 2.15. Resolving RtlSetHeapInformation</figcaption></figure><p>After renaming variables and functions considering their purposes, <strong>FUN_0040639c </strong>function’s decompiled state looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJv9RakwtLXlkeibugYUQg.png" /><figcaption>Fig. 2.16. FUN_0040639c decompiled state</figcaption></figure><h3>2.3. Debugger Detaching</h3><p>Inside FUN_0040639c, <strong>FUN_0040b444 </strong>is called after creating checksum lists. This function then calls <strong>ZwSetInformationThread </strong>with the second parameter 0x11.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*iyTp_CyKyINChHIzjTx4LQ.png" /><figcaption>Fig. 2.17. ZwSetInformationThread call</figcaption></figure><p>According to documentation, if the second parameter ThreadInformationClass is set to 0x11, the threads of the process will be hidden to debuggers. Note that the document states this for NtSetInformationThread function, but it is practically the same as ZwSetInformationThread.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i1gT3ZfjTWWlGzE3yQThAw.png" /><figcaption>Fig. 2.18. Anti-debugging with ZwSetInformationThread</figcaption></figure><h3>2.4 Disabling Remote Debugger Attaching</h3><p>Inside FUN_0040639c, <strong>FUN_0040b470 </strong>function is called in the end (Fig 2.16). First, our api_resolver function (FUN_00405aec) is called to get <strong>DbgUiRemoteBreakin</strong> function pointer inside ntdll.dll.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxBdNHoCWSHUKMzwRnrnFA.png" /><figcaption>Fig 2.19. “DbgUiRemoteBreakin” function address</figcaption></figure><p>Then it changes <strong>DbgUiRemoteBreakin </strong>function’s memory location’s protection to (Read &amp; Write &amp; Execute) using ZwProtectVirtualMemory with parameter 0x40. Normally it has only Read &amp; Execute permissions since it is a .text section inside ntdll.dll.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a_3EuP60GXE9SWqxjwvPUg.png" /><figcaption>Fig 2.20. Permission change of “DbgUiRemoteBreakin”</figcaption></figure><p>Then it calls <strong>cryptbase.SystemFunction040</strong> which is <strong>RtlEncryptMemory </strong>with the parameters “DbgUiRemoteBreakin” function memory address and size value 0x20.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81nMdXYfAJq7hQZCb-ytXw.png" /><figcaption>Fig. 2.21. cryptbase.SystemFunction040 call</figcaption></figure><p>This function simply encrypts the first 0x20 (32) bytes of <strong>DbgUiRemoteBreakin </strong>in order to prevent remote debugging. This will cause the program to crash. Dumping “DbgUiRemoteBreakin” before and after encryption:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*jHXeFmw-FycoBQpPMUUi1w.png" /><figcaption>Fig. 2.22. Before SystemFunction040 call</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*GreJgFCGi7r3m3-lsJIf_w.png" /><figcaption>Fig. 2.23. After SystemFunction040 call</figcaption></figure><h3>3. Conclusion</h3><p>LockBit 3.0 employs a range of sophisticated anti-analysis techniques to evade detection and hinder forensic investigation. Through systematic reverse engineering, I identified key mechanisms such as dynamic deobfuscation, API function resolution via checksum validation, and multiple debugger detection and prevention techniques. These are the ones that I’ve found during my analysis.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc74a326c30a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unauthorized Access to NTDS.DIT File in Domain Controllers]]></title>
            <link>https://medium.com/@bartukilickaya/unauthorized-access-to-ntds-dit-file-in-domain-controllers-69505ec67f20?source=rss-b11c68af8db4------2</link>
            <guid isPermaLink="false">https://medium.com/p/69505ec67f20</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[credentials]]></category>
            <category><![CDATA[red-team-tools]]></category>
            <category><![CDATA[ntds]]></category>
            <dc:creator><![CDATA[Bartu Kılıçkaya]]></dc:creator>
            <pubDate>Sun, 14 Jan 2024 14:06:55 GMT</pubDate>
            <atom:updated>2024-01-14T14:07:09.841Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Unauthorized Access to NTDS.DIT File in Domain Controllers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*7GA_GSV7rYT6qsVbO-_epw.png" /></figure><p><strong>Research &amp; Report:</strong></p><p>NTDS.DIT file is a prominent component of the Windows Active Directory service. Active Directory is a directory service used by Windows domain networks. It stores information of the data on the network, such as users, groups, and computers, and it allows domain admins to manage this information. NTDS.DIT stands for “NT Directory Services Database Information Table” and it is basically a database file that stores information from the Active Directory database, so it contains user and service accounts, group memberships, and other active directory-related information. It is generally located in domain controllers which are servers responsible for user authentication.</p><p><strong>The NTDS.DIT file is crucial for several reasons:</strong></p><p>· <strong>User Authentication</strong>: NTDS.DIT file is used to authenticate users when they log in to domain-joined computers.</p><p>· <strong>Group Memberships</strong>: NTDS.DIT file retains information about group memberships and it allows domain admins to manage user access rights effectively.</p><p>· <strong>Resource Access</strong>: It contains information about network resources such as services, printers, and shared folders.</p><p>· <strong>Security Policies</strong>: It stores security policies that apply to users and computers in the active directory domain.</p><p>Unauthorized extraction and access to the NTDS.DIT file can cause significant harm to the domain. If attackers somehow gain access to this file, they can potentially compromise the entire Active Directory domain using stored user account credentials. It contains information about user accounts, such as usernames, password hashes, and security identifiers (SIDs). The attackers can dump this NTDS.DIT file and crack the password hashes offline and then use that password for unauthorized access to other systems. NTDS.DIT file also stores domain administrator credentials as well, so if they manage to crack the password hash of domain administrators, they can control the entire domain. Additionally, the attackers can perform golden ticket, silver ticket, denial of service (DoS), and domain trust exploitation attacks as well.</p><p>NTLM and LM hashes are hashed representations of user passwords used in Windows operating systems for authentication. When a new user creates his password or changes it, windows generates these hashes which are then used for authenticating users. Also if attackers manage to obtain these hashes, instead of trying to crack these hashes, they can pass-the-hash to authenticate as a user without knowing the plain text password. Attackers exploit these dependencies to gain unauthorized access to other systems.</p><p><strong>Current Protection Analysis:</strong></p><p>Windows has several protection techniques in order to protect the NTDS.DIT file. Here are some of the protection techniques:</p><p>· <strong>File System Security</strong>: By setting proper access control lists (ACLs), domain admins can restrict access to this file. On the other hand, misconfiguring these permissions can lead to unauthorized access to NTDS.DIT.</p><p>· <strong>Encryption at Rest</strong>: Windows supports BitLocker which is used to encrypt the entire operating system including NTDS.DIT file. Encryption at rest can help prevent unauthorized access in case of physical theft.</p><p>· <strong>Auditing and Monitoring</strong>: Administrators should monitor access to NTDS.DIT file. Auditing and monitoring can help detect suspicious activities. If monitoring configurations are inadequately placed, such as logging too much or too little information, it may impact the effectiveness of monitoring.</p><p><strong>Practical Implementation:</strong></p><p>We have a domain controller with Microsoft Server 2016 installed at ip: 192.168.14.154</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*qabMG2oHVJ3K1rzDdBKfzw.png" /></figure><p>We can access this domain controller with a domain administrator account using evil-winrm with our kali machine. Assuming we have already compromised one of the domain administrators’ accounts. We can log in using either password directly with -p parameter or using password hash with -H parameter, it doesn’t matter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*tqCYh5g8ANSGhuDSBr4bPQ.png" /></figure><p>We can then dump NTDS.DIT file using this command:</p><p><strong>powershell “ntdsutil.exe ‘ac i ntds’ ‘ifm’ ‘create full c:\temp’ q q”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*hLQzxQD4CWUWtYEHvtpuKg.png" /></figure><p>After downloading registry hives and NTDS:DIT file to our local machine, we can use <strong>secretsdump</strong> from impacket tools in order to dump the credentials from the NTDS.DIT file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zlN--rrGDb-Qa_UiRxE8SA.png" /></figure><p>As you can see, we managed to dump domain user account names and corresponding NTLM hashes successfully.</p><p><strong>Security Measures Design:</strong></p><p><strong>Implement Credential Guard:</strong> In order to protect the NTDS.DIT file, we can implement Windows Credential Guard which is a feature that helps protect domain credentials using virtualization. It can prevent Pass-the-hash and pass-the-ticket attacks.</p><p><strong>Enable LSA Protection: </strong>LSA protection can prevent code injection attacks and thus; mitigate attacks that attempt to manipulate LSA processes to access NTDS.DIT file.</p><p><strong>Use Protected Users Security Group: </strong>The Protected Users security group in Active Directory is used to protect important accounts such as domain admin, service, and backup accounts by preventing them from using weak encryption types.</p><p><strong>Audits and Monitoring: </strong>Regularly auditing and monitoring related to NTDS.DIT file access and using SIEM solutions can help prevent unauthorized access.</p><p><strong>Restricted Access to DC: </strong>Let only domain administrator(s) remotely access the domain controller in order to protect NTDS.DIT file. For instance, <strong>user2</strong> will not be able to access the domain controller and dump NTDS.DIT file because he does not have RDP or WinRM access to domain controller. This way, even if user2 account was compromised, the attacker wouldn’t be able to remotely access the domain controller and dump NTDS.DIT file.</p><p>Remove remote management membership from user2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*d-uMGAWxuTlNjazqgdjf1Q.png" /></figure><p>Then we won’t be able to access the domain controller using evil-winrm.</p><p>Before &amp; after editing group membership:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*K_WdEM2gvjzh50G16BSOfw.png" /></figure><p><strong>References:</strong></p><p><a href="https://www.ired.team/offensive-security/credential-access-and-credential-dumping/ntds.dit-enumeration">https://www.ired.team/offensive-security/credential-access-and-credential-dumping/ntds.dit-enumeration</a></p><p><a href="https://windowstechno.com/what-is-ntds-dit/">https://windowstechno.com/what-is-ntds-dit/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69505ec67f20" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>