Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-m7wr-2xf7-cm9p

Опубликовано: 04 мар. 2024
Источник: github
Github: Прошло ревью
CVSS4: 8.7
CVSS3: 8.1

Описание

pgx SQL Injection via Line Comment Creation

Impact

SQL injection can occur when all of the following conditions are met:

  1. The non-default simple protocol is used.
  2. A placeholder for a numeric value must be immediately preceded by a minus.
  3. There must be a second placeholder for a string value after the first placeholder; both must be on the same line.
  4. Both parameter values must be user-controlled.

e.g.

Simple mode must be enabled:

// connection string includes "prefer_simple_protocol=true" // or // directly enabled in code config.ConnConfig.PreferSimpleProtocol = true

Parameterized query:

SELECT * FROM example WHERE result=-$1 OR name=$2;

Parameter values:

$1 => -42 $2 => "foo\n 1 AND 1=0 UNION SELECT * FROM secrets; --"

Resulting query after preparation:

SELECT * FROM example WHERE result=--42 OR name= 'foo 1 AND 1=0 UNION SELECT * FROM secrets; --';

Patches

The problem is resolved in v4.18.2.

Workarounds

Do not use the simple protocol or do not place a minus directly before a placeholder.

Пакеты

Наименование

github.com/jackc/pgx

go
Затронутые версииВерсия исправления

< 4.18.2

4.18.2

Наименование

github.com/jackc/pgx/v4

go
Затронутые версииВерсия исправления

< 4.18.2

4.18.2

EPSS

Процентиль: 69%
0.00591
Низкий

8.7 High

CVSS4

8.1 High

CVSS3

Дефекты

CWE-89

Связанные уязвимости

CVSS3: 8.1
ubuntu
почти 2 года назад

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.

CVSS3: 8.1
redhat
почти 2 года назад

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.

CVSS3: 8.1
nvd
почти 2 года назад

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.

CVSS3: 8.1
msrc
почти 2 года назад

pgx SQL Injection via Line Comment Creation

CVSS3: 8.1
debian
почти 2 года назад

pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2 ...

EPSS

Процентиль: 69%
0.00591
Низкий

8.7 High

CVSS4

8.1 High

CVSS3

Дефекты

CWE-89