Skip to content
RCE Write-up Advanced

Vulnerabilities in Open Source C2 Frameworks

The author reviewed several open source command-and-control frameworks and found a mix of authenticated and unauthenticated remote code execution flaws, including command injection in Sliver and Havoc, a path traversal file download in Ninja, and an input injection in SHAD0W. An attacker with an operator account, or in some cases a fake agent, could run commands on the teamserver itself.

Laurence Tennant Follow

Published on blog.includesecurity.com

Application and source code security assessments are the primary focus of our work at Include Security, but sometimes network pentesting that uses software written by other hackers is needed. I decided to investigate open source Command & Control (C2) frameworks used in network and red teaming assessments to…

Laurence Tennant, on blog.includesecurity.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 underlying mistake is that untrusted values (operator options or agent-reported details) are placed into shell commands or file paths on the teamserver without proper validation or escaping.

Impact

An authenticated operator could gain a root shell on the teamserver, breaking the intended security boundary between operator and server; in other frameworks a fake agent could achieve unauthenticated code execution.

What the attacker needed

An operator account on the teamserver; ability to run agent generation commands

The fix

Sliver removed the vulnerable stager command and now tells operators to build stagers locally; the Havoc service API bypass was fixed but the authenticated RCE remained in the master branch at the time of writing.

How it was found

  1. Generate a Metasploit stager with advanced options that include an output file path on the teamserver.
  2. Start a listener on the attacking machine to catch the reverse shell.
  3. Trigger agent compilation so the overwritten bundled binary runs, giving a root shell.

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.

A command-and-control framework is software that attackers (or red teams testing defences) use to manage computers they have already broken into. The central server that coordinates everything is called the teamserver, and the small program on the victim machine is the agent. The author found that in several of these frameworks, a user or a fake agent could trick the teamserver into running commands on itself, which is a serious problem because the server holds all the operation's data.

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 Laurence Tennant

View all

1 more disclosed report, 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.