Summary
borg-ui before 2.4.1 allows a repository-scoped operator to use the backup-plan API to include paths that should not be available to that role. If the application data directory is archived and its static signing key is exposed, the operator may forge an administrator token and gain full application access.
Affected context
The issue occurs in borg-ui's backup-plan API, where the source_directories field accepts paths without an adequate allow-list. It is risky when a repository-scoped operator can create or modify backup plans and the application data directory, including the static HS256 signing key, is readable through the resulting archive.
Exploit preconditions
- Attack surface: Backup-plan API.
- Required access: A repository-scoped operator account able to configure backup plans.
- Trigger point: Processing a plan with attacker-controlled
source_directoriesand making the resulting archive available for download. - Why exploitation is possible: The API does not sufficiently restrict archive source paths, potentially exposing application data and the JWT signing secret. Possession of that secret can enable forged administrator tokens.
Why this happens
The application accepts caller-controlled filesystem paths for backup sources without enforcing an appropriate path allow-list or containment boundary. This is an instance of CWE-73: External Control of File Name or Path. The resulting access to sensitive application files can expose a signing secret, turning a path-control weakness into an authentication and privilege-escalation risk.
Potential impact
- A repository-scoped operator could gain administrator-level access.
- Sensitive application data, including authentication secrets, could be exposed in archives.
- Forged tokens could enable access to administrator-only endpoints, including user-management APIs.
- The application could be taken over without administrator credentials.
General mitigation guidance
Defensive approaches focus on restricting which paths a backup plan can read and protecting sensitive application data.
- Apply server-side allow-lists to permitted backup sources; do not rely on client-provided paths or validation alone.
- Resolve and canonicalize paths, then enforce that they remain within explicitly approved directories.
- Keep application secrets outside backup-readable locations, and exclude sensitive files through enforced policy.
- Use a managed secret store and rotate signing keys when exposure is suspected.
- Apply least privilege to backup processes and separate repository-level permissions from application administration.
- Treat archive creation and download as sensitive operations, with authorization and auditing controls.
How teams detect issues like this
- Review backup-plan handling for user-controlled paths that lack allow-lists, canonicalization, or directory-boundary checks.
- Use static analysis or code review rules to flag filesystem access derived from API fields.
- Test authorization boundaries to confirm repository-scoped roles cannot select application or secret directories.
- Monitor backup-plan changes and archive contents for unexpected source paths or sensitive files.
- Enforce policy checks that prevent secrets and application credentials from being included in user-accessible archives.

