Skip to content

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Description

The application is disabling Wicket's string escaping functionality by calling `setEscapeModelStrings(false)`. This could lead to Cross Site Scripting (XSS) if used with user-supplied input. XSS is an attack which exploits a web application or system to treat user input as markup or script code. It is important to encode the data depending on the specific context it is used in.

Examples

Insecure Code

java
import org.apache.wicket.Component;
...
Component component = new Component();
component.setEscapeModelStrings(false);

Secure Code

java
import org.apache.wicket.Component;
...
Component component = new Component();
component.setEscapeModelStrings(true);

Remediation

Use Wicket's built-in escaping feature by calling `Component.setEscapeModelStrings(true);`

Rule Details

FieldValue
IDCODE-0733
CategoryWeb
SeverityMEDIUM
CWECWE-79
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
TagsXSS, Cross-site Scripting
OWASPA1:2017-Injection, A03:2021-Injection