CVE-2022-24863: Github.com/swaggo/http swagger Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-xg75-q3q5-cqmv
CVSS 7.5
CWE-755 CWE-400
Published
Advisory Summary

CVE-2022-24863 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-755: Improper Handling of Exceptional Conditions) affecting Github.com/swaggo/http swagger libraries in the Go ecosystem. The issue involves denial of service in http-swagger. Remediation is available by upgrading affected packages to version 1.2.6.

CVE-2022-24863 at a Glance

CVE Identifier CVE-2022-24863
GHSA Identifier GHSA-xg75-q3q5-cqmv
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-755: Improper Handling of Exceptional Conditions
Affected Product Github.com/swaggo/http swagger
Package Ecosystem Go
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-24863

To remediate this vulnerability, upgrade all affected Github.com/swaggo/http swagger 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/swaggo/http-swagger fixed: 1.2.6
Upgrade github.com/swaggo/http-swagger to 1.2.6
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/swaggo/http-swagger

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-24863, inspect your project dependencies for Github.com/swaggo/http swagger:

inspect dependencies for github.com/swaggo/http-swagger

Analyze the terminal output to locate any version of Github.com/swaggo/http swagger in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.6), 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-755: Improper Handling of Exceptional Conditions, where the product does not handle or incorrectly handles an exceptional condition. In Github.com/swaggo/http swagger, 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 Allows an attacker to perform a DOS attack consisting of memory exhaustion on the host system. ### Patches Yes. Please upgrade to v1.2.6. ### Workarounds A workaround is to restrict the path prefix to the "GET" method. As shown below ``` func main() { r := mux.NewRouter() r.PathPrefix("/swagger/").Handler(httpSwagger.Handler( httpSwagger.URL("http://localhost:1323/swagger/doc.json"), //The url pointing to API definition httpSwagger.DeepLinking(true), httpSwagger.DocExpansion("none"), httpSwagger.DomID("#swagger-ui"), )).Methods(http.MethodGet) ``` ### References Reporter dongguangli from https://www.huoxian.cn/ company ### For more information If you have any questions or comments about this advisory: * Open an issue in [http-swagger](https://github.com/swaggo/http-swagger/issues)

CVE-2022-24863 Affected Github.com/swaggo/http swagger Versions

1 component(s)
Fixed Versions:
1.2.6
Product / Package Ecosystem Affected Versions Fixed Version
github.com/swaggo/http-swagger
Go
< 1.2.6
1.2.6

References

Frequently Asked Questions

What is CVE-2022-24863?
CVE-2022-24863 is a security vulnerability in Github.com/swaggo/http swagger involving Denial of Service in http-swagger under CWE-755: Improper Handling of Exceptional Conditions.
Which Github.com/swaggo/http swagger versions are affected?
Affected versions include releases prior to 1.2.6 across affected packages: github.com/swaggo/http-swagger.
What version fixes CVE-2022-24863?
Upgrading to 1.2.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/swaggo/http-swagger affected?
Yes, github.com/swaggo/http-swagger is affected in releases prior to 1.2.6. Upgrade your dependency to 1.2.6 or later.
What is the CVSS score of CVE-2022-24863?
CVE-2022-24863 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-24863?
CVE-2022-24863 is classified under CWE-755: Improper Handling of Exceptional Conditions (The product does not handle or incorrectly handles an exceptional condition.).
How can I check Go dependencies for CVE-2022-24863?
Run the dependency tree command: 'inspect dependencies for github.com/swaggo/http-swagger'. 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-xg75-q3q5-cqmv",
  "modified" : "2024-03-04T18:35:26Z",
  "published" : "2022-04-22T20:55:52Z",
  "aliases" : [ "CVE-2022-24863" ],
  "summary" : "Denial of Service in http-swagger",
  "details" : "### Impact\nAllows an attacker to perform a DOS attack consisting of memory exhaustion on the host system.\n\n### Patches\nYes. Please upgrade to v1.2.6.\n\n### Workarounds\nA workaround is to restrict the path prefix to the \"GET\" method. As shown below\n```\nfunc main() {\n\tr := mux.NewRouter()\n\n\tr.PathPrefix(\"/swagger/\").Handler(httpSwagger.Handler(\n\t\thttpSwagger.URL(\"http://localhost:1323/swagger/doc.json\"), //The url pointing to API definition\n\t\thttpSwagger.DeepLinking(true),\n\t\thttpSwagger.DocExpansion(\"none\"),\n\t\thttpSwagger.DomID(\"#swagger-ui\"),\n\t)).Methods(http.MethodGet)\n```\n\n### References\nReporter dongguangli from https://www.huoxian.cn/ company\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [http-swagger](https://github.com/swaggo/http-swagger/issues)\n\n",
  "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" : "Go",
      "name" : "github.com/swaggo/http-swagger"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/swaggo/http-swagger/security/advisories/GHSA-xg75-q3q5-cqmv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24863"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/swaggo/http-swagger/pull/62"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/swaggo/http-swagger/commit/b7d83e8fba85a7a51aa7e45e8244b4173f15049e"
  }, {
    "type" : "WEB",
    "url" : "https://cosmosofcyberspace.github.io/improper_http_method_leads_to_xss/poc.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/swaggo/http-swagger"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/swaggo/http-swagger/releases/tag/v1.2.6"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-755" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-22T20:55:52Z",
    "nvd_published_at" : "2022-04-18T19:15:00Z"
  }
}