Uninitialized Memory Exposure

Affecting ip package, versions <1.1.5

Do your applications use this vulnerable package? Test your applications

Overview

ip is an IP address utility for node.js.

Affected versions of the package are vulnerable to Uninitialized Memory Exposure due to an insecure use of the Node.js Buffer class.

Details

The Buffer class in Node.js is a mutable array of binary data, and can be initialized with a string, array or number.

const buf1 = new Buffer([1,2,3]);
// creates a buffer containing [01, 02, 03]
const buf2 = new Buffer('test');
// creates a buffer containing ASCII bytes [74, 65, 73, 74]
const buf3 = new Buffer(10);
// creates a buffer of length 10

The first two variants simply create a binary representation of the value it received. The last one, however, pre-allocates a buffer of the specified size, making it a useful buffer, especially when reading data from a stream. When using the number constructor of Buffer, it will allocate the memory, but will not fill it with zeros. Instead, the allocated buffer will hold whatever was in memory at the time. If the buffer is not zeroed by using buf.fill(0), it may leak sensitive information like keys, source code, and system info.

For more information on the Buffer vulnerability, go to our blog.

Remediation

Upgrade ip to version 1.1.5 or higher. Note This is vulnerable only for Node <=4

References

CVSS Score

5.1
medium severity
  • Attack Vector
    Local
  • Attack Complexity
    High
  • Privileges Required
    None
  • User Interaction
    None
  • Scope
    Unchanged
  • Confidentiality
    High
  • Integrity
    None
  • Availability
    None
CVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Credit
ChALkeR
CWE
CWE-201
Snyk ID
npm:ip:20170304
Disclosed
03 Mar, 2017
Published
04 Jun, 2017