CVE-2022-3252: Github.com/apple/swift nio extras SwiftNIO Extras Vulnerable To Improper Vulnerability

HIGH
Advisory Identifier: GHSA-773g-x274-8qmf
CVSS 7.5
CWE-835
Published
Advisory Summary

CVE-2022-3252 is a HIGH (CVSS 7.5) swiftnio extras vulnerable to improper vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Github.com/apple/swift nio extras libraries in the SwiftURL ecosystem. The issue involves swiftnio extras vulnerable to improper detection of complete http body decompression. Remediation is available by upgrading affected packages to version 1.14.0, 1.10.3, 1.9.2.

CVE-2022-3252 at a Glance

CVE Identifier CVE-2022-3252
GHSA Identifier GHSA-773g-x274-8qmf
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Github.com/apple/swift nio extras
Package Ecosystem SwiftURL
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2022-3252

To remediate this vulnerability, upgrade all affected Github.com/apple/swift nio extras 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/apple/swift-nio-extras fixed: 1.14.0
Upgrade github.com/apple/swift-nio-extras to 1.14.0
github.com/apple/swift-nio-extras fixed: 1.10.3
Upgrade github.com/apple/swift-nio-extras to 1.10.3
github.com/apple/swift-nio-extras fixed: 1.9.2
Upgrade github.com/apple/swift-nio-extras to 1.9.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/apple/swift-nio-extras

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-3252, inspect your project dependencies for Github.com/apple/swift nio extras:

inspect dependencies for github.com/apple/swift-nio-extras

Analyze the terminal output to locate any version of Github.com/apple/swift nio extras in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.14.0), 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-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In Github.com/apple/swift nio extras, 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

SwiftNIO Extras provides a pair of helpers for transparently decompressing received HTTP request or response bodies. These two objects (`HTTPRequestDecompressor` and `HTTPResponseDecompressor`) both failed to detect when the decompressed body was considered complete. If trailing junk data was appended to the HTTP message body, the code would repeatedly attempt to decompress this data and fail. This would lead to an infinite loop making no forward progress, leading to livelock of the system and denial-of-service. This issue can be triggered by any attacker capable of sending a compressed HTTP message. Most commonly this is HTTP servers, as compressed HTTP messages cannot be negotiated for HTTP requests, but it is possible that users have configured decompression for HTTP requests as well. The attack is low effort, and likely to be reached without requiring any privilege or system access. The impact on availability is high: the process immediately becomes unavailable but does not immediately crash, meaning that it is possible for the process to remain in this state until an administrator intervenes or an automated circuit breaker fires. If left unchecked this issue will very slowly exhaust memory resources due to repeated buffer allocation, but the buffers are not written to and so it is possible that the processes will not terminate for quite some time. This risk can be mitigated by removing transparent HTTP message decompression. The issue is fixed by correctly detecting the termination of the compressed body as reported by zlib and refusing to decompress further data.

CVE-2022-3252 Affected Github.com/apple/swift nio extras Versions

3 component(s)
Fixed Versions:
1.14.01.10.31.9.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/apple/swift-nio-extras
SwiftURL
≥ 1.11.0
< 1.14.0
1.14.0
github.com/apple/swift-nio-extras
SwiftURL
≥ 1.10.0
< 1.10.3
1.10.3
github.com/apple/swift-nio-extras
SwiftURL
< 1.9.2
1.9.2

References

Frequently Asked Questions

What is CVE-2022-3252?
CVE-2022-3252 is a security vulnerability in Github.com/apple/swift nio extras involving SwiftNIO Extras vulnerable to improper detection of complete HTTP body decompression under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Github.com/apple/swift nio extras versions are affected?
Affected versions include releases prior to 1.14.0, 1.10.3, 1.9.2 across affected packages: github.com/apple/swift-nio-extras.
What version fixes CVE-2022-3252?
Upgrading to 1.14.0, 1.10.3, 1.9.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/apple/swift-nio-extras affected?
Yes, github.com/apple/swift-nio-extras is affected in releases prior to 1.14.0, 1.10.3, 1.9.2. Upgrade your dependency to 1.14.0, 1.10.3, 1.9.2 or later.
What is the CVSS score of CVE-2022-3252?
CVE-2022-3252 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-3252?
CVE-2022-3252 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check SwiftURL dependencies for CVE-2022-3252?
Run the dependency tree command: 'inspect dependencies for github.com/apple/swift-nio-extras'. 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-773g-x274-8qmf",
  "modified" : "2023-06-07T16:05:48Z",
  "published" : "2023-06-07T16:05:48Z",
  "aliases" : [ "CVE-2022-3252" ],
  "summary" : "SwiftNIO Extras vulnerable to improper detection of complete HTTP body decompression",
  "details" : "SwiftNIO Extras provides a pair of helpers for transparently decompressing received HTTP request or response bodies. These two objects (`HTTPRequestDecompressor` and `HTTPResponseDecompressor`) both failed to detect when the decompressed body was considered complete. If trailing junk data was appended to the HTTP message body, the code would repeatedly attempt to decompress this data and fail. This would lead to an infinite loop making no forward progress, leading to livelock of the system and denial-of-service.\n\nThis issue can be triggered by any attacker capable of sending a compressed HTTP message. Most commonly this is HTTP servers, as compressed HTTP messages cannot be negotiated for HTTP requests, but it is possible that users have configured decompression for HTTP requests as well. The attack is low effort, and likely to be reached without requiring any privilege or system access. The impact on availability is high: the process immediately becomes unavailable but does not immediately crash, meaning that it is possible for the process to remain in this state until an administrator intervenes or an automated circuit breaker fires. If left unchecked this issue will very slowly exhaust memory resources due to repeated buffer allocation, but the buffers are not written to and so it is possible that the processes will not terminate for quite some time.\n\nThis risk can be mitigated by removing transparent HTTP message decompression. The issue is fixed by correctly detecting the termination of the compressed body as reported by zlib and refusing to decompress further data.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "SwiftURL",
      "name" : "github.com/apple/swift-nio-extras"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.11.0"
      }, {
        "fixed" : "1.14.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "SwiftURL",
      "name" : "github.com/apple/swift-nio-extras"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.10.0"
      }, {
        "fixed" : "1.10.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "SwiftURL",
      "name" : "github.com/apple/swift-nio-extras"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.9.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/apple/swift-nio-extras/security/advisories/GHSA-773g-x274-8qmf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-3252"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apple/swift-nio-extras/pull/177"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apple/swift-nio-extras/pull/177/commits/359015de2c49e426c27b1d25dbf599b08a9d3ee6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apple/swift-nio-extras"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-07T16:05:48Z",
    "nvd_published_at" : "2022-09-21T19:15:00Z"
  }
}