Uninitialized Memory Exposure Affecting byte package, versions <1.4.1


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Mature

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID npm:byte:20180512
  • published 13 May 2018
  • disclosed 12 May 2018
  • credit ChALkeR

Introduced: 12 May 2018

CVE NOT AVAILABLE CWE-201 Open this link in a new tab

How to fix?

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

Overview

byte Input Buffer and Output Buffer, just like Java ByteBuffer.

Affected versions of this package are vulnerable to Uninitialized Memory Exposure. It allocates uninitialized buffers and reads data from them past the initialized length.

Details

The Buffer class on 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.

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
5.2 medium
  • Attack Vector (AV)
    Physical
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    Low
  • Integrity (I)
    None
  • Availability (A)
    High