Skip to main content
Mallory
← Back to News
payload-delivery-evasionoffensive-tooling-releaseextension-plugin-hijack

Custom Windows DLL Loading via LdrLoadDll Highlights Evasion and Hijacking Risks

Attack Tradecraft · 2 sources · Updated 3mo ago · First seen Apr 27, 2023

Custom Windows DLL Loading via LdrLoadDll Highlights Evasion and Hijacking Risks

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.

Who uses this technique?Get the actors, campaigns, and ATT&CK mapping behind it.
Get the tradecraft
Event timeline

How this story unfolded

Events from the most recent confirmed update back to the earliest known activity.

2 events · Feb 9, 2023 – Apr 27, 2023
  1. Apr 27, 20234y ago

    Technical walkthrough demonstrates custom DLL loader via LdrLoadDll

    A technical article demonstrated a custom C++ implementation of LoadLibrary using ntdll.dll functions RtlInitUnicodeString and LdrLoadDll, then used it to load a sample DLL and resolve exported functions. The author described the technique as useful for malware development and AV evasion, while presenting it as an educational demonstration tested on Windows 10 x64.

    Malware development trick - part 27: WinAPI LoadLibrary implementation. Simple C++ example. - cocomelonc
  2. Feb 9, 20234y ago

    Microsoft publishes LoadLibraryA security documentation

    Microsoft published documentation for the Win32 LoadLibraryA API, including security guidance warning that unsafe DLL path resolution and SearchPath usage can enable malicious DLL loading and DLL hijacking.

    LoadLibraryA function (libloaderapi.h) - Win32 apps | Microsoft Learn
Linked entities

Related entities

Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.

Open in app →

Affected products

1 linked
Windows
Do you run this?Get the adversaries, campaigns, and ATT&CK mapping behind this technique, with detections ready to deploy.
See Who Uses This Technique
Mallory platform

See the full picture, correlated to your attack surface.

This page covers what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which threat actors are using it right now, and what to deploy next.

Exposure mappingMap indicators from this story to your assets and identify affected systems in minutes.
Threat actor evidenceEvery observed campaign, victim, and pivot linked to actors named in this story.
Associated malwareMalware, exploits, and IOCs connected to the activity described here.
Detection signaturesYARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Scheduled alertsGet matching new stories delivered to your team as they break, not the next morning.
AI threadsAsk questions about this story and take action on the answers.