{"id":156,"date":"2018-02-05T03:06:04","date_gmt":"2018-02-05T03:06:04","guid":{"rendered":"http:\/\/malwrforensics.com\/en\/?p=156"},"modified":"2024-01-09T21:31:29","modified_gmt":"2024-01-09T21:31:29","slug":"you-dont-need-the-lt-and-gt-tags-to-have-a-successful-cross-site-scripting-xss-vulnerability","status":"publish","type":"post","link":"https:\/\/malwrforensics.com\/en\/2018\/02\/05\/you-dont-need-the-lt-and-gt-tags-to-have-a-successful-cross-site-scripting-xss-vulnerability\/","title":{"rendered":"You don&#8217;t need the lt and gt tags to have a successful cross-site scripting (XSS) vulnerability"},"content":{"rendered":"<p>While it&#8217;s definitely easier if the &#8220;&lt;&#8221; and &#8220;&gt;&#8221; tags are allowed, one can &#8220;convince&#8221; the target website to run javascript even if the tags are escaped.<\/p>\n<p>For example we have this search box:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-157 aligncenter\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_1-300x27.png\" alt=\"\" width=\"356\" height=\"32\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_1-300x27.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_1.png 539w\" sizes=\"auto, (max-width: 356px) 100vw, 356px\" \/><\/p>\n<p>Once we run the search, we notice that the html tags and the text between them was removed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-158 aligncenter\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_2-300x43.png\" alt=\"\" width=\"349\" height=\"50\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_2-300x43.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_2.png 424w\" sizes=\"auto, (max-width: 349px) 100vw, 349px\" \/><\/p>\n<p>Now, even though &#8220;&lt; script &gt;&#8221; was removed, the quotes are still there. That means we can add our own html attributes. As it happens, <a href=\"https:\/\/www.w3schools.com\/tags\/ev_onmouseover.asp\">onmouseover<\/a>\u00a0is an HTML attribute that we can add and it will execute our javascript code.<\/p>\n<p>We just need to study a bit how the strings are concatenated. We have something like this:<\/p>\n<p><span style=\"color: #993366;\">&#8230;names=&#8221;keywords&#8221; value=&#8221;<\/span><strong>OUR STRING<\/strong><span style=\"color: #993366;\">&#8221; placeholder=&#8230;<\/span><\/p>\n<p>Our string needs to close the start quote from value. Then we can add the new onmouseover attribute and the javascript code inside. Once that is done, we need to deal with the end quote from value, so we can just add a random field name that will be empty. In the end, it can look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-159 aligncenter\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_3-300x26.png\" alt=\"\" width=\"346\" height=\"30\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_3-300x26.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_3.png 537w\" sizes=\"auto, (max-width: 346px) 100vw, 346px\" \/><\/p>\n<p>Once we search using this string (and move the mouse), voila:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-160 aligncenter\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/02\/xss_no_lt_gt_4.png\" alt=\"\" width=\"346\" height=\"249\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>While it&#8217;s definitely easier if the &#8220;&lt;&#8221; and &#8220;&gt;&#8221; tags are allowed, one can &#8220;convince&#8221; the target website to run javascript even if the tags are escaped. For example we have this search box: Once we run the search, we notice that the html tags and the text between them was removed. Now, even though [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[43,42,23,24,25],"class_list":["post-156","post","type-post","status-publish","format-standard","hentry","category-security","tag-cross-site-scripting","tag-vulnerability","tag-web","tag-web-security","tag-xss"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[]}},"featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable_v2":"<p>While it&#8217;s definitely easier if the &#8220;&lt;&#8221; and &#8220;&gt;&#8221; tags are allowed, one can &#8220;convince&#8221; the target website to run javascript even if the tags are escaped. For example we have this search box: Once we run the search, we notice that the html tags and the text between them was removed. Now, even though &#8220;&lt; script &gt;&#8221; was removed, the quotes are still there. That means we can add our own html attributes. As it happens, onmouseover\u00a0is an HTML attribute that we can add and it will execute our javascript code. We just need to study a bit how&hellip;<\/p>\n","category_list_v2":"<a href=\"https:\/\/malwrforensics.com\/en\/category\/security\/\" rel=\"category tag\">Security<\/a>","author_info_v2":{"name":"malwrforensics","url":"https:\/\/malwrforensics.com\/en\/author\/u_malwrforensics\/"},"comments_num_v2":"0 comments","_links":{"self":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":3,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"predecessor-version":[{"id":826,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/156\/revisions\/826"}],"wp:attachment":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}