Buffer Overflow Vulnerability in Node.js - CVE-2018-12115

nodejs Updated 02 Oct 2025

Summary

21/08/2018
N/A
Yes i
High
7.5

ALPINE-CVE-2018-12115: In all versions of Node.js prior to 6.14.4, 8.11.4 and 10.9.0 when used with UCS-2 encoding (recognized by Node.js under the names 'ucs2', 'ucs-2', 'utf16le' and 'utf-16le'), Buffer#write() can be abused to write outside... Affects nodejs versions < 8.11.4-r0. Fixed in 8.11.4-r0. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Node.js is a popular open-source runtime environment that allows developers to execute JavaScript code server-side. It is widely used for building scalable network applications. The Node.js package provides various functionalities, including handling asynchronous events and managing input/output operations. However, certain versions of Node.js are vulnerable to a buffer overflow issue when using UCS-2 encoding, which can lead to potential security risks.

Vulnerability Detail

In all versions of Node.js prior to 6.14.4, 8.11.4, and 10.9.0, when used with UCS-2 encoding (recognized by Node.js under the names 'ucs2', 'ucs-2', 'utf16le', and 'utf-16le'), the Buffer#write() method can be exploited to write outside the bounds of a single Buffer. This miscalculation occurs when writes start from the second-to-last position of a buffer, potentially leading to data corruption or unauthorized access to memory.

How To Fix

Minimum fixed version

8.11.4-r0

This is the first release that contains the fix.

sudo apk add --upgrade nodejs

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

Workaround

As a temporary workaround, avoid using UCS-2 encoding in your applications. Instead, consider using UTF-8 encoding, which does not exhibit this vulnerability. You can change the encoding in your code as follows:

const buffer = Buffer.from('your string', 'utf8');

Conclusion

The CVE-2018-12115 vulnerability in Node.js poses significant risks due to buffer overflow issues when using UCS-2 encoding. It is crucial for developers to update to the patched versions to ensure the security of their applications. Utilizing tools like Vulert can help in monitoring and managing vulnerabilities effectively.

See every vulnerability recorded for nodejs →

Share this vulnerability

FAQ

CVE-2018-12115 is a vulnerability in Node.js that allows for buffer overflow when using UCS-2 encoding, potentially leading to data corruption.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Exploiting this vulnerability can lead to data corruption, unauthorized memory access, and potential security breaches in applications using affected Node.js versions.

You can update Node.js by running the command 'npm install nodejs@8.11.4' in your terminal to install the patched version.

Yes, Vulert can monitor and alert you in real-time for open-source vulnerabilities in your software using just a manifest file like package-lock.json.

Related vulnerabilities

Recent vulnerabilities recorded for nodejs.

How To Fix

Minimum fixed version

8.11.4-r0

This is the first release that contains the fix.

sudo apk add --upgrade nodejs

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