CVE-2026-54327 Overview
CVE-2026-54327 affects Pi, a minimal terminal coding harness maintained by earendil-works. The vulnerability exists in versions 0.74.0 through 0.78.0 and is fixed in 0.78.1. Pi stores API keys and OAuth credentials in an auth.json file. A race condition in the file write path can briefly create or rewrite this file with permissions derived from the process umask before tightening the file to owner-only permissions. Local users on the same system can read sensitive credentials during this short window. The flaw is classified under [CWE-367] Time-of-Check Time-of-Use (TOCTOU) race condition.
Critical Impact
A local attacker with low privileges can read API keys and OAuth tokens from auth.json during the brief window before file permissions are tightened to owner-only.
Affected Products
- Pi (earendil-works) versions 0.74.0 through 0.78.0
- Fixed in Pi version 0.78.1
- Component: packages/coding-agent/src/core/auth-storage.ts
Discovery Timeline
- 2026-06-23 - CVE-2026-54327 published to NVD
- 2026-06-25 - Last updated in NVD database
- Patch release - Pi 0.78.1 released with fix in commit 135fb545f99106a4a249274f129b90bc0a77d347
Technical Details for CVE-2026-54327
Vulnerability Analysis
The vulnerability resides in the credential storage logic of Pi's coding agent. The auth.json file holds API keys and OAuth credentials needed for the harness to authenticate against upstream services. The write path created or rewrote this file using default file creation semantics, applying permissions derived from the process umask. A second operation then tightened the file mode to 0o600 (owner read/write only). Between these two operations, the file existed with broader permissions, exposing its contents to other local users.
A local attacker on a shared system can race the write path, opening auth.json while permissions remain group- or world-readable. The window is short, but repeated invocations or filesystem monitoring make exploitation feasible on multi-user systems.
Root Cause
The root cause is a TOCTOU race condition [CWE-367] in the file write sequence. The code created the file first and then adjusted permissions, rather than specifying the restrictive mode at creation time. The umask of the invoking process governed initial permissions, which on many systems defaults to 022, producing a world-readable file.
Attack Vector
Exploitation requires local access with low privileges and user interaction, as a Pi user must trigger an auth.json write. The attacker monitors the file path with inotify or a tight read loop. When Pi creates the file with umask-derived permissions, the attacker reads the credentials before the mode is tightened to 0o600.
// Security patch in packages/coding-agent/src/core/auth-storage.ts
// fix(coding-agent): set auth file mode on creation
next?: string;
};
const AUTH_FILE_WRITE_OPTIONS = { encoding: "utf-8", mode: 0o600 } as const;
export interface AuthStorageBackend {
withLock<T>(fn: (current: string | undefined) => LockResult<T>): T;
withLockAsync<T>(fn: (current: string | undefined) => Promise<LockResult<T>>): Promise<T>;
Source: GitHub Commit 135fb54
The patch defines AUTH_FILE_WRITE_OPTIONS with mode: 0o600 applied at file creation. This removes the window in which umask-derived permissions can expose the file contents.
Detection Methods for CVE-2026-54327
Indicators of Compromise
- Unexpected processes opening or reading auth.json paths used by Pi installations
- inotify watches or repeated stat/open syscalls against Pi credential directories from non-owner users
- Unauthorized use of API keys or OAuth tokens stored by Pi against upstream services
Detection Strategies
- Audit installed Pi versions across developer workstations and identify any release between 0.74.0 and 0.78.0
- Monitor filesystem access to auth.json using Linux audit rules (auditctl -w /path/to/auth.json -p r)
- Review upstream service logs for credential use from unexpected IP addresses or user agents
Monitoring Recommendations
- Enable process and file telemetry on shared development systems where Pi is installed
- Alert on read access to Pi credential files by users other than the file owner
- Track API key usage patterns from services authenticated through Pi to detect token misuse
How to Mitigate CVE-2026-54327
Immediate Actions Required
- Upgrade Pi to version 0.78.1 or later on all systems
- Rotate any API keys and OAuth credentials previously stored in auth.json on shared or multi-user systems
- Restrict access to systems running vulnerable Pi versions until the upgrade is applied
Patch Information
The fix is available in Pi 0.78.1, released via GitHub Release v0.78.1. The patch is tracked in commit 135fb54 and documented in GHSA-r95r-rj6r-c39x. The fix sets file mode 0o600 at creation, eliminating the race window.
Workarounds
- Set a restrictive umask (umask 077) for users running Pi to limit permissions of newly created files
- Store Pi credentials on filesystems that are not shared with untrusted local users
- Manually verify and enforce 0o600 permissions on auth.json until the upgrade is completed
# Configuration example: enforce restrictive umask and verify auth.json permissions
umask 077
chmod 600 ~/.config/pi/auth.json
ls -l ~/.config/pi/auth.json
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

