id: rw-shadow
info:
name: /etc/shadow writable or readabel - Privilege Escalation
author: daffainfo
severity: high
reference:
- https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html#passwdshadow-files
- https://man7.org/linux/man-pages/man5/shadow.5.html
metadata:
verified: true
max-request: 2
tags: code,linux,privesc,local
self-contained: true
code:
- engine:
- sh
- bash
source: |
whoami
- engine:
- sh
- bash
source: |
[ -r "/etc/shadow" ] || [ -w "/etc/shadow" ] && echo "Either readable or writable" || echo "Not readable and not writable"
matchers:
- type: word
part: code_1_response
words:
- "root"
negative: true
- type: word
part: code_2_response
words:
- "Either readable or writable"
- type: word
part: code_2_response
words:
- "Not readable and not writable"
negative: true
# digest: 490a0046304402207974e0cc03df2c2f1939ed4abd700a9662e8ff35d9b5cad24208b6df3171a25402206d0c24abe4e2825e256bea8295182d242d4c39417906c01b9e000ba724250801:922c64590222798bb761d5b6d8e72950