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 4mo 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.

Why it matters

Impact assessment

Affects Windows software developers, enterprise Windows endpoints, and security teams monitoring user-mode execution on Windows 10 x64 and similar platforms. The immediate risk is not a new vendor vulnerability but an evasion and abuse technique that can support stealthy code execution and DLL hijacking, potentially leading to malware execution, privilege abuse, and reduced visibility for API-focused detections.

The scope is broad because the technique relies on native Windows loader behavior and common DLL-loading patterns rather than a niche product flaw. No active exploitation campaign is described in the source material, but the walkthrough provides directly reusable tradecraft for red teams and malware authors.

Supporting details

  • Affected platforms: Windows systems using standard DLL loading behavior, explicitly demonstrated on Windows 10 x64.
  • Affected populations: software developers, defenders monitoring Windows API usage, and organizations with applications that load DLLs from unsafe paths.
  • Business impact:
    • Stealthier malware execution by avoiding obvious LoadLibrary call patterns.
    • Increased risk of DLL hijacking where applications rely on insecure search order or current working directory resolution.
    • Potential operational disruption if malicious DLLs execute in trusted processes.
    • Possible reputational and financial impact from endpoint compromise or abuse of signed/legitimate applications.
  • Scope of exposure:
    • Broad exposure to insecure DLL search practices across Windows applications.
    • Technique is generally applicable, not limited to one vendor or product.
  • Exploitation status:
    • No in-the-wild campaign or intrusion is reported in the references.
    • The article explicitly frames the method as malware-development and AV-evasion tradecraft.
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.