-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
The FTP path resolution function does not enforce root directory boundaries, and uses unbounded sprintf() throughout.
Affected Files
src/ftpfqn.c:176-254(resolve_path)src/ftpfqn.clines 35, 52, 62, 73, 89, 108, 112, 120, 124, 140, 150, 153
Details
Path traversal
while (p = strstr(path, "/..")) {
/* normalizes but does not enforce root boundary */
}An attacker can escape the FTP root directory with CWD ../../etc.
Buffer overflows
Multiple sprintf() calls combine working directory and user input without bounds checking:
sprintf(buf, "%s%s", ftpc->cwd, in);
sprintf(buf, "%s.%s", ftpc->cwd, in);
sprintf(out, "%s/%s", ftpc->ufs->cwd->path, buf);Fix
- After path resolution, verify the canonical path starts with the configured FTP root.
- Replace all
sprintf()withsnprintf().
Severity
CRITICAL — path traversal + buffer overflow, both exploitable via FTP commands.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working