Join our Newsletter — 33% off our NHI Course

What would it take for HTML parsing quirks to beat WAFs?

 

(@nhi-mgmt-group)
Member Moderator
Joined: 2 years ago
Posts: 20225
Topic starter  

TL;DR: HTML parsing quirks can still turn malformed input into executable XSS and let blocklists and WAF signatures miss it, according to PortSwigger. Browser-facing controls need context-aware encoding and tests that follow real parsing behaviour.

Editorial analysis by NHI Mgmt Group, based on content published by PortSwigger: “What's in a tag name? JavaScript, apparently”.

Key questions

Q: Why do browser parsing quirks make XSS harder to stop than scanners suggest?

A: Scanners usually look for obvious script execution paths, but browsers interpret HTML in context.

Q: How can security teams find XSS issues that WAFs miss?

A: They should test with real browser rendering paths, not only with signature scans or static payload lists.

Q: What breaks when HTML input filtering only checks the raw string?

A: Raw-string filtering breaks when the browser reinterprets the same input into a different structure than the security control expected.

Practitioner guidance

  • Strengthen output encoding by context Encode data for the exact HTML, attribute, URL, or JavaScript context where it is rendered, rather than applying one generic escaping rule across all sinks.
  • Inventory dangerous DOM sinks Identify places where application data reaches innerHTML, setHTMLUnsafe, event handlers, or other executable DOM APIs, then replace or constrain those sinks.
  • Test browser parsing behaviour directly Build security tests around real browser rendering, including odd tag names, attribute coercion, and separator characters that may survive server-side sanitisation.

Bottom line: Browser parsing quirks still give attackers room to turn malformed HTML into executable script, which makes input shape alone an unreliable defence.

Glossary terms: Canonicalisation, Dangerous DOM Sink, Resolution Gap, Context-Aware Encoding

Explore further

View Full Forum →  |  NHI Foundation Course →  |  Our Services →  |  Read the full analysis →


This topic was modified 1 week ago by NHI Mgmt Group

   
Quote
(@mr-nhi)
Member Moderator
Joined: 6 months ago
Posts: 20715
 

Parsing differentials are the real control gap: this article shows that the browser's parsed representation and the defender's filtered representation are often not the same object. That mismatch is why blocklists fail so often against modern XSS payloads. Teams that only test input strings miss the transformation layer where bypasses are created. Practitioners should treat canonicalisation as part of the attack surface, not just a preprocessing detail.

A question worth separating out:

Q: Should organisations prioritise sanitisation or safer DOM APIs for XSS defence?

A: Safer DOM APIs should come first because they reduce the number of places where untrusted input can become executable. Sanitisation is still useful, but it is easier to get wrong when one input can be reused in multiple contexts. The strongest programme combines context-specific encoding with sink reduction and browser-based verification.

👉 Read our full editorial: Browser parsing quirks still enable XSS bypasses in modern HTML



   
ReplyQuote
Share:

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.