exploiting-linux-capabilities

Enumerates and abuses Linux file and process capabilities for privilege escalation and container escape.

954|172|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/xalgord/xalgorix --skill exploiting-linux-capabilities
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: exploiting-linux-capabilities
Source: https://github.com/xalgord/xalgorix/tree/main/internal/tools/skills/data/linux-hardening/exploiting-linux-capabilities
Command: npx skills add https://github.com/xalgord/xalgorix --skill exploiting-linux-capabilities

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

During authorized penetration tests, testers often overlook Linux capabilities as a privilege escalation vector, running getcap once and missing high-impact misconfigurations like cap_setuid on interpreters or cap_sys_admin in containers. This Skill provides a systematic workflow to enumerate, confirm, and exploit capability misconfigurations for local privilege escalation and container escape.

Core Features & Use Cases

  • Capability Enumeration: Guides discovery of file and process capabilities using getcap, getpcaps, and capsh, including decoding raw capability masks.
  • Exploitation Playbooks: Provides concrete command sequences for abusing cap_setuid, cap_dac_read_search, cap_dac_override, cap_sys_admin, cap_sys_ptrace, cap_chown, and ambient capabilities.
  • Container Escape: Covers mounting host disks via cap_sys_admin and chrooting into the host filesystem from within a container.
  • Use Case: A tester with a low-privilege shell finds /usr/bin/python3.11 = cap_setuid+ep via getcap -r /, then follows the Skill's steps to call setuid(0) and obtain a root shell, documenting the finding with the provided report template.

Quick Start

Ask the assistant to enumerate Linux capabilities on the target host and identify exploitable ones for privilege escalation.

Frequently Asked Questions about exploiting-linux-capabilities

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enumerate Linux capabilities for privilege escalation?

Run getcap -r / 2>/dev/null to list all file capabilities system-wide, and use capsh --print or cat /proc/$$/status to inspect the current process capability sets. Grep the output for high-value capabilities like setuid, dac_override, sys_admin, and sys_ptrace.

How to exploit cap_setuid on a Python binary for root access?

If getcap shows a Python binary with cap_setuid+ep, run python3 -c 'import os; os.setuid(0); os.system("/bin/bash")' to set the UID to 0 and spawn a root shell. The same technique works with perl, ruby, and node interpreters.

Can cap_sys_admin be used to escape a Docker container?

Yes, cap_sys_admin inside a container allows mounting the host block device. Identify the host disk with fdisk -l, mount it to a directory, then chroot into it or write an SSH key to the host's /root/.ssh/authorized_keys.

What is the difference between cap_dac_read_search and cap_dac_override?

cap_dac_read_search bypasses file read permission checks, allowing reads of files like /etc/shadow or root SSH keys. cap_dac_override additionally bypasses write checks, enabling modification of arbitrary files such as /etc/passwd or sudoers.

Why does a binary with empty capabilities (=ep) still run as root?

Per the capabilities man page, a non-root binary showing =ep in getcap output with no SUID bit can still execute with root privileges due to how the kernel treats empty capability sets. Confirm by running the binary and checking that id returns uid=0.

When should Linux capability abuse be tested during a pentest?

Test capabilities during authorized local privilege escalation after obtaining a user shell, especially when SUID enumeration comes up empty. It is also essential when assessing a container's effective capability set for escape potential.