GHSA-g5xv-mhgm-v5f6: Medium severity pip/mcp-atlassian vulnerability
Summary
When OAuth tokens are saved, MCP Atlassian always writes a plaintext fallback copy under ~/.mcp-atlassian/oauth-<clientid>.json. The fallback file is created with the process default umask rather than restrictive permissions. In this environment the file was created as mode 0664, exposing access and refresh tokens to same-group local users and any process that can read the home directory.
Details
OAuthConfig.savetokens() stores OAuth token data in keyring, but it also unconditionally maintains a plaintext file fallback for backwards compatibility in src/mcpatlassian/utils/oauth.py:350-386. If keyring saving fails it also falls back to the same file path in src/mcpatlassian/utils/oauth.py:387-391.
The fallback writer creates ~/.mcp-atlassian and then writes oauth-<clientid>.json with a normal open(tokenpath, "w") call in src/mcpatlassian/utils/oauth.py:392-420. No mode=0o600, os.open(..., 0o600), chmod, or owner-only directory permission is applied. The file contains both accesstoken and refreshtoken (src/mcpatlassian/utils/oauth.py:360-367) and is later loaded from the same plaintext path in src/mcpatlassian/utils/oauth.py:450-470.
The security policy warns that OAuth client credentials and secrets should not be exposed (SECURITY.md:39-44), but the current implementation creates a persistent plaintext token copy even when keyring succeeds.
PoC
The following safe local proof uses a temporary HOME and mocked keyring writes. It creates and deletes only temporary files.
bash uv run python - <<'PY' import json, os, shutil, stat, tempfile from pathlib import Path from unittest.mock import patch from mcpatlassian.utils.oauth import OAuthConfig
home = tempfile.mkdtemp(prefix='mcp-atlassian-oauth-poc-') oldhome = os.environ.get('HOME') os.environ['HOME'] = home try: cfg = OAuthConfig(clientid='poc-client', clientsecret='client-secret', redirecturi='http://localhost/callback', scope='offlineaccess', cloudid='cloud-id') cfg.accesstoken = 'poc-access-token' cfg.refreshtoken = 'poc-refresh-token' cfg.expiresat = 2000000000 with patch('keyring.setpassword', returnvalue=None): cfg.savetokens() tokenfile = Path(home) / '.mcp-atlassian' / 'oauth-poc-client.json' mode = stat.SIMODE(tokenfile.stat().stmode) data = json.loads(tokenfile.readtext()) print(json.dumps({ 'tokenfileexists': tokenfile.exists(), 'tokenfilemodeoctal': oct(mode), 'containsaccesstoken': data.get('accesstoken') == 'poc-access-token', 'containsrefreshtoken': data.get('refreshtoken') == 'poc-refresh-token', 'tokenfilepath': str(tokenfile), }, indent=2, sortkeys=True)) finally: if oldhome is not None: os.environ['HOME'] = oldhome else: os.environ.pop('HOME', None) shutil.rmtree(home) PY
Observed output from this environment:
json { "containsaccesstoken": true, "containsrefreshtoken": true, "tokenfileexists": true, "tokenfilemodeoctal": "0o664", "tokenfilepath": "/tmp/mcp-atlassian-oauth-poc-9m9wvktp/.mcp-atlassian/oauth-poc-client.json" }
The proof confirms that a plaintext file containing both access and refresh tokens is created and is not owner-only.
Impact
A local user, container sidecar, compromised dependency, backup job, or other process with filesystem read access to the account's home directory can recover OAuth access and refresh tokens. Refresh tokens can allow continued Atlassian API access until revoked or expired, depending on the OAuth app and token policy. In shared hosts, Kubernetes volumes, developer workstations, and CI runners, this can lead to persistent Atlassian account compromise.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/mcp-atlassianto a version that resolves this vulnerability.Fixed in 0.22.0
Event History
Frequently Asked Questions
Who can access the exposed credentials?
Same-group local users can read the tokens when the fallback file is group-readable, as in the observed 0664 mode. Any process able to read the user’s home directory may also be able to access the file.
What must an attacker be able to do to exploit this?
An attacker needs local filesystem read access to the affected user’s home directory or membership in a group that can read the fallback file. No interaction is required once the token file is readable.
How can I determine whether credentials are exposed?
Check for ~/.mcp-atlassian/oauth-<client_id>.json and inspect its permissions and directory accessibility. The file contains both access_token and refresh_token, and a mode such as 0664 allows group read access.
Does this depend on keyring storage failing?
No. The plaintext fallback is maintained unconditionally even when tokens are saved to keyring. It is also used if keyring saving fails.