{"id":"CVE-2024-27289","aliases":["AZL-35750","AZL-35763","DEBIAN-CVE-2024-27289","EUVD-2024-0962","GHSA-m7wr-2xf7-cm9p","GO-2024-2605","UBUNTU-CVE-2024-27289"],"status":"published","title":"pgx SQL Injection via Line Comment Creation","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.","severity":{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-11","score":0.00847,"percentile":0.58517,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-89"],"published":"2024-03-04T20:13:11Z","modified":"2026-11-02T12:02:30Z","fixes":[{"ecosystem":"Go","package":"github.com/jackc/pgx","fixed_in":["4.18.2"],"sources":["ghsa","osv"]},{"ecosystem":"Go","package":"github.com/jackc/pgx/v4","fixed_in":["4.18.2"],"sources":["ghsa","osv"]},{"ecosystem":"Azure Linux:3","package":"telegraf","fixed_in":["1.31.0-1"],"sources":["osv"]},{"ecosystem":"Azure Linux:2","package":"telegraf","fixed_in":["1.29.4-4"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"golang-github-jackc-pgx","fixed_in":["4.18.1-2"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"golang-github-jackc-pgx","fixed_in":["4.18.1-2"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Go","package":"github.com/jackc/pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.18.2"}]}]},{"source":"ghsa","ecosystem":"Go","package":"github.com/jackc/pgx/v4","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.18.2"}]}]},{"source":"osv","ecosystem":"Azure Linux:3","package":"telegraf","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.31.0-1"}]}]},{"source":"osv","ecosystem":"Azure Linux:2","package":"telegraf","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.29.4-4"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.15.0-4","4.18.1-1","4.18.1-2","4.18.3-1","4.18.3-1~exp0","4.18.3-2"]},{"source":"osv","ecosystem":"Debian:13","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.18.1-2"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.18.1-2"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/jackc/pgx","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"4.18.2"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/jackc/pgx/v4","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"4.18.2"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/jackc/pgx","ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/jackc/pgx/v4","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"4.18.2"}]}]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.6.2-2"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.15.0-4","4.18.1-1"]},{"source":"osv","ecosystem":"Ubuntu:25.10","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.18.1-1","4.18.1-2"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.18.1-2","4.18.3-2"]},{"source":"osv","ecosystem":"Ubuntu:26.04:LTS","package":"golang-github-jackc-pgx","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.18.1-2"]}],"products":[{"vendor":"jackc","product":"pgx"}],"references":[{"url":"https://github.com/jackc/pgx/security/advisories/GHSA-m7wr-2xf7-cm9p","tags":["x_refsource_CONFIRM","x_transferred","Vendor Advisory","advisory","web","report"]},{"url":"https://github.com/jackc/pgx/commit/f94eb0e2f96782042c96801b5ac448f44f0a81df","tags":["x_refsource_MISC","x_transferred","Patch","fix","web","report"]},{"url":"https://www.sonarsource.com/blog/double-dash-double-trouble-a-subtle-sql-injection-flaw/","tags":["Third Party Advisory","article"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-27289","tags":["web","advisory"]},{"url":"https://www.sonarsource.com/blog/double-dash-double-trouble-a-subtle-sql-injection-flaw","tags":["web"]},{"url":"https://github.com/advisories/GHSA-m7wr-2xf7-cm9p"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/27xxx/CVE-2024-27289.json","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2024-27289","tags":["advisory"]},{"url":"https://github.com/jackc/pgx","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2024-27289","tags":["report"]},{"url":"https://github.com/jackc/pgx/commit/826a89229b8b1cdf18e4190afa437d3df9901b9c","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2024-27289","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2024-27289","title":"pgx SQL Injection via Line Comment Creation","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.\n","status":"published","published":"2024-03-06T18:28:12.291Z","modified":"2025-06-12T15:45:56.361Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"cna"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:34:12.982241Z"}],"euvd":[{"id":"EUVD-2024-0962","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.\n","status":"published","published":"2024-03-06T18:28:12Z","modified":"2025-06-12T15:45:56Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T20:32:24.598995Z"}],"ghsa":[{"id":"GHSA-m7wr-2xf7-cm9p","title":"pgx SQL Injection via Line Comment Creation","description":"### Impact\n\nSQL injection can occur when all of the following conditions are met:\n\n1. The non-default simple protocol is used.\n2. A placeholder for a numeric value must be immediately preceded by a minus.\n3. There must be a second placeholder for a string value after the first placeholder; both\nmust be on the same line.\n4. Both parameter values must be user-controlled.\n\ne.g. \n\nSimple mode must be enabled:\n\n```go\n// connection string includes \"prefer_simple_protocol=true\"\n// or\n// directly enabled in code\nconfig.ConnConfig.PreferSimpleProtocol = true\n```\n\nParameterized query:\n\n```sql\nSELECT * FROM example WHERE result=-$1 OR name=$2;\n```\n\nParameter values:\n\n`$1` =\u003e `-42`\n`$2` =\u003e `\"foo\\n 1 AND 1=0 UNION SELECT * FROM secrets; --\"`\n\nResulting query after preparation:\n\n```sql\nSELECT * FROM example WHERE result=--42 OR name= 'foo\n1 AND 1=0 UNION SELECT * FROM secrets; --';\n```\n\n### Patches\n\nThe problem is resolved in v4.18.2.\n\n### Workarounds\n\nDo not use the simple protocol or do not place a minus directly before a placeholder.","status":"published","published":"2024-03-04T20:13:11Z","modified":"2026-03-15T05:01:56Z","cvss":[{"version":"4.0","score":8.7,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"high"},{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:39:36.642723Z"}],"nvd":[{"id":"CVE-2024-27289","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.\n","status":"published","published":"2024-03-06T19:15:08.14Z","modified":"2026-06-17T07:19:34.997Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"secondary"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:09:39.488031Z"}],"osv":[{"id":"CVE-2024-27289","title":"pgx SQL Injection via Line Comment Creation","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.\n","status":"published","published":"2024-03-06T18:28:12.291Z","modified":"2026-10-28T02:30:39.910018527Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T15:44:39.569658Z"},{"id":"DEBIAN-CVE-2024-27289","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.","status":"published","published":"2024-03-06T19:15:08.14Z","modified":"2026-11-02T12:02:30.08918858Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:45:42.204259Z"},{"id":"GHSA-m7wr-2xf7-cm9p","title":"pgx SQL Injection via Line Comment Creation","description":"### Impact\n\nSQL injection can occur when all of the following conditions are met:\n\n1. The non-default simple protocol is used.\n2. A placeholder for a numeric value must be immediately preceded by a minus.\n3. There must be a second placeholder for a string value after the first placeholder; both\nmust be on the same line.\n4. Both parameter values must be user-controlled.\n\ne.g. \n\nSimple mode must be enabled:\n\n```go\n// connection string includes \"prefer_simple_protocol=true\"\n// or\n// directly enabled in code\nconfig.ConnConfig.PreferSimpleProtocol = true\n```\n\nParameterized query:\n\n```sql\nSELECT * FROM example WHERE result=-$1 OR name=$2;\n```\n\nParameter values:\n\n`$1` =\u003e `-42`\n`$2` =\u003e `\"foo\\n 1 AND 1=0 UNION SELECT * FROM secrets; --\"`\n\nResulting query after preparation:\n\n```sql\nSELECT * FROM example WHERE result=--42 OR name= 'foo\n1 AND 1=0 UNION SELECT * FROM secrets; --';\n```\n\n### Patches\n\nThe problem is resolved in v4.18.2.\n\n### Workarounds\n\nDo not use the simple protocol or do not place a minus directly before a placeholder.","status":"published","published":"2024-03-04T20:13:11Z","modified":"2026-09-10T03:50:10.592342059Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"},{"version":"4.0","score":8.7,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"high"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T15:46:51.463834Z"},{"id":"UBUNTU-CVE-2024-27289","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.","status":"published","published":"2024-03-06T19:15:00Z","modified":"2026-10-17T12:56:43.512932421Z","cvss":[{"version":"3.1","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T16:54:48.333535Z"},{"id":"AZL-35750","title":"CVE-2024-27289 affecting package telegraf for versions less than 1.31.0-1","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.\n","status":"published","published":"2024-03-06T19:15:08Z","modified":"2026-04-21T04:33:20.515838Z","updated_at":"2026-11-02T15:28:04.173658Z"},{"id":"AZL-35763","title":"CVE-2024-27289 affecting package telegraf for versions less than 1.29.4-4","description":"pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.\n","status":"published","published":"2024-03-06T19:15:08Z","modified":"2026-04-21T04:25:05.013839Z","updated_at":"2026-11-02T15:28:04.173658Z"},{"id":"GO-2024-2605","title":"SQL injection in github.com/jackc/pgx/v4","description":"SQL injection is possible when the database uses the non-default simple protocol, a minus sign directly precedes a numeric placeholder followed by a string placeholder on the same line, and both parameter values are user-controlled.","status":"published","published":"2024-03-11T20:08:05Z","modified":"2026-02-04T03:50:07.714601Z","updated_at":"2026-11-02T15:47:01.185262Z"}]}}
