QID 981155
QID 981155: Java (maven) Security Update for com.charleskorn.kaml:kaml (GHSA-fmm9-3gv8-58f4)
Security update has been released for com.charleskorn.kaml:kaml to fix the vulnerability.
Note: The preceding description block is extracted directly from the security advisory. Using automation, we have attempted to clean and format it as much as possible without introducing additional issues.
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.
- GHSA-fmm9-3gv8-58f4 -
github.com/advisories/GHSA-fmm9-3gv8-58f4
CVEs related to QID 981155
| Advisory ID | Software | Component | Link |
|---|---|---|---|
| GHSA-fmm9-3gv8-58f4 | com.charleskorn.kaml:kaml |
|