Improper Handling of Missing Values in kaml
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:
!<x>
The following is a sample application that demonstrates this issue:
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 = """
!<x>
"""
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 software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Java / Kotlin (Maven) | com.charleskorn.kaml:kaml | < 0.35.3 | 0.35.3 |
References
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L- Weakness (CWE)
CWE-230, CWE-835- Platform
- Java / Kotlin (Maven)
- Package
com.charleskorn.kaml:kaml- Disclosed
- 07.09.2021
- Updated
- 11.10.2026 12:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-fmm9-3gv8-58f4 - CC BY 4.0
Vulnerability history: com.charleskorn.kaml:kaml
All published vulnerabilities of this package (Java / Kotlin (Maven)), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 2
- First → latest
- 09.2021 03.2023
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- High 1
- Medium 1
Disclosures per year
- 2021: 1
- 2022: 0
- 2023: 1
- 2024: 0
- 2025: 0
- 2026: 0
-
Improper Handling of Missing Values in kaml this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.