com.charleskorn.kaml:kaml@0.28.2 vulnerabilities

Direct Vulnerabilities

Known vulnerabilities in the com.charleskorn.kaml:kaml package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • H
Denial of Service (DoS)

com.charleskorn.kaml:kaml is a YAML support for kotlinx.serialization.

Affected versions of this package are vulnerable to Denial of Service (DoS) when parsing input containing anchors and aliases. Attackers can trigger excessive memory consumption and a crash with a billion laughs attack.

How to fix Denial of Service (DoS)?

Upgrade com.charleskorn.kaml:kaml to version 0.53.0 or higher.

[,0.53.0)
  • M
Denial of Service (DoS)

com.charleskorn.kaml:kaml is a YAML support for kotlinx.serialization.

Affected versions of this package are vulnerable to Denial of Service (DoS). An attacker 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 exhaustion 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.

PoC

# 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")
}

How to fix Denial of Service (DoS)?

Upgrade com.charleskorn.kaml:kaml to version 0.35.3 or higher.

[,0.35.3)