Skip to content

chore(deps): update [mix] postgrex (0.22.2 → 0.22.4) [security] - #205

Open
wttj-bot[bot] wants to merge 1 commit into
mainfrom
renovate/hex-postgrex-vulnerability
Open

chore(deps): update [mix] postgrex (0.22.2 → 0.22.4) [security]#205
wttj-bot[bot] wants to merge 1 commit into
mainfrom
renovate/hex-postgrex-vulnerability

Conversation

@wttj-bot

@wttj-bot wttj-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
postgrex (source) dev patch 0.22.20.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.

Workaround

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.

Workaround

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.

Configuration

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.

@wttj-bot
wttj-bot Bot requested a review from a team as a code owner July 10, 2026 13:07
@wttj-bot wttj-bot Bot changed the title chore(deps): update [mix] postgrex (0.22.2 → 0.22.3) [security] chore(deps): update [mix] postgrex (0.22.2 → 0.22.3) [security] - autoclosed Jul 20, 2026
@wttj-bot wttj-bot Bot closed this Jul 20, 2026
@wttj-bot
wttj-bot Bot deleted the renovate/hex-postgrex-vulnerability branch July 20, 2026 01:36
@wttj-bot wttj-bot Bot changed the title chore(deps): update [mix] postgrex (0.22.2 → 0.22.3) [security] - autoclosed chore(deps): update [mix] postgrex (0.22.2 → 0.22.3) [security] Jul 20, 2026
@wttj-bot wttj-bot Bot reopened this Jul 20, 2026
@wttj-bot
wttj-bot Bot force-pushed the renovate/hex-postgrex-vulnerability branch 3 times, most recently from 54a0217 to bf459ab Compare July 24, 2026 11:10
@wttj-bot
wttj-bot Bot force-pushed the renovate/hex-postgrex-vulnerability branch from bf459ab to 4fd399d Compare August 7, 2026 13:07
@wttj-bot wttj-bot Bot changed the title chore(deps): update [mix] postgrex (0.22.2 → 0.22.3) [security] chore(deps): update [mix] postgrex (0.22.2 → 0.22.4) [security] Aug 7, 2026
@wttj-bot wttj-bot Bot changed the title chore(deps): update [mix] postgrex (0.22.2 → 0.22.4) [security] chore(deps): update [mix] postgrex (0.22.2 → 0.22.4) [security] - autoclosed Aug 12, 2026
@wttj-bot wttj-bot Bot closed this Aug 12, 2026
@wttj-bot wttj-bot Bot changed the title chore(deps): update [mix] postgrex (0.22.2 → 0.22.4) [security] - autoclosed chore(deps): update [mix] postgrex (0.22.2 → 0.22.4) [security] Aug 12, 2026
@wttj-bot wttj-bot Bot reopened this Aug 12, 2026
@wttj-bot
wttj-bot Bot force-pushed the renovate/hex-postgrex-vulnerability branch 2 times, most recently from 4fd399d to 5880e75 Compare August 12, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants