DLL HIJACKING // SEARCH ORDER // WINDOWS RCE
WINDOWS APPLICATION SECURITY

DLL Search-Order Hijacking to RCE on a Business Automation Client

PROC MON // PAYLOAD DLL // METERPRETER

researcher
Naveen Jagadeesan
published
2022-12-15
platform
Windows Desktop Application

Summary

A Windows business-automation desktop client loaded libraries using relative search order without integrity checks. Planting a malicious DLL in a preferred search location yielded code execution on application start — first proven with a benign Calculator payload, then escalated to a Meterpreter session.

Theory: why desktop clients still pay

Web apps get most of the attention in bug bounty programs. Desktop line-of-business tools often ship with:

The working theory:

If Procmon shows NAME NOT FOUND for a DLL in a directory the user (or a low-priv process) can write, you likely have a loader bug — not a malware technique demo.

DLL search-order primer (attacker view)

When an application calls LoadLibrary("foo.dll") without a full path, Windows walks a search order. Exact order depends on SafeDllSearchMode and API variants, but the practical attacker preference is:

  1. Application directory (often writable on poorly packaged enterprise tools)
  2. Other early entries before system directories

If the real dependency lives later in the order — or is optional and missing — a planted foo.dll wins.

Enumeration methodology

1) Baseline with Process Monitor

Filter on the target PID/process name:

2) Rank candidates

Prefer DLLs that:

Exploitation path

Proof payload

Generate a DLL that executes a non-destructive proof (e.g., launch Calculator) to confirm:

  1. load order preference
  2. no signature gate
  3. stability (app doesn’t crash before your DllMain runs)

Plant

Copy the payload to the winning path identified in Procmon, matching the expected filename.

Validate

On next start:

Escalate

Swap the proof DLL for a reverse-shell / Meterpreter-class payload. Without DLL signing checks or Safe loading policies, the loader treats malware as a dependency.

Impact

Root causes

Mitigations (vendor)

Takeaway

DLL hijacking is “old,” but it remains high-signal against niche enterprise clients. The research skill is not generating the payload — it is seeing the missing load as a vulnerability class and proving impact with a clean chain from Procmon to shell.