Summary
Chartbrew connection settings can store attacker-chosen SSL certificate or SSH key paths, which may later be passed to file deletion without restricting them to managed certificate files. A user who can create or update and then delete a connection on their own team may cause files accessible to the Chartbrew process to be removed.
Affected context
The issue is in data-connection certificate and SSH-key cleanup. It can occur when connection creation or update accepts absolute file paths and cleanup later treats those stored values as managed files without verifying that they remain within an approved directory. The extent of possible deletion depends on the permissions of the Chartbrew process; the default container runs as uid 0.
Exploit preconditions
- Attack surface: Data-connection creation, update, and cleanup in Chartbrew
- Required access: Permission to create or update and delete connections on the user's own team; default self-signup grants a teamOwner these permissions
- Trigger point: Deleting a connection can invoke cleanup of its stored SSL or SSH path; duplicateConnection is also identified as a cleanup trigger
- Why exploitation is possible: Cleanup passes the stored path to
fs.unlinkwithout restricting it to an approved certificate directory - Permission boundary: Deletion is limited by the filesystem permissions of the Chartbrew process
Why this happens
Connection data includes file paths that can be selected by the user, but cleanup uses those values as filesystem deletion targets without enforcing a trusted directory boundary. This is an instance of CWE-73: External Control of File Name or Path: externally controlled path data influences a sensitive filesystem operation.
Potential impact
- An attacker may delete files that the Chartbrew process can access, such as
/code/.envor application source files - Deletion of configuration or application files could cause integrity loss or service disruption
- A process running with elevated filesystem permissions could expose a broader set of files to deletion
General mitigation guidance
Common defensive patterns include:
- Avoid using user-supplied paths directly in file deletion operations
- Store managed files under an application-controlled directory and derive deletion targets from trusted identifiers
- Canonicalize and validate paths against an explicit allowed directory before filesystem operations
- Apply least-privilege permissions to the application process and container
- Treat connection settings as untrusted input, even when submitted by authenticated team members
How teams detect issues like this
- Use static analysis to find file deletion calls that receive paths from request data, persisted connection fields, or other externally influenced sources
- Review connection creation, update, duplication, and cleanup flows for path validation and directory-boundary enforcement
- Monitor application and container filesystem activity for deletion attempts outside designated managed-file directories
- Apply code-review and policy checks that require trusted path construction for destructive filesystem operations

