CVE-2023-31136: Github.com/vapor/postgres nio PostgresNIO Processes Unencrypted Bytes From Vulnerability

LOW
Advisory Identifier: GHSA-9cfh-vx93-84vv
CVSS 3.7
CWE-522
Published
Advisory Summary

CVE-2023-31136 is a LOW (CVSS 3.7) postgresnio processes unencrypted bytes from vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Github.com/vapor/postgres nio libraries in the SwiftURL ecosystem. The issue involves postgresnio processes unencrypted bytes from man-in-the-middle. Remediation is available by upgrading affected packages to version 1.14.2.

CVE-2023-31136 at a Glance

CVE Identifier CVE-2023-31136
GHSA Identifier GHSA-9cfh-vx93-84vv
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product Github.com/vapor/postgres nio
Package Ecosystem SwiftURL
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-31136

To remediate this vulnerability, upgrade all affected Github.com/vapor/postgres nio dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/vapor/postgres-nio fixed: 1.14.2
Upgrade github.com/vapor/postgres-nio to 1.14.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/vapor/postgres-nio

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-31136, inspect your project dependencies for Github.com/vapor/postgres nio:

inspect dependencies for github.com/vapor/postgres-nio

Analyze the terminal output to locate any version of Github.com/vapor/postgres nio in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.14.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. In Github.com/vapor/postgres nio, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Any user of PostgresNIO connecting to servers with TLS enabled is vulnerable to a man-in-the-middle attacker injecting false responses to the client's first few queries, despite the use of TLS certificate verification and encryption. _The remaining text in this section is quoted verbatim from [PostgreSQL's CVE-2021-23222 advisory](https://www.postgresql.org/support/security/CVE-2021-23222/):_ > If more preconditions hold, the attacker can exfiltrate the client's password or other confidential data that might be transmitted early in a session. The attacker must have a way to trick the client's intended server into making the confidential data accessible to the attacker. A known implementation having that property is a PostgreSQL configuration vulnerable to [CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/). As with any exploitation of [CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/), the server must be using trust authentication with a clientcert requirement or using cert authentication. To disclose a password, the client must be in possession of a password, which is atypical when using an authentication configuration vulnerable to [CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/). The attacker must have some other way to access the server to retrieve the exfiltrated data (a valid, unprivileged login account would be sufficient). ### Patches The vulnerability is addressed in PostgresNIO versions starting from [1.14.2](https://github.com/vapor/postgres-nio/releases/tag/1.14.2) via [2df54bc94607f44584ae6ffa74e3cd754fffafc7](https://github.com/vapor/postgres-nio/commit/2df54bc94607f44584ae6ffa74e3cd754fffafc7), which required [additional support](https://github.com/apple/swift-nio/pull/2419) from SwiftNIO. ### Workarounds There are no known workarounds for unpatched users. ### Additional Credits Special thanks to PostgreSQL's Tom Lane <[tgl@sss.pgh.pa.us](mailto:tgl@sss.pgh.pa.us)> for reporting this issue! ### References - [PostgreSQL security advisory for CVE-2021-23222](https://www.postgresql.org/support/security/CVE-2021-23222/) - [GitHub security advisory GHSA-735f-7qx4-jqq5 for CVE-2021-23222](https://github.com/advisories/GHSA-735f-7qx4-jqq5) - [PostgreSQL security advisory for CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/) - [GitHub security advisory GHSA-467w-rrqc-395f for CVE-2021-23214](https://github.com/advisories/GHSA-467w-rrqc-395f) - [SwiftNIO PR #2419 Add unprocessedBytes property on NIOSingleStepByteToMessageProcessor](https://github.com/apple/swift-nio/pull/2419) - [PostgresNIO commit 2df54bc94607f44584ae6ffa74e3cd754fffafc7](https://github.com/vapor/postgres-nio/commit/2df54bc94607f44584ae6ffa74e3cd754fffafc7) - [PostgresNIO 1.42.2 release](https://github.com/vapor/postgres-nio/releases/tag/1.14.2)

CVE-2023-31136 Affected Github.com/vapor/postgres nio Versions

1 component(s)
Fixed Versions:
1.14.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/vapor/postgres-nio
SwiftURL
< 1.14.2
1.14.2

References

Frequently Asked Questions

What is CVE-2023-31136?
CVE-2023-31136 is a security vulnerability in Github.com/vapor/postgres nio involving PostgresNIO processes unencrypted bytes from man-in-the-middle under CWE-522: Insufficiently Protected Credentials.
Which Github.com/vapor/postgres nio versions are affected?
Affected versions include releases prior to 1.14.2 across affected packages: github.com/vapor/postgres-nio.
What version fixes CVE-2023-31136?
Upgrading to 1.14.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/vapor/postgres-nio affected?
Yes, github.com/vapor/postgres-nio is affected in releases prior to 1.14.2. Upgrade your dependency to 1.14.2 or later.
What is the CVSS score of CVE-2023-31136?
CVE-2023-31136 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2023-31136?
CVE-2023-31136 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check SwiftURL dependencies for CVE-2023-31136?
Run the dependency tree command: 'inspect dependencies for github.com/vapor/postgres-nio'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9cfh-vx93-84vv",
  "modified" : "2023-05-10T19:20:16Z",
  "published" : "2023-05-10T19:20:16Z",
  "aliases" : [ "CVE-2023-31136" ],
  "summary" : "PostgresNIO processes unencrypted bytes from man-in-the-middle",
  "details" : "### Impact\nAny user of PostgresNIO connecting to servers with TLS enabled is vulnerable to a man-in-the-middle attacker injecting false responses to the client's first few queries, despite the use of TLS certificate verification and encryption.\n\n_The remaining text in this section is quoted verbatim from [PostgreSQL's CVE-2021-23222 advisory](https://www.postgresql.org/support/security/CVE-2021-23222/):_\n\n> If more preconditions hold, the attacker can exfiltrate the client's password or other confidential data that might be transmitted early in a session. The attacker must have a way to trick the client's intended server into making the confidential data accessible to the attacker. A known implementation having that property is a PostgreSQL configuration vulnerable to [CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/). As with any exploitation of [CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/), the server must be using trust authentication with a clientcert requirement or using cert authentication. To disclose a password, the client must be in possession of a password, which is atypical when using an authentication configuration vulnerable to [CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/). The attacker must have some other way to access the server to retrieve the exfiltrated data (a valid, unprivileged login account would be sufficient).\n\n### Patches\nThe vulnerability is addressed in PostgresNIO versions starting from [1.14.2](https://github.com/vapor/postgres-nio/releases/tag/1.14.2) via [2df54bc94607f44584ae6ffa74e3cd754fffafc7](https://github.com/vapor/postgres-nio/commit/2df54bc94607f44584ae6ffa74e3cd754fffafc7), which required [additional support](https://github.com/apple/swift-nio/pull/2419) from SwiftNIO.\n\n### Workarounds\nThere are no known workarounds for unpatched users.\n\n### Additional Credits\nSpecial thanks to PostgreSQL's Tom Lane <[tgl@sss.pgh.pa.us](mailto:tgl@sss.pgh.pa.us)> for reporting this issue!\n\n### References\n- [PostgreSQL security advisory for CVE-2021-23222](https://www.postgresql.org/support/security/CVE-2021-23222/)\n- [GitHub security advisory GHSA-735f-7qx4-jqq5 for CVE-2021-23222](https://github.com/advisories/GHSA-735f-7qx4-jqq5)\n- [PostgreSQL security advisory for CVE-2021-23214](https://www.postgresql.org/support/security/CVE-2021-23214/)\n- [GitHub security advisory GHSA-467w-rrqc-395f for CVE-2021-23214](https://github.com/advisories/GHSA-467w-rrqc-395f)\n- [SwiftNIO PR #2419 Add unprocessedBytes property on NIOSingleStepByteToMessageProcessor](https://github.com/apple/swift-nio/pull/2419)\n- [PostgresNIO commit 2df54bc94607f44584ae6ffa74e3cd754fffafc7](https://github.com/vapor/postgres-nio/commit/2df54bc94607f44584ae6ffa74e3cd754fffafc7)\n- [PostgresNIO 1.42.2 release](https://github.com/vapor/postgres-nio/releases/tag/1.14.2)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "SwiftURL",
      "name" : "github.com/vapor/postgres-nio"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.14.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vapor/postgres-nio/security/advisories/GHSA-9cfh-vx93-84vv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-31136"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apple/swift-nio/pull/2419"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vapor/postgres-nio/commit/2df54bc94607f44584ae6ffa74e3cd754fffafc7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-467w-rrqc-395f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-735f-7qx4-jqq5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vapor/postgres-nio"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vapor/postgres-nio/releases/tag/1.14.2"
  }, {
    "type" : "WEB",
    "url" : "https://www.postgresql.org/support/security/CVE-2021-23214"
  }, {
    "type" : "WEB",
    "url" : "https://www.postgresql.org/support/security/CVE-2021-23222"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-522" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-05-10T19:20:16Z",
    "nvd_published_at" : "2023-05-09T14:15:13Z"
  }
}