Course contentsShow
← Security
Lesson 656 of 3,05214. Web Security - XSS and Content InjectionFree lesson

Polyglot Payloads and Mutation Fuzzing

Creating multi-context payloads and using mutation-based fuzzing to discover filter weaknesses and bypass WAFs.

Polyglot Payloads and Mutation Fuzzing

You'll learn how to craft multi-context payloads that work across different execution environments and use automated mutation techniques to find weak spots in XSS filters.

What Are Polyglot Payloads?

A polyglot payload is an XSS injection that executes successfully in multiple contexts simultaneously—HTML, JavaScript, attribute values, or even across different parsing engines. Think of it like a Swiss Army knife: one payload that works regardless of where it lands in the page.

For example, a payload like:

jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//</stYle/</titLe/</teXtarEa/</scRipt/--!>\x3csVg/<sVg/oNloAd=alert()//>\x3e

This nightmare string combines event handlers, script tags, encoding variations, case manipulation, and comment tricks you've already learned. It attempts to "break out" of whatever context it's injected into.

Mutation Fuzzing Explained

Mutation fuzzing takes a known working XSS payload and automatically generates thousands of variations by:

  • Changing character encodings (HTML entities, Unicode, hex)
  • Swapping tag names and event handlers
  • Adding whitespace, null bytes, or special characters
  • Varying quote styles and case

The fuzzer throws these mutations at the application to discover which filter rules are incomplete. If a filter blocks <script> but not <sCrIpT> or <s%63ript>, mutation fuzzing will find it.

This technique automates what you learned about character encoding bypasses, case manipulation, and tag variations—testing hundreds of combinations to map out the filter's blind spots.

Key Takeaway: Polyglot payloads are universal XSS strings designed to execute in multiple contexts, while mutation fuzzing systematically varies known payloads to discover weaknesses in WAFs and filters—both are essential for bypassing sophisticated defenses.