CVE-2017-5029: Nokogiri libxslt Integer Overflow Vulnerability

nokogiri Updated 02 Oct 2025

Summary

31/07/2018
Yes i
High
8.8

CVE-2017-5029: Nokogiri implementation of libxslt lacks integer overflow checks. Affects nokogiri versions < 1.7.2. Fixed in 1.7.2. How to fix ↓

Also tracked for

The same CVE-2017-5029 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Nokogiri is a RubyGem that provides a simple and efficient way to parse and manipulate XML and HTML documents. It utilizes the libxslt library for XSLT transformations. Libxslt is a C library that implements XSLT 1.0 and XPath 1.0 specifications. However, prior to version 1.7.2, Nokogiri's implementation of libxslt lacked integer overflow checks in the xsltAddTextString function in transform.c. This vulnerability allowed a remote attacker to perform an out-of-bounds memory write by exploiting a crafted HTML page.

Vulnerability Detail

The vulnerability in Nokogiri's implementation of libxslt arises from the absence of integer overflow checks during a size calculation in the xsltAddTextString function. This oversight enables a remote attacker to execute an out-of-bounds memory write attack. By leveraging a specially crafted HTML page, an attacker can trigger the vulnerability and potentially achieve arbitrary code execution or cause a denial-of-service condition. The lack of proper bounds checking allows the attacker to overwrite memory beyond the intended boundaries, leading to potential system instability or unauthorized access to sensitive information.

How To Fix

Latest published version: 1.19.4 as of 22 Oct 2026

gem install nokogiri -v 1.19.4

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.7.2

This is the first release that contains the fix.

gem install nokogiri -v 1.7.2

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

Workaround

As a workaround, users can consider implementing input validation and sanitization techniques to mitigate the risk of exploitation. By carefully validating and sanitizing user-supplied input, the likelihood of encountering a crafted HTML page that triggers the vulnerability can be reduced. However, this workaround may not provide complete protection and should be seen as a temporary measure until the package is updated.

Conclusion

The Nokogiri libxslt Integer Overflow Vulnerability (CVE-2017-5029) allows a remote attacker to perform an out-of-bounds memory write by exploiting a crafted HTML page. This can lead to arbitrary code execution or denial-of-service attacks. It is crucial to update Nokogiri to version 1.7.2 or later to mitigate this vulnerability. Input validation and sanitization techniques can be used as a temporary workaround. For further assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for nokogiri →

Share this vulnerability

FAQ

Nokogiri is a RubyGem that allows developers to parse and manipulate XML and HTML documents efficiently.

Libxslt is a C library that implements XSLT 1.0 and XPath 1.0 specifications, used by Nokogiri for XSLT transformations.

An integer overflow occurs when an arithmetic operation results in a value that exceeds the maximum representable value for the data type. In this case, the lack of integer overflow checks in Nokogiri's implementation of libxslt allows an attacker to manipulate the size calculation, leading to an out-of-bounds memory write.

Exploiting this vulnerability can result in arbitrary code execution or denial-of-service attacks. An attacker could gain unauthorized access to sensitive information or cause system instability.

To fix the vulnerability, update Nokogiri to version 1.7.2 or later. This can be done by running the appropriate package manager command or manually updating the RubyGem.

Related vulnerabilities

Recent vulnerabilities recorded for nokogiri.

How To Fix

Latest published version: 1.19.4 as of 22 Oct 2026

gem install nokogiri -v 1.19.4

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.7.2

This is the first release that contains the fix.

gem install nokogiri -v 1.7.2

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