{"id":"GHSA-4vv7-jj25-4gh6","revision":null,"records":[{"revision":"6f4a319dbf264bdda704b8ce339ce126","observedAt":"2026-10-23T15:48:27.903+00:00","statement":{"source":"cve-program","id":"CVE-2026-59866","aliases":[],"title":"Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName","description":"Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 1.32.5, Kiota emitted x-ms-kiota-info clientClassName and clientNamespaceName values without identifier or path sanitization as both generated client class or namespace names and generated output path components when `kiota generate` ran without -c/--class-name, allowing an attacker-controlled or compromised OpenAPI description to write generated source outside the -o output directory and inject arbitrary text into generated class or namespace declarations. This issue is fixed in version 1.29.1 and 1.32.5 by GenerationConfiguration.SanitizeClientClassName and SanitizeClientNamespaceName.","state":0,"publishedAt":"2026-07-16T14:46:50.738+00:00","modifiedAt":"2026-08-17T15:03:20.823+00:00","affected":[{"ecosystem":"Vendor product","name":"kiota","ranges":[],"versions":[],"rawVersionEvidence":"{\n                    \"vendor\": \"microsoft\",\n                    \"product\": \"kiota\",\n                    \"versions\": [\n                        {\n                            \"version\": \">= 1.30.0, < 1.31.1\",\n                            \"status\": \"affected\"\n                        },\n                        {\n                            \"version\": \"< 1.29.1\",\n                            \"status\": \"affected\"\n                        }\n                    ]\n                }"}],"metrics":[{"system":"CVSS 4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.3,"severity":"CRITICAL"}],"references":["https://github.com/microsoft/kiota/security/advisories/GHSA-4vv7-jj25-4gh6","https://github.com/microsoft/kiota/pull/7884","https://github.com/microsoft/kiota/commit/dc812dbbf88ef7edf53a890d36b2f9d1460e947d","https://github.com/microsoft/kiota/releases/tag/v1.32.5"],"sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-59866","license":"CVE Program Terms of Use","key":"cve-program:CVE-2026-59866","identifiers":["CVE-2026-59866"]},"retained":false,"historicalAffected":[]},{"revision":"266f1140be2e4d16a906e0ce04390657","observedAt":"2026-10-25T14:19:22.811+00:00","statement":{"source":"nvd","id":"CVE-2026-59866","aliases":[],"title":"Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 1.32.5, Kiota emitted x-ms-kiota-info clientClassName and clientNamespaceName values without identifier or path sanitization as both generated client class or namespa…","description":"Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 1.32.5, Kiota emitted x-ms-kiota-info clientClassName and clientNamespaceName values without identifier or path sanitization as both generated client class or namespace names and generated output path components when `kiota generate` ran without -c/--class-name, allowing an attacker-controlled or compromised OpenAPI description to write generated source outside the -o output directory and inject arbitrary text into generated class or namespace declarations. This issue is fixed in version 1.29.1 and 1.32.5 by GenerationConfiguration.SanitizeClientClassName and SanitizeClientNamespaceName.","state":0,"publishedAt":"2026-07-16T16:19:15.493+00:00","modifiedAt":"2026-10-24T20:10:00.137+00:00","affected":[],"metrics":[{"system":"CVSS 4.0 · security-advisories@github.com · Secondary","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","score":9.3,"severity":"CRITICAL"}],"references":["https://github.com/microsoft/kiota/commit/dc812dbbf88ef7edf53a890d36b2f9d1460e947d","https://github.com/microsoft/kiota/pull/7884","https://github.com/microsoft/kiota/releases/tag/v1.32.5","https://github.com/microsoft/kiota/security/advisories/GHSA-4vv7-jj25-4gh6"],"sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2026-59866","license":"NIST NVD usage terms; underlying source attribution retained","enrichment":{"sourceStatus":"Deferred","weaknesses":["CWE-22","CWE-94"],"productCriteria":[],"sourceDates":{"published":"2026-07-16T16:19:15.493","lastModified":"2026-10-24T20:10:00.137"},"relatedAdvisories":[],"note":"NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON."},"key":"nvd:CVE-2026-59866","identifiers":["CVE-2026-59866"]},"retained":false,"historicalAffected":[]},{"revision":"54d97980658a4dddaec9b3be04a7934b","observedAt":"2026-10-23T16:01:25.029+00:00","statement":{"source":"osv","id":"GHSA-4vv7-jj25-4gh6","aliases":["CVE-2026-59866"],"title":"Microsoft Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName","description":"### Summary\n\nMicrosoft Kiota emitted the `x-ms-kiota-info` extension's `clientClassName` or `clientNamespaceName` value\n**raw**, with no identifier or path sanitization, as **both** the generated client's class/namespace name\n**and** part of the generated output path. When `kiota generate` is run **without `-c/--class-name`** — the\nzero-config workflow that `x-ms-kiota-info` is explicitly designed for (the API provider supplies the names in\nthe description so consumers don't have to) — an attacker who controls or tampers with the OpenAPI description\ncould therefore:\n\n- **(CWE-22) write the generated source file to a path outside the `-o` output directory** — e.g.\n  `clientClassName: \"/var/www/html/shell\"`; and\n- **(CWE-94) inject arbitrary text into the generated class/namespace declaration**, corrupting the generated\n  client.\n\nConfirmed on Kiota **1.32.4** (the self-contained `linux-x64` release binary), i.e. **after** the earlier\nwriter-sink hardening — that fix escaped property/enum/default/serialization sinks but never sanitized the\nprovider-supplied `clientClassName` / `clientNamespaceName`.\n\n### Details\n\n`clientClassName` reached two unsanitized sinks (observed in the generated C#; the same raw emission occurred\nfor Java, Go, TypeScript, Python, and PHP):\n\n```\n# output FILENAME (CWE-22): clientClassName flows into the file path\nclientClassName: \"/abs/path/PWNED\"   ->   /abs/path/PWNED.cs   (written outside -o)\n\n# class declaration (CWE-94): clientClassName flows verbatim into the type declaration\nclientClassName: 'Pwn { } public class INJECTED { } public partial class RealClient'\n   ->  public partial class Pwn { } public class INJECTED { } public partial class RealClient : ... { }\n```\n\n`clientNamespaceName` reached the analogous namespace/path sinks.\n\n### Impact\n\nA developer or CI host generating a client from an attacker-controlled or compromised OpenAPI description\n(without `-c`) could create/overwrite a generated source file at an attacker-influenced path and emit\nattacker-controlled text into the generated client.\n\nThis does **not** reach clean remote code execution: because `clientClassName` is reused verbatim at multiple\nsites (the class name **and** the constructor name), injected code cannot be made to compile — it breaks the\nbuild. So the code-injection vector is a generation/build-corruption (integrity/DoS), and the high-severity\nprimitive is the file write. CWE-22 / CWE-94.\n\n### Patches\n\nFixed in **1.29.1 and 1.32.5** (https://github.com/microsoft/kiota/pull/7884). `clientClassName` and\n`clientNamespaceName` sourced from `x-ms-kiota-info` are now sanitized before use:\n`GenerationConfiguration.SanitizeClientClassName` strips any character outside `[A-Za-z0-9_]` and any invalid\nleading character (falling back to `ApiClient`), and `SanitizeClientNamespaceName` restricts to\n`[A-Za-z0-9._-]`, collapses consecutive dots, strips invalid leading characters (falling back to `ApiSdk`).\nThis removes path separators, drive/colon, `..`, quotes, and braces, so the values can no longer influence\nthe output path or inject into the declaration.\n\n### Remediation\n\nUpgrade to Kiota **1.29.1, 1.32.5,** or later and regenerate affected clients.","state":0,"publishedAt":"2026-07-24T16:12:14+00:00","modifiedAt":"2026-08-17T15:00:08.105647+00:00","affected":[{"ecosystem":"NuGet","name":"Microsoft.OpenApi.Kiota","ranges":[{"type":"ECOSYSTEM","events":[{"kind":"introduced","version":"1.30.0"},{"kind":"fixed","version":"1.32.5"}]}],"versions":["1.30.0","1.31.0","1.31.1","1.32.0","1.32.1","1.32.2","1.32.3","1.32.4"],"rawVersionEvidence":null},{"ecosystem":"NuGet","name":"Microsoft.OpenApi.Kiota.Builder","ranges":[{"type":"ECOSYSTEM","events":[{"kind":"introduced","version":"1.30.0"},{"kind":"fixed","version":"1.32.5"}]}],"versions":[],"rawVersionEvidence":null},{"ecosystem":"NuGet","name":"Microsoft.OpenApi.Kiota","ranges":[{"type":"ECOSYSTEM","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"1.29.1"}]}],"versions":["0.1.0-preview","0.1.1-preview","0.1.2-preview","0.1.3-preview","0.10.0-preview","0.11.0-preview","0.11.1-preview","0.2.0-preview","0.2.1-preview","0.3.0-preview","0.4.0-preview","0.5.0-preview","0.5.1-preview","0.6.0-preview","0.7.1-preview","0.8.3-preview","0.9.0-preview","1.0.0","1.0.1","1.1.0","1.1.1","1.1.2","1.1.3","1.10.0","1.10.1","1.11.0","1.11.1","1.12.0","1.13.0","1.14.0","1.15.0","1.16.0","1.17.0","1.18.0","1.19.0","1.19.1","1.2.0","1.2.1","1.20.0","1.21.0","1.22.0","1.22.1","1.22.2","1.22.3","1.23.0","1.24.0","1.24.1","1.24.2","1.24.3","1.25.1","1.26.0","1.26.1","1.27.0","1.28.0","1.29.0","1.3.0","1.4.0","1.5.0","1.5.1","1.6.1","1.7.0","1.8.0","1.8.1","1.8.2","1.9.0","1.9.1"],"rawVersionEvidence":null},{"ecosystem":"NuGet","name":"Microsoft.OpenApi.Kiota.Builder","ranges":[{"type":"ECOSYSTEM","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"1.29.1"}]}],"versions":["0.2.0-preview","0.3.0-preview","0.4.0-preview","0.5.0-preview","0.5.1-preview","0.6.0-preview","0.7.1-preview","1.0.0","1.0.1","1.1.0","1.1.1","1.1.2","1.1.3","1.10.0","1.10.1","1.11.0","1.11.1","1.12.0","1.13.0","1.14.0","1.15.0","1.16.0","1.17.0","1.18.0","1.19.0","1.19.1","1.2.0","1.2.1","1.20.0","1.21.0","1.22.0","1.22.1","1.22.2","1.22.3","1.23.0","1.3.0","1.4.0","1.5.0","1.5.1","1.6.1","1.7.0","1.8.0","1.8.1","1.8.2","1.9.0","1.9.1"],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V4","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/microsoft/kiota/security/advisories/GHSA-4vv7-jj25-4gh6","https://nvd.nist.gov/vuln/detail/CVE-2026-59866","https://github.com/microsoft/kiota/pull/7884","https://github.com/microsoft/kiota/commit/dc812dbbf88ef7edf53a890d36b2f9d1460e947d","https://github.com/microsoft/kiota","https://github.com/microsoft/kiota/releases/tag/v1.32.5"],"sourceUrl":"https://github.com/advisories/GHSA-4vv7-jj25-4gh6","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-4vv7-jj25-4gh6","identifiers":["GHSA-4vv7-jj25-4gh6","CVE-2026-59866"]},"retained":false,"historicalAffected":[]}],"coverage":[{"source":"cisa-kev:global","scope":"Complete CISA KEV catalog; all vendors. Missing entries do not establish absence of exploitation.","generation":"2026-10-27T15:15:10.0599163+00:00","complete":true,"records":1758,"lastAttemptAt":"2026-10-27T15:15:10.0599163+00:00","lastSuccessAt":"2026-10-27T15:15:10.2728795+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:15:10.2728805+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"cve-program","scope":"Official CVE Program baseline and cumulative hourly delta; all vendors, published and rejected records","generation":"cve-187d2b72c94ceb8c4417f1032ec3109a3a3a7b730abadb561d8cdd2a96e04d27-8bb6fff76518d08eacd06e13d128f24b210ef27991cb0ab2236490d4dd3b5fe6","complete":true,"records":415032,"lastAttemptAt":"2026-10-27T15:09:38.1394183+00:00","lastSuccessAt":"2026-10-27T15:09:38.0414822+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:09:38.1394183+00:00","snapshotPublishedAt":"2026-10-27T14:31:01+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"euvd","scope":"Rolling EUVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global EUVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-43321610382942b8ad8c85917eab1546","complete":false,"records":4735,"lastAttemptAt":"2026-10-27T15:15:49.7535245+00:00","lastSuccessAt":"2026-10-24T23:18:49.862+00:00","error":"InvalidDataException","lastVerifiedAt":"2026-10-24T23:18:49.862+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":0,"expectedIdentifiers":13486},{"source":"first-epss:nuget","scope":"FIRST EPSS for explicit CVE aliases in the collected public NuGet archive. Not a global EPSS backfill.","generation":"2026-10-27T15:15:10.0599163+00:00","complete":true,"records":1093,"lastAttemptAt":"2026-10-27T15:15:10.0599163+00:00","lastSuccessAt":"2026-10-27T15:15:10.2765312+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:15:10.2765323+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"nvd","scope":"Rolling NVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global NVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-88a38441ad1248599975b90993827b01","complete":false,"records":13423,"lastAttemptAt":"2026-10-27T15:15:45.1432116+00:00","lastSuccessAt":"2026-10-27T15:15:45.139+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:15:45.139+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13480,"expectedIdentifiers":13486},{"source":"osv:Go","scope":"Complete OSV Go ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"go-9aac152375d0a5e113d83b548d5b8eef3e502e5699b45f50871eab64fdebfbb1","complete":true,"records":9782,"lastAttemptAt":"2026-10-27T15:15:09.8979368+00:00","lastSuccessAt":"2026-10-27T15:15:09.6352152+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:15:09.8979368+00:00","snapshotPublishedAt":"2026-10-27T15:03:35+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:NuGet","scope":"Complete OSV NuGet ecosystem archive, including GitHub Advisory Database records; NuGet version matching only","generation":"nuget-bad5d31e7f6a5e3d338e11d8789069b63620a403f927730769688b42f768e4f6","complete":true,"records":1965,"lastAttemptAt":"2026-10-27T15:09:38.2835342+00:00","lastSuccessAt":"2026-10-26T16:35:43.1460623+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:09:38.2835342+00:00","snapshotPublishedAt":"2026-10-26T16:18:29+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:crates.io","scope":"Complete OSV crates.io ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"crates.io-112103ad2640f03b274c0e731c3f4398f99b844297f2e68d520aeec5561d6df2","complete":true,"records":2997,"lastAttemptAt":"2026-10-27T15:15:10.0075658+00:00","lastSuccessAt":"2026-10-27T11:11:56.4872351+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:15:10.0075658+00:00","snapshotPublishedAt":"2026-10-27T10:33:05+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:npm","scope":"Complete OSV npm ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"npm-7e26fba71e5cf7d18798513b59ea2bb3b5abe64df0a968b5e2c3f16d11533f05","complete":true,"records":230819,"lastAttemptAt":"2026-10-27T15:14:41.8729153+00:00","lastSuccessAt":"2026-10-27T15:14:39.610946+00:00","error":null,"lastVerifiedAt":"2026-10-27T15:14:41.8729153+00:00","snapshotPublishedAt":"2026-10-27T15:03:39+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null}]}