Vulnerability library
Security checkMay 13, 2024

ViewState is not Encrypted

Understand the exposure, see the recommended fix, and check whether your own website has related weaknesses.

Check your website

Find this and other vulnerabilities with a free scan.

Your scan runs on your computer. No account required.

Description

The ViewState, a hidden form input in ASP.NET pages, automatically persists information and application data specific to a page. If the ViewState is not encrypted, its contents can be easily viewed by anyone, potentially exposing sensitive information.

Recommendation

To enhance security, avoid storing sensitive values in the ViewState and enable encryption for it. For the entire application, enable ViewState encryption by adding the specified configuration to the Web.Config file under the system.web node:

<system.web>
  <pages viewStateEncryptionMode="Always" />
</system.web>

Alternatively, for specific pages, enable encryption by adding the provided directive at the top of each page:

<%@Page ViewStateEncryptionMode="Always" %>

References

Could your website be exposed too?

SmartScanner can check your website for ViewState is not Encrypted and gives you actionable findings to investigate.

Start a free scan

Related Issues

See something that needs correcting? Let us knowUpdated May 13, 2024