Skip to content

Commit 546054f

Browse files
committed
Clean up docs and files
1 parent cc63766 commit 546054f

File tree

10 files changed

+85
-43
lines changed

10 files changed

+85
-43
lines changed
File renamed without changes.

README.md

-35
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77

88
Maliketh is a multi-user, customizable C2 framework. The goal of Maliketh is to provide a flexible, easy to use C2 framework that can be customized to fit the needs of the operator. The poster used in the initial presentation is located [here](./data/Maliketh%20C2%20Poster.png).
99

10-
## Server features
11-
12-
* Multi-user (operators)
13-
* Easily configurable (via YAML files)
14-
* Easily deployable (via Docker)
15-
* Per-operator implant builder
16-
1710
## Implant features
1811

1912
The implant is written in C++ and targeted for Windows. The main feature of the implant is its ability to change its behavior based on the configuration file it receives from the server. This allows the operator to customize the implant to fit their needs. The implant also has the following features (see [here](./design/opcodes.md) for more info):
@@ -29,34 +22,6 @@ The implant is written in C++ and targeted for Windows. The main feature of the
2922
* *Very* Basic Anti-VM
3023
* Sleep skipping detection
3124

32-
## Server deployment
33-
34-
To start the server, 90% of your work can be done by running the following command in the project root:
35-
36-
```bash
37-
docker-compose -f server/docker-compose.yml --env-file server/.env.example up
38-
```
39-
40-
Note: You will need to create a `.env` file in the `server/` directory. See `.env.example` for an example.
41-
42-
The only thing left to do is bootstrap the database and create the admin user. To do this, run the following command in the `server` directory:
43-
44-
```bash
45-
./bootstrap_db.sh
46-
```
47-
48-
The output of this script will be a JSON configuration for the admin user. You can use this with the maliketh [client](./client/) to connect to the server.
49-
50-
## Ideal server setup
51-
52-
An ideal setup would involve 2 servers. 1 running nginx which the implants connect back to, and 1 running the actual server. This would allow you to use a domain name for the implants to connect to, and also allow you to use SSL. The nginx server would be configured to proxy all traffic to the server. The nginx server would also be configured to use SSL. The server would be configured to only accept connections from the nginx server. This would allow you to use SSL, but not have to worry about the overhead of SSL on the server.
53-
54-
On the server side, Wireguard should be installed and configured. The server should be configured to only accept connections from the Wireguard interface. Wireguard keys should be generated for each operator. The server should be configured to only accept connections from the Wireguard interface.
55-
56-
<p align="center">
57-
<img src="./data/Maliketh%20Network%20Diagram.png" alt="Ideal setup" width="500"/>
58-
</p>
59-
6025
## Future work
6126

6227
- [ ] Implement Golang client

__init__.py

Whitespace-only changes.

design/operator.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ Operators are a single user of the C2 framework. A server can have many operator
44

55
## Creating an operator
66

7-
In order to create an operator, the admin of the server needs to run the `create_operator.py` script:
7+
In order to create an operator, the admin of the server needs to run the `create_operator.py` script in the `operator` docker container:
8+
9+
For this example, assume the docker container has ID `37fc3915b843`.
810

911
```bash
10-
python create_operator.py --name operator_name
12+
docker exec 37fc3915b843 python create_operator.py --name operator_name
1113
```
1214

1315
More options can be found in the help section of that script.

design/specs/operator-c2-http.md

+37
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ These are the *default* endpoints for the operator HTTP server. These endpoints
1313
| `/op/implant/config/:implant_id` | `POST` | Updates the malleable configuration of the implant with the given ID | [example](#post-opimplantconfigimplant_id) |
1414
| `/op/implant/list` | `GET` | Lists all implants | [example](#opimplantlist) |
1515
| `/op/implant/kill/:id` | `GET` | Removes the given implant from the database and purges it from the affected system. | [example](#opimplantkillimplant_id) |
16+
| `/op/implant/build` | `POST` | Builds an implant with the given configuration | [example](#opimplantbuild) |
1617
| `/op/auth/token/request` | `GET` | Used for fetching an operators authentication token | [example](#opauthtokenrequest) |
1718
| `/op/auth/token/revoke` | `DELETE` | Revokes the current operator authentication token | [example](#opauthtokenrevoke) |
1819
| `/op/auth/token/status` | `GET` | Checks the status of the current operator authentication token | [example](#opauthtokenstatus) |
@@ -411,3 +412,39 @@ Failure:
411412
"message": "Invalid token"
412413
}
413414
```
415+
416+
### `/op/implant/build`
417+
418+
This endpoint is used to build a new implant. Note that depending on the power of the C2 server, this may take a while (a few minutes). The request should be a valid JSON object with any of the following fields:
419+
420+
| Name | Meaning | Default |
421+
| :-- | :----- | :----- |
422+
| `initial_sleep_seconds` | The number of seconds to wait before connecting to the server | `180` |
423+
| `schtask_persist` | Whether or not to use schtasks for persistence | `true` |
424+
| `use_antidebug` | Whether or not to use antidebugging techniques | `true` |
425+
| `kill_parent` | Whether or not to kill the parent process after spawning (unused) | `true` |
426+
| `use_antivm` | Whether or not to use antivm techniques | `true` |
427+
| `scheduled_task_name` | The name of the scheduled task | `MicrosoftEdgeUpdateTaskMachineUA` |
428+
| `register_max_retries` | The maximum number of times to retry registering with the server | `5` |
429+
430+
__Example request__:
431+
432+
```json
433+
{
434+
"initial_sleep_seconds": 180,
435+
"schtask_persist": true,
436+
"use_antidebug": true,
437+
"kill_parent": true,
438+
"use_antivm": true,
439+
"scheduled_task_name": "MicrosoftEdgeUpdateTaskMachineUA",
440+
"register_max_retries": 5
441+
}
442+
```
443+
444+
__Example response__:
445+
446+
```json
447+
{
448+
"implant": "base64_encoded_implant_pe"
449+
}
450+
```

design/structs/README.md

-3
This file was deleted.

nginx/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ FROM nginx:alpine
22

33
WORKDIR /app
44

5+
ENV PROXY_HOST=proxy.example.com
6+
ENV C2_HOST=c2.example.com
7+
58
COPY nginx.conf /etc/nginx/nginx.conf
69
COPY fullchain.pem /app/fullchain.pem
710
COPY privkey.pem /app/privkey.pem

nginx/nginx.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ http {
55
server {
66
listen 80;
77
server_name _;
8-
return 301 https://kjh2iur80in12rjfbjn.ddns.net$request_uri;
8+
return 301 https://${PROXY_HOST}$request_uri;
99
}
1010

1111
server {
1212
listen 443 ssl;
13-
server_name kjh2iur80in12rjfbjn.ddns.net;
13+
server_name ${PROXY_HOST};
1414

1515
ssl_certificate /app/fullchain.pem;
1616
ssl_certificate_key /app/privkey.pem;
@@ -20,7 +20,7 @@ http {
2020
proxy_set_header X-Real-IP $remote_addr;
2121
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2222

23-
proxy_pass http://neuredirector.redirectme.net;
23+
proxy_pass http://${C2_HOST};
2424
}
2525
}
2626
}

server/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Maliketh - Server
2+
3+
## Features
4+
5+
* Multi-user (operators)
6+
* Easily configurable (via YAML files)
7+
* Easily deployable (via Docker)
8+
* Per-operator implant builder
9+
10+
11+
## Setup
12+
13+
To start the server, 90% of your work can be done by running the following command in the project root:
14+
15+
```bash
16+
docker-compose -f server/docker-compose.yml --env-file server/.env.example up
17+
```
18+
19+
Note: You will need to create a `.env` file in the `server/` directory. See `.env.example` for an example.
20+
21+
The only thing left to do is bootstrap the database and create the admin user. To do this, run the following command in the `server` directory:
22+
23+
```bash
24+
./bootstrap_db.sh
25+
```
26+
27+
The output of this script will be a JSON configuration for the admin user. You can use this with the maliketh [client](../client/) to connect to the server.
28+
29+
30+
## Ideal server setup
31+
32+
An ideal setup would involve 2 servers. 1 running nginx which the implants connect back to, and 1 running the actual server. This would allow you to use a domain name for the implants to connect to, and also allow you to use SSL. The nginx server would be configured to proxy all traffic to the server. The nginx server would also be configured to use SSL. The server would be configured to only accept connections from the nginx server. This would allow you to use SSL, but not have to worry about the overhead of SSL on the server.
33+
34+
On the server side, Wireguard should be installed and unique WireGuard keys should be given to each operator along with their operator configuration. The server should be configured to only accept connections from the Wireguard interface. Wireguard keys should be generated for each operator. The server should be configured to only accept connections from the Wireguard interface.
35+
36+
<p align="center">
37+
<img src="./data/Maliketh%20Network%20Diagram.png" alt="Ideal setup" width="500"/>
38+
</p>

server/instance/c2.db

-20 KB
Binary file not shown.

0 commit comments

Comments
 (0)