The introduction of ChatGPT and other large language models marked a kind of revolution. Code synthesis has become simple, understandable, fast and free for everyone. This powerful and versatile tool can also be used to create malware, which in the future may develop into a new and extremely dangerous type of polymorphic cyber threats.
Traditional security solutions such as EDR use layered data analysis systems to combat some of today's most sophisticated threats. The developers of most automated security tools claim that their brainchild prevents new or non-standard behaviors almost every day. But in practice this happens very rarely.
By using new malware creation techniques such as neural network algorithms, hackers can combine a range of easily detectable actions into an unusual hodgepodge and effectively evade detection. Because antivirus models simply will not be able to recognize such software as malicious.
The problem will be exacerbated when artificial intelligence can independently "become at the helm" and fully manage cyber attacks. Because AI methods can be quite atypical compared to those used by humans. In addition, the staggering speed with which these attacks can be carried out makes the threat much more dangerous.
To demonstrate what AI-based malware can do, Hyas created a simple PoC exploit that uses a large language model to synthesize the functions of a polymorphic keylogger and dynamically change the code at runtime. And all this without any C2 infrastructure to deliver or test functionality. Experts gave their malware the name "BlackMamba" in honor of the deadly snake.
Hyas researchers were able to combine two seemingly incompatible concepts. The first was to eliminate the command and control channel (C2 server) in order to automate the actions of malware. And the second concept implied the use of code generation methods using artificial intelligence, so that the malicious program itself changes on the fly, replenishing its “combat arsenal”, and evading detection more effectively.
BlackMamba uses a secure executable that accesses a trusted OpenAI domain during execution. The malware then executes the dynamically generated code in the context of a benign program using Python's exec() function. At the same time, the entire malicious polymorphic part of the program remains completely in memory, which also does not contribute to detection by anti-virus solutions.
Every time BlackMamba is launched, it resynthesizes all of its keylogging capabilities, making the main malicious component truly polymorphic. The malware was tested by one of the industry's leading EDR solutions (unnamed, unfortunately) and went completely undetected numerous times.
Using the built-in keylogging feature, BlackMamba may collect sensitive information such as usernames, passwords, credit card numbers, and other personal or sensitive data that a user enters on their device. Once this data is captured, the malware uses the Microsoft Teams webhook to send the collected data to a malicious channel where the data can be analyzed and then sold on the dark web. Since Microsoft Teams is also a trusted domain, antivirus solutions did not react to uploading data through this channel.
Potential attackers can use the popular Auto-py-to-exe tool to package and deliver malware to a target computer. It is an open source Python package that allows developers to convert their Python scripts into standalone executables that can be run on Windows, macOS, and Linux operating systems. While this package is intended for legitimate use, it can also be used by malware authors to package their Python-based "creations" into executable files that can be distributed and run on the target system without the need to install additional software.
Once an executable is created, a hacker can distribute it to potential targets via email links, social engineering schemes, and other typical means. When the victim executes the executable, the malware will silently run on the victim's system and be able to perform various malicious activities such as stealing confidential information, changing system settings, or downloading additional malware.
The threats posed by this new type of malware are very real. By eliminating communication with the C2 server and generating a new unique code right at the time of malware execution, malware such as BlackMamba is practically not detected by modern antivirus solutions.
In the era of the rapid development of artificial intelligence and the constant replenishment of its areas of application, it is extremely important to remain vigilant and be even more careful about your own information security. If cybercriminals do start massively injecting AI technologies into their malicious products, who knows what that could lead to.