Tag-splitting is an evasion method that breaks malicious markup into fragments so a sanitizer does not recognise the complete executable pattern. The browser later reconstructs the content into a valid script element, which allows hidden payloads to run after message rendering.
How Tag-Splitting Works as an Evasion Technique
Tag-splitting is a parsing attack, not a payload type. The attacker hides executable markup by breaking it into pieces that look harmless in isolation, then relies on browser reassembly, parser differentials, or downstream HTML processing to turn fragments back into active code after the initial filter has already made its decision.
This makes the technique effective anywhere sanitisation is pattern-based rather than parser-accurate. A filter may inspect fragments, encoded characters, or partial tags and fail to recognise the full structure that the browser later normalises into executable HTML.
Why Sanitizers Miss Fragmented Markup
The core weakness is a mismatch between the security control and the browser's parsing rules. If the defensive layer evaluates text before normalisation, or applies a simplified grammar, it may approve content that becomes dangerous once the user agent reconstructs tag boundaries, attributes, or executable elements.
That means the risk is often less about one specific tag and more about trust in the wrong processing stage. Defences that stop at string matching, incomplete entity handling, or partial token inspection are especially exposed to this class of bypass.
Where Tag-Splitting Shows Up in Web Security
Tag-splitting appears in cross-site scripting chains, HTML injection, and message-rendering flaws where untrusted content is later inserted into a page. It can also matter in chat systems, rich-text editors, notification feeds, and any workflow that stores content first and renders it later through a browser or browser-like component.
In practice, the danger is not confined to a single sink. If the same untrusted content is transformed by multiple layers, such as sanitiser, template engine, client-side renderer, and browser, the attacker may only need one layer to mis-handle the fragment boundary for the final output to become executable.
How to Defend Against Fragment-Based HTML Evasion
Robust defence starts with consistent parsing and output encoding rather than ad hoc blacklist rules. Security teams should treat any untrusted markup as hostile, ensure sanitisation uses a parser that matches the browser's behaviour, and avoid mixing partially sanitised fragments with later DOM manipulation that can reconstitute executable HTML.
Defensive review should also cover the full content pipeline. Rendering paths, preview components, import/export flows, and rich-text conversion libraries are all places where apparently inert fragments can become active markup if the final browser-visible representation is not controlled end to end.
Risk and Threat Considerations
Tag-splitting is dangerous because it turns content sanitisation into a boundary-confusion problem. If defenders inspect fragments rather than the final parse tree, an attacker can smuggle executable markup past the control and trigger script execution after rendering.
Failure mechanism: The application trusts an incomplete representation of the content, so the browser's normalisation step reconstructs the malicious structure after validation has already passed.
Impact: Successful exploitation can lead to script execution in the victim's browser, session abuse, content tampering, credential theft, or further client-side compromise depending on the application context.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V1 — Encoding and Sanitization | Tag-splitting bypasses HTML sanitization and encoding controls. |
| V3 — Web Frontend Security | The attack exploits frontend rendering and browser-side reconstruction of markup. | |
| V16 — Security Logging and Error Handling | Detection and review of failed or suspicious markup handling support investigation. | |
| Recommendation — Validate sanitization and output encoding against browser parsing behavior. Harden frontend rendering paths that accept untrusted HTML or rich text. Log sanitization failures and suspicious markup transformations for review. | ||
| NIST SP 800-53 Rev 5 | SI-10 — Information Input Validation | Fragmented markup evades validation when input is checked before normalisation. |
| SI-16 — Memory and Resource Integrity | Client-side reconstruction can alter execution behavior after initial checks. | |
| Recommendation — Validate untrusted input after normalisation and before rendering. Preserve integrity across transformation stages before content reaches the browser. | ||
Practitioner Guidance
What to watch for: Review any feature that accepts user-supplied rich text, HTML snippets, or message content and then renders it after transformations. The key question is whether the sanitiser, encoder, and browser are all evaluating the same final structure, or whether fragments can be recombined later into something executable.
Practitioner takeaway: Treat parser mismatch as a security issue in its own right, not just a bug in one filter. If the content can become HTML again at any later stage, the full render path needs to be validated as a single security boundary.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
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.
Reviewed and updated by the NHIMG editorial team on November 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org