> For the complete documentation index, see [llms.txt](https://capcap-1.gitbook.io/capcap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capcap-1.gitbook.io/capcap/readme/ctf-modules/information-gathering/service-enumeration/nfs-111-2049.md).

# NFS (111, 2049)

### Key notes

* Ports — 111 and 2049
* Commands — showmount, mount, ls -n, umount
* Dangerous settings — no\_root\_squash, rw, insecure
* Key concept — NFS trusts UID, so matching UID = file access\
  \
  `Network File System` (`NFS`) is a network file system developed by Sun Microsystems and has the same purpose as SMB. Its purpose is to access file systems over a network as if they were local.
* OS Target: Primarily used between Linux/Unix systems.
* Ports: 111 (rpcbind/portmapper) and 2049 (NFS).
* The Flaw: NFSv2/v3 lacks native user authentication; it trusts the client machine’s UID/GID. If you change your local UID to match the target file owner, you get access.

### Dangerous Settings <a href="#dangerous-settings" id="dangerous-settings"></a>

| **Option**       | **Description**                                                                                                      |
| ---------------- | -------------------------------------------------------------------------------------------------------------------- |
| `rw`             | Read and write permissions.                                                                                          |
| `insecure`       | Ports above 1024 will be used.                                                                                       |
| `nohide`         | If another file system was mounted below an exported directory, this directory is exported by its own exports entry. |
| `no_root_squash` | All files created by root are kept with the UID/GID 0.                                                               |

Footprinting the Service:

{% code title="Footprint the service and check active RPC mappings" %}

```bash
sudo nmap 10.129.14.128 -p111,2049 -sV -sC
sudo nmap --script nfs* -p 111,2049 <IP>
```

{% endcode %}

{% code title="Show available NFS shares" %}

```bash
showmount -e 10.129.14.128
```

{% endcode %}

{% code title="Mount the target share to a local folder (-o nolock bypasses file locking)" %}

```bash
mkdir target-NFS
sudo mount -t nfs <IP>:/source/path ./target-NFS/ -o nolock
```

{% endcode %}

{% code title="Inspect raw numeric User IDs inside the mounted share" %}

```bash
ls -ln ./target-NFS/
```

{% endcode %}

{% code title="Clean up / Unmount the share" %}

```bash
sudo umount ./target-NFS
```

{% endcode %}


---

# 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 dynamically by asking a question.

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

```
GET https://capcap-1.gitbook.io/capcap/readme/ctf-modules/information-gathering/service-enumeration/nfs-111-2049.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
