Pi Agent: Race condition in Pi auth.json writes could expose stored credentials
Affected releases · @earendil-works/pi-coding-agent
- 0.78.x0.78.0Fixed in 0.78.1
- 0.77.x0.77.0No fix on this line yet
- 0.76.x0.76.0No fix on this line yet
- 0.75.x0.75.0 – 0.75.5No fix on this line yet
- 0.74.x0.74.0 – 0.74.2No fix on this line yet
On 0.78.x, the newest line:
npm install @earendil-works/pi-coding-agent@0.78.1Every release on a timeline
Not affected
1.0.0 – 1.6.0
13 releases, latest
Affected
0.74.0 – 0.78.0
12 releases
Fixed
0.78.1 – 0.99.2
40 releases
Affected releases · @mariozechner/pi-coding-agent
- 0.73.x0.73.0 – 0.73.1No fix on this line yet
- 0.72.x0.72.0 – 0.72.1No fix on this line yet
- 0.71.x0.71.0 – 0.71.1No fix on this line yet
- 0.70.x0.70.0 – 0.70.6No fix on this line yet
- 0.69.x0.69.0No fix on this line yet
- 0.68.x0.68.0 – 0.68.1No fix on this line yet
- 0.67.x0.67.0 – 0.67.68No fix on this line yet
- 0.66.x0.66.0 – 0.66.1No fix on this line yet
- 0.65.x0.65.0 – 0.65.2No fix on this line yet
- 0.64.x0.64.0No fix on this line yet
- 0.63.x0.63.0 – 0.63.2No fix on this line yet
- 0.62.x0.62.0No fix on this line yet
- 0.61.x0.61.0 – 0.61.1No fix on this line yet
- 0.60.x0.60.0No fix on this line yet
- 0.59.x0.59.0No fix on this line yet
- 0.58.x0.58.0 – 0.58.4No fix on this line yet
- 0.57.x0.57.0 – 0.57.1No fix on this line yet
- 0.56.x0.56.0 – 0.56.3No fix on this line yet
- 0.55.x0.55.0 – 0.55.4No fix on this line yet
- 0.54.x0.54.0 – 0.54.2No fix on this line yet
- 0.53.x0.53.0 – 0.53.1No fix on this line yet
- 0.52.x0.52.0 – 0.52.12No fix on this line yet
- 0.51.x0.51.0 – 0.51.6No fix on this line yet
- 0.50.x0.50.0 – 0.50.9No fix on this line yet
- 0.49.x0.49.0 – 0.49.3No fix on this line yet
- 0.48.x0.48.0No fix on this line yet
- 0.47.x0.47.0No fix on this line yet
- 0.46.x0.46.0No fix on this line yet
- 0.45.x0.45.0 – 0.45.7No fix on this line yet
- 0.44.x0.44.0No fix on this line yet
- 0.43.x0.43.0No fix on this line yet
- 0.42.x0.42.0 – 0.42.5No fix on this line yet
- 0.41.x0.41.0No fix on this line yet
- 0.40.x0.40.0 – 0.40.1No fix on this line yet
- 0.39.x0.39.0 – 0.39.1No fix on this line yet
- 0.38.x0.38.0No fix on this line yet
- 0.37.x0.37.0 – 0.37.8No fix on this line yet
- 0.36.x0.36.0No fix on this line yet
- 0.35.x0.35.0No fix on this line yet
- 0.34.x0.34.0 – 0.34.2No fix on this line yet
- 0.33.x0.33.0No fix on this line yet
- 0.32.x0.32.0 – 0.32.3No fix on this line yet
- 0.31.x0.31.0 – 0.31.1No fix on this line yet
- 0.30.x0.30.0 – 0.30.2No fix on this line yet
- 0.29.x0.29.0 – 0.29.1No fix on this line yet
- 0.28.x0.28.0No fix on this line yet
No release fixes it yet, not even the latest, 0.73.1.
Every release on a timeline
Not affected
0.6.2 – 0.27.9
125 releases
Affected
0.28.0 – 0.73.1
146 releases, latest
What happens
Pi auth.json writes could briefly expose stored credentials to local users
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.
Info
The affected credential storage code wrote auth.json and then corrected the file mode in a separate operation. During the interval between those operations, a local user who could read and traverse the Pi agent configuration directory could potentially read the file before its permissions were restricted.
The file can contain API keys, OAuth access tokens, and OAuth refresh tokens for configured providers. The affected behavior was present in the original auth.json credential storage implementation and thus affects both the original @mariozechner/pi-coding-agent package as well as @earendil-works/pi-coding-agent.
Impact
Exploitation requires local access to the same machine and read/traverse access to the victim's Pi agent configuration directory. Users whose ~/.pi/agent directory is private to their account are less exposed. The main impact is disclosure of stored provider credentials, which may allow use of the configured provider accounts according to the privileges of those credentials.
This is not remotely exploitable by itself.
Affected versions
Affected:
@mariozechner/pi-coding-agent >= 0.28.0, <= 0.73.1Affected:
@earendil-works/pi-coding-agent >= 0.74.0, < 0.78.1Patched:
@earendil-works/pi-coding-agent >= 0.78.1
The solution
Version 0.78.1 changed the credential storage writes to create auth.json with mode 0600 at open time. The fix applies to initial file creation and credential save paths, including OAuth token refresh writes.
Recommendations
Upgrade to @earendil-works/pi-coding-agent version 0.78.1 or later. Users still on the deprecated @mariozechner/pi-coding-agent package should migrate to the @earendil-works/pi-coding-agent package and install version 0.78.1 or later.
After upgrading, rotate any credentials that may have been exposed on multi-user systems where the Pi agent configuration directory was readable by other local users.
Workarounds
If upgrading immediately is not possible, restrict the Pi agent configuration directory so only the owning user can traverse it, restrict auth.json to owner-only permissions, and run Pi with a restrictive umask such as 077 until the upgrade is complete.
Timeline
2026-05-29: Report received
2026-06-02: Fix committed
2026-06-04: Fixed version released
2026-06-08: Advisory published
Credits
Reported by Paul Urian and Cosmin Alexa of CrowdStrike.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.