CVE-2023-45286: Github.com/go resty/resty/v2 Github.com/go-resty/resty/v2 HTTP Request Body Disclosure Vulnerability

MODERATE
Advisory Identifier: GHSA-xwh9-gc39-5298
CVSS 5.9
CWE-362 CWE-200
Published
Advisory Summary

CVE-2023-45286 is a MODERATE (CVSS 5.9) github.com/go-resty/resty/v2 http request body disclosure vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Github.com/go resty/resty/v2 libraries in the Go ecosystem. The issue involves github.com/go-resty/resty/v2 http request body disclosure. Remediation is available by upgrading affected packages to version 2.11.0.

CVE-2023-45286 at a Glance

CVE Identifier CVE-2023-45286
GHSA Identifier GHSA-xwh9-gc39-5298
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product Github.com/go resty/resty/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

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:H/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 High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-45286

To remediate this vulnerability, upgrade all affected Github.com/go resty/resty/v2 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/go-resty/resty/v2 fixed: 2.11.0
Upgrade github.com/go-resty/resty/v2 to 2.11.0
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/go-resty/resty/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-45286, inspect your project dependencies for Github.com/go resty/resty/v2:

inspect dependencies for github.com/go-resty/resty/v2

Analyze the terminal output to locate any version of Github.com/go resty/resty/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.11.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-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Github.com/go resty/resty/v2, 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

A race condition in go-resty can result in HTTP request body disclosure across requests. This condition can be triggered by calling sync.Pool.Put with the same *bytes.Buffer more than once, when request retries are enabled and a retry occurs. The call to sync.Pool.Get will then return a bytes.Buffer that hasn't had bytes.Buffer.Reset called on it. This dirty buffer will contain the HTTP request body from an unrelated request, and go-resty will append the current HTTP request body to it, sending two bodies in one request. The sync.Pool in question is defined at package level scope, so a completely unrelated server could receive the request body.

CVE-2023-45286 Affected Github.com/go resty/resty/v2 Versions

1 component(s)
Fixed Versions:
2.11.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/go-resty/resty/v2
Go
≥ 2.10.0
< 2.11.0
2.11.0

References

Frequently Asked Questions

What is CVE-2023-45286?
CVE-2023-45286 is a security vulnerability in Github.com/go resty/resty/v2 involving github.com/go-resty/resty/v2 HTTP request body disclosure under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which Github.com/go resty/resty/v2 versions are affected?
Affected versions include releases prior to 2.11.0 across affected packages: github.com/go-resty/resty/v2.
What version fixes CVE-2023-45286?
Upgrading to 2.11.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/go-resty/resty/v2 affected?
Yes, github.com/go-resty/resty/v2 is affected in releases prior to 2.11.0. Upgrade your dependency to 2.11.0 or later.
What is the CVSS score of CVE-2023-45286?
CVE-2023-45286 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2023-45286?
CVE-2023-45286 is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') (The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.).
How can I check Go dependencies for CVE-2023-45286?
Run the dependency tree command: 'inspect dependencies for github.com/go-resty/resty/v2'. 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-xwh9-gc39-5298",
  "modified" : "2024-05-20T21:58:12Z",
  "published" : "2023-11-28T17:36:21Z",
  "aliases" : [ "CVE-2023-45286" ],
  "summary" : "github.com/go-resty/resty/v2 HTTP request body disclosure",
  "details" : "A race condition in go-resty can result in HTTP request body disclosure across requests.\n\nThis condition can be triggered by calling sync.Pool.Put with the same *bytes.Buffer more than once, when request retries are enabled and a retry occurs. The call to sync.Pool.Get will then return a bytes.Buffer that hasn't had bytes.Buffer.Reset called on it. This dirty buffer will contain the HTTP request body from an unrelated request, and go-resty will append the current HTTP request body to it, sending two bodies in one request.\n\nThe sync.Pool in question is defined at package level scope, so a completely unrelated server could receive the request body.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-resty/resty/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.10.0"
      }, {
        "fixed" : "2.11.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-45286"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-resty/resty/issues/739"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-resty/resty/issues/743"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-resty/resty/pull/745"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-resty/resty/commit/577fed8730d79f583eb48dfc81674164e1fc471e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-resty/resty"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-resty/resty/releases/tag/v2.11.0"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2023-2328"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-362" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-28T17:36:21Z",
    "nvd_published_at" : "2023-11-28T17:15:08Z"
  }
}