# VNX-554: ASP.NET Misconfiguration: Not Using Input Validation Framework

ASP.NET request validation is switched off: ValidateRequest="false" on a page, validateRequest="false" or requestValidationMode="2.0" in Web.config.

| Field | Value |
|---|---|
| Rule ID | `VNX-554` |
| Severity | Medium |
| SARIF level | `warning` |
| Kind | `sast` |
| Languages | C#, XML |
| CWE | [CWE-554](https://cwe.mitre.org/data/definitions/554.html) |
| CAPEC | [CAPEC-66](https://capec.mitre.org/data/definitions/66.html) |
| ATT&CK | [T1190](https://attack.mitre.org/techniques/T1190/) |
| CWSS vector | `CWSS:1.0/TI:M/AP:RU/AL:S/IC:N/FC:LT/RP:RU/RL:S/AV:L/AS:N/IN:A/SC:A/BI:M/DI:H/EX:M/EC:N/P:C` |
| Tags | `aspnet` `request-validation` `cwe-554` |
| Source | [`internal/sast/rules/vnx-554.rego`](https://github.com/Vulnesis/cli/blob/main/internal/sast/rules/vnx-554.rego) |

## Overview

VNX-554 maps to [CWE-554: ASP.NET Misconfiguration: Not Using Input Validation Framework](https://cwe.mitre.org/data/definitions/554.html). It reports the settings that turn off ASP.NET request validation, the framework's built-in rejection of markup and script in request input.

## Why this matters

Request validation is a coarse filter, but it stops the plain `<script>` payloads that reach pages which forget to encode their output. Turning it off for a page, a controller or the whole site removes that net everywhere it applied, usually to let one rich-text field through.

## What gets flagged

```aspx
<%@ Page Language="C#" ValidateRequest="false" CodeBehind="Comment.aspx.cs" Inherits="Site.Comment" %>
```

```xml
<httpRuntime targetFramework="4.8" requestValidationMode="2.0" />
<pages validateRequest="false" />
```

```csharp
[HttpPost]
[ValidateInput(false)]
public ActionResult Create(string title, string body) { ... }
```

Not flagged: validation left on or set to `true`, `requestValidationMode` 4.0 or 4.5, the field-level opt-outs `[AllowHtml]` and `Request.Unvalidated`, ASP.NET Core (it has no request validation), XML and `<%-- --%>` comments, C# comments and string literals.

## Remediation

1. Remove `ValidateRequest="false"`, `validateRequest="false"`, `requestValidationMode="2.0"` and `[ValidateInput(false)]`.
2. Where one field must accept markup, allow it on that field only with `[AllowHtml]` and sanitise it with an HTML sanitiser.
3. Encode all output (`<%: %>`, `@` in Razor, `HttpUtility.HtmlEncode`); request validation does not replace it.

## References

- [CWE-554: ASP.NET Misconfiguration: Not Using Input Validation Framework](https://cwe.mitre.org/data/definitions/554.html)
- [Request validation in ASP.NET](https://learn.microsoft.com/en-us/aspnet/whitepapers/request-validation)

## Suppressing this rule

Put a `nosec` comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file's language (`#`, `//`, `--` or `;`):

```text
# nosec vnx-554
// nosec vnx-554
```

Or record an ignore rule: `vulnetix ignore add --rule vnx-554 --reason "..."`. See [Suppressing findings](/sast/guides/suppressing-findings.md).
