Creating an ASP.NET debug binary may reveal sensitive informationΒΆ
ID: cs/web/debug-binary
Kind: problem
Severity: warning
Precision: very-high
Tags:
- security
- maintainability
- frameworks/asp.net
- external/cwe/cwe-11
- external/cwe/cwe-532
Query suites:
- csharp-code-scanning.qls
- csharp-security-extended.qls
- csharp-security-and-quality.qls
Click to see the query in the CodeQL repository
ASP.NET applications that deploy a βdebugβ build to production can reveal debugging information to end users. This debugging information can aid a malicious user in attacking the system. The use of the debugging flag may also impair performance, increasing execution time and memory usage.
RecommendationΒΆ
Remove the βdebugβ flag from the Web.config file if this configuration is likely to be used in production.
ExampleΒΆ
The following example shows the βdebugβ flag set to true in a Web.config file for ASP.NET:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation
defaultLanguage="c#"
debug="true"
/>
...
</system.web>
</configuration>
This will produce a βdebugβ build that may be exploited by an end user.
To fix this problem, the βdebugβ flag should be set to false, or removed completely:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation
defaultLanguage="c#"
/>
...
</system.web>
</configuration>
ReferencesΒΆ
MSDN: Why debug=false in ASP.NET applications in production environment.
Common Weakness Enumeration: CWE-11.
Common Weakness Enumeration: CWE-532.