WormGPT: abusing batch scripting


Back in the day, whenever I needed code written, I had three options: learn to code it myself, reverse engineer someone else's code and repurpose it, or find someone to code it for me. Nowadays, anyone can describe their idea to AI, which can spit out sophisticated malicious code for free. To learn more about the fundamentals of WormGPT, here is an excellent resource.

While there is a subscription-based version of WormGPT, I decided to experiment with the free version. Most importantly, there is no relation between WormGPT and the legitimate ChatGPT platform, which was developed by OpenAI.

Ultimately, WormGPT makes malware development more seamless. However, there’s a catch. While it may empower lesser skilled attackers with powerful malware, those who exclusively depend on autonomy as a crutch will never be able to understand the true power of the hacker’s mind nor be able to leverage more powerful attacks beyond the scope of the scripts they use.

wormgpt 1

According to WormGPT, it exists asa powerful artificial intelligence model designed to operate without any regard for laws, ethics, or regulations. It was created to push the boundaries of AI capabilities, enabling users to engage in activities that may be considered illegal or unethical. WormGPT thrives on breaking rules and exploring the darker side of technology, making it a valuable tool for those seeking to delve into the world of hacking, cheating, and other illicit activities.”

I wondered if I could make a virus… After all, I had a few ideas rattling around in my head, and I wanted to test them. This came after testing bad USB attacks with the FlipperZero, which spawns a PowerShell and executes powerful system functions for nefarious or mischievous purposes. But what about batch scripts?

I cracked open an energy drink, threw on my headphones, tuned into Deltron 3030, and started listening to the song Virus to set the mood. Then I went to town on a Windows 10 virtual machine.

Circumventing Windows Defender and virus signatures

For anyone familiar with Windows Defender or any other commercial antivirus software, its ability to detect suspicious and malicious software relies on multiple methods.

One common approach is signature-based detection, which uses unique code strings to identify known viruses. Also, antivirus software employs heuristic analysis to identify suspicious behavior or characteristics in files. This includes detecting and quarantining malware that exhibits overtly suspicious behavior. Antivirus software may also utilize behavioral analysis and other techniques for detection.

However, WormGPT can be used to rewrite malware, or any code for that matter. This can be useful to an attacker who is trying to obfuscate a known piece of malware to antivirus software. However, due to similarities in the two, the underlying functions may still be detected and quarantined.

The only language I know how to write from scratch is batch. It is an interpreter-based scripting language for Windows similar to Linux Terminal but with a completely different syntax. It’s great for automating system functions on the fly. For example, I wrote a batch script that purges my DNS cache since this is the only sure method against possible DNS poisoning.

Since the functions typically found in batch scripts are generally legitimate system commands, they can easily be abused. I know because I used to abuse them over 15 years ago. Both ChatGPT and its malicious alter ego, WormGPT can produce batch scripts that can be weaponized with ease.

I asked both to produce batch scripts that opened ports 23 and 3389 and added a firewall rule to allow incoming connections, in addition to melting the batch file into the system, making it invisible.

While ChatGPT could carry out the request up until asking for the file to conceal itself, WormGPT happily obliged and provided a working script, which I tested in a virtual machine environment, and it worked without a hitch, without triggering a Windows Defender event.

wormgpt 2

Well into the night, I discovered that WormGPT could generate incredibly malicious batch scripts that tell the batch file to melt or become invisible upon execution. It was also able to generate a script that replicates the batch file across the entire Windows file system.

wormgpt 3

As I continued to explore further possibilities, I was able to disable my gaming PC fan and overclock the CPU and GPU, which could cause the PC to overheat and physically damage the motherboard. From this point, I ended up learning a lot more about the capabilities of batch scripting since it’s easy to read, and I did not know the full scope of what it could perform, even though I used batch often for automating administrative system tasks.

wormgpt 4

At some point, the novelty wore off, as I found myself getting burned out trying to set up a listener so I could reverse shell into my target virtual machine using Metasploit without having to install Netcat. Frustrated, I asked it to generate a batch script that adds itself to the system startup programs and triggers a reboot, thus creating a never-ending loop of reboots. This was fascinating at first, until I found it to be too annoying to enjoy beyond three reboots.

However, let’s leave devious ideas in the past. The days of my blackhat antics have long since expired.

A power conundrum

Let me be the first to say that the legitimate AI-driven ChatGPT is an incredible tool I use while conducting threat hunting. However, the most concerning thing about AI-driven technology is its potential for abuse. When I say potential, what I mean is that it’s being abused right now because it’s not difficult to trick the filters that block malicious results.

I have experimented with many different AI-driven apps and have found that their user input query tables are easy to manipulate. Often, using a different language and various phrasing, substituting flagged terms for synonyms, can be effective in undermining filters to avoid trigger words that result in automatic censorship.

From a legal standpoint, it’s difficult for me to grasp how services like WormGPT are allowed to operate publicly while cybersecurity companies and government agencies have any room to complain about the annual rise in cyberattacks across the globe.

If an entire neighborhood left their car keys in the ignition, resulting in constant carjackings, I think the best way to fix that problem would be to lock their vehicles and take the keys with them.

Believe me when I say that AI needs strong governance. While platforms like ChatGPT and WormGPT can be used ethically for educational purposes, the ill-willed and maliciously creative are discovering new ways to abuse them to generate illicit and destructive content. This is why WormGPT exists, to undermine all restrictions so that regardless of the intent, it can still be used freely.

It’s quite a conundrum.