GHSA-8j8c-7jfh-h6hx Code Injection in js-yaml

Not scored Published

Attackers can execute arbitrary code via malicious YAML files processed by the vulnerable load function in the js-yaml library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is GHSA-8j8c-7jfh-h6hx?

GHSA-8j8c-7jfh-h6hx is a code injection vulnerability in js-yaml, published on 4 Jun 2019. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Versions of js-yaml prior to 3.13.1 are vulnerable to Code Injection. The load() function may execute arbitrary code injected through a malicious YAML file. Objects that have toString as key, JavaScript code as value and are used as explicit mapping keys allow attackers to execute the supplied code through the load() function. The safeLoad() function is unaffected.

An example payload is { toString: !<tag:yaml.org,2002:js/function> 'function (){return Date.now()}' } : 1 which returns the object { "1553107949161": 1 }

Recommendation

Upgrade to version 3.13.1.

Which versions are affected by GHSA-8j8c-7jfh-h6hx?

2 open source packages ship an affected version, including js-yaml.

PackageAffectedFixed in
js-yaml npmAll versions3.13.1
js-yaml npmAll versions3.13.1

How do I fix GHSA-8j8c-7jfh-h6hx?

Upgrade js-yaml to 3.13.1 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is GHSA-8j8c-7jfh-h6hx being exploited?

There is no known exploitation of GHSA-8j8c-7jfh-h6hx in the wild and no public exploit code.

Sources

Is GHSA-8j8c-7jfh-h6hx in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free