Summary
Phoenix's applyChatTemplate GraphQL query formats attacker-controlled templates in a way that allows traversal through Python object internals. An attacker who can reach the query may read process environment variables, potentially exposing PHOENIX_SECRET and enabling administrative session-token forgery or decryption of protected credentials.
Affected context
The issue occurs in Phoenix's applyChatTemplate GraphQL query when attacker-controlled F-string templates are passed to the formatter and object attribute access permits traversal through private Python attributes. On default installations, the endpoint is unauthenticated; when authentication is enabled, any account can reach it.
Exploit preconditions
- Attack surface: The
applyChatTemplateGraphQL query - Required access: No authentication on default installations; any account when authentication is enabled
- Trigger point: Formatting an attacker-controlled template
- Why exploitation is possible: Template field resolution can traverse Python object internals and expose process environment variables or internal module state
Why this happens
The formatter processes attacker-controlled F-string templates while DotDict.__getattr__ does not block access to private attributes. This allows attribute traversal through Python object internals, mapping to CWE-134: Use of Externally-Controlled Format String. The resulting exposure of environment variables and internal state is also relevant to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Potential impact
- Process environment variables and internal module state could be disclosed
- Exposure of
PHOENIX_SECRETmay enable administrative session-token forgery - Credentials protected by keys derived from the secret may be decrypted
- Unauthorized access to sensitive application data or administrative functions may result
General mitigation guidance
Defensive patterns focus on treating templates as untrusted input and limiting what the formatter can access.
- Use a restricted template language or formatter that does not traverse arbitrary object attributes
- Block access to private attributes and other sensitive object internals
- Prefer explicit, allowlisted template variables over general-purpose object access
- Keep secrets out of process environments and limit their scope where practical
- Apply least-privilege controls to accounts that can reach template-formatting functionality
How teams detect issues like this
- Review template formatting code for attacker-controlled input and unrestricted attribute resolution
- Use static analysis rules to flag template engines or formatters that permit object introspection
- Review GraphQL authorization policies, including unauthenticated access and permissions granted to ordinary accounts
- Monitor for unusual access to template-formatting queries and unexpected reads or use of sensitive secrets
- Add policy checks that require allowlisted variables and restricted attribute access

