GitHub Advisoryadvisory · Go

GHSA-cj55-gc7m-wvcq req may send an unintended request when a malformed URL is provided

MEDIUM Published 2024-08-26 Modified 2024-11-18 Official page ↗
Aliases
CVE-2024-45258
Ecosystem
Go
Packages
github.com/imroc/req/v3, github.com/imroc/req, github.com/imroc/req/v2
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N
Weaknesses
CWE-20, CWE-918, CWE-94
Reviewed
2024-08-26

Affected packages

• Go github.com/imroc/req/v3: < 3.43.4 → fixed in 3.43.4 • Go github.com/imroc/req: < 3.43.4 → fixed in 3.43.4 • Go github.com/imroc/req/v2: < 3.43.4 → fixed in 3.43.4

Description

The `req` library is a widely used HTTP library in Go. However, it does not handle malformed URLs effectively. As a result, after parsing a malformed URL, the library may send HTTP requests to unexpected destinations, potentially leading to security vulnerabilities or unintended behavior in applications relying on this library for handling HTTP requests. Despite developers potentially utilizing the `net/url` library to parse malformed URLs and implement blocklists to prevent HTTP requests to listed URLs, inconsistencies exist between how the `net/url` and `req` libraries parse URLs. These discrepancies can lead to the failure of defensive strategies, resulting in potential security threats such as Server-Side Request Forgery (SSRF) and Remote Code Execution (RCE).

Related

Alias · CVE (1)

  • CVE-2024-45258 The req package before 3.43.4 for Go may send an unintended request when a malformed URL is provided, because cleanHost in http.go… vulnerability

Weakness · CWE (3)

  • CWE-20 Improper Input Validation weakness
  • CWE-918 Server-Side Request Forgery weakness
  • CWE-94 Improper Control of Generation of Code weakness

References