1 Commits
Author SHA1 Message Date
Thomas VincentandTheWitness 4238aadcb1 security: escape LIKE wildcards in poller_automation and plugins.php filters (#7670)
* security: add db_like_escape and bind the PTR hostname in poller_automation

poller_automation.php concatenated the gethostbyaddr() result into a LIKE clause, so an attacker controlling the reverse-DNS zone injected SQL through a crafted PTR record. The new db_like_escape() helper neutralises the LIKE metacharacters, and the reverse-DNS hostname is now passed as a bound parameter (LIKE ?). The escape semantics are covered by unit tests and verified against a live MariaDB.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* security: bind and LIKE-escape the plugins.php filter (GHSA-jjfq-mj5r-2r95)

The plugins.php filter reached its LIKE clauses through db_qstr(), which escapes quotes but not the LIKE metacharacters, so a filter of '%' matched every row and bypassed the state filter. The filter LIKE clauses are now bound placeholders and the value is LIKE-escaped once with db_like_escape() and reused for each placeholder; the count and list queries are prepared.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
2026-08-16 21:15:44 -04:00