Disabled Certificate Validation
TLS certificate validation is disabled by a callback that always returns true (or DangerousAcceptAnyServerCertificateValidator), so any certificate is accepted and the connection is exposed to man-in-the-middle interception (CWE-295).
Standards mapping
- OWASP Top 10
- A02:2021 - Cryptographic Failures
- OWASP ASVS
- V9.2.1 (L2)
Vulnerable vs. safe
ServicePointManager.ServerCertificateValidationCallback = (s, cert, chain, errors) => true;ServicePointManager.ServerCertificateValidationCallback = (s, cert, chain, errors) => errors == SslPolicyErrors.None;Why it matters & how to fix it
TLS certificate validation is disabled by a callback that always returns true (or DangerousAcceptAnyServerCertificateValidator), so any certificate is accepted and the connection is exposed to man-in-the-middle interception (CWE-295). Remove the override and rely on default chain validation; for a private CA, add it to the trust store instead of bypassing validation.
References
Rule ID integsec.csharp.misc.disabled-certificate-validation - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Other Security ChecksChild Process Shell True
- JavaScript / TypeScript - Other Security ChecksOpen Redirect Tainted Input
- Python - Other Security ChecksDjango Mark Safe
- Python - Other Security ChecksFlask Debug Enabled
- Python - Other Security ChecksFlask Render Template String
- Python - Other Security ChecksInsecure Tempfile Mktemp