Using Generative AI to Understand How an Obfuscated Script Works

Tackling Code Obfuscation

When facing a new technical challenge, I’m someone who often feels “in over my head,” I tackle these feelings through research and preparation. Today, I’m delving into code obfuscation, a frequent challenge in malware analysis. I’ll also demonstrate how a solo intelligence analyst can navigate such a challenge using generative AI.

In the context of Windows, batch files are scripts that can automate the placement, execution, and deletion of malware. To conceal these capabilities, obfuscation techniques are employed. There are numerous methods to hide code, making it difficult for both humans and machines to understand its purpose. A particular tool recently caught my attention due to the perplexing nature of its output.

This signals that there’s more for me to learn, so let’s dive in.

The obfuscator:
https://github.com/BiggerDABOSS/BatchObfuscator

When I run my benign script through BatchObfuscator, it transforms from readable to unreadable.

      (image: original script)
      (image: obfuscating the script)
      (image: result of obfuscating the script)
    Interestingly, the obfuscated script still executes correctly when run.
      (image: successful obfuscated script execution)
    (image: the code that applies obfuscation to a batch file)

Upon examining the obfuscation code, I must confess that I don’t fully grasp how it functions. It utilizes certutil.exe, a tool I’m familiar with for its Base64 encode/decode capabilities, but this alone doesn’t fully explain what we’re observing. There are additional elements in this code that warrant further exploration.

Let’s seek assistance from GPT-4 and see if it can provide clarity. I’ve been using a generative AI Framework called Fabric for various tasks, including code analysis.

Let’s discover what insights generative AI can offer.
This article has been indexed from Security Boulevard

Read the original article:

Using Generative AI to Understand How an Obfuscated Script Works