OneDrive as a covert C2 transport for Cobalt Strike
Discover the most used tools by our community.
A Cobalt Strike User-Defined C2 channel that uses OneDrive as the transport layer.
In Azure Portal, go to App registrations and create a new app:
Note the tenant ID and client ID from the overview page.
Under Certificates & secrets, create a new secret and copy its value.
In the user's OneDrive, create two folders, one for the inbox and one for the outbox (e.g. c2inbox and c2outbox).
Open Graph Explorer, sign in as that user, and run:
GET https://graph.microsoft.com/v1.0/me/drive/root/children Grab the id of each folder and the driveId from any entry in the JSON response.
cp server/config.json.example server/config.json Fill in server/config.json:
make Run Start the relay (use screen or tmux so it stays up if your terminal disconnects):
python3 server/relay.py --config server/config.json --ts-addr --ts-port In Cobalt Strike, create a UDC2 listener on the same port and load client/bof.o.
The relay creates a few files next to your config to keep track of things between restarts:
If the relay's local state gets corrupted or a stale lock is blocking startup, use --clean to wipe the state file and spool directory so the relay starts fresh:
You can also reset manually by deleting the state file and spool directory yourself. If the lock file is stale (no relay running), delete it too.




