CVE-2021-39194: Kaml Improper Handling Of Missing Values Vulnerability
MODERATECVE-2021-39194 is a MODERATE (CVSS 4.3) improper handling of missing values vulnerability (CWE-230: Improper Handling of Missing Values) affecting Kaml libraries in the Maven ecosystem. The issue involves improper handling of missing values in kaml. Remediation is available by upgrading affected packages to version 0.35.3.
CVE-2021-39194 at a Glance
Security Impact
CVSS: 4.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2021-39194
To remediate this vulnerability, upgrade all affected Kaml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>com.charleskorn.kaml</groupId>
<artifactId>kaml</artifactId>
<version>0.35.3</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=com.charleskorn.kaml
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-39194, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=com.charleskorn.kaml
Analyze the terminal output to locate any version of Kaml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.35.3), your application is affected.
Note: The mvn dependency:tree -Dincludes=com.charleskorn.kaml command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-230: Improper Handling of Missing Values, where the product does not handle or incorrectly handles when a parameter, field, or argument name is specified, but the associated value is missing, i.e. it is empty, blank, or null. In Kaml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-39194 Affected Kaml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
com.charleskorn.kaml:kaml
|
Maven |
< 0.35.3
|
0.35.3
|
References
Frequently Asked Questions
What is CVE-2021-39194?
Which Kaml versions are affected?
What version fixes CVE-2021-39194?
Is kaml affected?
What is the CVSS score of CVE-2021-39194?
What CWE is associated with CVE-2021-39194?
How can I check Maven dependencies for CVE-2021-39194?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-fmm9-3gv8-58f4",
"modified" : "2021-09-08T14:47:32Z",
"published" : "2021-09-07T23:08:40Z",
"aliases" : [ "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "com.charleskorn.kaml:kaml"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.35.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "< 0.35.2"
}
} ],
"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"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-230", "CWE-835" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-09-07T18:02:13Z",
"nvd_published_at" : "2021-09-07T20:15:00Z"
}
}