Skip to content

PHP - Privilege Escalation

ID: privesc-python

Severity: high

Author: daffainfo

Tags: code,linux,php,privesc,local

Python is a high-level, general-purpose programming language known for its readability and simplicity. It is widely used for web development, scientific computing, artificial intelligence, and system automation. Python’s versatility, extensive standard library, and large community make it a popular choice for a wide range of applications.

id: privesc-python
info:
name: PHP - Privilege Escalation
author: daffainfo
severity: high
description: |
Python is a high-level, general-purpose programming language known for its readability and simplicity. It is widely used for web development, scientific computing, artificial intelligence, and system automation. Python's versatility, extensive standard library, and large community make it a popular choice for a wide range of applications.
reference:
- https://gtfobins.github.io/gtfobins/python/
metadata:
verified: true
max-request: 4
tags: code,linux,php,privesc,local
self-contained: true
code:
- engine:
- sh
- bash
source: |
whoami
- engine:
- sh
- bash
source: |
python -c 'import os; os.system("whoami")'
- engine:
- sh
- bash
source: |
sudo python -c 'import os; os.system("whoami")'
- engine:
- sh
- bash
source: |
python -c 'import os; os.setuid(0); os.system("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")'
- 'contains(code_4_response, "root")'
condition: or
# digest: 4b0a004830460221009d573c184e24737640e3535778e28ed55e29bed051507f2358779b8e8c5d912c022100f2fd6f437e9833ff598a60bd5ce205d6da5a4776c4189c74dddd982b7fc15249:922c64590222798bb761d5b6d8e72950

This template is used to detect vulnerabilities in web applications. It can be used with the Nuclei tool to scan for specific patterns or behaviors.

Terminal window
$ nuclei -u "URL" -t "code/privilege-escalation/linux/binary/privesc-python.yaml"

View on Github