Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') Affecting github.com/go-resty/resty/v2 package, versions >=2.10.0-rc.1 <2.11.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.16% (53rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-GITHUBCOMGORESTYRESTYV2-6091928
  • published28 Nov 2023
  • disclosed27 Nov 2023
  • creditLogan Attwood (@lattwood)

Introduced: 27 Nov 2023

CVE-2023-45286  (opens in a new tab)
CWE-362  (opens in a new tab)

How to fix?

Upgrade github.com/go-resty/resty/v2 to version 2.11.0 or higher.

Overview

github.com/go-resty/resty/v2 is a simple HTTP and REST client library for Go (inspired by Ruby rest-client)

Affected versions of this package are vulnerable to Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'). An attacker can disclose the HTTP request body across requests by triggering the race condition when 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 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.

CVSS Scores

version 3.1