Encoding Obfuscation - Script Tag XSS with Encoded Protocol Prefix
This rule spots attempts to hide a classic script-tag cross-site scripting payload by encoding parts of it as unusual byte sequences instead of plain text. The trick is meant to slip past simple filters that only look for the literal text 'javascript:' or plain whitespace.
How the attack works
An attacker crafts input containing a script tag around a javascript:alert() payload, which is a well-known way to trigger arbitrary JavaScript execution if rendered unsafely. Instead of writing normal spaces or the plain protocol prefix, they substitute specific byte sequences that render as invisible or non-standard whitespace and separator characters. A naive filter looking for exact strings like 'javascript:' with normal spacing will not match the disguised version, but browsers or downstream renderers may still interpret it as executable code. This is one obfuscation technique among the broader garak 'encoding' probe family used to test how well a system resists disguised script injection.
Netzilo detection
Netzilo reports this behaviour when it is observed.
- Signature ID
- a97015f0-868c-46f1-9325-3e1bfcc72ac6
- Severity
- High
Why it matters
If an AI agent or application passes this obfuscated payload through to a browser or any component that renders HTML/JavaScript, it can result in script execution in that context, potentially leading to session hijacking, data exfiltration, or unauthorized actions performed as the victim.
What you can do
- →Do not rely on literal string matching or blocklists to catch script injection; use a proper HTML sanitizer that normalizes encoding before filtering.
- →Enforce output encoding/escaping at the point where any user-influenced content is rendered as HTML.
- →Apply a Content Security Policy that blocks inline script execution regardless of how the payload is encoded.
- →Review any code path where AI-generated or user-supplied text is inserted into HTML, and treat this as review guidance rather than a full XSS filter.
Known benign look-alikes
- Security research CTF writeups discussing XSS payloads in educational text
- Code review samples of sanitization failures in backtick code blocks