[MAVEN:GHSA-FMM9-3GV8-58F4] Improper Handling of Missing Values in kaml

Severity Moderate
Affected Packages 1
Fixed Packages 1
CVEs 1

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 = """
!<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.

Package Affected Version
pkg:maven/com.charleskorn.kaml/kaml < 0.35.2
Package Fixed Version
pkg:maven/com.charleskorn.kaml/kaml = 0.35.3
ID
MAVEN:GHSA-FMM9-3GV8-58F4
Severity
moderate
URL
https://github.com/advisories/GHSA-fmm9-3gv8-58f4
Published
2021-09-07T23:08:40
(3 years ago)
Modified
2023-02-01T05:06:25
(19 months ago)
Rights
Maven Security Team
Type Package URL Namespace Name / Product Version Distribution / Platform Arch Patch / Fix
Affected pkg:maven/com.charleskorn.kaml/kaml com.charleskorn.kaml kaml < 0.35.2
Fixed pkg:maven/com.charleskorn.kaml/kaml com.charleskorn.kaml kaml = 0.35.3
# CVE Description CVSS EPSS EPSS Trend (30 days) Affected Products Weaknesses Security Advisories Exploits PoC Pubblication Date Modification Date
# CVE Description CVSS EPSS EPSS Trend (30 days) Affected Products Weaknesses Security Advisories PoC Pubblication Date Modification Date
Loading...