<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Justin Begley</title>
    <description>The latest articles on DEV Community by Justin Begley (@hoax3).</description>
    <link>https://dev.to/hoax3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1100852%2F51d18569-1b57-4c81-a2f0-8d7afe73fdda.png</url>
      <title>DEV Community: Justin Begley</title>
      <link>https://dev.to/hoax3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hoax3"/>
    <language>en</language>
    <item>
      <title>Cross-Site Scripting</title>
      <dc:creator>Justin Begley</dc:creator>
      <pubDate>Wed, 02 Sep 2026 02:23:59 +0000</pubDate>
      <link>https://dev.to/hoax3/cross-site-scripting-108e</link>
      <guid>https://dev.to/hoax3/cross-site-scripting-108e</guid>
      <description>&lt;h1&gt;
  
  
  Cross-Site Scripting
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Reflected XSS&lt;/p&gt;

&lt;p&gt;Arises when an application receives data in an HTTP requrest and includes that data within the immediate response in an unsafe way.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Site has a user-supplied search term in a n a URL:&lt;/span&gt;
https://insecure-website/search?term&lt;span class="o"&gt;=&lt;/span&gt;gift

&lt;span class="c"&gt;# Reflected XSS allows an attacker to construct an attack like this:&lt;/span&gt;
https://insecure-website/search?term&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;script&amp;gt;/&lt;span class="k"&gt;*&lt;/span&gt; insert bad stuff here &lt;span class="k"&gt;*&lt;/span&gt;/&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Stored XSS&lt;/p&gt;

&lt;p&gt;Stored XSS also known as Second-order or persistent XSS arises when an application receives data from an untrusted source and includes that data within its later HTTP responses in an unsafe way.&lt;/p&gt;

&lt;p&gt;Suppose a website allows users to submit comments on blog posts, which are displayed to other users. Users submit comments using an HTTP request like the following:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /post/comment HTTP/1.1
Host: vulnerable-website.com
Content-Length: 100

&lt;span class="nv"&gt;postId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3&amp;amp;comment&lt;span class="o"&gt;=&lt;/span&gt;This+post+was+extremely+helpful.&amp;amp;name&lt;span class="o"&gt;=&lt;/span&gt;Carlos+Montoya&amp;amp;email&lt;span class="o"&gt;=&lt;/span&gt;carlos%40normal-user.net

&lt;span class="c"&gt;# An Attacker can submit a malicious comment like this:&lt;/span&gt;
&lt;span class="nv"&gt;comment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;%3Cscript%3E%2F&lt;span class="k"&gt;*&lt;/span&gt;%2BBad%2Bstuff%2Bhere...%2B&lt;span class="k"&gt;*&lt;/span&gt;%2F%3C%2Fscript%3E
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DOM-Based XSS&lt;/p&gt;

&lt;p&gt;DOM-based XSS arise when JS takes data from attacker-controllable, such as the URL, and it passes it to a sink that supports dynamic code execution, such as &lt;code&gt;eval()&lt;/code&gt; or &lt;code&gt;innerHTML&lt;/code&gt;. This enables attackers to execute malicious JS, which typically allows them to hijack other users’ accounts.&lt;/p&gt;

&lt;p&gt;To deliver DOM-based XSS attack, you need to place data into a source so that it is propagated to a sink and causes execution of arbitrary JS.&lt;/p&gt;

&lt;p&gt;The most common source for DOM XSS is the URL, which is typically access with the window.location object. An attacker can construct a link to send a victim to a vulnerable page with a payload in the query string and fragment portions of the URL. In certain circumstances, such as when targeting a 404 page or a website running PHP, the payload can also be placed in the path.&lt;/p&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Able to trigger alert when document.write was attempting to follow query results&lt;/span&gt;
&lt;span class="c"&gt;# Escape the &amp;lt;img&amp;gt; element&lt;/span&gt;
&lt;span class="s2"&gt;"&amp;gt;&amp;lt;svg onload=alert(1)&amp;gt; 
"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;lt;img &lt;span class="nv"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;x &lt;span class="nv"&gt;onerror&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alert&lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;Resources

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://medium.com/@fath3ad.22/understanding-dom-based-xss-sources-and-sinks-c17ae4bc7455" rel="noopener noreferrer"&gt;Dom Sinks and Sources&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Testing XSS&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content Security Policy (CSP)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Browser mechanism that aims to mitigate the impact of cross-site scripting and some other vulns. If an app that employs CSP contains XSS like behavior, then the csp might hinder or prevent exploitation of the vulnerability. Often the CSP can be circumvented to enable exploitation of the underlying vuln.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Dangling Markup Injection&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A technique that can be used to capture data cross-domain in situation where a full cross-site scripting exploit is not possible, due to input filters or other defenses. It can often be exploited to capture sensitive info that is visible to other users, incluiding CSRF tokens that can be used to perform unauthorized actions on behalf of the user.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When testing for reflected and stored, a key task is to identify the XSS context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The location within the response where attacker-controllable data appears.&lt;/li&gt;
&lt;li&gt;Any input validation or other processing that is being performed that data by the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;XSS Between HTML Tags&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Wehn the XSS context is text between html tags, you need to introduce some new HTML tags designed to trigger execution of JavaScript. Some common methods:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt; &lt;span class="na"&gt;onerror=&lt;/span&gt;&lt;span class="s"&gt;alert(1)&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;strong&gt;XSS in HTML tag Attribs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the XSS context is into an HTML tag attrib value, you might sometimes be able to terminate the attribe value, close the tag, and introduce a new one:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"&amp;gt;&amp;lt;script&amp;gt;alert(document.domain)&amp;lt;script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;More commonly in this situation, angle brackets are blocked or encoded, so your input cannot break out of the tag in which it appears. Provided you can terminate the attribute value, you can normally introduce a new attribute that creates a scriptable context, such as an event handler. For example:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; autofocus onfocus=alert(document.domain) x=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The above payload creates an onfocus event that execute JS when the element receives the focus, and also add the autofocus attrib to try to trigger the onfocus event automatically without any user interaction. Finally, it add x=” to gracefully repair the following markup.&lt;/p&gt;

&lt;p&gt;Sometimes the XSS context is into a type of HTML tag attribute that itself can create a scriptable context. Here, you can execute JS without needing to terminate the attribute value. For example, if the XSS context is into the href attribute of an anchor tag, you can use the JavaScript pseudo-protocol to execute script. For Example:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;“javascript:alert(document.domain)”&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;You might encounter websites that encode angle brackets but still allow you to inject attributes. Sometimes, these injections are possible even within tags that don’t usually fire events automatically, such as a canonical tag. You can exploit this behavior using access keys and user interaction on Chrome. Access keys allow you to provide keyboard shortcuts that reference a specific element. The access key attribute allows you to define a letter that, when pressed in combination with other keys (these vary across different platforms), will cause events to fire.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XSS into JavaScript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the XSS context is some existing JavaScript within the response, a wide variety Of situations can arise, with different techniques necessary to perform a successful exploit.&lt;/p&gt;

&lt;p&gt;Terminating the existing script&lt;/p&gt;

&lt;p&gt;In the simplest case, it possible to simply close the script tag that is enclosing the existing JS. for Example, if the XsS context is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;controllable data here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;then you can use the following payload to break out of the existing JS and execute your own:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="nx"&gt;onerror&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The reason this works is that the browser first performs HTML parsing to identity the page elements including blocks of scrip, and only later performs JavaScript parsing to understand and execute the embedded scripts. The above payload leaves the original script broken with an unterminated string literal. But that doesn’t prevent the subsequent script being parsed and executed in the normal way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Breaking out of a JavaScript string&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In cases the XSS context is inside a quoted string literal, it is often possible to break out of the string and execute JS directly. It is essential to repair the script following the XSS context, because any syntax errors there will prevent the whole script from executing.&lt;/p&gt;

&lt;p&gt;Some useful ways of breaking out of a string literal are:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-alert(document.domain)-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;;alert(document.domain)//
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Some applications attempt to prevent input from breaking out of the JS string by escaping any single quote characters with a backslash before a character tells the JS parser that the character should be interpreted literally, and not as a special character such as a string terminator. In this situation, applications often make the mistake of failing to escape the backslash character itself. This means that an attacker can use their own backslash character to neutralize the backslash that is added by the application:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//for example, suppose that the input&lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;;alert(document.domain)//
//gets converted to:
&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;;alert(document.domain)//
You can now use the alternative payload:
&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;;alert(document.domain)//
//which would be converted to:
&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;//&lt;/span&gt;
&lt;span class="c1"&gt;//Here the first backslash means that the second backslash is interpreted literally and not as a special character. &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Some websites make XSS more difficult by restricting which character you are allowed to use. This can be on the website level or by deploying a WAF that prevents your requests from ever reaching the website. In these situations, you need to experiment with other ways of calling functions which bypass these security measures. One way of doing this is to use the &lt;code&gt;throw&lt;/code&gt; statement with an exception handler. This enables you to pass args to a function without using parentheses. The following code assigns the &lt;code&gt;alert()&lt;/code&gt; function to the global exception handler and the &lt;code&gt;throw&lt;/code&gt; statement passes the &lt;code&gt;1&lt;/code&gt; to the exception handler. The end result is that the &lt;code&gt;alert&lt;/code&gt; function is called with &lt;code&gt;1&lt;/code&gt; as an arg.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;onerror&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;strong&gt;Making use of HTML-encoding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the XSS context is some existing JS within a quoted tag attrib, such as an event handler, it is possible to make use of HTML-encoding to work around some input filters.&lt;/p&gt;

&lt;p&gt;When the browser has parsed out the HTML tags attributes within a response, it will perform HTML decoding of tag attribute values before they are processed any further. If the server-side application blocks or sanitizes certain characters that are needed for a successful XSS exploit, you can often bypass the input validation by HTML-encoding those characters.&lt;/p&gt;

&lt;p&gt;for example, if the XSS context is :&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;onclick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;...var input='controllable data here'; ...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;and the application blocks or escapes single quote characters, you can use the following payload to break out of the JS string and execute your own script:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;apos&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;apos&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The &lt;code&gt;&amp;amp;apos;&lt;/code&gt; sequence is an HTML entity representing an apostrophe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XSS in JavaScript template literals&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JS template literals are string literals that allow embedded JS expressions. The embedded expressions are evaluated and are normally concatenated into the surrounding text. Template literals are encapsulated in backticks instead of normal quotation marks, and embedded expressions are identified using the ${…} syntax.&lt;/p&gt;

&lt;p&gt;For example the following script will print a welcome message that includes the user’s display name:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;docment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Welcome, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;When the XSS context is into a JavaScript template literal, there is no need to terminate the literal. Instead you simply need to use the ${…} syntax to embed a Javascript expression that will be executed when the literal is processed. For example, if the XSS context is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`controllable data here`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Then you can use the following payload to execute JavaScript without terminating the template literal:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Resources&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;polyglot, string of text which can escape attributes, tags and bypass filters all in one.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */onerror=alert('THM') )//%0D%0A%0d%0a//&amp;lt;/stYle/&amp;lt;/titLe/&amp;lt;/teXtarEa/&amp;lt;/scRipt/--!&amp;gt;\x3csVg/&amp;lt;sVg/oNloAd=alert('THM')//&amp;gt;\x3e&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>testing1</category>
    </item>
  </channel>
</rss>
