/BattlePaddle

A C2 Bot using Raw Sockets on both Windows and Linux

Primary LanguageC++

BattlePaddle

Still in alpha, it works but still needs a lot of cleaning up and documentation. This is a work in progress.

What is it?

BattlePaddle is a Raw Socket C2 bot for both Linux and Windows.

Dependencies?

The dependencies are as minimal as possible:

  • Linux
    • pthread on the device compiling the binary.
      • I have chosen to include all of pthread into the binary to make deployment as simple as possible. Just drop the binary and run.
  • Windows
    • Just the things found in this repo :)

Configure and Compiling

Configuration

Edit the config file found in source/bpLib/config/Config.cpp

Each configuration option in that file is as followed:

  • c2IpEdit is the IP of your C2.
    • If your C2 IP is 10.1.1.100 the line would look like:
      uint8_t c2IpEdit[4] = {10, 1, 1, 100};
  • gatewayipEdit is the IP of your this bot's gateway. Only linux uses this configuration. I am looking into alternatives to find this automatically in a way that keeps it distro agnostic.
    • If your Gateway IP is 10.1.1.1 the line would look like:
      uint8_t gatewayipEdit[4] = {10, 1, 1, 1};
  • useGateway, once again only used for linux, tells the bot whether or not there is a hop between it and the C2. Used so the bot knows what IP to arp for.
  • requestActionInterval is the rate at which the bot will request a command from the C2. This is in milliseconds.

Compilation

Both Windows and Linux create a shared library such as a .SO or .DLL and an executable. You only need to deploy and run one of them.

  • Linux

    • The build systems I use include:
      • cmake
      • g++
      • make

    An example of commands to compile:

    mkdir build
    cd build
    cmake ..
    make
  • Windows

    • The build systems used include:
      • ninja

    I build the project on windows either with Visual Studio with it's cmake build tools or VsCode using the Cmake Tools Extension

RawSocket Library

Go to source/bpLib/rawsocket to read more.

C2

Go to C2 to read more.

Alpha Timeline

  • Setup Raw sockets on linux
  • Investigate Raw sockets on windows
    • winsock
    • WinDivert
      • Receiving Packets
      • Sending Packets
  • Design BP protocol
  • Determine how Windows will interact with Linux bot
    • Recieve C2 commands via Linux bots
    • Don't send anything to avoid pcap dependency if raw sockets work
    • Get WinDivert injects to work
  • Implement ability for bots to run commands.
  • Refactor Code
  • Documentation