HTML and JavaScript injection occurs when untrusted content is interpreted as markup or executable code.
DOM-based XSS is a client-side form of this problem: JavaScript takes untrusted data and passes it to a dangerous DOM or URL-handling sink.
Tests if a string is interpreted as HTML instead of displayed literally.
<h1>LOGPIPE_TEST_MARKER</h1>
<script>alert(1)</script>
Expected behavior: tags appear as text or are safely sanitized; no script executes.
Tests whether an attacker can introduce an event handler through an HTML element.
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
Expected behavior: event handlers do not execute.
Tests whether untrusted data inserted into an HTML attribute can escape its quoted value and add another attribute.
" autofocus onfocus="alert(1)
"><img src=x onerror=alert(1)>
Expected behavior: the value remains inside its intended text or attribute context.
Tests whether untrusted links can use an executable URL scheme.
<a href="javascript:alert(1)">LOGPIPE_TEST_LINK</a>
Expected behavior: reject unsafe URL schemes. Allow only explicitly supported schemes, typically HTTPS and, where required, HTTP.
Tests whether untrusted content can embed another document.
<iframe src="https://example.invalid"></iframe>
<iframe src="data:text/html,LOGPIPE_TEST_MARKER"></iframe>
Expected behavior: untrusted content cannot create active embedded documents.
Tests whether content inserted into a style block or style attribute can escape its intended context.
</style><script>alert(1)</script>
Expected behavior: do not concatenate untrusted values into CSS or style blocks.
The same string can be safe or unsafe depending on the browser API that receives it.
// Safe for plain text:
element.textContent = untrustedValue;
// Dangerous with untrusted HTML:
element.innerHTML = untrustedValue;
Review uses of:
innerHTMLouterHTMLinsertAdjacentHTMLdocument.writePrefer textContent, safe DOM creation APIs, and context-aware sanitization when rich HTML is genuinely required.
Markdown renderers may allow raw HTML or dangerous link schemes unless configured safely.
[LOGPIPE_TEST_LINK](javascript:alert(1))
<img src=x onerror=alert(1)>
Expected behavior: disable raw HTML if it is not needed, sanitize rendered HTML, and validate link protocols.
Tests inconsistent decoding or sanitization order.
<script>alert(1)</script>
%3Cscript%3Ealert(1)%3C/script%3E
Expected behavior: content remains inert through decoding, storage, API serialization, and display.
If content is passed into a template engine as template source rather than as a value, expressions may be evaluated.
${7*7}
<%= 7*7 %>
Expected behavior: treat user-controlled content as data, never compile it as a template.
textContent or the frameworkâs normal escaped text interpolation.https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XSS%20Injection https://owasp.org/www-community/attacks/xss/ https://owasp.org/www-community/attacks/DOM_Based_XSS