# CVE-2018-25032: Nokogiri affected by zlib's Out-of-bounds Write vulnerability

> Attackers can trigger memory corruption in zlib during compression, potentially leading to code execution or denial of service.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 25 Mar 2022
- **Updated:** 14 Oct 2026
- **Also known as:** ALPINE-CVE-2018-25032, ALSA-2022:1642, ALSA-2022:2201, ALSA-2022:7813, ALSA-2022:8420, AZL-26135, AZL-26156, AZL-26164, AZL-42715, AZL-42759, AZL-43675, AZL-43678, AZL-43753, AZL-43990, AZL-44181, AZL-44466, AZL-44919, AZL-45177, AZL-45231, AZL-9143, CLEANSTART-2026-ID64471, CLSA-2022-1649170583, CLSA-2022-1652706098, CLSA-2022-1652706231, CLSA-2022-1652706470, CLSA-2022-1652706582, CLSA-2022-1652986439, CLSA-2022-1652986558, CLSA-2022-1652987318, CLSA-2022-1652987360, CLSA-2022-1653004535, DEBIAN-CVE-2018-25032, DLA-2968-1, DLA-2993-1, DSA-5111-1, ECHO-07bd-01d6-b9fc, GHSA-jc36-42cf-vqwj, JLSEC-2026-477, MGASA-2022-0124, OESA-2022-1651, PSF-2022-3, RHSA-2022:1591, RHSA-2022:1642, RHSA-2022:1661, RHSA-2022:2192, RHSA-2022:2197, RHSA-2022:2198, RHSA-2022:2201, RHSA-2022:2213, RHSA-2022:2214, RHSA-2022:4584, RHSA-2022:4592, RHSA-2022:4845, RHSA-2022:7813, RHSA-2022:8420, RHSA-2023:0943, RHSA-2023:0975, RHSA-2023:0976, RLSA-2022:1642, RLSA-2022:2201, RLSA-2022:7813, SUSE-SU-2022:1023-1, SUSE-SU-2022:1043-1, SUSE-SU-2022:1061-1, SUSE-SU-2022:1061-2, SUSE-SU-2022:1062-1, SUSE-SU-2022:14929-1, UBUNTU-CVE-2018-25032, USN-5355-1, USN-5355-2, USN-5359-1, USN-5359-2, openSUSE-SU-2022:1061-1, openSUSE-SU-2024:11966-1, openSUSE-SU-2024:12021-1, openSUSE-SU-2024:12042-1, openSUSE-SU-2024:12068-1, openSUSE-SU-2024:12097-1, openSUSE-SU-2024:13629-1

## What is CVE-2018-25032?

CVE-2018-25032 is a high-severity memory corruption vulnerability in Apple Mac Os X, published on 25 Mar 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

zlib before 1.2.12 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches.

Weakness: CWE-787 (Out-of-bounds Write)

## Which versions are affected by CVE-2018-25032?

2 open source packages ship an affected version, including nokogiri. It affects 27 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `nokogiri` | RubyGems | All versions | 1.13.4 |
| `nokogiri` | RubyGems | All versions | 1.13.4 |
| `mingw32-zlib` | AlmaLinux:8 | All versions | 1.2.8-10.el8 |
| `mingw32-zlib-static` | AlmaLinux:8 | All versions | 1.2.8-10.el8 |
| `mingw64-zlib` | AlmaLinux:8 | All versions | 1.2.8-10.el8 |
| `mingw64-zlib-static` | AlmaLinux:8 | All versions | 1.2.8-10.el8 |
| `rsync` | AlmaLinux:8 | All versions | 3.1.3-14.el8 |
| `rsync-daemon` | AlmaLinux:8 | All versions | 3.1.3-14.el8 |
| `zlib` | AlmaLinux:8 | All versions | 1.2.11-18.el8_5 |
| `zlib-devel` | AlmaLinux:8 | All versions | 1.2.11-18.el8_5 |
| `zlib-static` | AlmaLinux:8 | All versions | 1.2.11-18.el8_5 |
| `mingw32-zlib` | AlmaLinux:9 | All versions | 1.2.12-2.el9 |
| `mingw32-zlib-static` | AlmaLinux:9 | All versions | 1.2.12-2.el9 |
| `mingw64-zlib` | AlmaLinux:9 | All versions | 1.2.12-2.el9 |
| `mingw64-zlib-static` | AlmaLinux:9 | All versions | 1.2.12-2.el9 |
| `minizip` | Red Hat:enterprise_linux:7::client | All versions | 0:1.2.7-20.el7_9 |
| `minizip-devel` | Red Hat:enterprise_linux:7::client | All versions | 0:1.2.7-20.el7_9 |
| `zlib` | Red Hat:enterprise_linux:7::client | All versions | 0:1.2.7-20.el7_9 |
| `zlib-debuginfo` | Red Hat:enterprise_linux:7::client | All versions | 0:1.2.7-20.el7_9 |
| `zlib-devel` | Red Hat:enterprise_linux:7::client | All versions | 0:1.2.7-20.el7_9 |
| `zlib-static` | Red Hat:enterprise_linux:7::client | All versions | 0:1.2.7-20.el7_9 |
| `minizip` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.2.7-20.el7_9 |
| `minizip-devel` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.2.7-20.el7_9 |
| `zlib-debuginfo` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.2.7-20.el7_9 |
| `zlib-devel` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.2.7-20.el7_9 |
| `zlib-static` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.2.7-20.el7_9 |
| `minizip` | Red Hat:enterprise_linux:7::server | All versions | 0:1.2.7-20.el7_9 |
| `minizip-devel` | Red Hat:enterprise_linux:7::server | All versions | 0:1.2.7-20.el7_9 |
| `zlib` | Red Hat:enterprise_linux:7::server | All versions | 0:1.2.7-20.el7_9 |
| `zlib-debuginfo` | Red Hat:enterprise_linux:7::server | All versions | 0:1.2.7-20.el7_9 |
| `zlib-devel` | Red Hat:enterprise_linux:7::server | All versions | 0:1.2.7-20.el7_9 |
| `zlib-static` | Red Hat:enterprise_linux:7::server | All versions | 0:1.2.7-20.el7_9 |
| `minizip` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.2.7-20.el7_9 |
| `minizip-devel` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.2.7-20.el7_9 |
| `zlib` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.2.7-20.el7_9 |
| `zlib-debuginfo` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.2.7-20.el7_9 |
| `zlib-devel` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.2.7-20.el7_9 |
| `zlib-static` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.2.7-20.el7_9 |
| `rsync` | Red Hat:enterprise_linux:8::baseos | All versions | 0:3.1.3-14.el8_6.2 |
| `rsync-daemon` | Red Hat:enterprise_linux:8::baseos | All versions | 0:3.1.3-14.el8_6.2 |

Products: Apple Mac Os X, Apple Macos, Azul Zulu, Debian Debian Linux, Fedoraproject Fedora, Goto Gotoassist, Mariadb Mariadb, Netapp Active Iq Unified Manager, Netapp E-Series Santricity Os Controller, Netapp H300s Firmware, Netapp H410c Firmware, Netapp H410s Firmware, Netapp H500s Firmware, Netapp H700s Firmware, Netapp Hci Compute Node, Netapp Management Services for Element Software, Netapp Oncommand Workflow Automation, Netapp Ontap Select Deploy Administration Utility, Nokogiri Nokogiri, Python Python and 7 more.

## How do I fix CVE-2018-25032?

Upgrade nokogiri to 1.13.4 or later.

## Is CVE-2018-25032 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2018-25032 exists.

Public exploit code:

- https://github.com/Trinadh465/external_zlib_4.4_CVE-2018-25032 (github_poc): https://github.com/Trinadh465/external_zlib_4.4_CVE-2018-25032
- https://github.com/Satheesh575555/external_zlib-1.2.7_CVE-2018-25032 (github_poc): https://github.com/Satheesh575555/external_zlib-1.2.7_CVE-2018-25032
- https://github.com/Trinadh465/external_zlib_AOSP10_r33_CVE-2018-25032 (github_poc): https://github.com/Trinadh465/external_zlib_AOSP10_r33_CVE-2018-25032

## Other vulnerabilities in Apple Mac Os X

- [CVE-2014-7169](https://insights.sbomify.com/CVE-2014-7169/): GNU Bourne-Again Shell (Bash) Arbitrary Code Execution (critical 9.8, exploited in the wild)
- [CVE-2014-6271](https://insights.sbomify.com/CVE-2014-6271/): GNU Bourne-Again Shell (Bash) Arbitrary Code Execution (critical 9.8, exploited in the wild)
- [CVE-2012-1823](https://insights.sbomify.com/CVE-2012-1823/): PHP-CGI Query String Parameter (critical 9.8, exploited in the wild)
- [CVE-2021-30713](https://insights.sbomify.com/CVE-2021-30713/): Apple macOS Unspecified (high 7.8, exploited in the wild)
- [CVE-2019-8526](https://insights.sbomify.com/CVE-2019-8526/): Apple macOS Use-After-Free (high 7.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2018-25032 and fix it if it is affected.

What it is: CVE-2018-25032 is a high-severity memory corruption vulnerability in Apple Mac Os X, published on 25 Mar 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2018-25032 exists.

Affected packages and fixed versions:
- nokogiri (RubyGems): affected all versions; fixed in 1.13.4
- nokogiri (RubyGems): affected all versions; fixed in 1.13.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2018-25032/ (Markdown: https://insights.sbomify.com/CVE-2018-25032/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2018-25032
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2018-25032
- OSV: https://osv.dev/vulnerability/CVE-2018-25032

---
From sbomify Insights: https://insights.sbomify.com/CVE-2018-25032/
Summaries are generated and may contain mistakes; the official description above is the record.
