CVE-2018-20173 - Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Severity

75%

Complexity

99%

Confidentiality

106%

Zoho ManageEngine OpManager 12.3 before 123238 allows SQL injection via the getGraphData API.

Zoho ManageEngine OpManager 12.3 before 123238 allows SQL injection via the getGraphData API.

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 SQL Command ('SQL Injection')

CWE-89

In 2008, a large number of web servers were compromised using the same SQL injection attack string. This single string worked against many different programs. The SQL injection was then used to modify the web sites to serve malicious code.

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

CWE-89

The following code dynamically constructs and executes a SQL query that searches for items matching a specified name. The query restricts the items displayed to those where owner matches the user name of the currently-authenticated user.


               
...

The query that this code intends to execute follows:


               
SELECT * FROM items WHERE owner = <userName> AND itemname = <itemName>;

However, because the query is constructed dynamically by concatenating a constant base query string and a user input string, the query only behaves correctly if itemName does not contain a single-quote character. If an attacker with the user name wiley enters the string:


               
name' OR 'a'='a

for itemName, then the query becomes the following:


               
SELECT * FROM items WHERE owner = 'wiley' AND itemname = 'name' OR 'a'='a';

The addition of the:


               
OR 'a'='a

condition causes the WHERE clause to always evaluate to true, so the query becomes logically equivalent to the much simpler query:


               
SELECT * FROM items;

This simplification of the query allows the attacker to bypass the requirement that the query only return items owned by the authenticated user; the query now returns all entries stored in the items table, regardless of their specified owner.

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

CWE-89

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

CWE-89

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

CWE-89

This code intends to print a message summary given the message ID.


               
mysql_query("SELECT MessageID, Subject FROM messages WHERE MessageID = '$id'");

The programmer may have skipped any input validation on $id under the assumption that attackers cannot modify the cookie. However, this is easy to do with custom client code or even in the web browser.

While $id is wrapped in single quotes in the call to mysql_query(), an attacker could simply change the incoming mid cookie to:


               
1432' or '1' = '1

This would produce the resulting query:


               
SELECT MessageID, Subject FROM messages WHERE MessageID = '1432' or '1' = '1'

Not only will this retrieve message number 1432, it will retrieve all other messages.

In this case, the programmer could apply a simple modification to the code to eliminate the SQL injection:


               
mysql_query("SELECT MessageID, Subject FROM messages WHERE MessageID = '$id'");

However, if this code is intended to support multiple users with different message boxes, the code might also need an access control check (CWE-285) to ensure that the application user has the permission to see that message.

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

CWE-89

This example attempts to take a last name provided by a user and enter it into a database.


               
$query = "INSERT INTO last_names VALUES('$userKey', '$name')";# ensure only letters, hyphens and apostrophe are allowed

While the programmer applies a whitelist to the user input, it has shortcomings. First of all, the user is still allowed to provide hyphens which are used as comment structures in SQL. If a user specifies -- then the remainder of the statement will be treated as a comment, which may bypass security logic. Furthermore, the whitelist permits the apostrophe which is also a data / command separator in SQL. If a user supplies a name with an apostrophe, they may be able to alter the structure of the whole statement and even change control flow of the program, possibly accessing or modifying confidential information. In this situation, both the hyphen and apostrophe are legitimate characters for a last name and permitting them is required. Instead, a programmer may want to use a prepared statement or apply an encoding routine to the input to prevent any data / directive misinterpretations.

Overview

Type

ZohoCorp ManageEngine OpManager

First reported 6 years ago

2018-12-17 08:29:00

Last updated 6 years ago

2019-01-04 16:56:00

Affected Software

ZohoCorp ManageEngine OpManager 12.3 12300

12.3

ZohoCorp ManageEngine OpManager 12.3 123001

12.3

ZohoCorp ManageEngine OpManager 12.3 123002

12.3

ZohoCorp ManageEngine OpManager 12.3 123003

12.3

ZohoCorp ManageEngine OpManager 12.3 123004

12.3

ZohoCorp ManageEngine OpManager 12.3 123005

12.3

ZohoCorp ManageEngine OpManager 12.3 123006

12.3

ZohoCorp ManageEngine OpManager 12.3 123007

12.3

ZohoCorp ManageEngine OpManager 12.3 123008

12.3

ZohoCorp ManageEngine OpManager 12.3 123009

12.3

ZohoCorp ManageEngine OpManager 12.3 123010

12.3

ZohoCorp ManageEngine OpManager 12.3 123011

12.3

ZohoCorp ManageEngine OpManager 12.3 123012

12.3

ZohoCorp ManageEngine OpManager 12.3 123013

12.3

ZohoCorp ManageEngine OpManager 12.3 123014

12.3

ZohoCorp ManageEngine OpManager 12.3 123015

12.3

ZohoCorp ManageEngine OpManager 12.3 123021

12.3

ZohoCorp ManageEngine OpManager 12.3 123022

12.3

ZohoCorp ManageEngine OpManager 12.3 123023

12.3

ZohoCorp ManageEngine OpManager 12.3 123024

12.3

ZohoCorp ManageEngine OpManager 12.3 123025

12.3

ZohoCorp ManageEngine OpManager 12.3 123026

12.3

ZohoCorp ManageEngine OpManager 12.3 123027

12.3

ZohoCorp ManageEngine OpManager 12.3 123028

12.3

ZohoCorp ManageEngine OpManager 12.3 123029

12.3

ZohoCorp ManageEngine OpManager 12.3 123030

12.3

ZohoCorp ManageEngine OpManager 12.3 123031

12.3

ZohoCorp ManageEngine OpManager 12.3 123032

12.3

ZohoCorp ManageEngine OpManager 12.3 123033

12.3

ZohoCorp ManageEngine OpManager 12.3 123034

12.3

ZohoCorp ManageEngine OpManager 12.3 123035

12.3

ZohoCorp ManageEngine OpManager 12.3 123036

12.3

ZohoCorp ManageEngine OpManager 12.3 123037

12.3

ZohoCorp ManageEngine OpManager 12.3 123043

12.3

ZohoCorp ManageEngine OpManager 12.3 123044

12.3

ZohoCorp ManageEngine OpManager 12.3 123045

12.3

ZohoCorp ManageEngine OpManager 12.3 123046

12.3

ZohoCorp ManageEngine OpManager 12.3 123047

12.3

ZohoCorp ManageEngine OpManager 12.3 123048

12.3

ZohoCorp ManageEngine OpManager 12.3 123049

12.3

ZohoCorp ManageEngine OpManager 12.3 123050

12.3

ZohoCorp ManageEngine OpManager 12.3 123051

12.3

ZohoCorp ManageEngine OpManager 12.3 123052

12.3

ZohoCorp ManageEngine OpManager 12.3 123053

12.3

ZohoCorp ManageEngine OpManager 12.3 123054

12.3

ZohoCorp ManageEngine OpManager 12.3 123055

12.3

ZohoCorp ManageEngine OpManager 12.3 123056

12.3

ZohoCorp ManageEngine OpManager 12.3 123057

12.3

ZohoCorp ManageEngine OpManager 12.3 123062

12.3

ZohoCorp ManageEngine OpManager 12.3 123063

12.3

ZohoCorp ManageEngine OpManager 12.3 123064

12.3

ZohoCorp ManageEngine OpManager 12.3 123065

12.3

ZohoCorp ManageEngine OpManager 12.3 123066

12.3

ZohoCorp ManageEngine OpManager 12.3 123067

12.3

ZohoCorp ManageEngine OpManager 12.3 123068

12.3

ZohoCorp ManageEngine OpManager 12.3 123069

12.3

ZohoCorp ManageEngine OpManager 12.3 123070

12.3

ZohoCorp ManageEngine OpManager 12.3 123076

12.3

ZohoCorp ManageEngine OpManager 12.3 123077

12.3

ZohoCorp ManageEngine OpManager 12.3 123078

12.3

ZohoCorp ManageEngine OpManager 12.3 123079

12.3

ZohoCorp ManageEngine OpManager 12.3 123080

12.3

ZohoCorp ManageEngine OpManager 12.3 123081

12.3

ZohoCorp ManageEngine OpManager 12.3 123082

12.3

ZohoCorp ManageEngine OpManager 12.3 123083

12.3

ZohoCorp ManageEngine OpManager 12.3 123084

12.3

ZohoCorp ManageEngine OpManager 12.3 123086

12.3

ZohoCorp ManageEngine OpManager 12.3 123090

12.3

ZohoCorp ManageEngine OpManager 12.3 123091

12.3

ZohoCorp ManageEngine OpManager 12.3 123092

12.3

ZohoCorp ManageEngine OpManager 12.3 123192

12.3

ZohoCorp ManageEngine OpManager 12.3 123193

12.3

ZohoCorp ManageEngine OpManager 12.3 123194

12.3

ZohoCorp ManageEngine OpManager 12.3 123195

12.3

ZohoCorp ManageEngine OpManager 12.3 123196

12.3

ZohoCorp ManageEngine OpManager 12.3 123197

12.3

ZohoCorp ManageEngine OpManager 12.3 123198

12.3

ZohoCorp ManageEngine OpManager 12.3 123204

12.3

ZohoCorp ManageEngine OpManager 12.3 123205

12.3

ZohoCorp ManageEngine OpManager 12.3 123206

12.3

ZohoCorp ManageEngine OpManager 12.3 123207

12.3

ZohoCorp ManageEngine OpManager 12.3 123208

12.3

ZohoCorp ManageEngine OpManager 123222

12.3

ZohoCorp ManageEngine OpManager 123223

12.3

ZohoCorp ManageEngine OpManager 123224

12.3

ZohoCorp ManageEngine OpManager 123229

12.3

ZohoCorp ManageEngine OpManager 123230

12.3

ZohoCorp ManageEngine OpManager 123231

12.3

ZohoCorp ManageEngine OpManager 12.3 123237

12.3

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.