Summary
GoFound contains a path traversal vulnerability in its database API that can let unauthenticated attackers target directories outside the intended data directory for deletion. It becomes risky when a crafted database parameter reaches a recursive deletion operation without adequate path validation.
GoFound contains a path traversal vulnerability in its database API that can let unauthenticated attackers target directories outside the intended data directory for deletion. It becomes risky when a crafted database parameter reaches a recursive deletion operation without adequate path validation.
Affected context
The issue affects GoFound through version 1.4.1 in the /api/db/create and /api/db/drop endpoints. The risk arises when the database parameter is used to construct a filesystem path and the resulting path is not constrained to the intended data directory before deletion.
The issue affects GoFound through version 1.4.1 in the /api/db/create and /api/db/drop endpoints. The risk arises when the database parameter is used to construct a filesystem path and the resulting path is not constrained to the intended data directory before deletion.
Exploit preconditions
- Attack surface: HTTP GET requests to
/api/db/createor/api/db/drop - Required access: The described endpoints can be reached without authentication
- Trigger point: The server processes a
databaseparameter containing path traversal sequences - Why exploitation is possible: The resulting path can escape the data directory and be passed to recursive deletion
- Attack surface: HTTP GET requests to
/api/db/createor/api/db/drop - Required access: The described endpoints can be reached without authentication
- Trigger point: The server processes a
databaseparameter containing path traversal sequences - Why exploitation is possible: The resulting path can escape the data directory and be passed to recursive deletion
Why this happens
The underlying issue is improper limitation of a pathname to a restricted directory, which maps to CWE-22: Path Traversal. The application uses user-influenced path data in a filesystem operation without reliably ensuring that the resolved target remains within the intended data directory. Because the affected operation recursively removes directories, an out-of-bound path can have destructive effects.
The underlying issue is improper limitation of a pathname to a restricted directory, which maps to CWE-22: Path Traversal. The application uses user-influenced path data in a filesystem operation without reliably ensuring that the resolved target remains within the intended data directory. Because the affected operation recursively removes directories, an out-of-bound path can have destructive effects.
Potential impact
- Attackers may delete directories outside the intended data directory
- Application data or files needed for service operation could be lost
- Service availability could be disrupted
- A victim's browser could trigger a request that causes deletion, depending on the surrounding deployment and browser protections
- Attackers may delete directories outside the intended data directory
- Application data or files needed for service operation could be lost
- Service availability could be disrupted
- A victim's browser could trigger a request that causes deletion, depending on the surrounding deployment and browser protections
General mitigation guidance
Defensive patterns include:
- Map accepted database identifiers to server-controlled paths instead of accepting arbitrary path fragments
- Resolve and verify paths remain within a designated base directory before filesystem operations
- Reject traversal components and enforce strict input schemas
- Avoid destructive actions through GET requests; require an appropriately protected state-changing operation
- Run the service with only the filesystem permissions it needs, limiting the consequences of path-handling mistakes
Defensive patterns include:
- Map accepted database identifiers to server-controlled paths instead of accepting arbitrary path fragments
- Resolve and verify paths remain within a designated base directory before filesystem operations
- Reject traversal components and enforce strict input schemas
- Avoid destructive actions through GET requests; require an appropriately protected state-changing operation
- Run the service with only the filesystem permissions it needs, limiting the consequences of path-handling mistakes
How teams detect issues like this
- Use static analysis to identify user-controlled values flowing into recursive deletion or other filesystem APIs
- Review path construction and containment checks around database management endpoints
- Apply request validation policies that reject unexpected path syntax and restrict database identifiers to an allowlist
- Monitor application and filesystem audit logs for deletion attempts targeting paths outside the expected data directory
- Automated code review tools may help identify risky input-to-filesystem flows
- Use static analysis to identify user-controlled values flowing into recursive deletion or other filesystem APIs
- Review path construction and containment checks around database management endpoints
- Apply request validation policies that reject unexpected path syntax and restrict database identifiers to an allowlist
- Monitor application and filesystem audit logs for deletion attempts targeting paths outside the expected data directory
- Automated code review tools may help identify risky input-to-filesystem flows

