Kestrel
대시보드로 돌아가기
CVE-2026-59862HIGH· 7.5MITRENVDGHSA대응게시일: 2026. 07. 16.수정일: 2026. 07. 24.

Microsoft Kiota: Code Generation Literal Injection in Kiota Python Generator

RCE

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
7.5high

이론적 심각도 점수

EPSS
1.0%상위 40.2%

30일 내 악용 확률 예측

KEV
미등재

실측 악용 기록 없음

권장 대응 기한14일 이내CISA SSVC 기준

2주 이내 패치 — 우선 조치 대상

자동화 가능외부 노출· KEV 미등재 · 자동화 가능 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

악용 경로
공격 벡터네트워크
공격 복잡도낮음
필요 권한불필요
사용자 상호작용불필요
범위불변
영향
기밀성 영향없음
무결성 영향없음
가용성 영향높음
버전별 점수
CVSS 3.17.5HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

상세 설명

Code Generation Literal Injection in Kiota Python Generator Leads to Arbitrary Code Execution at Import Time.

The Kiota Python code generator is vulnerable to a code generation literal injection issue when processing malicious or untrusted OpenAPI specifications. Specifically, attacker-controlled enum value descriptions from x-ms-enum.values[].description can flow into generated Python files without newline sanitization, allowing injected content to escape a comment context and execute at module scope when the generated module is imported.

This issue requires user interaction in the form of generating a client from a malicious specification and importing the generated code, which is a common development and CI workflow.

Impact

A malicious OpenAPI specification can cause arbitrary Python code to be emitted into generated model files. The payload executes when the affected module is imported.

Potential impact includes

Credential theft from developer or CI environments
Exfiltration of environment variables and secrets
Source code disclosure
Persistence via regenerated backdoored client output
Who is impacted
Developers generating Python SDKs from external or untrusted OpenAPI specs
Teams with CI/CD automation that regenerates clients from remote specification URLs
Any environment importing generated Python modules before manual review
Vulnerability details
Two gaps combine to enable exploitation:

Enum description cleanup gap

In KiotaBuilder.SetEnumOptions, enum option descriptions are assigned to Documentation.DescriptionTemplate without CleanupDescription on this path, allowing control characters such as newlines to propagate.

Python description sanitization gap

PythonConventionService.RemoveInvalidDescriptionCharacters escapes backslashes and triple quotes but did not remove carriage return/newline characters, unlike some other language convention services.

Exploit path

Malicious newline in x-ms-enum description is emitted through enum writing path.
Generated inline comment output is split by newline.
Subsequent attacker-controlled line lands at module scope in generated .py file.
Importing the module executes the injected code.

Attack vectors

OpenAPI specifications hosted at attacker-controlled URLs
Supply-chain scenarios where third-party specs are consumed automatically
CI pipelines that generate and then import or test generated Python clients

Patches

https://github.com/microsoft/kiota/pull/7735

Workarounds

If you cannot upgrade immediately:

Only generate from trusted, internally controlled OpenAPI specification sources.
Disable or gate automatic generation from remote specs in CI/CD.
Add validation/sanitization for x-ms-enum descriptions before generation.
Review generated Python files for suspicious top-level statements near enum/model declarations.
Run generation and validation in isolated environments without access to production secrets.

Remediation

Upgrade to Kiota 1.32.0 or later.

Regenerate existing Python clients to replace previously generated vulnerable output.

Recommended validation after upgrade

Regenerate from the same spec used in proof-of-concept testing
Confirm malicious multi-line enum descriptions no longer produce executable top-level output

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.