Skip to content

feat(java): detect SSH ServerHostKeyVerifier that always returns true (CWE-295) - #151

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-ssh-hostkey-verifier-accept-all
Open

feat(java): detect SSH ServerHostKeyVerifier that always returns true (CWE-295)#151
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-ssh-hostkey-verifier-accept-all

Conversation

@ai-anant

Copy link
Copy Markdown

Detect a ServerHostKeyVerifier (SSH/SFTP client host-identity validation) whose verifyServerHostKey(...) method always returns the literal true without inspecting the presented key.

When host key verification is disabled in this way, an on-path attacker can impersonate the SSH/SFTP peer, hijack the session, and harvest any credential the client exchanges (private keys, passwords), enabling full man-in-the-middle takeover of the connection.

  • Rule: codevigilant.java.jenkins.ssl.ssh-serverhostkeyverifier-accept-all
  • Languages: java (Jenkins tree)
  • Severity: WARNING
  • Tested: positive repro fires, sanitized negative (compares against expected key) does not fire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant