Evaluating LLM-Generated Obfuscated XSS Payloads for Machine Learning-Based Detection
This paper presents a structured pipeline that combines deterministic techniques with large language models to generate and evaluate obfuscated XSS payloads based on runtime behavior, revealing that while fine-tuning improves behavioral preservation, current LLMs still struggle to create valid obfuscations that enhance downstream machine learning detection performance.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are a security guard at a very fancy art gallery (the internet). Your job is to stop people from sneaking in and painting "X" on the walls (hacking the website).
For a long time, the bad guys (hackers) have been trying to trick you. They don't just walk in with a giant red "X" painted on their shirt. Instead, they wear a disguise. They might paint the "X" in invisible ink, write it in a secret code, or break it into tiny pieces and hide them in different pockets. This is called obfuscation.
Your old security cameras (traditional detectors) are great at spotting a big red "X," but they get confused when the "X" is hidden in code or broken up. So, the gallery owners decided to hire a super-smart AI robot (a Large Language Model, or LLM) to help them. They told the robot: "Please learn how the bad guys disguise their 'X's, and then generate thousands of new disguises so we can practice spotting them."
This paper is about testing if that AI robot is actually good at its job.
The Problem: The Robot is a "Fake" Artist
The researchers found a big problem. The AI robot is great at making things look like a disguise. It can write code that looks like a secret message. But, just because it looks like a disguise doesn't mean it actually works as a disguise.
Think of it like a child drawing a picture of a tiger. The child might draw stripes and a tail, and it looks like a tiger. But if you put that drawing in a zoo, it won't roar, it won't hunt, and it won't scare anyone. It's just a drawing.
In the world of hacking, if the AI generates a "disguised" attack that looks scary but doesn't actually trigger the alarm (doesn't execute the code), it's useless. It's just noise.
The Solution: The "Test Drive" Pipeline
To fix this, the researchers built a special testing pipeline. Here is how it works, step-by-step:
- The Recipe Book (Deterministic Chains): First, they used a strict rulebook to create "perfect" disguises. They took a real attack, applied specific rules (like "turn letters into numbers" or "add invisible comments"), and made sure the attack still worked. This gave them a list of "Source" (original attack) and "Target" (perfect disguise) pairs.
- The Driving School (Fine-Tuning): They took their AI robot and gave it a crash course using only those "perfect" pairs. They said, "Look, this is how you turn an attack into a working disguise. Learn this pattern."
- The Test Drive (Runtime Validation): This is the most important part. Instead of just checking if the robot's new disguises look similar to the old ones, they actually ran them in a real web browser.
- Did the browser pop up an alert box?
- Did it steal data?
- Did it crash?
- If the new disguise did the exact same thing as the original attack, it passed. If it did nothing, it failed.
The Results: The Robot is Getting Better, But Still Stumbles
Here is what they found:
- The Baseline (No Training): When they asked the untrained robot to make disguises, only 15% of them actually worked. The robot was mostly just making up gibberish that looked like code but did nothing.
- The Trained Robot: After the "driving school" (fine-tuning), the success rate went up to 22%. That's a huge improvement (about 47% better!), but it still means that 78% of the time, the robot is failing. It's still making "fake tigers" that don't roar.
- The Secret Sauce: They noticed that some types of disguises were easier for the robot to learn than others. Simple tricks like "splitting words apart" worked well. But complex tricks like "turning everything into hexadecimal numbers" confused the robot, and those usually failed.
The Big Question: Does This Help the Security Guard?
Finally, they asked: "Does giving the security guard these new robot-made examples actually make the guard better at catching real hackers?"
- The Answer: Not really. The guard's performance didn't get much better.
- Why? Because the robot's examples were still a tiny drop in a huge bucket of real data. Also, since most of the robot's examples were "fake tigers" (didn't work), adding them didn't teach the guard anything new.
- The Silver Lining: However, they found that if they only used the 22% of examples that passed the "Test Drive" (the ones that actually worked), they could add them to the training data without hurting the guard's performance. It's safe to use, even if it doesn't immediately make the guard a superhero.
The Takeaway
The main lesson of this paper is: Don't trust an AI just because it sounds smart.
In cybersecurity, generating text that looks like a hack is easy. Generating text that actually works as a hack is incredibly hard. If you want to use AI to help you find hackers, you must have a "Test Drive" (a real browser check) to make sure the AI isn't just hallucinating fake attacks.
In short: The AI is a talented artist, but it's still learning how to paint a tiger that can actually hunt. Until it gets better, we need to double-check its work before letting it teach our security guards.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.