Cross-site Scripting when rendering error messages in laminas-form
Moderate severity
GitHub Reviewed
Published
Jan 28, 2022
in
laminas/laminas-form
•
Updated Feb 3, 2023
Package
Affected versions
>= 3.1.0, < 3.1.1
>= 3.0.0, < 3.0.2
< 2.17.1
Patched versions
3.1.1
3.0.2
2.17.1
Description
Reviewed
Jan 28, 2022
Published by the National Vulnerability Database
Jan 28, 2022
Published to the GitHub Advisory Database
Jan 28, 2022
Last updated
Feb 3, 2023
Impact
When rendering validation error messages via the
formElementErrors()
view helper shipped with laminas-form, many messages will contain the submitted value. However, in vulnerable versions of laminas-form, the value was not being escaped for HTML contexts, which can potentially lead to a Reflected Cross-Site Scripting (XSS) attack.Patches
The following versions were issued to mitigate the vulnerability:
Workarounds
At the top of a view script where you call the
formElementErrors()
view helper, place the following code:Before calling
formElementErrors()
with a form, fieldset, or element, call the above closure as followsFor more information
If you have any questions or comments about this advisory:
References