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

132
Vistas
client potential XSS jQuery

I have the following problem, Client Potential XSS and tried to fix it

$('#plazo input[value=' + $('#plazoActual').text() + ']').prop('checked', true);

but I don't understand why .text() is a vulnerability

Hope someone experienced can help, how to properly sanitize the above line.

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

0

The vulnerability is not $('#plazoActual').text(), but the fact that you take that value from the page (probably editable by a user), and use it in $(). It is reported, because $() can create elements, and if it's created from concatenated user input, it allows for injection (xss).

At first sight this particular case does not seem vulnerable though, because $() above does not create an element, it is just a selector for an input field (the first character is a # and there is a space). I think this cannot be exploited in general, but jQuery was a long time ago with all kinds of vulnerabilities also depending on the exact version. Also the input can potentially be manipulated so the selector finds something else in the page, which might be useful in a more complex attack.

A more robust and more secure way would be to find all inputs in #plazo (something like $('#plazo input')), iterate through them, and set checked where the value is $('#plazoActual').text(). So the point is to not have dynamic content in the selector.

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