Dec 17, 2019 11:15 PM
(This post was last modified: Dec 17, 2019 11:21 PM by Shisho.)
I've been developing a botkiller that specifically targets malware running on Linux servers. Ideally it runs on 32 bit and 64 bit architectures and uses the C99 header stdint.h to define architecture independent unsigned integers with fixed widths. This should allow it to be portable across any 32/64 bit system.
The code can be found below:
https://github.com/shishohf/advanced-botkiller
The code uses the kernel PID max file to get the maximum PID and uses a zero signal kill that iterates from 1 to the PID max and stores it in an array. It then uses the /proc filesystem to find the binary file that started the process by reading the symlink found under /proc/PID/exe and stores the real path. It checks if the file has been removed by searching the real path for the string "(deleted)" and kills the process if it has. If it has not been deleted it then proceeds to store the binary file in a buffer and iterates over it byte by byte to match any sequence of characters located within the binary provided in the STRINGS[] array. If it matches any sequence it kills the process and removes the binary.
I am looking for suggestions that will improve this botkiller.
I was considering adding functions like a ptrace if you are root to access process memory and scan heap and stack for strings since bots like Mirai use encrypted strings loaded into a linked list and reverse the encryption at runtime.
Anything you think is useful will be considered as I am actively developing this code.
Thanks in advance.
The code can be found below:
https://github.com/shishohf/advanced-botkiller
The code uses the kernel PID max file to get the maximum PID and uses a zero signal kill that iterates from 1 to the PID max and stores it in an array. It then uses the /proc filesystem to find the binary file that started the process by reading the symlink found under /proc/PID/exe and stores the real path. It checks if the file has been removed by searching the real path for the string "(deleted)" and kills the process if it has. If it has not been deleted it then proceeds to store the binary file in a buffer and iterates over it byte by byte to match any sequence of characters located within the binary provided in the STRINGS[] array. If it matches any sequence it kills the process and removes the binary.
I am looking for suggestions that will improve this botkiller.
I was considering adding functions like a ptrace if you are root to access process memory and scan heap and stack for strings since bots like Mirai use encrypted strings loaded into a linked list and reverse the encryption at runtime.
Anything you think is useful will be considered as I am actively developing this code.
Thanks in advance.



