VYPR
Unrated severityNVD Advisory· Published Jun 21, 2026

Capgo CLI - Arbitrary File Overwrite via Symlink-Following in Local Credential Operations

CVE-2026-56236

Description

Capgo CLI before 12.128.2 contains arbitrary file overwrite vulnerabilities in login and build credentials operations that follow symlinks without validation. Attackers can create malicious symlinks in repositories to overwrite arbitrary files or expose credentials with world-readable permissions when developers run the CLI.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

2

Patches

Vulnerability mechanics

Root cause

"The CLI writes sensitive files using `writeFileSync`/`writeFile` without checking whether the destination path is a symlink, and creates global credentials with world-readable permissions (664) instead of 0600."

Attack vector

An attacker creates a malicious repository containing a symlink named `.capgo` or `.capgo-credentials.json` pointing to an arbitrary target file on the developer's filesystem. When the developer runs `capgo login --local` or `capgo build credentials save --local` inside that repository, the CLI follows the symlink and overwrites the target with attacker-controlled content (an API key string or a credentials JSON payload). The overwrite occurs even when authentication fails (for login) or when the user is not logged in (for credentials save). On shared systems, the global credentials file is written with world-readable permissions (664), exposing signing material to other local users. [ref_id=1]

Affected code

The advisory identifies two source files: `src/login.ts` (the `loginInternal` function writes `.capgo` via `writeFileSync` without symlink checks) and `src/build/credentials.ts` (the `build credentials save --local` path writes `.capgo-credentials.json` via `writeFile` without symlink checks, and the global path `$HOME/.capgo-credentials/credentials.json` is created with permissions 664). [ref_id=1]

What the fix does

The advisory recommends three remediation steps: refuse symlink destinations by using `lstat` + `isSymbolicLink` before writing, enforce safe permissions (0600 for files, 0700 for directories), and write atomically (temp file + rename) after safety checks. Additionally, the advisory suggests deferring the `.capgo` write until after API key validation succeeds, and checking that `.gitignore` is a regular file before appending to it. The patch (version 12.128.2) implements these changes to prevent symlink following and to set restrictive permissions. [ref_id=1]

Preconditions

  • inputDeveloper runs the Capgo CLI inside a repository controlled by the attacker
  • inputRepository contains a symlink named .capgo or .capgo-credentials.json pointing to an attacker-chosen target
  • configFor the permissions issue, the credentials file is stored globally and another local user on the shared system can read it

Generated on Jun 22, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

2

News mentions

0

No linked articles in our index yet.