Custom Windows DLL Loading via LdrLoadDll Highlights Evasion and Hijacking Risks
Attack Tradecraft · 2 sources · Updated 3mo ago · First seen Apr 27, 2023

A technical walkthrough demonstrated how to load a Windows DLL without calling the standard LoadLibrary API by invoking the undocumented ntdll.dll routine LdrLoadDll from a C++ program. The example used a sample pet.dll, then resolved exported functions with GetProcAddress, showing that the DLL could be loaded and executed successfully on Windows 10 x64. The technique was presented as a malware-development and AV-evasion method, illustrating how attackers or red teams can bypass more obvious API usage while preserving normal DLL functionality.
Microsoft's documentation for LoadLibraryA underscores the broader security implications of DLL loading, warning that unsafe path handling and incorrect assumptions about the DLL search order can enable malicious DLL loading and hijacking. The guidance notes that developers who rely on insecure search behavior, including the current working directory or SearchPath, may expose applications to attacker-controlled libraries, making DLL loading behavior a persistent abuse point for both stealthy execution and privilege abuse on Windows.


