LOW 2.2

CVE-2026-54327: Pi Terminal Coding Tool API Credential Exposure via Race Condition

Pi is a lightweight terminal-based coding tool that manages API authentication through a local configuration file. Between versions 0.74.0 and 0.78.1, a timing vulnerability could temporarily expose stored API keys and OAuth tokens with overly permissive file access before the application locked down security settings. This window is extremely brief but theoretically allows a local user with active session privileges to read credentials meant to be private. The issue has been patched in version 0.78.1.

Source data · NVD / CISA · public domain

CVSS
3.1 · 2.2 LOW · CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
Weaknesses (CWE)
CWE-367, CWE-732
Affected products
0 configuration(s)
Published / Modified
2026-06-23 / 2026-06-26

NVD description (verbatim)

Pi is a minimal terminal coding harness. From 0.74.0 until 0.78.1, Pi stored API keys and OAuth credentials in auth.json. A race condition in the file write path could briefly create or rewrite this file with permissions derived from the process umask before tightening the file to owner-only permissions. This vulnerability is fixed in 0.78.1.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-54327 exploits a race condition in Pi's file initialization sequence. During auth.json creation or rewrite, the file briefly inherits permissions from the process umask (typically 0o022 on Unix-like systems) before being explicitly restricted to owner-only mode (0o600). A local attacker with user-level access can potentially read the file during this race window to extract plaintext API keys and OAuth refresh tokens. The vulnerability stems from the order of operations: write-then-chmod rather than atomic creation with secure permissions. Both CWE-367 (Improper Input Validation) and CWE-732 (Incorrect Permission Assignment) apply, though CWE-732 is the primary root cause.

Business impact

If an attacker gains read access to auth.json during the race condition window, they obtain plaintext credentials that grant direct access to connected APIs and third-party services. The scope of impact depends on the privileges associated with those credentials—they could range from read-only API access to full account control over linked services. For development teams using Pi, this means potential lateral movement into integrated CI/CD pipelines, deployment systems, or SaaS platforms. The low CVSS score reflects the local-only attack surface and the requirement for user interaction (UI:R), but the credentials themselves are high-value if extracted. Organizations with strict API key rotation policies will face operational overhead; those without will face prolonged exposure risk.

Affected systems

Pi versions 0.74.0 through 0.78.0 are vulnerable. The vulnerability is resolved in 0.78.1. Because Pi is a developer tool rather than infrastructure software, exposure is limited to local machines where it is installed—chiefly developer workstations, CI/CD agents, and container build environments. Organizations using Pi in automated tooling should prioritize patching build agents and CI runners where credentials are most concentrated.

Exploitability

Exploitation requires local code execution or interactive login access (PR:L, UI:R in the CVSS vector). An attacker cannot exploit this remotely. The race condition window is narrow, making reliable exploitation difficult without precise timing or the ability to trigger auth.json rewrites repeatedly. However, the condition is reproducible: any action that causes Pi to write credentials will create an opportunity. An attacker with shell access to a shared system, a compromised user account, or the ability to run local monitoring could reliably capture the credentials. The CVSS:3.1 score of 2.2 (LOW severity) correctly reflects the constrained attack surface, but this should not be read as 'low priority'—credential theft of any kind demands attention.

Remediation

Upgrade Pi to version 0.78.1 or later. This release modifies the file creation logic to set restrictive permissions atomically, eliminating the race condition. For development teams, prioritize patching installations on shared systems and CI/CD agents before individual workstations. Verify the upgrade by checking the Pi version with 'pi --version' or equivalent. Additionally, rotate any API keys and OAuth tokens that may have been stored in auth.json on systems running vulnerable versions, particularly if those systems have multiple users or handle sensitive integrations.

Patch guidance

Patch immediately for any Pi installation on shared systems, CI/CD agents, container build environments, or systems accessible to multiple users. Upgrade to 0.78.1 using the project's documented installation method (typically a package manager or direct binary replacement). Test the upgrade in a non-critical environment first to confirm compatibility with your workflows. If you cannot patch immediately, implement access controls: restrict login access to the system, enable file monitoring on ~/.pi/ or the auth.json storage path, and rotate credentials frequently. Verify the update by confirming the version number changes and that auth.json is created with 0o600 permissions (owner read/write only) after upgrade.

Detection guidance

Monitor for auth.json files with excessive permissions (world or group readable). On Unix-like systems, run 'find ~/.pi -name auth.json -perm /077' to identify instances with overly permissive modes. Log file access to auth.json using auditd or equivalent; unusual access patterns (especially from other user accounts) warrant investigation. If your infrastructure spans multiple machines, audit Pi version numbers across your fleet to identify unpatched instances. Watch for unexpected API activity or token refreshes that may indicate stolen credentials. No public exploit code is known, but if you detect suspicious access to auth.json on a vulnerable version, assume credentials may be compromised and rotate them immediately.

Why prioritize this

Although the CVSS score is low, this vulnerability warrants prioritization for several reasons: (1) it directly threatens credentials, the crown jewels of secure API integration; (2) it affects development and build infrastructure where secrets density is high; (3) the fix is low-risk and straightforward; (4) credentials stolen via this vector could enable lateral movement into connected services and pipelines. Treat this as a moderate-priority vulnerability for any organization using Pi in automated or multi-user contexts, despite the low numerical score.

Risk score, explained

CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N yields 2.2 (LOW). Attack Vector (AV:L) reflects local-only exploitation. Attack Complexity (AC:H) acknowledges the narrow race window and timing difficulty. Privilege Required (PR:L) and User Interaction (UI:R) further restrict the attack surface. Confidentiality impact (C:L) is limited to credential exposure rather than widespread system compromise. The score is mathematically sound for the attack scenario but should not minimize the business risk of credential leakage; organizational context and credential sensitivity often justify treating credential-theft vulnerabilities more urgently than their numerical score suggests.

Frequently asked questions

We use Pi in our CI/CD pipeline. Do we need to patch immediately?

Yes. CI/CD agents are high-value targets for credential extraction, and auth.json often contains tokens for deployment systems, artifact repositories, and cloud services. Patch your build agents to 0.78.1 before patching developer workstations. If build agents run as a dedicated user on shared infrastructure, the window for exploitation is even wider.

Can this vulnerability be exploited remotely?

No. The vulnerability requires local code execution or login access (AV:L in CVSS). However, if your systems are accessible via SSH, container breakouts, or compromised user accounts, a remote attacker could leverage those to gain local access and then exploit this race condition.

Should we rotate credentials after upgrading Pi?

Yes, if the vulnerable version was installed on systems with multiple users, shared access, or untrusted accounts. If auth.json was only ever accessed by a single trusted user in a controlled environment, rotation may be optional but is still recommended as a best practice.

Does this affect other tools that use Pi as a library?

Only if those tools integrate Pi's auth.json file handling directly. If they use Pi as a CLI tool, they inherit the vulnerability until Pi itself is patched. Check your downstream dependencies and confirm they have upgraded Pi to 0.78.1.

This analysis is based on publicly available information and the CVE description as of June 2026. Verification of patch versions, affected product versions, and vendor advisories is the responsibility of the user. No exploit code or weaponized proof-of-concept is provided. Organizations should validate all patch applicability and compatibility within their own environments before deployment. This intelligence should inform but not replace vendor advisories, internal security policies, or incident response procedures. Source: NVD (public-domain), retrieved 2026-07-29. Analysis generated by SEC.co (claude-haiku-4-5).