Bug 16129 - ntvfs_simple maps SMB names to Unix paths without rejecting dot-dot traversal before filesystem sinks
Summary: ntvfs_simple maps SMB names to Unix paths without rejecting dot-dot traversal...
Status: RESOLVED WONTFIX
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Test infrastructure (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-06-15 00:47 UTC by Douglas Bagnall
Modified: 2026-11-01 06:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Bagnall 2026-06-15 00:47:13 UTC
Tridge writes:

An authenticated SMB client on a share using the non-default NTVFS simple backend can supply names containing traversal components; svfs_unix_path() concatenates them to connectpath and feeds POSIX filesystem calls without containment checks.

- source4/ntvfs/simple/svfs_util.c:36-50 lowercases the name, prepends connectpath, replaces backslashes with slashes, and returns the path.
- source4/ntvfs/simple/vfs_simple.c:147-150 uses the computed path in unlink().
- source4/ntvfs/simple/vfs_simple.c:360-407 uses it in mkdir() and open().
- source4/ntvfs/simple/vfs_simple.c:466-512 uses it in mkdir(), rmdir(), and rename().
- source4/ntvfs/simple/README:1-10 documents root file access and testing-only status.
- docs-xml/smbdotconf/vfs/ntvfshandler.xml:20-27 documents the option as NTVFS-only and not default s3fs.

Remaining uncertainty: No live SMB request was run, and a full audit of all upstream NTVFS canonicalization was not performed; confidence is therefore medium despite the vulnerable backend helper.
#### Dataflow

**Attacker role:** Authenticated SMB client with access to a share configured with ntvfs handler = simple.

**Entrypoint:** SMB pathname, wildcard, mkdir/rmdir, open, unlink, and rename requests handled by source4/ntvfs/simple.

**Trust boundary:** Client SMB path strings cross into local Unix filesystem operations under the backend's process privileges.

**Controls and counterevidence:**
- The simple backend README says it is testing-only and all file access is as root.
- The ntvfs handler option applies only to NTVFS deployments, not the default s3fs file server.
- Read-only share checks reduce write sinks but do not provide path containment.

**Exploit steps:**
- Find a Samba4 NTVFS share using the simple backend.
- Send an SMB request with a path such as backslash traversal components that survive to svfs_unix_path().
- The helper converts backslashes to slashes after concatenating with the share connectpath.
- The resulting Unix path escapes the share root and is used in open, unlink, mkdir, rmdir, or rename.

- Additional evidence is available in the per-candidate attack-path report.

#### Reachability

The path is reachable under the attacker role and entry point documented above, with these limits considered:
- The simple backend README says it is testing-only and all file access is as root.
- The ntvfs handler option applies only to NTVFS deployments, not the default s3fs file server.
- Read-only share checks reduce write sinks but do not provide path containment.

Attacker outcome: An authenticated SMB client on a share using the non-default NTVFS simple backend can supply names containing traversal components; svfs_unix_path() concatenates them to connectpath and feeds POSIX filesystem calls without containment checks.

#### Severity

Final severity is **medium**. This has a concrete sink and plausible attacker path, but role, configuration, optional feature, or runtime preconditions bound practical exploitability.

**Impact calibration:** Read, write, delete, create, or rename outside the share root; because the module documents root file access, misconfigured deployments can amplify this to root filesystem effects.

**Likelihood calibration:** Low to medium: the backend is non-default and testing-only, but it is a documented selectable handler and has direct filesystem sinks.

**Severity rationale:** Final severity is **medium** because the repository evidence shows a real trust-boundary crossing and reachable sink, while the listed controls and deployment preconditions bound exploitability and blast radius.

Counterevidence and deployment limits considered: The simple backend README says it is testing-only and all file access is as root.; The ntvfs handler option applies only to NTVFS deployments, not the default s3fs file server.; Read-only share checks reduce write sinks but do not provide path containment..

Additional runtime proof against a live Samba service or a default deployment configuration would raise confidence; evidence that the feature is unreachable, trusted-only, or fully mitigated in supported builds would lower severity.

#### Remediation

Remove or hard-disable the simple backend for production, or add canonical path containment using dirfd/openat-style operations and reject traversal before every filesystem sink. Add regression coverage that exercises the attacker-controlled input at the listed entry point and asserts the validation, authorization, containment, or size check occurs before the dangerous sink.


| Severity | medium |
| Confidence | medium |
| Confidence rationale | Source evidence supports the issue, but no live SMB request was run, and a full audit of all upstream NTVFS canonicalization was not performed; confidence is therefore medium despite the vulnerable backend helper. |
Comment 1 Douglas Bagnall 2026-06-15 00:49:00 UTC
I have left this [EMBARGOED][SECURITY] because I am using a template, but it is NTVFS, so not really security.

See bug 16128.
Comment 2 Andrew Bartlett 2026-08-08 08:16:23 UTC
We may be able to simply remove the ntvfs_simple code.
Comment 4 Andrew Bartlett 2026-08-08 09:01:15 UTC
The README literally says:

This module (ntvfs 'simple') provides a very, very simple posix backend.

WARNING: All file access is done as user 'root'!!!
        Only use this module for testing, with only test data!!! 

Moving under the embargoed non-security bug.
Comment 5 Samba QA Contact 2026-08-18 08:07:03 UTC
This bug was referenced in samba master:

c53367a48f886cb90621fdfe9911f90f9109cdf4
Comment 6 Volker Lendecke 2026-09-21 15:38:18 UTC
"Fixed" by removing the offending code
Comment 7 Andrew Bartlett 2026-11-01 06:10:56 UTC
[Bulk message on a number of bugs being made public at once]

The embargo is being removed from this bug.  

That is not to say that the issue is not a real bug, but some things are better dealt with in public, where the normal process is both more available to external contributors and much, much more efficient.  

If you have a patch for this issue, please do contribute it via our normal GitLab process:

https://wiki.samba.org/index.php/Contribute#Submitting_Patches_via_GitLab

All patches to Samba must follow our copyright policy:

https://www.samba.org/samba/devel/copyright-policy.html

Thanks to all who report issues to Samba, we value your patience as we, along with the rest of the Open Source and Free Software communities, work though the reported issues.