/

CVE-2019-25777

Severity:

HIGH RISK

(7.3)

Unsafe YAML Deserialization (CWE-502) in Perl YAML Module

CVE-2019-25777

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502, CWE-914

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A vulnerability in older Perl YAML releases allows specially crafted YAML documents to replace package variables and alter deserialization behavior. If an attacker can supply YAML to multiple Load() calls in the same process, this may enable arbitrary Perl code execution.

A vulnerability in older Perl YAML releases allows specially crafted YAML documents to replace package variables and alter deserialization behavior. If an attacker can supply YAML to multiple Load() calls in the same process, this may enable arbitrary Perl code execution.

Affected context

The issue occurs in Perl applications that use affected YAML releases and process attacker-influenced YAML documents. Risk increases when multiple documents are loaded within the same process, because an earlier document may change package variables that control whether later documents are evaluated as code.

The issue occurs in Perl applications that use affected YAML releases and process attacker-influenced YAML documents. Risk increases when multiple documents are loaded within the same process, because an earlier document may change package variables that control whether later documents are evaluated as code.

Exploit preconditions

  • Attack surface: Application or service paths that deserialize YAML input
  • Required access: Ability to provide or influence YAML documents accepted by the application
  • Trigger point: YAML processing through Load() calls
  • Process condition: Multiple deserialization operations occur in a shared Perl process
  • Why exploitation is possible: A permitted document can modify package variables controlling code loading, causing later code-bearing content to be evaluated
  • Attack surface: Application or service paths that deserialize YAML input
  • Required access: Ability to provide or influence YAML documents accepted by the application
  • Trigger point: YAML processing through Load() calls
  • Process condition: Multiple deserialization operations occur in a shared Perl process
  • Why exploitation is possible: A permitted document can modify package variables controlling code loading, causing later code-bearing content to be evaluated

Why this happens

The vulnerability combines unsafe deserialization with insufficient restrictions on package-variable assignment. Perl/glob YAML documents can name arbitrary package symbols, including variables that control YAML code loading; subsequent perl/code documents may then be passed to string evaluation. This maps primarily to CWE-502: Deserialization of Untrusted Data, with CWE-914: Improper Control of Dynamically-Managed Code Resources also describing the unsafe modification of code-execution controls.

The vulnerability combines unsafe deserialization with insufficient restrictions on package-variable assignment. Perl/glob YAML documents can name arbitrary package symbols, including variables that control YAML code loading; subsequent perl/code documents may then be passed to string evaluation. This maps primarily to CWE-502: Deserialization of Untrusted Data, with CWE-914: Improper Control of Dynamically-Managed Code Resources also describing the unsafe modification of code-execution controls.

Potential impact

  • An attacker may execute arbitrary Perl code in the application process
  • Application credentials, secrets, or accessible data could be exposed
  • The process could be modified or disrupted
  • Attackers could use the compromised process to affect connected services
  • Integrity of application state or generated output could be impacted
  • An attacker may execute arbitrary Perl code in the application process
  • Application credentials, secrets, or accessible data could be exposed
  • The process could be modified or disrupted
  • Attackers could use the compromised process to affect connected services
  • Integrity of application state or generated output could be impacted

General mitigation guidance

Mitigation generally focuses on treating YAML as data rather than executable content and reducing trust in deserialized input.

Common defensive patterns include:

  • Use safe, restricted YAML parsing modes that do not construct arbitrary objects or evaluate code
  • Disable code loading and prevent input from changing parser or loader options
  • Apply an allowlisted schema for accepted YAML structures and scalar types
  • Avoid processing attacker-controlled documents in a shared process where parser state can persist
  • Isolate parsing workloads and run them with least-privilege permissions
  • Reduce exposure of secrets and sensitive resources to the parsing process

Mitigation generally focuses on treating YAML as data rather than executable content and reducing trust in deserialized input.

Common defensive patterns include:

  • Use safe, restricted YAML parsing modes that do not construct arbitrary objects or evaluate code
  • Disable code loading and prevent input from changing parser or loader options
  • Apply an allowlisted schema for accepted YAML structures and scalar types
  • Avoid processing attacker-controlled documents in a shared process where parser state can persist
  • Isolate parsing workloads and run them with least-privilege permissions
  • Reduce exposure of secrets and sensitive resources to the parsing process

How teams detect issues like this

Organizations can look for this weakness through:

  • Static analysis rules identifying unsafe YAML loaders, code-evaluation paths, and unrestricted glob or package-variable handling
  • Code review signals such as deserialization of external input followed by string evaluation or mutable global parser settings
  • Tests that verify code-loading controls cannot be changed by input documents
  • Dependency and policy checks covering YAML parser configuration and safe-deserialization requirements
  • Runtime monitoring for unexpected Perl process behavior, child-process creation, or access to sensitive resources after YAML processing

Automated security review tools may help identify unsafe parser usage, but findings should be validated against the application's input and process boundaries.

Organizations can look for this weakness through:

  • Static analysis rules identifying unsafe YAML loaders, code-evaluation paths, and unrestricted glob or package-variable handling
  • Code review signals such as deserialization of external input followed by string evaluation or mutable global parser settings
  • Tests that verify code-loading controls cannot be changed by input documents
  • Dependency and policy checks covering YAML parser configuration and safe-deserialization requirements
  • Runtime monitoring for unexpected Perl process behavior, child-process creation, or access to sensitive resources after YAML processing

Automated security review tools may help identify unsafe parser usage, but findings should be validated against the application's input and process boundaries.

Sources

SourceLink
github.comgithub.com/ingydotnet/yaml-pm/commit/bace96b5e6661d521c7c515c94a09e081c911fce.patch
github.comgithub.com/ingydotnet/yaml-pm/issues/212
metacpan.orgmetacpan.org/release/TINITA/YAML-1.28/changes
openwall.comopenwall.com/lists/oss-security/2026/10/05/7

Frequently asked

questions

It can be remotely exploitable when a network-facing application accepts attacker-controlled YAML and performs the affected deserialization sequence. Otherwise, exploitation may require local or upstream access to the documents.

The attacker must be able to influence YAML documents processed by the application, and the relevant process behavior must allow later deserialization operations to inherit changed loader settings.

Use a safe YAML parser configuration that treats input strictly as data, blocks code loading, and validates documents against an allowlisted schema before use.

Keep parser controls immutable from input, avoid evaluating deserialized content, isolate parsing processes, and enforce secure-deserialization rules through code review, testing, and automated policy checks.

It can be remotely exploitable when a network-facing application accepts attacker-controlled YAML and performs the affected deserialization sequence. Otherwise, exploitation may require local or upstream access to the documents.

The attacker must be able to influence YAML documents processed by the application, and the relevant process behavior must allow later deserialization operations to inherit changed loader settings.

Use a safe YAML parser configuration that treats input strictly as data, blocks code loading, and validates documents against an allowlisted schema before use.

Keep parser controls immutable from input, avoid evaluating deserialized content, isolate parsing processes, and enforce secure-deserialization rules through code review, testing, and automated policy checks.

Find out what's already
exploitable in your codebase.