Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

246
Vistas
Can xss attacks bypass InnerText?

all my friend's website DOM use innerText instead of innerHTML. I tried all possible ways i know but none of them work. Is it anyway that I can bypass innerText and make the tag work just like with the innerHTML tag?

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Why not just using innerHTML ? and then use DOMPurify to sanitize your DOM. it finds any potential ways that the user can add data like javascript:alert('hacked'); and makes them as normal HTML.

DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.

look at the below example:

DOMPurify.sanitize('<img src=x onerror=alert(1)//>'); // becomes <img src="x">

you can use sanitize method then wrapped your html field or in this case image to avoid xss

another example,

const html = `<input type="text" name="text" />`;

ELEMENT.innerHTML = DOMPurify.sanitize(html, { // optional configurations // })

so if a user tries to add for example an image inside the input like

DOMpurify notices onload on image and removes it from submitting

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda