漏洞描述
Ash allows the value of a variable to be set at the same time it is marked read only by writing readonly name=value With no arguments
id: privesc-ash
info:
name: Ash - Privilege Escalation
author: daffainfo
severity: high
description: |
Ash allows the value of a variable to be set at the same time it is marked read only by writing readonly name=value With no arguments
reference:
- https://gtfobins.github.io/gtfobins/ash/
metadata:
verified: true
max-request: 3
tags: code,linux,ash,privesc,local
self-contained: true
code:
- engine:
- sh
- bash
source: |
whoami
- engine:
- sh
- bash
source: |
ash -c 'whoami'
- engine:
- sh
- bash
source: |
sudo ash -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: 4a0a004730450220358eca7b7d2e45755051a418f2d7a06d494a4fc086246f771cf673fc3b9be7ad022100e2a50d8b723046d133f1d59a942e39d4eecb448b94b2a1d383b9abf4974fff28:922c64590222798bb761d5b6d8e72950