Back

LOW

YAML injection via unescaped newlines in ymlr document comments

Published Jul 31, 2026

Description

Improper Neutralization of CRLF Sequences vulnerability in ufirstgroup ymlr (Elixir.Ymlr module) allows attackers to inject arbitrary content into generated YAML documents through document comments. Ymlr.document!/2 interpolates each caller-supplied comment string into the output behind a single # prefix without validating it or escaping line breaks. Because a YAML comment is terminated by a line break, the first carriage return or line feed in the comment string ends the comment context and everything after it is emitted at column 0 of the document body.

An attacker who controls text that the host application passes as a comment can forge top-level mapping keys, override values the application itself set, and emit --- or ... markers that split the output into additional documents. Downstream consumers of the generated YAML, such as configuration loaders, deployment manifests, CI pipelines and data importers, parse the injected content as legitimate data. The same clause backs Ymlr.document/2, Ymlr.documents!/2 and Ymlr.documents/2, so every document encoding entry point is affected.

This vulnerability is associated with program files lib/ymlr.ex and program routines 'Elixir.Ymlr':document!/2, 'Elixir.Ymlr':documents!/2.

This issue affects ymlr from 0.0.1 before 5.1.6.

Affected products

Remediation

Vendor solution

Split any untrusted comment string on line breaks and pass the resulting list as the comment element of the {comment, data} tuple. Ymlr prefixes every list element with its own # marker, so no line can leave the comment context. Alternatively, reject comment strings that contain carriage return or line feed characters, or keep untrusted text out of comments entirely and place it in the encoded data instead, where the encoder quotes it.

Weaknesses (1)

References (6)

Change history (0)

No recorded changes yet.

Sources
CVE.org / MITRE
Status PUBLISHED
Assigner EEF
Published Jul 31, 2026
Updated Aug 1, 2026
Reserved Jul 22, 2026
CISA Vulnrichment
Updated Jul 31, 2026
NVD
Status Awaiting Analysis
Modified Aug 4, 2026
Red Hat
Severity n/a
Public date n/a
ENISA EUVD
Assigner EEF
Published Jul 31, 2026
Updated Aug 1, 2026
Exploited since n/a
EUVD-2026-51537