2022-01-24 03:28:16 +00:00
# Laika
2022-03-18 04:51:53 +00:00
< p align = "center" >
< a href = "https://github.com/CPunch/Laika/actions/workflows/check-build.yaml" > < img src = "https://github.com/CPunch/Laika/actions/workflows/check-build.yaml/badge.svg" alt = "Workflow" > < / a >
< a href = "https://github.com/CPunch/Laika/blob/main/LICENSE.md" > < img src = "https://img.shields.io/github/license/CPunch/Laika" alt = "License" > < / a >
< / p >
2022-04-14 17:38:57 +00:00
[![asciicast ](https://asciinema.org/a/487180.svg )](https://asciinema.org/a/487180)
2022-01-24 03:28:16 +00:00
2022-04-14 17:38:57 +00:00
Laika is a simple cross-platform Remote Access Toolkit stack for educational purposes. It allows encrypted communication across a custom binary protocol. The bot client supports both Windows & Linux environments, while the shell & CNC server specifically target Linux environments. Laika is meant to be small and discreet, Laika believes in hiding in plain sight.
2022-03-07 17:06:56 +00:00
2022-01-30 07:15:51 +00:00
Some notable features thus far:
2022-04-14 17:38:57 +00:00
- [X] Lightweight, the bot alone is 183kb (`MinSizeRel`) and uses very little resources minimizing Laika's footprint.
- [X] Authentication & packet encryption using LibSodium and a predetermined public CNC key. (generated with `bin/genKey` )
2022-04-06 06:07:16 +00:00
- [X] Server and Shell configuration through `.ini` files.
2022-03-28 21:28:44 +00:00
- [X] Ability to open shells remotely on the victim's machine.
2022-04-14 17:38:57 +00:00
- [ ] Persistence across reboot: (toggled with `-DLAIKA_PERSISTENCE=On` )
- [X] Persistence via Cron on Linux-based systems.
- [ ] Persistence via Windows Registry.
2022-03-28 21:28:44 +00:00
- [ ] Ability to relay socket connections to/from the victim's machine.
2022-02-17 23:57:08 +00:00
- [ ] Uses obfuscation techniques also seen in the wild (string obfuscation, tiny VMs executing sensitive operations, etc.)
2022-04-14 17:38:57 +00:00
- [ ] Simple configuration using CMake:
2022-03-28 21:28:44 +00:00
- [X] Setting keypairs (`-DLAIKA_PUBKEY=? -DLAIKA_PRIVKEY=?`, etc.)
2022-02-17 23:57:08 +00:00
- [ ] Obfuscation modes
2022-01-24 03:28:16 +00:00
2022-02-18 00:21:29 +00:00
## Would this work in real world scenarios?
2022-03-02 16:54:31 +00:00
My hope is that this becomes complete enough to be accurate to real RAT sources seen in the wild. However since Laika uses a binary protocol, the traffic the bot/CNC create would look very suspect and scream to sysadmins. This is why most RATs/botnets nowadays use an HTTP-based protocol, not only to 'blend in' with traffic, but it also scales well with large networks of bots where the CNC can be deployed across multiple servers and have a generic HTTP load balancer.
2022-02-18 00:21:29 +00:00
I could add some padding to each packet to make it look pseudo-HTTP-like, however I haven't given much thought to this.
2022-01-30 07:15:51 +00:00
2022-02-25 04:13:05 +00:00
## Directories explained
2022-03-28 21:28:44 +00:00
- `/cmake-modules` holds helper functions for CMake.
- `/lib` is a shared static library between the bot, shell & CNC. LibSodium is also vendor'd here.
- `/cnc` is the Command aNd Control server. (Currently only targets Linux)
- `/bot` is the bot client to be ran on the target machine. (Targets both Linux and Windows)
- `/shell` is the main shell to connect to the CNC server with to issue commands. (Currently only targets Linux)
2022-02-25 04:13:05 +00:00
- `/tools` holds tools for generating keypairs, etc.
2022-03-15 18:05:11 +00:00
## CMake Definitions
| Definition | Description | Example |
| ----------------- | ------------------------------------- | --------------------------------------------------------------------------------- |
| LAIKA_PUBKEY | Sets CNC's public key | -DLAIKA_PUBKEY=997d026d1c65deb6c30468525132be4ea44116d6f194c142347b67ee73d18814 |
| LAIKA_PRIVKEY | Sets CNC's private key | -DLAIKA_PRIVKEY=1dbd33962f1e170d1e745c6d3e19175049b5616822fac2fa3535d7477957a841 |
| LAIKA_CNC_IP | Sets CNC's public ip | -DLAIKA_CNC_IP=127.0.0.1 |
| LAIKA_CNC_PORT | Sets CNC's bind()'d port | -DLAIKA_CNC_PORT=13337 |
2022-04-08 00:04:42 +00:00
| LAIKA_PERSISTENCE | Enables persistence for LaikaBot | -DLAIKA_PERSISTENCE=On |
2022-03-15 18:05:11 +00:00
> examples are passed to `cmake -B <dir>`
2022-01-30 07:15:51 +00:00
## Configuration and compilation
2022-02-18 00:21:29 +00:00
Make sure you have the following libraries and tools installed:
2022-02-18 21:26:29 +00:00
- CMake (>=3.10)
2022-03-03 16:57:33 +00:00
- Compiler with C11 support (GCC >= 4.7, Clang >= 3.1, etc.)
2022-02-18 00:21:29 +00:00
2022-03-28 21:28:44 +00:00
The only dependency (LibSodium) is vender'd and statically compiled against the `/lib` . This should be kept up-to-date against stable and security related updates to LibSodium.
2022-01-30 07:15:51 +00:00
First, compile the target normally
2022-02-18 21:26:29 +00:00
```sh
$ cmake -B build & & cmake --build build
2022-01-30 07:15:51 +00:00
```
Now, generate your custom key pair using `genKey`
2022-02-18 21:26:29 +00:00
```sh
$ ./bin/genKey
2022-01-30 07:15:51 +00:00
```
Next, rerun cmake, but passing your public and private keypairs
2022-02-18 21:26:29 +00:00
```sh
2022-04-14 17:38:57 +00:00
$ rm -rf bin build & & \
2022-02-18 21:26:29 +00:00
cmake -B build -DLAIKA_PUBKEY=997d026d1c65deb6c30468525132be4ea44116d6f194c142347b67ee73d18814 -DLAIKA_PRIVKEY=1dbd33962f1e170d1e745c6d3e19175049b5616822fac2fa3535d7477957a841 -DCMAKE_BUILD_TYPE=MinSizeRel & & \
cmake --build build
2022-01-30 07:15:51 +00:00
```
2022-02-18 00:21:29 +00:00
2022-04-11 17:56:42 +00:00
Output binaries are put in the `./bin` folder
# Ansible-Playbook
To setup a test VPS for a Laika CNC, check out [this ansible playbook ](https://github.com/CPunch/Laika-Playbook ).