CVE-2026-53998 CRITICAL 10.0 난이도Difficulty 중급Intermediate
Phoenix applyChatTemplate: 포맷 문자열 탐색으로 서버 비밀 값 유출Phoenix applyChatTemplate: Format-String Traversal Leaks Server Secrets
CVE-2026-53998는 Arize Phoenix의 Use of Externally-Controlled Format String(CWE-134) 취약점으로, CVSS 10(CRITICAL)입니다. 영향 버전: 13.0.0 ≤ v < 15.7.0. 수정 버전: 15.7.0.CVE-2026-53998 is an Use of Externally-Controlled Format String (CWE-134) vulnerability in Arize Phoenix, rated CVSS 10 (CRITICAL). Affected: 13.0.0 ≤ v < 15.7.0. Fixed in: 15.7.0.
| 제품Product | Arize Phoenix |
|---|---|
| 영향 버전Affected | 13.0.0 ≤ v < 15.7.0 |
| 수정 버전Fixed in | 15.7.0 |
| 심각도Severity | CVSS 10 CRITICAL |
| 취약점 유형Weakness | CWE-134 Use of Externally-Controlled Format String |
| 공격 조건Attack conditions | 원격 (네트워크) · 인증 불필요 · 사용자 상호작용 불필요Remote (network) · No authentication · No user interaction |
1. TL;DR
Phoenix(Arize의 AI 관측·평가 플랫폼)에는 applyChatTemplate라는 GraphQL 쿼리가 있다. 호출자는 이 쿼리로 프롬프트 템플릿을 전달하고 “F_STRING” 템플릿 형식을 선택할 수 있다. 취약한 버전에서는 서버가 이 템플릿을 Python의 str.format()으로 렌더링했다. 이 함수는 {x.attr} 같은 속성 조회를 지원하므로, 템플릿이 무해한 변수에서 시작해 Python 내부로 이동하고 환경 변수 같은 프로세스 수준 상태에 도달할 수 있었다.
속성 접근을 제한하려는 작은 래퍼 클래스 DotDict가 있었지만, __class__ 같은 이름에는 한 번도 실행되지 않았다. 이런 이름은 모든 객체에 존재하고, __getattr__는 일반 조회가 실패할 때만 호출되기 때문이다.
기본 설치에서는 이 엔드포인트에 인증이 필요 없다. 인증을 켜면 어떤 계정으로든 호출할 수 있다. 권고문에 따르면 PHOENIX_SECRET이 유출되면 공격자는 관리자 세션 토큰을 위조하고 저장된 자격 증명을 복호화할 수 있다.
수정은 15.7.0에 포함되었다. str.format()을 _로 시작하는 속성 이름을 거부하는 포매터로 교체했다.
2. Flaw 분류
| 항목 | 값 |
|---|---|
| 주요 CWE | CWE-134 Use of Externally-Controlled Format String (NVD는 CWE-200, Exposure of Sensitive Information도 함께 기재) |
| 제품 / 구성 요소 | arize-phoenix, applyChatTemplate GraphQL 쿼리 및 FStringTemplateFormatter |
| 영향 받는 버전 | NVD 기준 13.0.0 이상 15.7.0 미만. GHSA는 >= 13.0.0, v15.7.0에서 패치됨으로 표기 |
| 공격 벡터 | 네트워크 (CVSS:3.1 AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:L, 점수 10.0) |
| 선행 조건 | Phoenix GraphQL API에 대한 네트워크 접근. 기본 설치에서는 자격 증명 불필요, 인증이 켜진 경우 유효한 계정 아무거나 필요 |
| 영향 | 환경 변수와 내부 모듈 상태 노출. PHOENIX_SECRET이 포함될 수 있으며, 권고문에 따르면 이는 관리자 세션 토큰 위조와 해당 키에서 파생된 자격 증명의 복호화를 가능하게 함 |
| 사용자 상호작용 | 없음 |
3. 근본 원인
세 가지 설계 결정이 겹쳐 이 flaw가 발생했다.
1. 사용자 텍스트가 포맷 문자열이 되었다. applyChatTemplate은 템플릿과 형식 옵션을 받는다. F_STRING이 선택되면 FStringTemplateFormatter._format()이 template.format(**wrapped_variables)를 호출했다. Python의 포맷 미니 언어는 단순 치환 이상의 기능을 한다. {name.attr}나 {name[key]} 같은 치환 필드는 전달된 객체에 대해 속성 조회와 인덱스 조회를 수행한다. 따라서 템플릿을 제어하는 사람은 작은 탐색 언어를 제어하게 된다.
2. 방어 장치가 잘못된 위치에 있었다. Phoenix는 {user.name}이 dict에서도 동작하도록 dict와 list 변수를 도우미 클래스(DotDict)로 감싼다. 권고문은 이 도우미의 __getattr__를 “ineffective attribute access control”(효과 없는 속성 접근 제어)이라고 설명한다. PR이 그 이유를 설명한다. __class__ 같은 이름은 모든 Python 객체의 실제 속성이다. Python은 일반 조회가 실패할 때만 __getattr__를 호출하므로, 이런 이름에 대해서는 방어 장치가 참조된 적이 없다.
3. Python 객체 그래프는 서로 연결되어 있다. 거의 모든 객체에서 “비공개” 속성을 따라가면 그 클래스에, 이어서 클래스의 초기화 함수에, 그 함수의 모듈 전역 변수에 이른다. 이 전역 변수가 os 같은 모듈을 참조할 수 있고, os는 프로세스 환경을 노출한다. 템플릿이 이 연결을 따라가면 포매터는 도달한 값을 그대로 출력한다. 이는 Phoenix만의 문제가 아니라 Python 포맷 문자열 탐색의 일반적 특성이다.
또한 기본 설치에서는 이 엔드포인트에 인증 요구 사항이 없었으므로, 서버에 접근할 수 있는 누구나 이 입력에 도달할 수 있었다.
4. 익스플로잇 흐름(개념)
아래 단계는 각 단계를 개념으로만 설명한다. 입력 문자열은 제시하지 않는다.
- 엔드포인트에 접근한다. 공격자가
applyChatTemplate에 GraphQL 요청을 보낸다. 기본 설치에서는 자격 증명이 필요 없다. 인증이 켜져 있으면 계정 아무거나 사용할 수 있다. - F-string 모드를 선택하고 변수를 제공한다. 요청은
F_STRING형식을 선택하고 단순한 변수 하나를 전달한다. 이 변수는 템플릿이 탐색을 시작할 객체를 제공하는 역할만 한다. - 변수에서 프로세스 상태까지 탐색한다. 템플릿 텍스트에는 밑줄로 시작하는 이름을 통해 속성 조회를 연쇄적으로 이어 가는 필드가 들어 있다. 변수의 타입에서 시작해 함수의 전역 변수로, 다시 환경을 보유한 모듈로 이동한다.
- 서버가 결과를 응답에 렌더링한다.
str.format()이 연쇄 조회를 해석하고, 도달한 객체의 문자열 표현을 반환 메시지 텍스트에 넣는다. - 유출된 비밀 값을 사용한다. 환경 내용에
PHOENIX_SECRET이 포함될 수 있다. 권고문은 이 키가 JWT에 서명하고 저장된 자격 증명의 암호화 키를 파생하는 데 쓰인다고 설명한다.
- GraphQL 요청 — applyChatTemplate, F_STRING
- 템플릿 필드가 객체 내부를 탐색
- 서버가 환경/모듈 상태를 응답에 렌더링
- 공격자가 PHOENIX_SECRET 확인
- 관리자 세션 위조 / 저장된 자격 증명 복호화
5. 트리거 조건
- 버전: Phoenix 13.0.0 이상 15.7.0 미만(NVD). 제보자는 14.8.0까지 테스트했다.
- 도달 가능성: 공격자가 Phoenix GraphQL 엔드포인트에 요청을 보낼 수 있어야 한다.
- 인증: 기본 설치에서는 엔드포인트가 인증되지 않는다. 인증을 켠 경우에는 역할과 관계없이 인증된 계정 아무거나 있으면 충분하다.
- 템플릿 모드: F-string 형식이 선택되어야 한다. PR은 Mustache 포매터가 같은 벡터의 영향을 받지 않는다고 밝힌다.
pystache는 dict 조회만 수행하고 내장 타입에 대한getattr을 거부한다고 설명한다. - 프로세스 내 비밀 값: 공격자가 얻는 정보는 서버 프로세스가 보유한 값에 따라 달라진다.
PHOENIX_SECRET과 다른 비밀 값이 환경에 있는 배포가 가장 많이 노출된다.
6. 패치 분석
수정 커밋: e7224a6, PR #13197(“prevent format-string injection in f-string template formatter”)에서 나왔다. 15.7.0 릴리스 노트에 포함되어 있다.
이 패치는 필드 이름 탐색을 직접 처리하는 string.Formatter 하위 클래스를 추가한다. _로 시작하는 속성 이름이 나오면 오류를 발생시킨다. 그리고 _format()이 str.format() 대신 이 포매터를 호출한다. 핵심 부분은 아래와 같다.
class _SafeFieldFormatter(Formatter):
def get_field(self, field_name: str, args: Any, kwargs: Any) -> Any:
...
for attr, index in _FIELD_NAME_PART_RE.findall(rest):
if attr:
if attr.startswith("_"):
raise TemplateFormatterError(
f"Access to attribute '{attr}' is not permitted in templates"
)
obj = getattr(obj, attr)
else:
obj = obj[int(index) if index.lstrip("-").isdigit() else index]
return obj, first
..
return template.format(**wrapped_variables)
return self._formatter.vformat(template, (), wrapped_variables)이 패치가 흐름을 끊는 이유. 3단계는 시작 변수에서 모듈 전역 변수까지 밑줄로 시작하는 속성을 따라가는 데 의존한다. 새 get_field는 그런 속성이 처음 나오는 지점에서 오류를 발생시킨다. 검사가 래퍼 클래스가 아니라 포매터에서 실행되므로, __getattr__가 호출되지 않는 객체를 포함해 템플릿이 건드리는 모든 객체에 적용된다. PR은 {user.name}, {items[0].value} 같은 일반적인 사용은 계속 동작한다고 밝힌다. 또한 인젝션 페이로드와 그 변형에 대한 회귀 테스트, 그리고 Mustache가 영향을 받지 않음을 확인하는 테스트를 추가했다.
수정의 범위(필자의 분석이며 벤더가 확인한 내용은 아님). 인용한 부분에서 방어는 속성 접근만 다룬다. 인덱스 접근은 이름으로 걸러지지 않는다. 도달 가능한 객체가 키 조회로 민감한 데이터를 노출하는 경우에만 문제가 되며, 이는 테스트하지 않았다. 이 수정은 제보자가 권고했던 리졸버에 대한 인증 추가는 하지 않은 것으로 보인다. 내가 읽은 자료에서는 다른 후속 변경을 찾지 못했다.
7. 탐지·완화
즉시 조치
arize-phoenix를 15.7.0 이상으로 업그레이드한다.- 바로 업그레이드할 수 없다면 Phoenix GraphQL API에 대한 네트워크 접근을 제한한다. 인증을 켜고 서비스를 신뢰할 수 없는 네트워크에 노출하지 않는다. 인증만으로는 flaw가 사라지지 않는다. 어떤 계정이든 여전히 엔드포인트에 접근할 수 있기 때문이다.
- 영향을 받는 인스턴스에 신뢰할 수 없는 상대가 접근할 수 있었다면, 환경 변수의 비밀 값이 노출되었을 수 있다고 간주한다.
PHOENIX_SECRET을 교체하고, 기존 세션을 무효화하고, LLM API 키와 OAuth 토큰 같은 저장된 자격 증명을 교체한다. 이는 일반적인 사고 대응 관행이며 권고문의 지시 사항은 아니다. - 프로세스 환경에 저장된 값을 점검한다. 환경에 두는 비밀 값을 줄이면 유사한 유출의 피해가 줄어든다.
탐지
- GraphQL 또는 리버스 프록시 로그에서 예상치 못한 출처나 계정의
applyChatTemplate요청을 찾는다. 로그인이 필요하도록 구성된 인스턴스에 대한 인증 없는 요청도 포함한다. - 이런 요청에서 치환 필드 안에 이중 밑줄(dunder) 이름이 포함된 템플릿 텍스트를 표시한다. 정상적인 템플릿에는 거의 필요하지 않다. 이는 휴리스틱이며 완전한 시그니처는 아니다.
- 노출이 의심되는 경우 이후 비정상적인 관리자 세션을 확인한다. 새 관리자 토큰, 낯선 주소에서의 로그인, 평소 패턴을 벗어난 자격 증명 사용 등이 그 예다.
- 일반적인 점검 습관으로, 사용자가 영향을 줄 수 있는 문자열이
str.format(),format_map(),string.Formatter에 전달되는 코드를 직접 검색한다.
격리된 실습(로컬 Docker 랩)
이 취약점은 인터넷에 연결되지 않은 로컬 Docker 랩에서만 재현한다. 취약한 Phoenix 버전(13.0.0 이상 15.7.0 미만)을 격리된 컨테이너 네트워크에서 실행한다. 비밀 값은 반드시 더미 값만 사용하고 실제 키는 쓰지 않는다. 이 랩에서 업그레이드 전후의 동작을 비교하고, PR의 회귀 테스트가 통과하는지 확인한다. 본인이 소유하지 않은 시스템에는 테스트하지 않는다. 이 초안은 공격 입력을 의도적으로 제공하지 않는다.
8. References
1. TL;DR
Phoenix (Arize’s AI observability and evaluation platform) has a GraphQL query called applyChatTemplate. It lets a caller supply a prompt template and choose the “F_STRING” template format. In the vulnerable versions, the server rendered that template with Python’s str.format(). That function supports attribute lookups such as {x.attr}, so a template could walk from a harmless variable into Python internals and reach process-level state such as environment variables.
A small wrapper class, DotDict, was meant to limit attribute access. It never ran for names like __class__, because those names exist on every object and __getattr__ is only called when normal lookup fails.
On default installs the endpoint needs no authentication. When auth is enabled, any account can call it. Per the advisory, leaking PHOENIX_SECRET lets an attacker forge admin session tokens and decrypt stored credentials.
The fix is in 15.7.0. It replaces str.format() with a formatter that rejects any attribute name starting with _.
2. Flaw classification
| Item | Value |
|---|---|
| Primary CWE | CWE-134 Use of Externally-Controlled Format String (NVD also lists CWE-200, Exposure of Sensitive Information) |
| Product / component | arize-phoenix, applyChatTemplate GraphQL query and FStringTemplateFormatter |
| Affected versions | 13.0.0 up to (not including) 15.7.0 per NVD; the GHSA says >= 13.0.0, patched in v15.7.0 |
| Attack vector | Network (CVSS:3.1 AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:L, score 10.0) |
| Prerequisites | Network access to the Phoenix GraphQL API. No credentials on default installs; any valid account when authentication is enabled |
| Impact | Disclosure of environment variables and internal module state. This can include PHOENIX_SECRET, which per the advisory enables admin session-token forgery and decryption of credentials derived from that key |
| User interaction | None |
3. Root cause
Three design decisions combined to cause the flaw.
1. User text became a format string. applyChatTemplate accepts a template and a format option. With F_STRING, FStringTemplateFormatter._format() called template.format(**wrapped_variables). Python’s format mini-language is more than substitution. A replacement field like {name.attr} or {name[key]} performs attribute and index lookups on the object passed in. Whoever controls the template therefore controls a small traversal language.
2. The guard sat in the wrong place. Phoenix wraps dict and list variables in a helper (DotDict) so that {user.name} works on dicts. The advisory describes the helper’s __getattr__ as “ineffective attribute access control”. The PR explains why: names like __class__ are real attributes of every Python object. Python only calls __getattr__ when normal lookup fails, so the guard was never consulted for those names.
3. Python object graphs are connected. From almost any object, “private” attributes lead to its class, then to the class’s initializer, then to that function’s module globals. Those globals can reference modules such as os, and os exposes the process environment. A template can follow this chain and the formatter prints whatever it reaches. This is a general property of format-string traversal in Python, not something specific to Phoenix.
The endpoint also had no authentication requirement on default installs, so the input was reachable by anyone who could reach the server.
4. Exploit flow (conceptual)
The steps below describe each stage as a concept. No input strings are given.
- Reach the endpoint. The attacker sends a GraphQL request to
applyChatTemplate. On a default install no credentials are needed. If auth is enabled, any account works. - Choose the F-string mode and supply a variable. The request selects the
F_STRINGformat and passes one simple variable. That variable only gives the template an object to start traversing from. - Traverse from the variable to process state. The template text contains a field that chains attribute lookups through underscore-prefixed names. It walks from the variable’s type up to a function’s globals and on to the module that holds the environment.
- Server renders the result into the response.
str.format()resolves the chain and puts the string form of the reached object into the returned message text. - Use the leaked secrets. The environment contents can include
PHOENIX_SECRET. The advisory states this key signs JWTs and derives the encryption key for stored credentials.
- GraphQL request — applyChatTemplate, F_STRING
- template field traverses object internals
- server renders env/module state into response
- attacker reads PHOENIX_SECRET
- forge admin session / decrypt stored credentials
5. Trigger conditions
- Version: Phoenix 13.0.0 or later and earlier than 15.7.0 (NVD). The reporter tested up to 14.8.0.
- Reachability: The attacker can send requests to the Phoenix GraphQL endpoint.
- Authentication: On default installs the endpoint is unauthenticated. With authentication enabled, any authenticated account is enough, regardless of role.
- Template mode: The F-string format is selected. The PR notes that the Mustache formatter is not affected by the same vector. It says
pystacheonly does dict lookups and refusesgetattron builtin types. - Secrets in the process: What an attacker gains depends on what the server process holds. A deployment with
PHOENIX_SECRETand other secrets in its environment exposes the most.
6. Patch analysis
Fix commit: e7224a6, from PR #13197 (“prevent format-string injection in f-string template formatter”). It is listed in the 15.7.0 release notes.
The patch adds a string.Formatter subclass that resolves the field-name traversal itself. It raises an error for any attribute name starting with _. _format() then calls this formatter instead of str.format(). The key parts are below.
class _SafeFieldFormatter(Formatter):
def get_field(self, field_name: str, args: Any, kwargs: Any) -> Any:
...
for attr, index in _FIELD_NAME_PART_RE.findall(rest):
if attr:
if attr.startswith("_"):
raise TemplateFormatterError(
f"Access to attribute '{attr}' is not permitted in templates"
)
obj = getattr(obj, attr)
else:
obj = obj[int(index) if index.lstrip("-").isdigit() else index]
return obj, first
..
return template.format(**wrapped_variables)
return self._formatter.vformat(template, (), wrapped_variables)Why this breaks the flow. Step 3 depends on following underscore-prefixed attributes from the starting variable to the module globals. The new get_field raises an error at the first such attribute. Because the check runs in the formatter and not in a wrapper class, it applies to every object the template touches, including ones where __getattr__ is never called. The PR says normal usage such as {user.name} and {items[0].value} still works. It also adds regression tests for the injection payload and its variants, and tests confirming Mustache is unaffected.
Scope of the fix (my analysis, not vendor-confirmed). In the quoted part, the guard covers attribute access only. Index access is not filtered by name. It only matters if a reachable object exposes sensitive data through key lookup, and I did not test this. The fix does not appear to add authentication to the resolver, which the reporter had recommended. I did not find other follow-up changes in the sources I read.
7. Detection & mitigation
Immediate actions
- Upgrade
arize-phoenixto 15.7.0 or later. - If you cannot upgrade right away, restrict network access to the Phoenix GraphQL API. Enable authentication, and do not expose the service to untrusted networks. Authentication alone does not remove the flaw, because any account can still reach the endpoint.
- If an affected instance was reachable by untrusted parties, treat its environment secrets as possibly exposed. Rotate
PHOENIX_SECRET, invalidate existing sessions, and rotate stored credentials such as LLM API keys and OAuth tokens. This is general incident-response practice, not an instruction taken from the advisory. - Review what is stored in the process environment. Keeping fewer secrets there reduces the damage from any similar leak.
Detection
- Look in GraphQL or reverse-proxy logs for
applyChatTemplaterequests from unexpected sources or accounts. Include unauthenticated requests on instances that were meant to require login. - Flag template text in those requests that contains double-underscore (dunder) names inside replacement fields. Legitimate templates rarely need them. This is a heuristic and not a complete signature.
- Look for unusual admin sessions after any suspected exposure. Examples are new admin tokens, logins from unfamiliar addresses, or credentials used outside their normal pattern.
- As a general review habit, search your own code for user-influenced strings passed to
str.format(),format_map()orstring.Formatter.
Isolated practice (local Docker lab)
Reproduce this only in a local Docker lab with no internet access. Run a vulnerable Phoenix version (13.0.0 up to but not including 15.7.0) in an isolated container network. Use dummy secrets only, never real keys. Use the lab to compare behavior before and after the upgrade, and to check that the regression tests in the PR pass. Do not test against any system you do not own. This draft intentionally provides no attack input.