NFS Export With no_root_squash
An NFS export is configured with no_root_squash, so root on any permitted client has root access to the exported files and can plant set-user-ID executables.
| Severity | High |
| CVSS 3.1 | 8.8 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 8.7 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-266: Incorrect Privilege Assignment |
| OWASP Top 10 | A06:2025 Insecure Design |
| MITRE ATT&CK | T1548.001 Setuid and Setgid, T1039 Data from Network Shared Drive |
| Category | Broken Access Control |
Description
By default, an NFS server maps requests made by the root user (user ID 0) on a client to an unprivileged anonymous user, usually nobody, a behaviour known as root squashing. The no_root_squash option in /etc/exports turns this off for an export, so root on a client is treated as root on the exported file system. With the usual sec=sys (AUTH_SYS) security, the server trusts the user ID that the client sends, so anyone with root on a machine the export permits, which may be a machine of their own on a permitted network, can act as root on the export.
That lets them read, change and delete every file on the export regardless of its permissions, including other users' data, SSH keys and configuration files. They can also place a root-owned executable with the set-user-ID bit on the export: any user who can run it on the NFS server, where the export is a local file system, or on another client that mounts the export without the nosuid option, gains root on that host, so a low-privileged foothold on such a host is enough to become root. Where the export holds home directories, system files or virtual machine images, the result can be full compromise of the server and its clients.
The option is often set so that administration, backups or hypervisors using the export as a datastore work, and is found on Linux NFS servers and storage appliances. It is identified by reviewing /etc/exports or the output of exportfs -v on the server, or from a permitted client by mounting the export as root and checking whether files created there remain owned by root, and whether root-owned files with restrictive permissions can be read. Exports open to any host are reported separately; this finding concerns the squashing of root.
Remediation
Restore root squashing and limit which clients can mount the export:
- Remove
no_root_squashfrom the export's options in/etc/exportsso that the defaultroot_squashapplies, or stateroot_squashexplicitly, and apply the change withexportfs -ra. Considerall_squashfor exports that only need anonymous or single-account access. - Where one client genuinely needs root access, such as a backup server or a hypervisor, allow
no_root_squashonly for that client's specific address in its own export entry, never for a network range or wildcard, and keep that traffic on a dedicated, segregated storage network. - Restrict every export to the specific hosts that need it, and export read-only (
ro) where clients only need to read. - Mount NFS exports on clients with the
nosuidandnodevoptions. - Where clients cannot be trusted to assert user identities, use Kerberos security (
sec=krb5,krb5iorkrb5p) so that access depends on authenticated users rather than on the user ID the client sends. - Search exports that had the option for unexpected set-user-ID files and for changes to sensitive files, since they may already have been abused.
Confirm the fix with exportfs -v on the server, and from a permitted client by checking that a file created as root on the export is owned by the anonymous user.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.