Denial of Service Vulnerability in yaml-cpp

yaml-cpp Updated 02 Oct 2025

Summary

28/12/2018
N/A
Yes i
Medium
6.5

CVE-2018-20574: The SingleDocParser::HandleFlowMap function in yaml-cpp (aka LibYaml-C++) 0.6.2 allows remote attackers to cause a denial of service (stack consumption and application crash) via a crafted YAML file. Affects yaml-cpp across 2 version ranges.

< 0.6.3-1 < 562aefc114938e388457e6a531ed7b54d9dc1b62

Fixed in 0.6.3-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

yaml-cpp is an open-source library for parsing and emitting YAML files. It is commonly used in various applications to handle YAML data. The library allows developers to read and write YAML files, making it easier to work with structured data. However, a vulnerability has been discovered in yaml-cpp version 0.6.2, which can lead to a denial of service attack.

Vulnerability Detail

The vulnerability, identified as CVE-2018-20574, exists in the SingleDocParser::HandleFlowMap function of yaml-cpp. An attacker can exploit this vulnerability by providing a specially crafted YAML file. When the vulnerable function attempts to parse the malicious YAML file, it consumes excessive stack memory, leading to a stack overflow and subsequent application crash. This vulnerability can be exploited remotely, potentially causing disruption to affected systems.

How To Fix

Minimum fixed version

0.6.3-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade yaml-cpp

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a workaround, developers can implement input validation to detect and reject malicious YAML files. By validating the structure and content of YAML files before parsing them with yaml-cpp, developers can prevent the vulnerable function from being exploited. Here is an example of how input validation can be implemented in C++ using yaml-cpp:

#include <yaml-cpp/yaml.h>

bool validateYaml(const std::string& yamlData) {
    try {
        YAML::Node node = YAML::Load(yamlData);
        // Perform additional validation checks
        // ...
        return true;
    } catch (const YAML::Exception& e) {
        // Handle validation failure
        // ...
        return false;
    }
}

Conclusion

In conclusion, the yaml-cpp library is vulnerable to a denial of service attack due to a stack consumption issue in the SingleDocParser::HandleFlowMap function. To mitigate this vulnerability, it is crucial to update yaml-cpp to version 0.6.3-1 or later. Additionally, implementing input validation can provide an extra layer of protection against malicious YAML files. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for yaml-cpp →

Share this vulnerability

FAQ

yaml-cpp is an open-source library for parsing and emitting YAML files. It provides a convenient way for developers to work with structured data in YAML format.

The vulnerability allows remote attackers to cause a denial of service by crashing the application using a specially crafted YAML file. This can lead to disruption of affected systems.

To fix this vulnerability, update yaml-cpp to version 0.6.3-1 or later. Ensure that you are using the latest version of the library in your applications.

Yes, you can implement input validation to detect and reject malicious YAML files. By validating the structure and content of YAML files before parsing them with yaml-cpp, you can mitigate the risk of this vulnerability.

You can find more information about this vulnerability in the official CVE-2018-20574 advisory or by visiting the Vulert Playground at Vulert Scanner.

Related vulnerabilities

Recent vulnerabilities recorded for yaml-cpp.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

0.6.3-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade yaml-cpp

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback