generic.secrets.security.detected-ssh-password.detected-ssh-password

Community Favorite
profile photo of semgrepsemgrep
Author
37,965
Download Count*

SSH Password detected

Run Locally

Run in CI

Defintion

rules:
  - id: detected-ssh-password
    pattern-regex: sshpass -p\s*['|\\\"][^%]
    languages:
      - regex
    message: SSH Password detected
    severity: ERROR
    metadata:
      cwe:
        - "CWE-798: Use of Hard-coded Credentials"
      source-rule-url: https://github.com/grab/secret-scanner/blob/master/scanner/signatures/pattern.go
      category: security
      technology:
        - secrets
        - ssh
      confidence: LOW
      owasp:
        - A07:2021 - Identification and Authentication Failures
      references:
        - https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures
      cwe2022-top25: true
      cwe2021-top25: true
      subcategory:
        - audit
      likelihood: LOW
      impact: MEDIUM
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]
      vulnerability_class:
        - Hard-coded Secrets

Examples

detected-ssh-password.txt

# ruleid: detected-ssh-password
sshpass -p 'blah'

# ok: detected-ssh-password
cmdInput := fmt.Sprintf("sshpass -p '%s'", password)

# ok: detected-ssh-password
cmdInput := fmt.Sprintf("sshpass -p %s", password)