Skip to main content

CVE-2019-5477 — Vulnerability in nokogiri — CVE Details

CRITICAL

Nokogiri Command Injection Vulnerability

Published August 19, 2019Updated February 18, 2024Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (6.14%). Schedule for your next planned update.

Does your project use an affected nokogiri version?

Paste your Gemfile.lock to check it for CVE-2019-5477 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my Gemfile.lock

Summary

A command injection vulnerability in Nokogiri v1.10.3 and earlier allows commands to be executed in a subprocess via Ruby's Kernel.open method. Processes are vulnerable only if the undocumented method Nokogiri::CSS::Tokenizer#load_file is being called with unsafe user input as the filename. This vulnerability appears in code generated by the Rexical gem versions v1.0.6 and earlier. Rexical is used by Nokogiri to generate lexical scanner code for parsing CSS queries. The underlying vulnerability was addressed in Rexical v1.0.7 and Nokogiri upgraded to this version of Rexical in Nokogiri v1.10.4.

Advisory Timeline

  • First published August 19, 2019 (2656 days ago).
  • Last revised February 18, 2024 — 1643 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update nokogiri to 1.10.4 or later
gem install nokogiri -v 1.10.4
Bundler
Update rexical to 1.0.7 or later
gem install rexical -v 1.0.7

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (2)

Affects 1 ecosystem: RubyGems (2).

PackageFixed In
nokogiri RubyGems · Affected: 1.0.0, 1.0.1, 1.0.2, 1.0.3 (+109 more)1.10.4
rexical RubyGems · Affected: 1.0.3, 1.0.4, 1.0.5, 1.0.5.beta1 (+1 more)1.0.7

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-78
    OS Command InjectionMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2019-5477?
Nokogiri Command Injection Vulnerability. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
How do I check if my project is affected by CVE-2019-5477?
CVE-2019-5477 affects nokogiri and rexical. It has a 6.1% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2019-5477 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.8

Maximum impact if exploited, often with little effort or access required.

EPSS Score (30-day exploit probability)
6.14%
EPSS percentile: 94.2

This places it in the top 10% of EPSS-scored vulnerabilities — 94.2% of tracked vulnerabilities score at or below it, so it is substantially more likely to be exploited than most tracked vulnerabilities.

Also Known As

GHSA-cr5j-953j-xw5p

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Gemfile.lock