Missing TLS validation
Overview
Rule ID:
java_lang_ssl_verification
Applicable Languages: Java
Weakness ID: CWE-295
Description
Your code is at risk of Man-in-the-Middle attacks if it fails to validate TLS certificates. This vulnerability occurs when your application connects without verifying the server's hostname, exposing it to data interception and other security threats. Using deprecated components like DefaultHttpClient
, which does not perform hostname verification, or relying on the SSL protocol, known for its security flaws, further exacerbates these risks.
Remediation Guidelines
Use modern HTTP clients, such as
java.net.http.HttpClient
, that automatically handle TLS validation.Whenever possible, prefer the latest TLS protocol over SSL to enhance security. Explicitly request TLS in your application to mitigate vulnerabilities associated with SSL.
Avoid relying on deprecated HTTP clients like
DefaultHttpClient
, as they do not perform essential security checks such as TLS validation, leaving your application vulnerable."
References
Configuration
To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our SAST TOOL
Last updated