chore(deps): update dependency postgrex to v0.22.4 [security] #580

Open
renovate wants to merge 1 commit from renovate/hex-postgrex-vulnerability into main
Collaborator

This PR contains the following updates:

Package Type Update Change
postgrex (source) prod patch 0.22.2 → 0.22.4

SQL injection via unescaped dollar-quote in Postgrex.Notifications reconnect replay causes notification denial of service

CVE-2026-58225 / EEF-CVE-2026-58225 / GHSA-4mw9-4qgj-m97w

More information

Details

Summary

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.

Workarounds

Validate channel names before passing untrusted input to Postgrex.Notifications.listen/3. Reject any name that contains the dollar-quote delimiter (), or restrict channel names to a safe character set such as alphanumeric characters and underscores.

Severity

  • CVSS Score: 2.1 / 10 (Low)
  • Vector String: 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

References

This data is provided by OSV.


SQL injection via the :comment option in Postgrex.stream/4

CVE-2026-66838 / EEF-CVE-2026-66838 / GHSA-3gww-3f36-2388

More information

Details

Summary

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') vulnerability in elixir-ecto postgrex allows SQL Injection via the :comment option of Postgrex.stream/4. An attacker who can influence that value can close the comment delimiter with */ and extend the streamed statement with their own clauses, which execute under the connection's role. Ecto exposes the same option through Ecto.Repo.stream/2.

Postgrex appends the comment by concatenating it into the statement text sent in the Parse message, without escaping or rejecting */. The option is validated by comment_not_present!/1 at every other execution point; stream/4 never calls it. Because Parse accepts a single command, the injection is confined to the streamed statement and further statements cannot be chained.

This issue affects postgrex: from 0.19.3 before 0.22.4.

Workarounds

Reject any :comment value containing */ or a null byte before passing it to Postgrex.stream/4 or Ecto.Repo.stream/2. Alternatively, build comments only from trusted values.

Configurations

The application must pass a :comment derived from untrusted input to Postgrex.stream/4 or Ecto.Repo.stream/2. Applications that omit the option or pass only static values are unaffected.

Severity

  • CVSS Score: 5.9 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N

References

This data is provided by OSV.


Release Notes

elixir-ecto/postgrex (postgrex)

v0.22.4

Compare Source

  • Security
    • Escape comments on Postgrex.stream/4 (CVE-2026-66838)

v0.22.3

Compare Source

  • Security
    • Escape dollar signs in channel names in Postgrex.Notifications.listen/3 (CVE-2026-58225)

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [postgrex](https://hex.pm/packages/postgrex) ([source](https://github.com/elixir-ecto/postgrex)) | prod | patch | `0.22.2` → `0.22.4` | --- ### SQL injection via unescaped dollar-quote in Postgrex.Notifications reconnect replay causes notification denial of service [CVE-2026-58225](https://nvd.nist.gov/vuln/detail/CVE-2026-58225) / EEF-CVE-2026-58225 / [GHSA-4mw9-4qgj-m97w](https://github.com/advisories/GHSA-4mw9-4qgj-m97w) <details> <summary>More information</summary> #### Details ##### Summary 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. ##### Workarounds Validate channel names before passing untrusted input to Postgrex.Notifications.listen/3. Reject any name that contains the dollar-quote delimiter ($$), or restrict channel names to a safe character set such as alphanumeric characters and underscores. #### Severity - CVSS Score: 2.1 / 10 (Low) - Vector String: `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` #### References - [https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w](https://github.com/elixir-ecto/ecto/security/advisories/GHSA-4mw9-4qgj-m97w) - [https://cna.erlef.org/cves/CVE-2026-58225.html](https://cna.erlef.org/cves/CVE-2026-58225.html) - [https://github.com/elixir-ecto/postgrex/commit/795c6062f62c4394272ff4b89170688857b4f841](https://github.com/elixir-ecto/postgrex/commit/795c6062f62c4394272ff4b89170688857b4f841) - [https://hex.pm/packages/postgrex](https://hex.pm/packages/postgrex) This data is provided by [OSV](https://osv.dev/vulnerability/EEF-CVE-2026-58225). </details> --- ### SQL injection via the :comment option in Postgrex.stream/4 [CVE-2026-66838](https://nvd.nist.gov/vuln/detail/CVE-2026-66838) / EEF-CVE-2026-66838 / [GHSA-3gww-3f36-2388](https://github.com/advisories/GHSA-3gww-3f36-2388) <details> <summary>More information</summary> #### Details ##### Summary Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') vulnerability in elixir-ecto postgrex allows SQL Injection via the `:comment` option of `Postgrex.stream/4`. An attacker who can influence that value can close the comment delimiter with `*/` and extend the streamed statement with their own clauses, which execute under the connection's role. Ecto exposes the same option through `Ecto.Repo.stream/2`. Postgrex appends the comment by concatenating it into the statement text sent in the `Parse` message, without escaping or rejecting `*/`. The option is validated by `comment_not_present!/1` at every other execution point; `stream/4` never calls it. Because `Parse` accepts a single command, the injection is confined to the streamed statement and further statements cannot be chained. This issue affects postgrex: from 0.19.3 before 0.22.4. ##### Workarounds Reject any `:comment` value containing `*/` or a null byte before passing it to `Postgrex.stream/4` or `Ecto.Repo.stream/2`. Alternatively, build comments only from trusted values. ##### Configurations The application must pass a `:comment` derived from untrusted input to `Postgrex.stream/4` or `Ecto.Repo.stream/2`. Applications that omit the option or pass only static values are unaffected. #### Severity - CVSS Score: 5.9 / 10 (Medium) - Vector String: `CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N` #### References - [https://github.com/elixir-ecto/ecto/security/advisories/GHSA-3gww-3f36-2388](https://github.com/elixir-ecto/ecto/security/advisories/GHSA-3gww-3f36-2388) - [https://cna.erlef.org/cves/CVE-2026-66838.html](https://cna.erlef.org/cves/CVE-2026-66838.html) - [https://github.com/elixir-ecto/postgrex/commit/e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c](https://github.com/elixir-ecto/postgrex/commit/e1ecba618ddea4cee2556bd6ad9b6285e05f9d3c) - [https://github.com/elixir-ecto/postgrex/commit/4011be852c99dc61ddb98cb01aa41e8775a0e3dd](https://github.com/elixir-ecto/postgrex/commit/4011be852c99dc61ddb98cb01aa41e8775a0e3dd) - [https://hex.pm/packages/postgrex](https://hex.pm/packages/postgrex) This data is provided by [OSV](https://osv.dev/vulnerability/EEF-CVE-2026-66838). </details> --- ### Release Notes <details> <summary>elixir-ecto/postgrex (postgrex)</summary> ### [`v0.22.4`](https://github.com/elixir-ecto/postgrex/blob/HEAD/CHANGELOG.md#v0224-2026-08-07) [Compare Source](https://github.com/elixir-ecto/postgrex/compare/v0.22.3...v0.22.4) - Security - Escape comments on `Postgrex.stream/4` (CVE-2026-66838) ### [`v0.22.3`](https://github.com/elixir-ecto/postgrex/blob/HEAD/CHANGELOG.md#v0223-2026-07-09) [Compare Source](https://github.com/elixir-ecto/postgrex/compare/v0.22.2...v0.22.3) - Security - Escape dollar signs in channel names in `Postgrex.Notifications.listen/3` (CVE-2026-58225) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNjUuMiIsInVwZGF0ZWRJblZlciI6IjQzLjE2NS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWF0ZWQiLCJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSIsInNlY3VyaXR5Il19-->
chore(deps): update dependency postgrex to v0.22.4 [security]
Some checks reported errors
continuous-integration/drone/push Build was killed
28900be672
renovate force-pushed renovate/hex-postgrex-vulnerability from 28900be672
Some checks reported errors
continuous-integration/drone/push Build was killed
to 22fec276e7
All checks were successful
continuous-integration/drone/push Build is passing
2026-10-08 21:24:22 +02:00
Compare
renovate force-pushed renovate/hex-postgrex-vulnerability from 22fec276e7
All checks were successful
continuous-integration/drone/push Build is passing
to 69556becc3
All checks were successful
continuous-integration/drone/push Build is passing
2026-10-11 02:04:56 +02:00
Compare
renovate force-pushed renovate/hex-postgrex-vulnerability from 69556becc3
All checks were successful
continuous-integration/drone/push Build is passing
to 55aafaf083
All checks were successful
continuous-integration/drone/push Build is passing
2026-10-12 12:13:09 +02:00
Compare
Some checks are pending
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production
Required
Some required checks are missing.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin renovate/hex-postgrex-vulnerability:renovate/hex-postgrex-vulnerability
git switch renovate/hex-postgrex-vulnerability
Sign in to join this conversation.
No description provided.