Skip to content

ASP.NET input validation disabled

Description

The application disables request validation for a method by using the `[ValidateInput(false)]` attribute in a controller class. This disables ASP.NET from examining requests for injection attacks such as Cross-Site-Scripting (XSS). To fix this, re-enable validation by using `ValidateInput(true)` or ensure that request data is validated and not output directly into the view.

Examples

Insecure Code

c#
[ValidateInput(false)]
public void SomeActionMethod()
{
}

Secure Code

c#
[ValidateInput(true)]
public void SomeActionMethod()
{
}

Remediation

Replace `[ValidateInput(false)]` with `[ValidateInput(true)]` or implement custom validation for request data.

Rule Details

FieldValue
IDCODE-0458
CategoryInsecureConfig
SeverityMEDIUM
CWECWE-554
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
TagsXSS, request validation
OWASPA6:2017-Security Misconfiguration, A05:2021-Security Misconfiguration