CVE-2017-14100 - Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

Severity

75%

Complexity

99%

Confidentiality

106%

In Asterisk 11.x before 11.25.2, 13.x before 13.17.1, and 14.x before 14.6.1 and Certified Asterisk 11.x before 11.6-cert17 and 13.x before 13.13-cert5, unauthorized command execution is possible. The app_minivm module has an "externnotify" program configuration option that is executed by the MinivmNotify dialplan application. The application uses the caller-id name and number as part of a built string passed to the OS shell for interpretation and execution. Since the caller-id name and number can come from an untrusted source, a crafted caller-id name or number allows an arbitrary shell command injection.

In Asterisk 11.x before 11.25.2, 13.x before 13.17.1, and 14.x before 14.6.1 and Certified Asterisk 11.x before 11.6-cert17 and 13.x before 13.13-cert5, unauthorized command execution is possible. The app_minivm module has an "externnotify" program configuration option that is executed by the MinivmNotify dialplan application. The application uses the caller-id name and number as part of a built string passed to the OS shell for interpretation and execution. Since the caller-id name and number can come from an untrusted source, a crafted caller-id name or number allows an arbitrary shell command injection.

CVSS 3.0 Base Score 9.8. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

CVSS 2.0 Base Score 7.5. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (AV:N/AC:L/Au:N/C:P/I:P/A:P).

Demo Examples

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

CWE-78

This example code intends to take the name of a user and list the contents of that user's home directory. It is subject to the first variant of OS command injection.


               
system($command);

The $userName variable is not checked for malicious input. An attacker could set the $userName variable to an arbitrary OS command such as:


               
;rm -rf /

Which would result in $command being:


               
ls -l /home/;rm -rf /

Since the semi-colon is a command separator in Unix, the OS would first execute the ls command, then the rm command, deleting the entire file system.

Also note that this example code is vulnerable to Path Traversal (CWE-22) and Untrusted Search Path (CWE-426) attacks.

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

CWE-78

This example is a web application that intends to perform a DNS lookup of a user-supplied domain name. It is subject to the first variant of OS command injection.


               
}
close($fh);
print "<br>\n";

Suppose an attacker provides a domain name like this:


               
cwe.mitre.org%20%3B%20/bin/ls%20-l

The "%3B" sequence decodes to the ";" character, and the %20 decodes to a space. The open() statement would then process a string like this:


               
/path/to/nslookup cwe.mitre.org ; /bin/ls -l

As a result, the attacker executes the "/bin/ls -l" command and gets a list of all the files in the program's working directory. The input could be replaced with much more dangerous commands, such as installing a malicious program on the server.

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

CWE-78

The example below reads the name of a shell script to execute from the system properties. It is subject to the second variant of OS command injection.


               
System.exec(script);

If an attacker has control over this property, then they could modify the property to point to a dangerous program.

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

CWE-78

In the example below, a method is used to transform geographic coordinates from latitude and longitude format to UTM format. The method gets the input coordinates from a user through a HTTP request and executes a program local to the application server that performs the transformation. The method passes the latitude and longitude coordinates as a command-line option to the external program and will perform some processing to retrieve the results of the transformation and return the resulting UTM coordinates.


               
}
return utmCoords;
// process results of coordinate transform// ...

However, the method does not verify that the contents of the coordinates input parameter includes only correctly-formatted latitude and longitude coordinates. If the input coordinates were not validated prior to the call to this method, a malicious user could execute another program local to the application server by appending '&' followed by the command for another program to the end of the coordinate string. The '&' instructs the Windows operating system to execute another program.

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

CWE-78

The following code is from an administrative web application designed to allow users to kick off a backup of an Oracle database using a batch-file wrapper around the rman utility and then run a cleanup.bat script to delete some temporary files. The script rmanDB.bat accepts a single command line parameter, which specifies what type of backup to perform. Because access to the database is restricted, the application runs the backup as a privileged user.


               
...
"&&c:\\utl\\cleanup.bat\"")

The problem here is that the program does not do any validation on the backuptype parameter read from the user. Typically the Runtime.exec() function will not execute multiple commands, but in this case the program first runs the cmd.exe shell in order to run multiple commands with a single call to Runtime.exec(). Once the shell is invoked, it will happily execute multiple commands separated by two ampersands. If an attacker passes a string of the form "& del c:\\dbms\\*.*", then the application will execute this command along with the others specified by the program. Because of the nature of the application, it runs with the privileges necessary to interact with the database, which means whatever command the attacker injects will run with those privileges as well.

Overview

Type

Digium

First reported 7 years ago

2017-09-02 16:29:00

Last updated 5 years ago

2019-10-03 00:03:00

Affected Software

Digium Asterisk 13.0.0 LTS

13.0.0

Digium Asterisk 13.0.0 Beta 1

13.0.0

Digium Asterisk 13.0.0 Beta 2

13.0.0

Digium Asterisk 13.0.0 Beta 3

13.0.0

Digium Asterisk 13.0.1

13.0.1

Digium Asterisk 13.0.2

13.0.2

Digium Asterisk 13.1.0

13.1.0

Digium Asterisk 13.1.0 release candidate 1

13.1.0

Digium Asterisk 13.1.0 release candidate 2

13.1.0

Digium Asterisk 13.1.1

13.1.1

Digium Asterisk 13.2.0

13.2.0

Digium Asterisk 13.2.0 release candidate 1

13.2.0

Digium Asterisk 13.2.1

13.2.1

Digium Asterisk 13.3.0 Release Candidate 1

13.3.0

Digium Asterisk 13.3.2

13.3.2

Digium Asterisk 13.4.0

13.4.0

Digium Asterisk 13.4.0 Release Candidate 1

13.4.0

Digium Asterisk 13.5.0

13.5.0

Digium Asterisk 13.5.0 Release Candidate 1

13.5.0

Digium Asterisk 13.6.0 Release Candidate 1

13.6.0

Digium Asterisk 13.7.0 Release Candidate 1

13.7.0

Digium Asterisk 13.7.0 Release Candidate 2

13.7.0

Digium Asterisk 13.7.1

13.7.1

Digium Asterisk 13.7.2

13.7.2

Digium Asterisk 13.8.0

13.8.0

Digium Asterisk 13.8.0 Release Candidate 1

13.8.0

Digium Asterisk 13.8.1

13.8.1

Digium Asterisk 13.8.2

13.8.2

Digium Asterisk 13.9.0

13.9.0

Digium Asterisk 13.9.1

13.9.1

Digium Asterisk 13.10.0

13.10.0

Digium Asterisk 13.10.0 Release Candidate 1

13.10.0

Digium Asterisk 13.11.0

13.11.0

Digium Asterisk 13.11.1

13.11.1

Digium Asterisk 13.11.2

13.11.2

Digium Asterisk 13.12

13.12

Digium Asterisk 13.12.0

13.12.0

Digium Asterisk 13.12.1

13.12.1

Digium Asterisk 13.12.2

13.12.2

Digium Asterisk 13.13

13.13

Digium Asterisk 13.13.0

13.13.0

Digium Asterisk 13.13.1

13.13.1

Digium Asterisk 13.14.0

13.14.0

Digium Asterisk 13.14.0 Release Candidate 1

13.14.0

Digium Asterisk 13.14.0 Release Candidate 2

13.14.0

Digium Asterisk 13.14.1

13.14.1

Digium Asterisk 13.15.0

13.15.0

Digium Asterisk 13.15.0 Release Candidate 1

13.15.0

Digium Asterisk 13.15.0 Release Candidate 2

13.15.0

Digium Asterisk 13.15.0 Release Candidate 3

13.15.0

Digium Asterisk 13.15.1

13.15.1

Digium Asterisk 13.16.0

13.16.0

Digium Asterisk 13.16.0 Release Candidate 1

13.16.0

Digium Asterisk 13.16.0 Release Candidate 2

13.16.0

Digium Asterisk 13.17.0

13.17.0

Digium Asterisk 13.17.0 Release Candidate 1

13.17.0

Digium Asterisk 14.0

14.0

Digium Asterisk 14.0.0

14.0.0

Digium Asterisk 14.0.0 Beta 1

14.0.0

Digium Asterisk 14.0.0 Beta 2

14.0.0

Digium Asterisk 14.0.0 Release Candidate 1

14.0.0

Digium Asterisk 14.0.0 Release Candidate 2

14.0.0

Digium Asterisk 14.0.1

14.0.1

Digium Asterisk 14.0.2

14.0.2

Digium Asterisk 14.01

14.01

Digium Asterisk 14.1

14.1

Digium Asterisk 14.1.0

14.1.0

Digium Asterisk 14.1.1

14.1.1

Digium Asterisk 14.1.2

14.1.2

Digium Asterisk 14.02

14.02

Digium Asterisk 14.2

14.2

Digium Asterisk 14.2.0

14.2.0

Digium Asterisk 14.2.1

14.2.1

Digium Asterisk 14.3.0

14.3.0

Digium Asterisk 14.3.0 Release Candidate 1

14.3.0

Digium Asterisk 14.3.0 Release Candidate 2

14.3.0

Digium Asterisk 14.3.1

14.3.1

Digium Asterisk 14.4.0

14.4.0

Digium Asterisk 14.4.0 Release Candidate 1

14.4.0

Digium Asterisk 14.4.0 Release Candidate 2

14.4.0

Digium Asterisk 14.4.0 Release Candidate 3

14.4.0

Digium Asterisk 14.4.1

14.4.1

Digium Asterisk 14.5.0

14.5.0

Digium Asterisk 14.5.0 Release Candidate 1

14.5.0

Digium Asterisk 14.5.0 Release Candidate 2

14.5.0

Digium Asterisk 14.6.0

14.6.0

Digium Asterisk 14.6.0 Release Candidate 1

14.6.0

Digium Asterisk 11.0.0

11.0.0

Digium Asterisk 11.0.0 beta1

11.0.0

Digium Asterisk 11.0.0 beta2

11.0.0

Digium Asterisk 11.0.0 release candidate 1

11.0.0

Digium Asterisk 11.0.0 release candidate 2

11.0.0

Digium Asterisk 11.0.1

11.0.1

Digium Asterisk 11.0.2

11.0.2

Digium Asterisk 11.1.0

11.1.0

Digium Asterisk 11.1.0 release candidate 1

11.1.0

Digium Asterisk 11.1.0 release candidate 2

11.1.0

Digium Asterisk 11.1.0 release candidate 3

11.1.0

Digium Asterisk 11.1.1

11.1.1

Digium Asterisk 11.1.2

11.1.2

Digium Asterisk 11.2.0 release candidate 1

11.2.0

Digium Asterisk 11.2.1

11.2.1

Digium Asterisk 11.2.2

11.2.2

Digium Asterisk 11.4.0 release candidate 4

11.4.0

Digium Asterisk 11.6.0

11.6.0

Digium Asterisk 11.6.0 release candidate 1

11.6.0

Digium Asterisk 11.6.0 release candidate 2

11.6.0

Digium Asterisk 11.6.1

11.6.1

Digium Asterisk 11.7.0

11.7.0

Digium Asterisk 11.7.0 release candidate 1

11.7.0

Digium Asterisk 11.7.0 release candidate 2

11.7.0

Digium Asterisk 11.8.0

11.8.0

Digium Asterisk 11.8.0 release candidate 1

11.8.0

Digium Asterisk 11.8.0 release candidate 2

11.8.0

Digium Asterisk 11.8.0 release candidate 3

11.8.0

Digium Asterisk 11.8.1

11.8.1

Digium Asterisk 11.9.0

11.9.0

Digium Asterisk 11.9.0 release candidate 1

11.9.0

Digium Asterisk 11.9.0 release candidate 2

11.9.0

Digium Asterisk 11.9.0 release candidate 3

11.9.0

Digium Asterisk 11.10.0

11.10.0

Digium Asterisk 11.10.0 release candidate 1

11.10.0

Digium Asterisk 11.10.1

11.10.1

Digium Asterisk 11.10.1 release candidate 1

11.10.1

Digium Asterisk 11.10.2

11.10.2

Digium Asterisk 11.11.0

11.11.0

Digium Asterisk 11.11.0 release candidate 1

11.11.0

Digium Asterisk 11.12.0

11.12.0

Digium Asterisk 11.12.0 release candidate 1

11.12.0

Digium Asterisk 11.12.1

11.12.1

Digium Asterisk 11.13.0

11.13.0

Digium Asterisk 11.13.0 release candidate 1

11.13.0

Digium Asterisk 11.13.1

11.13.1

Digium Asterisk 11.14.0 LTS

11.14.0

Digium Asterisk 11.14.0 release candidate 1

11.14.0

Digium Asterisk 11.14.0 release candidate 2

11.14.0

Digium Asterisk 11.14.1

11.14.1

Digium Asterisk 11.14.2

11.14.2

Digium Asterisk 11.15.0 Release Candidate 1

11.15.0

Digium Asterisk 11.15.0 Release Candidate 2

11.15.0

Digium Asterisk 11.15.1

11.15.1

Digium Asterisk 11.16.0 Release Candidate 1

11.16.0

Digium Asterisk 11.17.0 Release Candidate

11.17.0

Digium Asterisk 11.17.1

11.17.1

Digium Asterisk 11.18.0

11.18.0

Digium Asterisk 11.18.0 Release Candidate 1

11.18.0

Digium Asterisk 11.19.0 Release Candidate 1

11.19.0

Digium Asterisk 11.20.0 Release Candidate 1

11.20.0

Digium Asterisk 11.21.0 Release Candidate 1

11.21.0

Digium Asterisk 11.21.0 Release Candidate 2

11.21.0

Digium Asterisk 11.21.1

11.21.1

Digium Asterisk 11.21.2

11.21.2

Digium Asterisk 11.22.0

11.22.0

Digium Asterisk 11.22.0 Release Candidate 1

11.22.0

Digium Asterisk 11.23.0

11.23.0

Digium Asterisk 11.23.0 Release Candidate 1

11.23.0

Digium Asterisk 11.23.1

11.23.1

Digium Asterisk 11.24.0

11.24.0

Digium Asterisk 11.24.1

11.24.1

Digium Asterisk 11.25.0

11.25.0

Digium Asterisk 11.25.1

11.25.1

Digium Certified Asterisk 11.6-cert1

11.6

Digium Certified Asterisk 11.6 Cert10

11.6

Digium Certified Asterisk 11.6 Cert11

11.6

Digium Certified Asterisk 11.6 Cert12

11.6

Digium Certified Asterisk 11.6 Cert13

11.6

Digium Certified Asterisk 11.6 Cert14

11.6

Digium Certified Asterisk 11.6 Cert15

11.6

Digium Certified Asterisk 11.6 Cert16

11.6

Digium Certified Asterisk 11.6-cert1 release candidate 1

11.6

Digium Certified Asterisk 11.6-cert1 release candidate 2

11.6

Digium Certified Asterisk 11.6-cert2

11.6

Digium Certified Asterisk 11.6-cert3

11.6

Digium Certified Asterisk 11.6 Cert4

11.6

Digium Certified Asterisk 11.6 Cert5

11.6

Digium Certified Asterisk 11.6 Cert6

11.6

Digium Certified Asterisk 11.6 Cert7

11.6

Digium Certified Asterisk 11.6 Cert8

11.6

Digium Certified Asterisk 11.6 Cert9

11.6

Digium Certified Asterisk 13.13 Cert2

13.13

Digium Certified Asterisk 13.13 Cert3

13.13

Digium Certified Asterisk 13.13 Cert4

13.13

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.