Its-Just-Nans / mirai-dockerized

Analysis and implementation of a botnet
https://n4n5.dev/articles/mirai-docker/
1 stars 0 forks source link

SR2I-project-mirai-docker

Source code

We do not own the source code of the MIRAI botnet, the source code, as mentionned in the commit comes from https://github.com/jgamblin/Mirai-Source-Code

Note that we modifed some parts. See also https://n4n5.dev/articles/mirai-docker/

Modified parts

Modified parts are mentionned in the 3rd commit of the repo, here is little explations :

See also https://github.com/Its-Just-Nans/mirai-dockerized/issues/1

All changes can be seen here

Used docker

Explanations

Loader

We give some ips and creds to the loader. The loader connect to these and tries to run some commands. To determine the arch of the target, there are multiple option that we are not using in this repo. The arch is used to determine which mirai code to send.

After determining the arch, the loader tries to download the binary by using wget or tftp (depending which is installed).

Note that are tftpd configuration on the host server is acting weird so we only use a apache2 server (you can try and tell us by making a PR/issue !)

After downlading it, the loader run the mirai code.

Mirai code

In our example, the mirai code only connects to the CNC (for now ?)

Normally the mirai code is also contacting the Scanner and attcking, but as we use a debug version of mirai, the scan and attack are not launched

A good idea would be that @3-dd-1 make some commits to run a non-debug version of mirai code :)

Run

docker compose up --build
# connect to CNC then enter username and password
telnet localhost 2323
shift
pwd
# you are now in the CNC 'shell'

Testing

During testing, we recommmend to use the --force-recreate option of docker compose

docker compose up --build --force-recreate

# useful commands
docker compose exec -it db mysql -u root -p