Skip to content
RCE Write-up Beginner

Dll Hijacking Persistence Using Discord

Discord loads a missing DLL (d3d12.dll) from a user-writable directory, allowing an attacker who can place a file there to execute code when Discord starts. This provides user-level persistence, but requires physical access to the machine.

bob van der staak Follow

Published on infosecwriteups.com

After finding a few different persistence methods. I wanted to validate an old DLL Hijacking exploit for persistence.

bob van der staak, on infosecwriteups.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 attempts to load a DLL from a user-writable directory without verifying its integrity, and the DLL is missing from the expected location.

Impact

An attacker with physical access could achieve user-level persistence by executing code whenever Discord starts; the report notes the issue was not accepted as a vulnerability because it requires physical access.

What the attacker needed

Physical access to the machine; ability to write to the Discord app directory

The fix

Applications should not load DLLs from user-writable locations and should verify file hashes before loading.

How it was found

  1. Create a malicious DLL named d3d12.dll.
  2. Place the DLL in the Discord app directory under %APPDATA%/local.
  3. Start Discord; the DLL is loaded and executes the attacker's code.

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.

When a program starts, it often loads extra code from DLL files. If a DLL is missing, Windows may look in folders the user can write to. An attacker can put a malicious DLL there, and the program will run it, letting the attacker run their own code each time 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.

More by bob van der staak

View all

3 more disclosed reports, best first.

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.