id: privesc-zsh info: name: Zsh - Privilege Escalation author: daffainfo severity: high description: | zsh is a powerful and feature-rich shell for Unix-like operating systems. It offers advanced interactive features, extensive customization options, and robust scripting capabilities reference: - https://gtfobins.github.io/gtfobins/zsh/ metadata: verified: true max-request: 3 tags: code,linux,zsh,privesc,local self-contained: true code: - engine: - sh - bash source: | whoami - engine: - sh - bash source: | zsh -c 'whoami' - engine: - sh - bash source: | sudo zsh -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: 4b0a00483046022100a27777a032bc8fb0a3e2a867285d0cd42cd9f86a049322603e8f04b572b5a4590221008ea1c8c84f81b54c9bba8885838fd47102d59fc32bf2018094b21e85e2b28e7b:922c64590222798bb761d5b6d8e72950