{"id":"CVE-2021-39194","aliases":["GHSA-fmm9-3gv8-58f4"],"url":"https://o3.security/vulnerability/CVE-2021-39194","summary":"Improper Handling of Missing Values in kaml","details":"### Impact\nAttackers that could provide arbitrary YAML input to an application that uses kaml could cause the application to endlessly loop while parsing the input. This could result in resource starvation and denial of service. \n\nThis only affects applications that use polymorphic serialization with the default tagged polymorphism style. Applications using the property polymorphism style are not affected.\n\nYAML input for a polymorphic type that provided a tag but no value for the object would trigger the issue, for example:\n\n```yaml\n!<x>\n```\n\nThe following is a sample application that demonstrates this issue:\n\n```kotlin\nimport com.charleskorn.kaml.Yaml\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\nprivate sealed class K {\n    @Serializable\n    @SerialName(\"x\")\n    data class X(\n        val property: String? = null,\n    ) : K()\n}\n\nconst val s = \"\"\"\n!<x>\n\"\"\"\n\nfun main() {\n    println(\"Started.\")\n    val result = Yaml.default.decodeFromString(K.serializer(), s)\n    println(\"Finished, result is $result\")\n}\n```\n\nOn vulnerable versions of kaml, the `decodeFromString()` operation hangs and never returns. \n\n\n### Patches\nVersion 0.35.3 or later contain the fix for this issue.","published":"2021-09-07T20:15:08.193Z","modified":"2026-07-09T10:01:38.285930Z","cvss":{"score":6.5,"severity":"MEDIUM","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"},"epss":null,"cisaKev":null,"exploitsKnown":2,"affectedPackages":[{"ecosystem":"Maven","name":"com.charleskorn.kaml:kaml","fixedVersion":"0.35.3"}],"fix":{"url":"https://github.com/charleskorn/kaml/commit/e18785d043fc6324c81e968aae9764b4b060bc6a","label":"charleskorn/kaml@e18785d"},"references":[{"type":"FIX","url":"https://github.com/charleskorn/kaml/commit/e18785d043fc6324c81e968aae9764b4b060bc6a"},{"type":"FIX","url":"https://github.com/charleskorn/kaml/issues/179"},{"type":"EVIDENCE","url":"https://github.com/charleskorn/kaml/security/advisories/GHSA-fmm9-3gv8-58f4"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-39194"},{"type":"WEB","url":"https://github.com/charleskorn/kaml"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-07-09T10:01:38.285930Z"}}