lolking-lookup@1.0.1
Vulnerabilities |
2 via 4 paths |
---|---|
Dependencies |
14 |
Source |
npm |
Find, fix and prevent vulnerabilities in your code.
high severity
- Vulnerable module: bl
- Introduced through: jsonist@0.1.1 and lolking-leaderboard@1.0.0
Detailed paths
-
Introduced through: lolking-lookup@1.0.1 › jsonist@0.1.1 › bl@0.7.0Remediation: Upgrade to jsonist@2.1.0.
-
Introduced through: lolking-lookup@1.0.1 › lolking-leaderboard@1.0.0 › jsonist@0.1.1 › bl@0.7.0
Overview
bl is a library that allows you to collect buffers and access with a standard readable buffer interface.
Affected versions of this package are vulnerable to Remote Memory Exposure. If user input ends up in consume()
argument and can become negative, BufferList state can be corrupted, tricking it into exposing uninitialized memory via regular .slice()
calls.
PoC by chalker
const { BufferList } = require('bl')
const secret = require('crypto').randomBytes(256)
for (let i = 0; i < 1e6; i++) {
const clone = Buffer.from(secret)
const bl = new BufferList()
bl.append(Buffer.from('a'))
bl.consume(-1024)
const buf = bl.slice(1)
if (buf.indexOf(clone) !== -1) {
console.error(`Match (at ${i})`, buf)
}
}
Remediation
Upgrade bl
to version 2.2.1, 3.0.1, 4.0.3, 1.2.3 or higher.
References
medium severity
- Vulnerable module: bl
- Introduced through: jsonist@0.1.1 and lolking-leaderboard@1.0.0
Detailed paths
-
Introduced through: lolking-lookup@1.0.1 › jsonist@0.1.1 › bl@0.7.0Remediation: Upgrade to jsonist@1.0.0.
-
Introduced through: lolking-lookup@1.0.1 › lolking-leaderboard@1.0.0 › jsonist@0.1.1 › bl@0.7.0
Overview
bl is a storage object for collections of Node Buffers.
A possible memory disclosure vulnerability exists when a value of type number
is provided to the append()
method and results in concatenation of uninitialized memory to the buffer collection.
This is a result of unobstructed use of the Buffer
constructor, whose insecure default constructor increases the odds of memory leakage.
Details
Constructing a Buffer
class with integer N
creates a Buffer
of length N
with raw (not "zero-ed") memory.
In the following example, the first call would allocate 100 bytes of memory, while the second example will allocate the memory needed for the string "100":
// uninitialized Buffer of length 100
x = new Buffer(100);
// initialized Buffer with value of '100'
x = new Buffer('100');
bl
's append
function uses the default Buffer
constructor as-is, making it easy to append uninitialized memory to an existing list. If the value of the buffer list is exposed to users, it may expose raw server side memory, potentially holding secrets, private data and code. This is a similar vulnerability to the infamous Heartbleed
flaw in OpenSSL.
const BufferList = require('bl')
var bl = new BufferList()
bl.append(new Buffer('abcd'))
bl.append(new Buffer('efg'))
bl.append('100')
// appends a Buffer holding 100 bytes of uninitialized memory
bl.append(100)
bl.append(new Buffer('j'))
You can read more about the insecure Buffer
behavior on our blog.
Similar vulnerabilities were discovered in request, mongoose, ws and sequelize.
Note This is vulnerable only for Node <=4