Polymorphic code and ChatGPT (read label before use!) · Kluetek
← all field notes
ai

Polymorphic code and ChatGPT (read label before use!)

Polymorphic malware rewrites itself to dodge detection. Language models can help catch it — and, as a recent proof of concept showed, can also help write it. A look at both edges of the same blade.

·2023-03-15·4 min read

Polymorphic code

Polymorphic code is malware that changes its behaviour to avoid detection. It can be caught with machine learning, which identifies patterns in text — language models are good at this because they look at the length and frequency of words and phrases within the corpus being analysed.

Why language models matter for detection

Language is how we interact with the world. Language models are an essential part of AI detection systems because they help computers understand how humans communicate — and what those interactions mean. When you’re trying to detect malicious behaviour on a network, it helps for the security software to understand human language well, so it doesn’t drown you in false positives or miss real threats.

Malicious prompts that bypass EDR

Polymorphic code is hard for traditional antivirus to detect and block because it changes its appearance. Recently the OpenAI API client — an otherwise harmless API — was used in a polymorphic-code simulation to bypass EDR filters. The simulation used the API client as part of a malicious prompt that would execute Python (a second layer) with no user interaction beyond clicking ‘OK.’

// the proof of concept
  • “I created a simple proof of concept exploiting a large language model to synthesize polymorphic keylogger functionality on-the-fly, dynamically modifying the benign code at runtime — all without any command-and-control infrastructure to deliver or verify the malicious keylogger functionality.” — Jeff Sims, Principal Security Engineer, HYAS InfoSec

Language models as a detection tool

Language models are a form of natural-language processing. They can detect malicious prompts by comparing them against known-good prompts, and they underpin systems like ChatGPT as well as research tools such as DeepHack and A2I2.

Conclusion

Language models are a powerful tool for spotting advanced persistent threats. Polymorphic code has been around since the dawn of computing, but it’s now being used in new ways that make it even harder to detect. The same models that can write it can also help us identify it — flagging the malicious prompts that slip past EDR and other defences before they cause damage.

polymorphic codeChatGPTEDRlanguage modelsmalware
// names, hosts and indicators are redacted — we describe engagements in shape and outcome only.Talk to an engineer →