# Capabilities

## What are Capabilities?

{% embed url="<https://man7.org/linux/man-pages/man7/capabilities.7.html>" %}
Capabilities man page
{% endembed %}

In short, "capability" is a "safer" version of SUID. However, it is still vulnerable in certain cases.

## Enumeration

Search for capabilities:

```bash
getcap -r / 2>/dev/null
```

## Python Capabilities

Suppose `/usr/bin/python2.6` has all capabilities:

![Python capabilities](/files/-MfjUR0o_jjyT_RDp3E4)

Spawn a root shell:

```bash
/usr/bin/python2.6 -c 'import os; os.setuid(0); os.system("/bin/bash")'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ret2basic.gitbook.io/ctfnote/red-teaming/privilege-escalation/linux-privilege-escalation/capabilities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
