id: privesc-lftp

info:
  name: lftp - Privilege Escalation
  author: daffainfo
  severity: high
  description: |
    lftp is a command-line file transfer program for Unix-like systems. It supports various protocols such as FTP, HTTP, SFTP, and FISH, and provides a range of features for file transfer and mirroring. lftp is known for its reliability and scriptability, making it a popular choice for automated file transfer tasks.
  reference:
    - https://gtfobins.github.io/gtfobins/lftp/
  metadata:
    verified: true
    max-request: 3
  tags: code,linux,lftp,privesc,local

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

  - engine:
      - sh
      - bash
    source: |
      lftp -c '!whoami'

  - engine:
      - sh
      - bash
    source: |
      sudo lftp -c '!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: 490a004630440220462cec07ea103fea931c8907e3c7ed09157109f08fac37e1c568ba71dedce6b602200279b85c4e3358fee401e7f4e3e7c655dccc0b5dcdec50007c11de56f2362612:922c64590222798bb761d5b6d8e72950