CVE-2026-58225
Full vulnerability record from the local CVENow database.
Description
SQL Injection vulnerability in elixir-ecto postgrex allows an attacker who can influence a LISTEN channel name to inject SQL into the reconnect replay query, causing a denial of service of the notification connection. Postgrex.Notifications sanitizes channel names with quote_channel/1, which doubles double quotes so the name is safe inside a double-quoted identifier. This protects the single-statement LISTEN and UNLISTEN paths. On every (re)connect, however, handle_connect/1 replays all registered channels at once by concatenating their LISTEN statements and wrapping them in a dollar-quoted anonymous code block (DO $$BEGIN ... END$$). quote_channel/1 does not escape the $$ dollar-quote delimiter that opens and closes this block. The listen/3 guards only reject null bytes and names longer than 63 bytes, so a channel name containing $$ passes validation unchanged. Once such a name is embedded, its $$ prematurely terminates the outer dollar-quoted string and PostgreSQL parses the remainder as additional top-level statements. Because handle_connect/1 runs on every (re)connect, the malformed replay query is rejected each time and the notification connection never re-establishes its subscriptions, silently dropping notifications for every channel sharing that connection. An application is affected when it passes untrusted input (for example a tenant or user identifier) as a channel name to Postgrex.Notifications.listen/3. The double-quote doubling prevents forming a fully valid injected statement, so arbitrary SQL execution is not possible, but the corrupted query reliably breaks the shared notification connection for all tenants, resulting in denial of service. This issue affects postgrex: from 0.16.0 before 0.22.3.
View original CVE JSON
{
"id": "CVE-2026-58225",
"sourceIdentifier": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db",
"published": "2026-07-10T11:16:36.300",
"lastModified": "2026-10-24T23:10:00.160",
"vulnStatus": "Deferred",
"cveTags": [],
"descriptions": [
{
"lang": "en",
"value": "SQL Injection vulnerability in elixir-ecto postgrex allows an attacker who can influence a LISTEN channel name to inject SQL into the reconnect replay query, causing a denial of service of the notification connection.\n\nPostgrex.Notifications sanitizes channel names with quote_channel/1, which doubles double quotes so the name is safe inside a double-quoted identifier. This protects the single-statement LISTEN and UNLISTEN paths. On every (re)connect, however, handle_connect/1 replays all registered channels at once by concatenating their LISTEN statements and wrapping them in a dollar-quoted anonymous code block (DO $$BEGIN ... END$$). quote_channel/1 does not escape the $$ dollar-quote delimiter that opens and closes this block.\n\nThe listen/3 guards only reject null bytes and names longer than 63 bytes, so a channel name containing $$ passes validation unchanged. Once such a name is embedded, its $$ prematurely terminates the outer dollar-quoted string and PostgreSQL parses the remainder as additional top-level statements. Because handle_connect/1 runs on every (re)connect, the malformed replay query is rejected each time and the notification connection never re-establishes its subscriptions, silently dropping notifications for every channel sharing that connection.\n\nAn application is affected when it passes untrusted input (for example a tenant or user identifier) as a channel name to Postgrex.Notifications.listen/3. The double-quote doubling prevents forming a fully valid injected statement, so arbitrary SQL execution is not possible, but the corrupted query reliably breaks the shared notification connection for all tenants, resulting in denial of service.\n\nThis issue affects postgrex: from 0.16.0 before 0.22.3."
},
{
"lang": "es",
"value": "Vulnerabilidad de inyección SQL en elixir-ecto postgrex permite a un atacante que puede influir en el nombre de un canal LISTEN inyectar SQL en la consulta de repetición de reconexión, causando una denegación de servicio de la conexión de notificación.\n\nPostgrex.Notifications sanea los nombres de los canales con quote_channel/1, que duplica las comillas dobles para que el nombre sea seguro dentro de un identificador entre comillas dobles. Esto protege las rutas LISTEN y UNLISTEN de una sola declaración. En cada (re)conexión, sin embargo, handle_connect/1 reproduce todos los canales registrados a la vez concatenando sus declaraciones LISTEN y envolviéndolas en un bloque de código anónimo entre comillas de dólar (DO $$BEGIN ... END$$). quote_channel/1 no escapa el delimitador de comillas de dólar $$ que abre y cierra este bloque.\n\nLas guardas de listen/3 solo rechazan bytes nulos y nombres de más de 63 bytes, por lo que un nombre de canal que contenga $$ pasa la validación sin cambios. Una vez que dicho nombre está incrustado, su $$ termina prematuramente la cadena externa entre comillas de dólar y PostgreSQL analiza el resto como declaraciones de nivel superior adicionales. Debido a que handle_connect/1 se ejecuta en cada (re)conexión, la consulta de repetición malformada es rechazada cada vez y la conexión de notificación nunca restablece sus suscripciones, descartando silenciosamente las notificaciones para cada canal que comparte esa conexión.\n\nUna aplicación se ve afectada cuando pasa una entrada no confiable (por ejemplo, un identificador de inquilino o usuario) como nombre de canal a Postgrex.Notifications.listen/3. La duplicación de comillas dobles impide formar una declaración inyectada completamente válida, por lo que la ejecución arbitraria de SQL no es posible, pero la consulta corrupta rompe de forma fiable la conexión de notificación compartida para todos los inquilinos, lo que resulta en una denegación de servicio.\n\nEste problema afecta a postgrex: desde 0.16.0 antes de 0.22.3."
}
],
"affected": [
{
"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db",
"affectedData": [
{
"vendor": "elixir-ecto",
"product": "postgrex",
"defaultStatus": "unaffected",
"collectionURL": "https://repo.hex.pm",
"packageName": "postgrex",
"cpes": [
"cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*"
],
"modules": [
"'Elixir.Postgrex.Notifications'"
],
"programFiles": [
"lib/postgrex/notifications.ex"
],
"programRoutines": [
{
"name": "'Elixir.Postgrex.Notifications':handle_connect/1"
},
{
"name": "'Elixir.Postgrex.Notifications':listen/3"
}
],
"repo": "https://github.com/elixir-ecto/postgrex",
"packageURL": "pkg:hex/postgrex",
"versions": [
{
"version": "0.16.0",
"lessThan": "0.22.3",
"versionType": "semver",
"status": "affected"
}
]
},
{
"vendor": "elixir-ecto",
"product": "postgrex",
"defaultStatus": "unaffected",
"collectionURL": "https://github.com",
"packageName": "elixir-ecto/postgrex",
"cpes": [
"cpe:2.3:a:elixir-ecto:postgrex:*:*:*:*:*:*:*:*"
],
"modules": [
"'Elixir.Postgrex.Notifications'"
],
"programFiles": [
"lib/postgrex/notifications.ex"
],
"programRoutines": [
{
"name": "'Elixir.Postgrex.Notifications':handle_connect/1"
},
{
"name": "'Elixir.Postgrex.Notifications':listen/3"
}
],
"repo": "https://github.com/elixir-ecto/postgrex",
"packageURL": "pkg:github/elixir-ecto/postgrex",
"versions": [
{
"version": "266b530faf9bde094e31e0e4ab851f933fadc0f5",
"lessThan": "795c6062f62c4394272ff4b89170688857b4f841",
"versionType": "git",
"status": "affected"
}
]
}
]
}
],
"metrics": {
"cvssMetricV40": [
{
"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db",
"type": "Secondary",
"cvssData": {
"version": "4.0",
"vectorString": "CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"baseScore": 2.1,
"baseSeverity": "LOW",
"attackVector": "LOCAL",
"attackComplexity": "LOW",
"attackRequirements": "PRESENT",
"privilegesRequired": "NONE",
"userInteraction": "NONE",
"vulnConfidentialityImpact": "NONE",
"vulnIntegrityImpact": "NONE",
"vulnAvailabilityImpact": "LOW",
"subConfidentialityImpact": "NONE",
"subIntegrityImpact": "NONE",
"subAvailabilityImpact": "NONE",
"exploitMaturity": "NOT_DEFINED",
"confidentialityRequirement": "NOT_DEFINED",
"integrityRequirement": "NOT_DEFINED",
"availabilityRequirement": "NOT_DEFINED",
"modifiedAttackVector": "NOT_DEFINED",
"modifiedAttackComplexity": "NOT_DEFINED",
"modifiedAttackRequirements": "NOT_DEFINED",
"modifiedPrivilegesRequired": "NOT_DEFINED",
"modifiedUserInteraction": "NOT_DEFINED",
"modifiedVulnConfidentialityImpact": "NOT_DEFINED",
"modifiedVulnIntegrityImpact": "NOT_DEFINED",
"modifiedVulnAvailabilityImpact": "NOT_DEFINED",
"modifiedSubConfidentialityImpact": "NOT_DEFINED",
"modifiedSubIntegrityImpact": "NOT_DEFINED",
"modifiedSubAvailabilityImpact": "NOT_DEFINED",
"Safety": "NOT_DEFINED",
"Automatable": "NOT_DEFINED",
"Recovery": "NOT_DEFINED",
"valueDensity": "NOT_DEFINED",
"vulnerabilityResponseEffort": "NOT_DEFINED",
"providerUrgency": "NOT_DEFINED"
}
}
],
"ssvcV203": [
{
"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"ssvcData": {
"timestamp": "2026-07-10T11:47:10.671088Z",
"id": "CVE-2026-58225",
"options": [
{
"exploitation": "poc"
},
{
"automatable": "no"
},
{
"technicalImpact": "partial"
}
],
"role": "CISA Coordinator",
"version": "2.0.3"
}
}
]
},
"weaknesses": [
{
"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db",
"type": "Secondary",
"description": [
{
"lang": "en",
"value": "CWE-89"
}
]
}
],
"references": [
{
"url": "https://cna.erlef.org/cves/CVE-2026-58225.html",
"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db"
},
{
"url": "https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w",
"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db"
},
{
"url": "https://github.com/elixir-ecto/postgrex/commit/795c6062f62c4394272ff4b89170688857b4f841",
"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db"
},
{
"url": "https://osv.dev/vulnerability/EEF-CVE-2026-58225",
"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db"
},
{
"url": "https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w",
"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0"
}
]
}