Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about Cross-site Sripting (XSS) vulnerabilities in an interactive lesson.
Start learningUpgrade htmr
to version 0.8.7 or higher.
htmr is a simple and lightweight conversion library from HTML string to react element coversions.
Affected versions of this package are vulnerable to Cross-site Sripting (XSS).
This module uses innerHTML
ref to unescape HTML entities. This leads to DOM-based XSS by inserting HTML-encoded XSS payload (see PoC).
create-react-app xss-htmr
htmr
module: cd xss-htmr; npm i htmr
src/App.js
file to this:import React from 'react'; import convert from 'htmr';
export default function App() { return convert(
<p>Hash: ${window.location.hash}</p>
); }
npm run start
http://localhost:3000/#<img/src/onerror=alert('xss')>
, an alert will popup.