漏洞描述
In Linux, the env command is used to display or modify the environment variables for a command. It can be used to set environment variables for a specific command or to print the current environment variables.
id: privesc-env
info:
name: env - Privilege Escalation
author: daffainfo
severity: high
description: |
In Linux, the env command is used to display or modify the environment variables for a command. It can be used to set environment variables for a specific command or to print the current environment variables.
reference:
- https://gtfobins.github.io/gtfobins/env/
metadata:
verified: true
max-request: 3
tags: code,linux,env,privesc,local
self-contained: true
code:
- engine:
- sh
- bash
source: |
whoami
- engine:
- sh
- bash
source: |
expect -c 'spawn whoami;interact'
- engine:
- sh
- bash
source: |
sudo expect -c 'spawn whoami;interact'
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: 4a0a0047304502206d1cdcc0363b8a0ae09b4c8700fe32428347e021f647cc2265d38ccfd18a8c5b022100ce43bffa746fcee42e11f4eb7f751e43184859dd3fd1e102e7779bef9a6fae4c:922c64590222798bb761d5b6d8e72950