ghsa-fmm9-3gv8-58f4
Vulnerability from github
Impact
Attackers 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.
This only affects applications that use polymorphic serialization with the default tagged polymorphism style. Applications using the property polymorphism style are not affected.
YAML input for a polymorphic type that provided a tag but no value for the object would trigger the issue, for example:
yaml
!<x>
The following is a sample application that demonstrates this issue:
```kotlin import com.charleskorn.kaml.Yaml import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable
@Serializable private sealed class K { @Serializable @SerialName("x") data class X( val property: String? = null, ) : K() }
const val s = """
!
fun main() { println("Started.") val result = Yaml.default.decodeFromString(K.serializer(), s) println("Finished, result is $result") } ```
On vulnerable versions of kaml, the decodeFromString()
operation hangs and never returns.
Patches
Version 0.35.3 or later contain the fix for this issue.
{ "affected": [ { "database_specific": { "last_known_affected_version_range": "\u003c 0.35.2" }, "package": { "ecosystem": "Maven", "name": "com.charleskorn.kaml:kaml" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "0.35.3" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2021-39194" ], "database_specific": { "cwe_ids": [ "CWE-230", "CWE-835" ], "github_reviewed": true, "github_reviewed_at": "2021-09-07T18:02:13Z", "nvd_published_at": "2021-09-07T20:15:00Z", "severity": "MODERATE" }, "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!\u003cx\u003e\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!\u003cx\u003e\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.", "id": "GHSA-fmm9-3gv8-58f4", "modified": "2021-09-08T14:47:32Z", "published": "2021-09-07T23:08:40Z", "references": [ { "type": "WEB", "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/issues/179" }, { "type": "WEB", "url": "https://github.com/charleskorn/kaml/commit/e18785d043fc6324c81e968aae9764b4b060bc6a" }, { "type": "WEB", "url": "https://github.com/charleskorn/kaml" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L", "type": "CVSS_V3" } ], "summary": "Improper Handling of Missing Values in kaml" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.