Home Cyber Security News Serious Vulnerability In Netmask npm Package Risked 270K+ Projects

Serious Vulnerability In Netmask npm Package Risked 270K+ Projects

by Abeerah Hashim
Netmask npm package vulnerability

A serious vulnerability existed in the Netmask npm package that could allow server-side request forgery. Currently, the Netmask npm package backs over 278,000 open source projects. Hence, the vulnerability that remained undetected for 9 years posed a risk to thousands of projects.

Netmask npm Package Vulnerability

Multiple security researchers have recently shed light on a serious vulnerability affecting the Netmask npm package. Netmask has garnered a huge user base as it parses IPv4 CIDR blocks.

Despite being popular, the package had a serious security vulnerability that remained unnoticed for 9 years. Given the user base in hundreds of millions globally, malicious exploitation of the flaw could have triggered devastating results. Though, the impact of the exploitation mainly depended on how a project used the package.

Sharing the details in a post, Sick Codes revealed how multiple researchers contacted them for an SSRF vulnerability in the package. These researchers include?John Jackson,?Nick Sahler, Victor Viale, and Kelly Kaoudis.

Briefly, the vulnerability existed because of the improper interpretation of the first octet of the IP address when expressed in octal format. Instead of evaluating it by first converting it to the decimal format, the Netmask simply considered the octal format as the decimal one and stripped the leading zeros.

As Sick Codes explained,

The problem is, private-ip thinks 0127 is 127 because it is not evaluating the first octet, which is in octal format, as the true decimal value 87.
This is?catastrophic.
private-ip thinks?0127.0.0.1?is?localhost, but it’s really?
Even worse, it goes the other way too!

While this issue doesn’t sound dangerous at first, the researchers explained how an adversary could exploit this glitch.

If your browser recognizes octal literals, but a nodejs application does not, users can submit all kinds of malevolent URLs that seem internal, but really go to remote files.
On the other hand, users can ALSO submit URLs that seem public, but they’re actually very private!

Hence, exploiting the bug could result in server-side request forgery to remote file inclusion by an attacker.

Patch Deployed

The Netmask npm package vulnerability has received the CVE ID CVE-2021-28918. The researchers found this vulnerability on March 16, 2021, that they reported to the vendors on March 17, 2021.

As observed, the bug affected Netmask v1.1.0 and below. Hence, the vendors deployed a fix with v.2.0.

However, another researcher RyotaK?discovered a bypass for the fix in v.2.0. Thus, the vendors had to rewrite the patch that they eventually released with v.2.0.1. The bypass has received the CVE ID CVE-2021-29418.

Since the patched version is now available, all users must ensure they update to the latest package version.

You may also like

Latest Hacking News

Privacy Preference Center


The __cfduid cookie is used to identify individual clients behind a shared IP address and apply security settings on a per-client basis.

cookie_notice_accepted and gdpr[allowed_cookies] are used to identify the choices made from the user regarding cookie consent.

For example, if a visitor is in a coffee shop where there may be several infected machines, but the specific visitor's machine is trusted (for example, because they completed a challenge within your Challenge Passage period), the cookie allows Cloudflare to identify that client and not challenge them again. It does not correspond to any user ID in your web application, and does not store any personally identifiable information.

__cfduid, cookie_notice_accepted, gdpr[allowed_cookies]


DoubleClick by Google refers to the DoubleClick Digital Marketing platform which is a separate division within Google. This is Google’s most advanced advertising tools set, which includes five interconnected platform components.

DoubleClick Campaign Manager: the ad-serving platform, called an Ad Server, that delivers ads to your customers and measures all online advertising, even across screens and channels.

DoubleClick Bid Manager – the programmatic bidding platform for bidding on high-quality ad inventory from more than 47 ad marketplaces including Google Display Network.

DoubleClick Ad Exchange: the world’s largest ad marketplace for purchasing display, video, mobile, Search and even Facebook inventory.

DoubleClick Search: is more powerful than AdWords and used for purchasing search ads across Google, Yahoo, and Bing.

DoubleClick Creative Solutions: for designing, delivering and measuring rich media (video) ads, interactive and expandable ads.



The _ga is asssociated with Google Universal Analytics - which is a significant update to Google's more commonly used analytics service. This cookie is used to distinguish unique users by assigning a randomly generated number as a client identifier. It is included in each page request in a site and used to calculate visitor, session and campaign data for the sites analytics reports. By default it is set to expire after 2 years, although this is customisable by website owners.

The _gat global object is used to create and retrieve tracker objects, from which all other methods are invoked. Therefore the methods in this list should be run only off a tracker object created using the _gat global variable. All other methods should be called using the _gaq global object for asynchronous tracking.

_gid works as a user navigates between web pages, they can use the gtag.js tagging library to record information about the page the user has seen (for example, the page's URL) in Google Analytics. The gtag.js tagging library uses HTTP Cookies to "remember" the user's previous interactions with the web pages.

_ga, _gat, _gid