Usage of naive Socket class to create SSL Socket
Last updated
Last updated
Rule ID: java_lang_socket_init
Applicable Languages: Java
Weakness ID: CWE-319
Using the naive Socket class to create SSL sockets compromises security. Directly creating SSL sockets with new Socket()
lacks the advanced security features provided by SSLSocketFactory
. SSLSocketFactory
is designed with SSL/TLS protocols in mind, offering encryption, hostname verification, and trust manager configuration, making it a more secure option for creating SSL sockets.
Avoid using java.net.Socket
to directly create SSL sockets due to its limited security capabilities.
Use SSLSocketFactory to create SSL sockets, ensuring the use of SSL/TLS protocols and other security enhancements.
To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our