CVE-2024-45302

6.1 MEDIUM

📋 TL;DR

RestSharp versions before 112.0.0 are vulnerable to CRLF injection in HTTP headers, allowing attackers to inject malicious headers or smuggle HTTP requests when user-controlled data is passed to header values. This affects any .NET application using RestSharp that processes untrusted input in HTTP headers, potentially leading to request splitting and server-side request forgery (SSRF).

💻 Affected Systems

Products:
  • RestSharp
Versions: All versions before 112.0.0
Operating Systems: All platforms running .NET
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when user-controlled data is passed to AddHeader, AddOrUpdateHeader, or AddDefaultHeader methods

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full SSRF allowing internal network reconnaissance, data exfiltration, or chained attacks against internal services

🟠

Likely Case

HTTP request smuggling leading to cache poisoning, session hijacking, or web cache deception

🟢

If Mitigated

Limited impact with proper input validation and header sanitization

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user input to reach vulnerable header methods; public PoC demonstrates request splitting

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 112.0.0

Vendor Advisory: https://github.com/restsharp/RestSharp/security/advisories/GHSA-4rr6-2v9v-wcpc

Restart Required: Yes

Instructions:

1. Update RestSharp NuGet package to version 112.0.0 or later
2. Rebuild and redeploy affected applications
3. Test functionality after update

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Validate and sanitize all user input before passing to RestSharp header methods

// C# example: Validate header values
if (headerValue.Contains("\r\n") || headerValue.Contains("\n"))
{
    throw new ArgumentException("Invalid header value");
}

🧯 If You Can't Patch

  • Implement strict input validation to reject CRLF sequences in header values
  • Use allowlists for header values and sanitize all user input before processing

🔍 How to Verify

Check if Vulnerable:

Check RestSharp package version in project files or NuGet packages; versions <112.0.0 are vulnerable

Check Version:

dotnet list package | findstr RestSharp

Verify Fix Applied:

Verify RestSharp version is 112.0.0 or higher in package manager and rebuild application

📡 Detection & Monitoring

Log Indicators:

  • Unusual HTTP headers with CRLF sequences
  • Multiple HTTP requests in single log entry
  • Unexpected internal service calls

Network Indicators:

  • HTTP requests with malformed headers
  • Requests containing \r\n sequences in header values

SIEM Query:

search index=web_logs "\r\n" OR "%0d%0a" in header_values

🔗 References

📤 Share & Export