2026-11-23 16:59CVE-2026-134842PostgreSQL
PUBLISHED5.2CWE-89

pgjdbc simple query mode quotes parameters for the wrong standard_conforming_strings value

pgjdbc, the PostgreSQL JDBC Driver, can quote a string parameter for the wrong value of standard_conforming_strings when preferQueryMode=simple is set. A statement, trigger or configuration reload can turn the setting off during a session. A parameter value with a backslash and a quote then ends the literal, and the rest of the value runs as SQL. Before 42.7.6 any session with the setting off was affected. The statement cache can also reuse a parse made under the other setting. With allowEncodingChanges=true and the EUC_JP or SJIS client encoding, the yen sign acts as a backslash. All versions before 42.7.15 are affected, and 42.7.15 fixes the problem.

Problem type

Affected products

pgjdbc

pgjdbc

< 42.7.15 - AFFECTED

References

JSON source

https://cveawg.mitre.org/api/cve/CVE-2026-134842
Click to expand
{
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "cveMetadata": {
    "cveId": "CVE-2026-134842",
    "assignerOrgId": "f86ef6dc-4d3a-42ad-8f28-e6d5547a5007",
    "assignerShortName": "PostgreSQL",
    "dateUpdated": "2026-11-23T16:59:14.633Z",
    "dateReserved": "2026-11-22T17:13:47.180Z",
    "datePublished": "2026-11-23T16:59:14.633Z",
    "state": "PUBLISHED"
  },
  "containers": {
    "cna": {
      "providerMetadata": {
        "orgId": "f86ef6dc-4d3a-42ad-8f28-e6d5547a5007",
        "shortName": "PostgreSQL",
        "dateUpdated": "2026-11-23T16:59:14.633Z"
      },
      "title": "pgjdbc simple query mode quotes parameters for the wrong standard_conforming_strings value",
      "descriptions": [
        {
          "lang": "en",
          "value": "pgjdbc, the PostgreSQL JDBC Driver, can quote a string parameter for the wrong value of standard_conforming_strings when preferQueryMode=simple is set. A statement, trigger or configuration reload can turn the setting off during a session. A parameter value with a backslash and a quote then ends the literal, and the rest of the value runs as SQL. Before 42.7.6 any session with the setting off was affected. The statement cache can also reuse a parse made under the other setting. With allowEncodingChanges=true and the EUC_JP or SJIS client encoding, the yen sign acts as a backslash. All versions before 42.7.15 are affected, and 42.7.15 fixes the problem."
        }
      ],
      "affected": [
        {
          "vendor": "pgjdbc",
          "product": "pgjdbc",
          "collectionURL": "https://repo.maven.apache.org/maven2",
          "packageName": "org.postgresql:postgresql",
          "programFiles": [
            "pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java",
            "pgjdbc/src/main/java/org/postgresql/core/BaseQueryKey.java",
            "pgjdbc/src/main/java/org/postgresql/core/CachedQueryCreateAction.java",
            "pgjdbc/src/main/java/org/postgresql/core/Utils.java"
          ],
          "programRoutines": [
            {
              "name": "org.postgresql.core.v3.SimpleParameterList.quoteAndCast"
            },
            {
              "name": "org.postgresql.core.CachedQueryCreateAction.create"
            },
            {
              "name": "org.postgresql.core.Utils.escapeLiteral"
            }
          ],
          "repo": "https://github.com/pgjdbc/pgjdbc",
          "defaultStatus": "unaffected",
          "versions": [
            {
              "version": "0",
              "status": "affected",
              "versionType": "maven",
              "lessThan": "42.7.15"
            }
          ]
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "lang": "en",
              "description": "CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')",
              "cweId": "CWE-89",
              "type": "CWE"
            }
          ]
        }
      ],
      "references": [
        {
          "url": "https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-6rxc-3r4p-gpff",
          "tags": [
            "vendor-advisory"
          ]
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "version": "3.1",
            "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
            "attackVector": "NETWORK",
            "attackComplexity": "HIGH",
            "privilegesRequired": "NONE",
            "userInteraction": "NONE",
            "scope": "UNCHANGED",
            "confidentialityImpact": "HIGH",
            "integrityImpact": "HIGH",
            "availabilityImpact": "HIGH",
            "baseScore": 8.1,
            "baseSeverity": "HIGH"
          }
        }
      ],
      "workarounds": [
        {
          "lang": "en",
          "value": "Use the default extended query mode, or keep standard_conforming_strings on."
        }
      ],
      "solutions": [
        {
          "lang": "en",
          "value": "Upgrade to pgjdbc 42.7.15 or later."
        }
      ],
      "timeline": [
        {
          "time": "2026-10-16T00:00:00.000Z",
          "lang": "en",
          "value": "Reported by Anthropic OSS Scanner (ANT-2026-CPJGFCH9)."
        },
        {
          "time": "2026-10-16T00:00:00.000Z",
          "lang": "en",
          "value": "Reported by Anthropic OSS Scanner (ANT-2026-H4KGSOTO)."
        },
        {
          "time": "2026-10-16T00:00:00.000Z",
          "lang": "en",
          "value": "Reported by Anthropic OSS Scanner (ANT-2026-JZYBNC5Y)."
        }
      ],
      "credits": [
        {
          "lang": "en",
          "value": "Anthropic OSS Scanner (ANT-2026-CPJGFCH9)",
          "type": "finder"
        },
        {
          "lang": "en",
          "value": "Anthropic OSS Scanner (ANT-2026-H4KGSOTO)",
          "type": "finder"
        },
        {
          "lang": "en",
          "value": "Anthropic OSS Scanner (ANT-2026-JZYBNC5Y)",
          "type": "finder"
        }
      ]
    }
  }
}