privesc-sshpass: sshpass - Privilege Escalation

日期: 2025-08-01 | 影响软件: sshpass | POC: 已公开

漏洞描述

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.

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