Disclosed vulnerabilities
No CVE assigned Published: Apr 25, 2021

Command injection vulnerability in s3-uploader

9.8 Critical Severity javascript node nodejs npm RCE
Adar Zandberg Reported by Checkmarx Zero

Summary

The s3-uploader Node.js package insecurely passes data to the metadata() function, which is ultimately concatenated to an OS command and executed in the context of the server.

Product

s3-uploader through 2.0.3.

Impact

Potential remote code execution is possible in cases where the attacker has control over the parameters passed to Image.prototype.getMetadata.

Steps to reproduce

In order to reproduce this, the following poc.js file should be created and executed:

var Upload = require('s3-uploader');
var client = new Upload('my_s3_bucket', {});
client.upload('nothing; touch hacked; #', {}, function(err, versions, meta) {});

Expected result:

A file named hacked has been created

Remediation

It is recommended to sanitize every untrusted input used by your applications.

Credit

This issue was discovered and reported by Checkmarx SCA Security Analyst Adar Zandberg.

Resources

  1. node-s3-uploader/index.js

Stay connected and never miss a research update!