Summary
LibreNMS 1.65 contains a SQL injection vulnerability in the address parameter handled by the /ajax_table.php API endpoint. A remote authenticated attacker with normal privileges may manipulate database queries and extract information from the LibreNMS database.
Affected context
The vulnerability occurs in LibreNMS deployments using the affected /ajax_table.php API endpoint, where user-controlled address data is incorporated into database queries without sufficient separation from SQL syntax. Exploitation is relevant when an attacker can authenticate with an account having normal privileges and reach the endpoint.
Exploit preconditions
- Attack surface: The remotely accessible
/ajax_table.phpAPI endpoint - Required access: A valid authenticated account with normal privileges
- Trigger point: Processing of attacker-controlled input in the
addressparameter - Why exploitation is possible: Input may influence database query behavior because it is not adequately isolated from the underlying SQL statement
Why this happens
The underlying bug is an unsafe construction or handling of SQL queries using externally controlled input. When application data is interpreted as part of a database command rather than treated strictly as a value, an attacker may alter query behavior. This corresponds to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.
Potential impact
- An attacker may extract sensitive information from the LibreNMS database.
- Database credentials, monitoring data, device details, or user information could be exposed.
- Query manipulation could affect the confidentiality and integrity of stored application data.
- The vulnerability could support further compromise if exposed database information includes reusable secrets.
General mitigation guidance
Mitigation generally focuses on ensuring that all database queries treat external input as data rather than executable SQL.
Common defensive patterns include:
- Using parameterized queries or prepared statements for database access.
- Avoiding string concatenation when constructing SQL statements.
- Applying allowlist-based validation appropriate to the expected address format.
- Limiting database account privileges to only the operations required by the application.
- Restricting endpoint access and requiring authentication and authorization checks by default.
- Reducing the sensitivity and exposure of data returned by API responses.
How teams detect issues like this
Organizations commonly detect SQL injection risks through:
- Static analysis rules that identify query construction through string concatenation or interpolation.
- Code review checks for unparameterized database calls and inconsistent input handling.
- Web application monitoring for abnormal query parameters, repeated database errors, or unusual API response patterns.
- Database audit logs that reveal unexpected query structures or broad data-access behavior.
- Policy enforcement requiring prepared statements and approved database-access abstractions.
Automated application security testing and neutral code-review tools may help identify unsafe query patterns during development.

