RC RANDOM CHAOS

Four HTTP requests take a Cacti guest to root

An unauthenticated stored SQL injection in Cacti lets attackers run commands in four HTTP requests. Patch, mitigations and detection guidance for defenders.

· 3 min read
Four HTTP requests take a Cacti guest to root

A researcher going by ek0ms savi0r, from the Church of Malware, published a working Cacti exploit on Thanksgiving Day that goes from a fresh, unauthenticated HTTP session to command execution in four requests. “No login. No valid API key. No phishing. Just four HTTP requests against the default guest surface,” the researcher wrote. The exploit, named 4HTTP2SHELL (earlier 4HTTP2ROOT), shipped as a technical write-up, a proof-of-concept, and a video in a GitHub repository called “Sad Girls 0day Club.” It was not reported to Cacti before release.

Cacti is an open-source monitoring and graphing tool that polls servers, routers, switches and firewalls for performance data. To do that it stores credentials and SNMP passphrases for the devices it watches, so command execution on a Cacti host gives an attacker a route to the rest of the network rather than one isolated box.

How the four requests work

The bug is a stored SQL injection in how Cacti validates guest users’ graph display settings. RavenAI’s breakdown: an attacker saves malicious SQL into a guest user’s graph display preferences, which get written to Cacti’s database. When Cacti later reads those preferences back, it executes the stored SQL. That lets the attacker rewrite the real-time poller’s configuration so the poller runs operating system commands. The only precondition is that the Cacti guest account is enabled. No valid credentials are required.

The researcher’s demo landed root. watchTowr notes that the privileges you actually get depend on the account running the Cacti web server and poller processes, which in many deployments is a low-privileged web account rather than root. Either way, it is code execution on a host that holds device credentials.

The exploit was tested against Cacti Core 1.2.31. Whether earlier versions are affected is not yet clear.

ek0ms savi0r used the release to air a grievance about disclosure, describing years of reports closed as duplicates, expected behavior, or issues that could not be reproduced. “We get cracked because we get gaslit for years by billion dollar companies that treat disclosure like a PR problem,” the researcher wrote. That is the stated reason this one dropped as a full-disclosure zero-day with a video on a holiday instead of going through a coordinated process.

Patch and mitigations

On November 28, Cacti developer Sean Mancini told BleepingComputer the vulnerability is patched, with a fix merged into the Cacti 1.2.31 maintenance branch. The patch stops guest users from saving profile or graph display preferences and adds validation of graph settings. If you run 1.2.31 you can apply the fix manually, but the Cacti team recommends testing it in a lab first to catch any issues before it hits production.

If you cannot patch immediately, disabling the guest account removes the precondition entirely. Restrict the web interface to trusted networks. Review poller configurations for commands you did not put there, and check application logs for warnings about non-numeric values in graph display settings, which is what an attempt looks like.

As of November 27 there were no reports of exploitation in the wild. With a PoC and a demonstration video already public, that is the window you are working against.

Share

Keep Reading

Latest on the Wire

Full wire →

New signal daily · RSS

Stay in the loop

New writing delivered when it's ready. No schedule, no spam.