Cobalt Strike persistence via DLL Hijacking
A Microsoft Teams update binary, Update.exe, tried to load a missing DLL from its own directory, allowing a malicious DLL to be loaded and executed. An attacker with local admin could place a crafted DLL to run a Cobalt Strike payload and persist, while mimicking Teams traffic to hide command-and-control communications.
blackarrow.net
Published on blackarrow.net
During a recent Red Team operation got local admin privileges on a workstation where an EDR solution was identified. In this scenario, the next step to proceed with the engagement was to infect and persist on the compromised system, towards securing remote access.
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 DLL in its own directory before the system directory, allowing a malicious DLL placed there to be loaded.
Impact
An attacker with local admin could execute arbitrary code and persist on the system, and could mimic legitimate Microsoft Teams traffic to evade detection.
What the attacker needed
Local admin privileges; write access to the application directory; victim runs the vulnerable binary
How it was found
- Use Process Monitor with filters to find processes loading non-existent DLLs.
- Identify Update.exe trying to load CRYPTSP.dll from its executable directory.
- Create a malicious DLL exporting CryptAcquireContextW that executes shellcode.
- Place the DLL in the same directory as Update.exe.
- Start Update.exe (or wait for it to run on login) to load the DLL and execute the payload.
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 shared code libraries called DLLs. If it looks for one in its own folder before the system folder, an attacker who can write to that folder can put a malicious DLL there. The program then runs the attacker's code instead of the real library, which can lead to persistence and remote control.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.