Skip to content
RCE Write-up Intermediate

Remote Code Execution through DLL Hijacking

A desktop application tried to load a DLL that was not present in its installation directory, so an attacker could place a malicious DLL with that name there. When the victim launched the application, the attacker's DLL ran and gave the attacker a reverse shell and full control of the machine.

medium.com

Published on medium.com

2. Created a malicious DLL using msfvenom with the name of the DLL missing from the thick client application

Ghost, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application searched for a required DLL in a user-writable directory without verifying its origin, allowing a planted file to be loaded and executed.

Impact

An attacker who can write to the application's directory could execute code on the victim's machine and take full control of it.

What the attacker needed

Write access to the app's install folder; victim launches the application

The fix

The application should load its DLLs from a trusted, non-user-writable location and verify their integrity before loading them.

How it was found

  1. Notice that the desktop application expects a DLL that is absent from its directory.
  2. Build a malicious DLL with the same name as the missing one.
  3. Copy that DLL into the application's folder on the victim machine.
  4. Wait for the victim to start the application.
  5. Receive a reverse shell connection from the victim.
  6. Gain full control of the victim's system.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Desktop programs often load extra code files called DLLs from their own folder. If one of those files is missing, the program may still look for it there, and anything with that name gets loaded and run. An attacker who can write a file into that folder can therefore run their own code on the victim's computer when the program starts.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.