# Improper Certificate Validation (CWE-295) The product does not validate, or incorrectly validates, a certificate. **Stack:** JavaScript - Prevalence: Moyenne 3 langages couverts - Impact: Élevé 4 règles de sévérité élevée - Prevention: Documentée 4 exemples de correctifs **OWASP:** Identification and Authentication Failures (A07:2021-Identification and Authentication Failures) - #7 ## Description 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. ## Prevention Stratégies de prévention pour Improper Certificate Validation basées sur 1 règles de détection Shoulder. ### JavaScript Keep certificate verification enabled and enforce TLS 1.2 or higher ## Warning Signs - [HIGH] insecure TLS/SSL configurations in Node ## Consequences - Contourner le mécanisme de protection - Lecture des données de l'application - Modification des données de l'application ## Mitigations - Les certificats doivent être soigneusement gérés et vérifiés afin de s'assurer qu'ils restent valides - Si l'épinglage de certificats est utilisé, assurez-vous qu'il est correctement implémenté - Utilisez correctement la validation des certificats client SSL/TLS ## Detection - Total rules: 4 - Languages: go, javascript, typescript, python ## Rules by Language ### Javascript (1 rules) - **Insecure TLS/SSL Configuration** [HIGH]: Detects insecure TLS/SSL configurations in Node.js applications that weaken transport security. Common misconfigurations: - rejectUnauthorized: false (disables certificate validation) - NODE_TLS_REJECT_UNAUTHORIZED=0 (globally disables TLS verification) - Weak TLS versions (TLS 1.0, 1.1) - Insecure SSL options in HTTPS requests These misconfigurations allow man-in-the-middle attacks. - Remediation: Keep certificate verification enabled and use TLS 1.2 or higher. ```javascript const agent = new https.Agent({ rejectUnauthorized: true, minVersion: 'TLSv1.2' }); ``` Learn more: https://shoulder.dev/learn/javascript/cwe-295/insecure-tls-config ### Typescript (1 rules) - **Insecure TLS/SSL Configuration** [HIGH]: Detects insecure TLS/SSL configurations in Node.js applications that weaken transport security. Common misconfigurations: - rejectUnauthorized: false (disables certificate validation) - NODE_TLS_REJECT_UNAUTHORIZED=0 (globally disables TLS verification) - Weak TLS versions (TLS 1.0, 1.1) - Insecure SSL options in HTTPS requests These misconfigurations allow man-in-the-middle attacks. - Remediation: Keep certificate verification enabled and use TLS 1.2 or higher. ```javascript const agent = new https.Agent({ rejectUnauthorized: true, minVersion: 'TLSv1.2' }); ``` Learn more: https://shoulder.dev/learn/javascript/cwe-295/insecure-tls-config