Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N
Network-accessible API requires only a low-privilege authenticated session (PR:L); table-name injection position constrains write-path impact to I:L; no availability impact in a read-path query context.
Primary rating from Vendor (TuranSec).
CVSS VectorVendor: TuranSec
Lifecycle Timeline
2DescriptionCVE.org
Magistrala (formerly Mainflux)'s message-readers API reads a format value from the HTTP query string (readers/api/http/transport.go) with no validation and interpolates it directly into raw SQL queries via fmt.Sprintf() in both the PostgreSQL reader (readers/postgres/messages.go: fmt.Sprintf("SELECT * FROM %s WHERE %s ...", format, cond)) and the TimescaleDB reader (readers/timescale/messages.go, same pattern), enabling SQL injection by any authenticated user able to query channel messages.
AnalysisAI
SQL injection in Magistrala's message-readers API exposes PostgreSQL and TimescaleDB backends to arbitrary query manipulation by any authenticated platform user. The unvalidated format HTTP query parameter is interpolated directly into raw SQL at the table-name identifier position via Go's fmt.Sprintf() in both readers/postgres/messages.go and readers/timescale/messages.go, enabling exfiltration of database contents with high confidentiality impact (CVSS C:H). The wildcard CPE (cpe:2.3:a:absmach:magistrala:*) indicates all known versions are affected; no vendor-released patch has been confirmed in available references, and no public exploit code or CISA KEV listing has been identified at time of analysis.
Technical ContextAI
Magistrala (formerly Mainflux) is an open-source IoT messaging and device-management platform by absmach. The vulnerability is a CWE-89 (Improper Neutralization of Special Elements used in an SQL Command) flaw originating in the HTTP transport layer at readers/api/http/transport.go, which reads the format query string parameter and passes it unsanitized downstream. Both the PostgreSQL reader (readers/postgres/messages.go) and TimescaleDB reader (readers/timescale/messages.go) construct raw SQL using the pattern fmt.Sprintf("SELECT * FROM %s WHERE %s ...", format, cond). Because the injection occurs at the SQL identifier (table name) position rather than a value position, standard parameterized query drivers cannot protect against it - PostgreSQL does not support bind parameters for identifiers. This means the only correct fix is allowlist validation of the format value before query construction. Depending on the Go PostgreSQL driver configuration, stacked queries or subquery-based exfiltration techniques may be feasible.
RemediationAI
No vendor-released patch has been identified at time of analysis - available references point only to the upstream repository and vulnerable source files, with no fixed release or security advisory noted. Operators should immediately restrict access to the message-readers API endpoint to the minimum set of authenticated principals required, enforced at the API gateway or network-policy layer. As a code-level compensating control, developers should implement strict allowlist validation on the format parameter before it reaches the SQL construction path - reject any value not matching the exact set of expected table identifiers using a map or switch statement; do not use regex alone, as bypass risk exists. Since PostgreSQL does not support parameterized identifiers, driver-level escaping is insufficient and the allowlist is the only sound fix. Monitor the upstream repository at https://github.com/absmach/magistrala for a patched release. Enabling PostgreSQL statement-level logging can help detect exploitation attempts in the interim.
More in PostgreSQL
View allPostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() improperl
An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl
Argument injection vulnerability in PostgreSQL 9.2.x before 9.2.4, 9.1.x before 9.1.9, and 9.0.x before 9.0.13 allows re
Unauthenticated arbitrary file write in Splunk Enterprise (below 10.2.4 and 10.0.7) and Splunk Cloud Platform (below 10.
Unauthenticated SQL injection in Sangoma Switchvox SMB Edition 8.3 (build 104997) lets remote attackers execute arbitrar
PostgreSQL versions before 9.2.22, 9.3.18, 9.4.13, 9.5.8 and 9.6.4 are vulnerable to incorrect authentication flaw allow
The build_tablename function in pgsql.c in the PostgreSQL (aka pgsql) extension in PHP through 5.6.7 does not validate t
A vulnerability in the h2oai/h2o-3 REST API versions 3.46.0.4 allows unauthenticated remote attackers to execute arbitra
In PostgreSQL 9.3 through 11.2, the "COPY TO/FROM PROGRAM" function allows superusers and users in the 'pg_execute_serve
Unauthenticated SQL injection in Vendure Shop API allows remote attackers to execute arbitrary SQL commands against the
Parse Server is an open source http web server backend. Rated critical severity (CVSS 10.0), this vulnerability is remot
Hard-coded default PostgreSQL credentials shipped in the docker-compose.yaml of langgenius Dify through version 1.5.1 al
Same weakness CWE-89 – SQL Injection
View allShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-53361
GHSA-pwc8-43hr-jg4j