/

CVE-2026-29872

Severity:

HIGH RISK

(8.2)

Information Disclosure in Streamlit-based GitHub MCP Agent

CVE-2026-29872

Analyzed

Vulnerability type

Category:

Information Disclosure

CWE:

CWE-200, CWE-284, CWE-522

Impact:

Exposure of Sensitive Authentication Credentials

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A cross-session information disclosure issue in the Streamlit-based GitHub MCP Agent causes user-supplied API tokens to be stored in process-wide environment variables without session isolation.

Because multiple users share the same Python process, credentials from one user can be accessed by subsequent, potentially unauthenticated users, exposing GitHub PATs and LLM API keys.

Affected context

This vulnerability occurs in a multi-user Streamlit deployment of the GitHub MCP Agent where:

  • The application runs multiple user sessions within a single long-lived Python process
  • User-provided secrets (e.g., GitHub tokens, LLM API keys) are written into os.environ
  • There is no per-session credential isolation or explicit clearing of secrets between requests

In such environments, any new session started after a user supplies credentials may inherit or read those values from the shared process environment.

Exploit preconditions

  • Attack surface: Web-based Streamlit UI exposed to multiple users, including untrusted or unauthenticated visitors.
  • Required access: Ability to interact with the application UI or issue HTTP requests to the Streamlit app endpoint.
  • Trigger point: At least one prior user must enter their credentials, which the app writes into os.environ or other process-global state.
  • Why exploitation is possible: Streamlit multiplexes multiple sessions through a single Python process, and environment variables are shared across all sessions. The application stores secrets in this shared space and does not enforce access controls or cleanup, allowing later users to read credentials that belong to previous users.

Why this happens

The underlying issue is the misuse of process-wide environment variables as a per-user credential store in a multi-session web application.

Environment variables in Python are global to the process (os.environ) and are not automatically scoped to individual HTTP sessions or Streamlit sessions.

By writing user-supplied secrets into this global namespace, the application violates isolation assumptions and exposes data across sessions, aligning with:

  • CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, since secrets become visible to users who did not supply them.
  • CWE-284: Improper Access Control, because there is no authorization boundary around the stored credentials.
  • CWE-522: Insufficiently Protected Credentials, as sensitive tokens are stored in a shared, long-lived, and easily accessible runtime location.

Abstractly, this reflects an insecure pattern where per-user secrets are stored in shared process state without isolation, lifecycle management, or access control.

Potential impact

  • Unauthorized access to GitHub Personal Access Tokens belonging to other users
  • Exposure of LLM API keys, enabling others to issue queries billed to the victim
  • Unauthorized access to private GitHub repositories, issues, and pull requests
  • Abuse of exposed tokens for data exfiltration, code tampering, or privilege escalation in connected services
  • Financial impact due to unapproved usage of metered APIs and services
  • Reputational damage if private code or data is leaked through compromised tokens

General mitigation guidance

Effective mitigation focuses on eliminating the use of shared process state for per-user secrets and enforcing strict isolation and minimization:

  • Per-session credential handling: Store user tokens in session-scoped structures provided by the web framework or in dedicated per-user storage with strong access controls, instead of os.environ or global variables.
  • Avoid environment variables for runtime user secrets: Reserve environment variables for static application configuration, not dynamic, user-supplied credentials.
  • Data minimization and short-lived usage: Use credentials only in-memory for the duration of a single request or action and discard them immediately afterward, avoiding long-lived retention.
  • Logical access controls: Ensure that any persisted tokens are associated with an authenticated principal and can only be retrieved by that same principal.
  • Secret redaction in logs and UI: Ensure that tokens are never echoed back in logs, debug UI components, or error messages.
  • Principle of least privilege: Encourage or enforce the use of scoped, minimal-privilege tokens so that any inadvertent exposure has reduced blast radius.
  • Session termination hygiene: On session end or logout, explicitly clear any session-bound references to credentials and invalidate temporary tokens when feasible.

How teams detect issues like this

Organizations can identify this class of issue by combining static inspection with runtime checks:

  • Static analysis patterns:
  • Flagging assignments of user-supplied values (from forms, request parameters, or Streamlit widgets) into os.environ or other global variables.
  • Identifying credential-like patterns (e.g., "token", "api_key") that are stored in global or module-level state.
  • Rules that detect use of environment variables as dynamic credential storage in web or multi-user contexts.
  • Code review signals:
  • Any use of environment variables for secrets that change at runtime or are tied to individual users.
  • Absence of clear per-session storage patterns when the app supports multiple concurrent users.
  • Lack of explicit lifecycle management for secrets (no cleanup or expiration).
  • Runtime and configuration checks:
  • Instrumentation or debug endpoints (restricted to operators) that enumerate sensitive environment variables and verify they only contain static config, not user data.
  • Security tests that simulate multiple users connecting in sequence and verify that later users cannot observe data from earlier sessions.
  • Automated tooling:
  • Secret scanning tools configured to alert on API keys or tokens appearing in environment dumps, debug logs, or diagnostic output.
  • CI policies that fail builds when environment variable writes originate from request-handling code paths.

Sources

SourceLink
github.comgithub.com/lilmingwa13/security-research/blob/main/CVE-2026-29872.md

Frequently asked

questions

The vulnerability is exploitable in any deployment where multiple users can access the same Streamlit instance. If an attacker can start a session after another user has entered their token, they may be able to harvest that token, even without authentication, depending on how the app exposes or reuses the stored values.

An attacker typically only needs network access to the Streamlit application. They do not need shell access or control over the host; instead, they exploit the shared process environment through the application's own behavior.

Stop using os.environ or other process-global state for storing user-specific credentials. Instead, handle tokens in per-session or per-request scope, or store them in a secure, access-controlled backend where retrieval is strictly tied to the authenticated user identity.

Design any multi-user or web-facing application under the assumption that process-wide state is shared among users. Apply principles of least privilege, strict session isolation, and data minimization for secrets, and incorporate security reviews or automated checks to flag any use of global state for user credentials during development.

Find out what's already
exploitable in your codebase.