> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/privesc/sudoers/sudo-bbot-binary-linux-privilege-escalation.md).

# Sudo bbot Binary - Linux Privilege Escalation

Sudo (bbot Binary) notes for Linux privilege escalation, with enumeration steps, exploitation examples, and reporting-focused validation.

## What It Is

Sudoers privilege escalation starts with the commands a user can run through `sudo`. Misconfigured binaries, unsafe script arguments, symlink handling, and vulnerable sudo versions can turn limited sudo rights into a root shell. This specific page focuses on **Sudo (bbot Binary)** and keeps the exploitation flow practical: identify the condition, validate it safely, then run the smallest payload needed to prove impact.

## Enumeration

Start by confirming the local context and the exact misconfiguration before running the exploit path.

```bash
sudo -l
sudo --version
```

## Examples

### Sudo - bbot (binary)

Audit of fees sudo:

```bash
sudo -l 
```

The user can run `/usr/local/bin/bbot` in root.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-10fc8f8f88230caa2d796f703db2f19c6fae5965%2Fimage%20(517).png?alt=media" alt=""><figcaption></figcaption></figure>

Content of `/usr/local/bin/bbot`:

```python
#!/opt/pipx/venvs/bbot/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from bbot.cli import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script/.pyw|/.exe)?$', '', sys.argv[0])
    sys.exit(main())
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-be6a8ba276a1e956c4b040f1acd221d23c438005%2Fimage%20(519).png?alt=media" alt=""><figcaption></figcaption></figure>

### Exploitation:

This script simply transmits arguments to the main function of `bbot`. Since we can control the arguments provided, we can use a feature of `bbot` to read any file — including those that are accessible only by user **root**.

After consulting the help or documentation for using `bbot`, we identified options for specifying a target file and an output directory:

```bash
sudo /usr/local/bin/bbot -t /root/root.txt -o /tmp/root -d
```

**Explication :**

* `-t /root/root.txt`: sets the target file to be processed.
* `-o /tmp/root`: specifies the output directory (where the results will be stored).
* `-d`: Enables debugging mode, in case additional information is needed.

As the script runs with the **root** privileges and no validation of the inputs is performed, this allows us to read arbitrary files, including the final file containing the **root flag**.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-38f304ff0dd3239d615ef146d27350e3eec435f9%2Fimage%20(521).png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/privesc/sudoers/sudo-bbot-binary-linux-privilege-escalation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
