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

Severity

72%

Complexity

39%

Confidentiality

165%

A vulnerability in the CLI command-parsing code of the Cisco StarOS operating system for Cisco ASR 5000 Series 11.0 through 21.0, 5500 Series, and 5700 Series devices and Cisco Virtualized Packet Core (VPC) Software could allow an authenticated, local attacker to break from the StarOS CLI of an affected system and execute arbitrary shell commands as a Linux root user on the system, aka Command Injection. The vulnerability exists because the affected operating system does not sufficiently sanitize commands before inserting them into Linux shell commands. An attacker could exploit this vulnerability by submitting a crafted CLI command for execution in a Linux shell command as a root user. Cisco Bug IDs: CSCvc69329, CSCvc72930.

A vulnerability in the CLI command-parsing code of the Cisco StarOS operating system for Cisco ASR 5000 Series 11.0 through 21.0, 5500 Series, and 5700 Series devices and Cisco Virtualized Packet Core (VPC) Software could allow an authenticated, local attacker to break from the StarOS CLI of an affected system and execute arbitrary shell commands as a Linux root user on the system, aka Command Injection. The vulnerability exists because the affected operating system does not sufficiently sanitize commands before inserting them into Linux shell commands. An attacker could exploit this vulnerability by submitting a crafted CLI command for execution in a Linux shell command as a root user. Cisco Bug IDs: CSCvc69329, CSCvc72930.

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

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

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

Cisco StarOS

First reported 7 years ago

2017-07-06 00:29:00

Last updated 7 years ago

2017-07-08 01:29:00

Affected Software

Cisco StarOS 11.0 Base

11.0_base

Cisco StarOS 12.0.0

12.0.0

Cisco StarOS 12.1 Base

12.1_base

Cisco StarOS 12.2(300)

12.2\(300\)

Cisco StarOS 12.2 Base

12.2_base

Cisco StarOS 14.0(600)

14.0\(600\)

Cisco StarOS 14.0.0

14.0.0

Cisco StarOS 15.0(912)

15.0\(912\)

Cisco StarOS 15.0(935)

15.0\(935\)

Cisco StarOS 15.0(938)

15.0\(938\)

Cisco StarOS 15.0 Base

15.0_base

Cisco StarOS 16.0(900)

16.0\(900\)

Cisco StarOS 16.0.0

16.0.0

Cisco StarOS 16.1.0

16.1.0

Cisco StarOS 16.1.1

16.1.1

Cisco StarOS 16.1.2

16.1.2

Cisco StarOS 16.5.0

16.5.0

Cisco StarOS 16.5.2

16.5.2

Cisco StarOS 17.2.0

17.2.0

Cisco StarOS 17.2.0.59184

17.2.0.59184

Cisco StarOS 17.3.0

17.3.0

Cisco StarOS 17.3.1

17.3.1

Cisco StarOS 17.3 Base

17.3_base

Cisco StarOS 17.7.0

17.7.0

Cisco StarOS 18.0.0

18.0.0

Cisco StarOS 18.0.0.57828

18.0.0.57828

Cisco StarOS 18.0.0.59167

18.0.0.59167

Cisco StarOS 18.0.0.59211

18.0.0.59211

Cisco StarOS 18.0.l0.59219

18.0.l0.59219

Cisco StarOS 18.1.0

18.1.0

Cisco StarOS 18.1.0.59776

18.1.0.59776

Cisco StarOS 18.1.0.59780

18.1.0.59780

Cisco StarOS 18.1 Base

18.1_base

Cisco StarOS 18.3.0

18.3.0

Cisco StarOS 18.3 Base

18.3_base

Cisco StarOS 18.4.0

18.4.0

Cisco StarOS 19.0.1

19.0.1

Cisco StarOS 19.0.m0.60737

19.0.m0.60737

Cisco StarOS 19.0.m0.60828

19.0.m0.60828

Cisco StarOS 19.0.m0.61045

19.0.m0.61045

Cisco StarOS 19.1.0

19.1.0

Cisco StarOS 19.1.0.61559

19.1.0.61559

Cisco StarOS 19.2.0

19.2.0

Cisco StarOS 19.3.0

19.3.0

Cisco StarOS 20.0.0

20.0.0

Cisco StarOS 20.0.1.0

20.0.1.0

Cisco StarOS 20.0.1.a0

20.0.1.a0

Cisco StarOS 20.0.1.v0

20.0.1.v0

Cisco StarOS 20.0.2.3

20.0.2.3

Cisco StarOS 20.0.2.3.65026

20.0.2.3.65026

Cisco StarOS 20.0.2.v1

20.0.2.v1

Cisco StarOS 20.0.m0.62842

20.0.m0.62842

Cisco StarOS 20.0.m0.63229

20.0.m0.63229

Cisco StarOS 20.0.v0

20.0.v0

Cisco StarOS 21.0 Base

21.0_base

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.