Learn about CVE-2023-45286, a vulnerability in github.com/go-resty/resty/v2 allowing HTTP request body disclosure. Find out about its impact, affected systems, and mitigation steps.
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.
Understanding CVE-2023-45286
This vulnerability, assigned CVE-2023-45286, affects the github.com/go-resty/resty/v2 container in versions less than 2.11.0. It leads to HTTP request body disclosure across multiple requests due to a race condition in go-resty.
What is CVE-2023-45286?
The CVE-2023-45286 vulnerability arises from a race condition in go-resty that enables the disclosure of HTTP request bodies across different requests. By manipulating the *bytes.Buffer within the sync.Pool, an attacker can expose sensitive information.
The Impact of CVE-2023-45286
The impact of CVE-2023-45286 is significant as it allows malicious actors to access and potentially exploit sensitive data transmitted via HTTP requests. This could lead to data breaches and unauthorized access to confidential information.
Technical Details of CVE-2023-45286
The following technical details outline the vulnerability in github.com/go-resty/resty/v2:
Vulnerability Description
The vulnerability allows HTTP request body disclosure when a race condition occurs in go-resty, resulting in the mixing of request bodies from different requests.
Affected Systems and Versions
Exploitation Mechanism
Exploiting this vulnerability requires triggering a specific race condition by calling sync.Pool.Put with the same *bytes.Buffer more than once and enabling request retries in go-resty.
Mitigation and Prevention
To mitigate the risks associated with CVE-2023-45286, it is crucial to take immediate and long-term security measures:
Immediate Steps to Take
Long-Term Security Practices
Patching and Updates
Ensure timely application of patches and updates provided by github.com/go-resty/resty/v2 to fix CVE-2023-45286.