CVE-2019-10791 (published 2020-02-18T17:15Z)

promise-probe before 0.10.0 allows remote attackers to perform a command injection attack. The file, outputFile and options functions can be controlled by users without any sanitization.

Severity: HIGH
CVSS v2 base score: 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-78
cwe_name: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
description: The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
extended_description: 
		   This weakness can lead to a vulnerability in environments in which the attacker does not have direct access to the operating system, such as in web applications. Alternately, if the weakness occurs in a privileged program, it could allow the attacker to specify commands that normally would not be accessible, or to call alternate commands with privileges that the attacker does not have. The problem is exacerbated if the compromised process does not follow the principle of least privilege, because the attacker-controlled commands may run with special system privileges that increases the amount of damage.
            There are at least two subtypes of OS command injection:
               
				 The application intends to execute a single, fixed program that is under its own control. It intends to use externally-supplied inputs as arguments to that program. For example, the program might use system("nslookup [HOSTNAME]") to run nslookup and allow the user to supply a HOSTNAME, which is used as an argument. Attackers cannot prevent nslookup from executing. However, if the program does not remove command separators from the HOSTNAME argument, attackers could place the separators into the arguments, which allows them to execute their own program after nslookup has finished executing.
				 The application accepts an input that it uses to fully select which program to run, as well as which commands to use. The application simply redirects this entire command to the operating system. For example, the program might use "exec([COMMAND])" to execute the [COMMAND] that was supplied by the user. If the COMMAND is under attacker control, then the attacker can execute arbitrary commands or programs. If the command is being executed using functions like exec() and CreateProcess(), the attacker might not be able to combine multiple commands together in the same line.
               
            From a weakness standpoint, these variants represent distinct programmer errors. In the first variant, the programmer clearly intends that input from untrusted parties will be part of the arguments in the command to be executed. In the second variant, the programmer does not intend for the command to be accessible to any untrusted party, but the programmer probably has not accounted for alternate ways in which malicious attackers can provide input.
         
         

Fix information:
repo_url: https://github.com/dottgonzo/node-promise-probe
commit_details: repo_url: https://github.com/dottgonzo/node-promise-probe
author: dario
author_date: 2020-02-05 23:09:27+01:00
msg: resolve vulnerability
repository: repo_url: https://github.com/dottgonzo/node-promise-probe
repo_name: dottgonzo/node-promise-probe
repo_language: TypeScript
owner: dottgonzo
file_changes: filename: index.js
change_type: ModificationType.MODIFY
diff: @@ -7,7 +7,7 @@ function ffprobe(file) {
             throw new Error('no file provided');
         fs_1.stat(file, (err, stats) => {
             if (err)
-                throw err;
+                return reject(new Error('wrong file provided'));
             child_process_1.exec('ffprobe -v quiet -print_format json -show_format -show_streams ' + file, (error, stdout, stderr) => {
                 if (error)
                     return reject(error);
@@ -34,6 +34,12 @@ function ffprobe(file) {
 exports.ffprobe = ffprobe;
 function createMuteOgg(outputFile, options) {
     return new Promise((resolve, reject) => {
+        if (!outputFile || !options || !options.seconds || !options.sampleRate || !options.numOfChannels)
+            return reject(new Error('malformed props to createMuteOgg'));
+        if (!Number.isInteger(options.seconds) ||
+            !Number.isInteger(options.sampleRate) ||
+            !Number.isInteger(options.numOfChannels))
+            return reject(new Error('malformed numerico options prop for createMuteOgg'));
         const ch = options.numOfChannels === 1 ? 'mono' : 'stereo';
         child_process_1.exec('ffmpeg -f lavfi -i anullsrc=r=' +
             options.sampleRate +

programming_language: JavaScript
filename: index.js.map
change_type: ModificationType.MODIFY
diff: @@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,iDAAoC;AACpC,2BAAyB;AAgHzB,iBAAwB,IAAY;IAClC,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/C,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;QAE9C,SAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxB,IAAI,GAAG;gBAAE,MAAM,GAAG,CAAA;YAElB,oBAAI,CAA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AkCC;AAED,yBAAgC,SAAiB,EAAE,UAAkB,EAAE,OAAgB;IACrF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,OAAO,CAAC,SAAS,CAAC;aACf,IAAI,CAAC,MAAM,CAAC,EAAE;YACb,IAAI,CAAC,OAAO;gBAAE,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;YACxD,aAAa,CAAC,UAAU,EAAE;gBACxB,OAAO,EAAE,OAAO;gBAChB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;gBAC9C,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;aACrC,CAAC;iBACC,IAAI,CAAC,GAAG,EAAE;gBACT,OAAO,CAAC,IAAI,CAAC,CAAA;YACf,CAAC,CAAC;iBACD,KAAK,CAAC,GAAG,CAAC,EAAE;gBACX,MAAM,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;QACN,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,CAAC,EAAE;YACX,MAAM,CAAC,GAAG,CAAC,CAAA;QACb,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACJ,CAAC;AArBD,0CAqBC"}
\ No newline at end of file

programming_language: Scala
filename: index.ts
change_type: ModificationType.MODIFY
diff: @@ -1,5 +1,6 @@
 import { exec } from 'child_process'
 import { stat } from 'fs'
+import { reject } from 'bluebird'
 
 export interface IFFFormat {
   filename: string
@@ -116,7 +117,7 @@ export function ffprobe(file: string): Promise<IFfprobe> {
     if (!file) throw new Error('no file provided')
 
     stat(file, (err, stats) => {
-      if (err) throw err
+      if (err) return reject(new Error('wrong file provided'))
 
       exec('ffprobe -v quiet -print_format json -show_format -show_streams ' + file, (error, stdout, stderr) => {
         if (error) return reject(error)
@@ -146,6 +147,16 @@ export function createMuteOgg(
   options: { seconds: number; sampleRate: number; numOfChannels: number }
 ) {
   return new Promise<true>((resolve, reject) => {
+    if (!outputFile || !options || !options.seconds || !options.sampleRate || !options.numOfChannels)
+      return reject(new Error('malformed props to createMuteOgg'))
+
+    if (
+      !Number.isInteger(options.seconds) ||
+      !Number.isInteger(options.sampleRate) ||
+      !Number.isInteger(options.numOfChannels)
+    )
+      return reject(new Error('malformed numerico options prop for createMuteOgg'))
+
     const ch = options.numOfChannels === 1 ? 'mono' : 'stereo'
 
     exec(

programming_language: TypeScript