Improper Certificate Validation
The product does not validate, or incorrectly validates, a certificate.
When a certificate is invalid or malicious, it might allow an attacker to spoof a trusted entity by interfering in the communication path between the host and client.
So behebst du diese Schwachstelle
Präventionsstrategien für Improper Certificate Validation basierend auf 4 Shoulder-Erkennungsregeln.
Use TLS 1.2+ minimum version and always verify certificates
client := &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, + MinVersion: tls.VersionTLS12, + InsecureSkipVerify: false, }, }, }
Keep certificate verification enabled and enforce TLS 1.2 or higher
const agent = new https.Agent({ - rejectUnauthorized: false + rejectUnauthorized: true, + minVersion: 'TLSv1.2' });
Keep SSL certificate verification enabled; use custom CA bundles for internal certs
import requests - response = requests.get('https://api.example.com', verify=False) + # Default verification (recommended) + response = requests.get('https://api.example.com') + + # Custom CA for internal services + response = requests.get('https://internal.example.com', verify='/path/to/ca-bundle.crt')
Keep SSL verification enabled (the default) or use custom CA bundles
import requests - response = requests.get(url, verify=False) + # Default: verify=True + response = requests.get(url, verify=True, timeout=10) + + # For custom CA certificates: + response = requests.get(url, verify='/path/to/ca-bundle.crt')
Finden Sie Schwachstellen in Ihrem Code
Verwenden Sie Shoulder, um Ihren Code nach Improper Certificate Validation-Mustern zu scannen. 4 Regeln.
# Scan with Shoulder CLI npx @shoulderdev/cli trust --cwe=295 # Or scan entire project npx @shoulderdev/cli trust .
Erkennungsregeln (4)
Worauf bei Code-Reviews zu achten ist
Diese Muster weisen auf potenzielle Improper Certificate Validation-Schwachstellen hin. Achten Sie bei Code-Reviews und Sicherheitsaudits darauf.
Scanne deine Codebasis nach Improper Certificate Validation
Shoulder CLI findet anfällige Muster in deiner gesamten Codebasis.