In this article we are going to analyze a new malware sample written in Python. By seeing the main source code we can see there is a reference to the C&C IP address 31.56.209[.]86. We can have the evidence of the command execution sequence of change directory to /tmp folder, wget command to download the SH script hosted on the URL 31.56.209[.]86/vb[.]sh on the port 80 (HTTP protocol), put as output "s" for file name output, chmod 777 command for maximum rights elevation and the consequential execution with "sh" command of the second stage malicious script.
The variable "PATHS" is used as reference to the imported library vb_safe to get the paths lists for vulnerabilities exploitations and PHPFuck encoder.
It's important to highlight that the function "data_for" with arity two takes as arguments the path and payload and based on the path the returned attributes like in JSON form change.
The function "hit" takes the variable "base" as the only argument and it uses that in POST requests.
The payload is filled in with the calling of the function (from variable "V") "build_payload" and the arguments "system" and INSTALL, the session is initialized with the calling of the function "requests.Session();" and initially the boolean variable for the verification is put as False. With the variable "s" the headers are updated for the User Agent attribute with "Mozilla/5.0".
Then we have a try-catch construct with the post requests with the built payloads with base + path (for each path), the data variable is filled in with a call to the function "data_for" and with timeout set as 12.
After the sessions phase the verification is done by analyzing the status code (if it is lower than 500) and it checks if "vb" is contained in the response text put in lowercase, then the results are printed and with base, path, status code, length attribute and the flush boolean variable put as True and then True value is returned.
In other cases False value is returned. The function "worker" has two arguments: q (used in the while-true loop) and if the payload is loaded correctly then it is appended with the "out" variable.
The main function strips with the slashes by creating the array "bs" with the variable "l" in a for loop with the argument sys.argv[1]. If the pattern for the URLs "://" is not present it is added consequently.
For every element in "bs" array, added in a queue, threads are used for concurrent execution and infection chain with the "worker" function and finally the output "vbullettin fired done" is printed.
By downloading and analyzing the second stage malicious script vb.sh we can have evidences related to the fact it uses several logical OR operators (||) for different "cd" commands, and switches constructs based on different architecture types, the "q" variable is removed and then it is used for the wget command with the use of the variable "U" that references to the variables "B" and "A" which are associated to the C&C IP address and the architecture type which is then associated to a specific exploit threat.
Based on the different types of exploits used different tools and libraries are called like: curl, busybox, toybox, Python.
The C&C IP address belongs to SWISSNET LLC, it is recognized as malicious by OSINT sources:
The first and second stage artifacts are recognized as malicious by OSINT sources and respectively labeled as "Trojan.Generic-Script.Save.ba608" and "Trojan.Linux.Gafgyt.m!c":
- d23d9985a06c6a686ab3cc87c05c42fa0eea91830b0373f438982ac3b711ba93
- 0ee23067f2515f795d293601a5ad10b572e13cfe
- 8c731e3bc509cd874219202ad7bd0ee5
- 45f0bfd98c7cace51a48e7b9064e7877774d5eec8bd3848100ab4d122221a828
- ceddb37469a64d9931a1cc799c9447271ab5c273
- e4d6693e2704b6ab224b44d31795b574
- 31.56.209[.]86
- microsoft-entra[.]net
%20%5BIn%20esecuzione%5D%20-%20Oracle%20VirtualBox.jpg)
%20%5BIn%20esecuzione%5D%20-%20Oracle%20VirtualBox.jpg)
%20%5BIn%20esecuzione%5D%20-%20Oracle%20VirtualBox.jpg)
%20%5BIn%20esecuzione%5D%20-%20Oracle%20VirtualBox.jpg)
%20%5BIn%20esecuzione%5D%20-%20Oracle%20VirtualBox.jpg)
%20%5BIn%20esecuzione%5D%20-%20Oracle%20VirtualBox.jpg)













