Cloudanix VulnDB

CVE-2024-31458

Medium · 4.6

CVSS

4.6

EPSS

12.6%

Published

May 14, 2024

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A bug in the Cacti monitoring tool lets people who already have limited access change some stored data by sending specially crafted information through the web interface.

Exploitation
Requires User Interaction
Attacker needs
Low Privilege
Complexity
Low
Impact
Data Tampering
Component
Application
Class
SQL Injection
Remediation
Patch
Effort
Low
Patch risk
Low

What it actually does

Unsanitized input from form_save() in graph_template_inputs.php is concatenated into a SQL statement inside draw_nontemplated_fields_graph_item() in lib/html_form_templates.php, enabling an authenticated attacker to alter the generated query and modify database contents.

Why it matters to the business

Attackers can tamper with monitoring configuration data, leading to incorrect graphs, faulty alerting, and potential loss of operational visibility for organizations running Cacti.

How an attack unfolds

An attacker authenticates with limited privileges, crafts a malicious request containing SQL syntax in the form fields handled by form_save(), and triggers the draw_nontemplated_fields_graph_item() path that builds and executes the unsanitized query, resulting in unauthorized data changes.

How to fix it

Upgrade Cacti to version 1.2.27 or apply commit b577c294214b7e65a7273031ef8f0045d2a0c5af; restrict web application database accounts to least privilege; consider web application firewall rules that block suspicious SQL metacharacters in form parameters.

How to confirm the fix worked

Confirm the installed version is 1.2.27 or later; review the patched code in graph_template_inputs.php and html_form_templates.php to verify input sanitization is present; test the affected endpoints with known-bad input patterns in a non-production environment.

Typical attack path

  1. Obtain a low-privileged authenticated session
  2. Submit crafted POST data to the graph template inputs save endpoint
  3. Trigger rendering of nontemplated graph item fields to execute the injected SQL
  4. Observe or leverage resulting database modifications

How to detect it

Inspect web server and application logs for unexpected SQL syntax or errors originating from graph_template_inputs.php and html_form_templates.php; correlate with authentication events for the same session; search database audit logs for unauthorized modifications to graph-related tables.

What your security team should do

  • Apply the fixed commit or upgrade to 1.2.27 within the next maintenance window
  • Audit database permissions for the Cacti application account
  • Enable query logging and monitor for anomalous SQL statements from the web application
  • Review recent changes to graph templates for signs of tampering

The record

Cacti provides an operational monitoring and fault management framework. Prior to version 1.2.27, some of the data stored in `form_save()` function in `graph_template_inputs.php` is not thoroughly checked and is used to concatenate the SQL statement in `draw_nontemplated_fields_graph_item()` function from `lib/html_form_templates.php` , finally resulting in SQL injection. Version 1.2.27 contains a patch for the issue.

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 cacti 0 1.2.16+ds1-2+deb11u4
Debian:12 cacti 0 1.2.24+ds1-1+deb12u3
Debian:13 cacti 0 1.2.27+ds1-1
SUSE:Package Hub 12 cacti 0 1.2.27-bp155.2.9.1
SUSE:Package Hub 12 cacti-spine 0 1.2.27-bp155.2.9.1
SUSE:Package Hub 15 SP5 cacti 0 1.2.27-bp155.2.9.1
SUSE:Package Hub 15 SP5 cacti-spine 0 1.2.27-bp155.2.9.1
SUSE:Package Hub 15 SP6 cacti 0 1.2.27-bp156.2.3.1
SUSE:Package Hub 15 SP6 cacti-spine 0 1.2.27-bp156.2.3.1
Ubuntu:20.04:LTS cacti 0 No fix
Ubuntu:20.04:LTS cacti 0 1.2.10+ds1-1ubuntu1.1
Ubuntu:22.04:LTS cacti 0 No fix
Ubuntu:22.04:LTS cacti 0 1.2.19+ds1-2ubuntu1.1
Ubuntu:24.04:LTS cacti 0 No fix
Ubuntu:24.04:LTS cacti 0 1.2.26+ds1-1ubuntu0.1
Ubuntu:Pro:14.04:LTS cacti 0 No fix
Ubuntu:Pro:14.04:LTS cacti 0 0.8.8b+dfsg-5ubuntu0.2+esm2
Ubuntu:Pro:16.04:LTS cacti 0 No fix
Ubuntu:Pro:16.04:LTS cacti 0 0.8.8f+ds1-4ubuntu4.16.04.2+esm2
Ubuntu:Pro:18.04:LTS cacti 0 No fix
Ubuntu:Pro:18.04:LTS cacti 0 1.1.38+ds1-1ubuntu0.1~esm3
openSUSE:Leap 15.5 cacti 0 1.2.27-bp155.2.9.1
openSUSE:Leap 15.5 cacti-spine 0 1.2.27-bp155.2.9.1
openSUSE:Leap 15.6 cacti 0 1.2.27-bp156.2.3.1
openSUSE:Leap 15.6 cacti-spine 0 1.2.27-bp156.2.3.1
openSUSE:Tumbleweed cacti 0 1.2.27-1.1

Related vulnerabilities