Skip to content

pathfinder rules: added unencrypted socket connection detection rule #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pathfinder-rules/java/UnEncryptedSocketConnection.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @name unencrypted-socket
* @description This socket is not encrypted. Use an SSLSocket created by SSLSocketFactory or SSLServerSocketFactory instead.
* @kind problem
* @id java/UnEncryptedSocketConnection
* @problem.severity warning
* @security-severity 3.1
* @precision medium
* @tags security
* external/cwe/cwe-319
*/

FROM ClassInstanceExpr AS cie
WHERE cie.getClassInstanceExpr().GetClassName() == "Socket" || cie.getClassInstanceExpr().GetClassName() == "ServerSocket"
SELECT cie.getName(), "This socket is not encrypted. Use an SSLSocket created by SSLSocketFactory or SSLServerSocketFactory instead"
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ protected void onCreate(Bundle savedInstanceState) {
// webview.javascriptEnabled();
webview.getSettings().setJavaScriptEnabled(true);

Socket socket = new Socket("www.google.com", 80);

Socket socket = new Socket();

ServerSocket serverSocket = new ServerSocket(80);

movieGeneralModal moviegeneralModal = (movieGeneralModal) intent.getSerializableExtra("DATA_MOVIE");

if (savedInstanceState == null) {
Expand Down
Loading