id: writable-etc-passwd

info:
  name: /etc/passwd writable - Privilege Escalation
  author: daffainfo
  severity: high
  reference:
    - https://book.hacktricks.xyz/linux-hardening/privilege-escalation#writable-etc-passwd
  metadata:
    verified: true
  tags: code,linux,privesc,local

self-contained: true
code:
  - engine:
      - sh
      - bash
    source: |
        [ -w "/etc/passwd" ] && echo "Writable" || echo "Not writable"

    matchers:
      - type: word
        part: code_1_response
        words:
          - "Writable"

      - type: word
        part: code_1_response
        words:
          - "Not writable"
        negative: true
# digest: 4a0a0047304502210096579c1feb0a90bdbb55acc382213a07ed99678c1afdaa1849273657d6292d3c02200903d3d37e2aafed546ff3b5259ecaa046cac660ae9acadb109f4dc694c4a81d:922c64590222798bb761d5b6d8e72950