id: privesc-unshare info: name: Unshare - Privilege Escalation author: daffainfo severity: high description: | The unshare command is used to run a command in a new namespace, which can isolate various aspects of the system, such as the mount namespace, network namespace, user namespace, and more. reference: - https://gtfobins.github.io/gtfobins/unshare/ metadata: verified: true max-request: 3 tags: code,linux,unshare,privesc,local self-contained: true code: - engine: - sh - bash source: | whoami - engine: - sh - bash source: | unshare whoami - engine: - sh - bash source: | sudo unshare 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: 4b0a004830460221008089aba3a614ad70901d62d2611e3a01a42cb1d918eac6315a938c392890768f022100867c33eb6a50e6df63d5adfb3438ef308341581f474ebabe50624c470a77ad90:922c64590222798bb761d5b6d8e72950