Overview
Rack is a modular Ruby web server interface. The Rack::Sendfile middleware logs unsanitised header values from the X-Sendfile-Type header, allowing an attacker toinject escape sequences (such as newline characters) into the header, resulting in log injection.
This vulnerability affects Rack versions prior to 2.2.12, 3.0.13, and 3.1.11.
Details
Module Info
Product: Rack
Affected packages: rack
Affected versions: <2.2.12, <3.0.13, <3.1.11
Github repository: https://github.com/rack/rack
Published packages: https://rubygems.org/gems/rack
Package manager: RubyGems
Fixed in: Rack v2.2.12, v3.0.13, v3.1.11
Vulnerability Info
The vulnerability stems from improper neutralization of escape sequences in log entries, specifically the X-Sendfile-Type header in the Rack::Sendfile middleware. This allows attackers to manipulate log files by injecting newline characters, whichcan obscure attack traces and complicate security audits.
Steps To Reproduce
1. Set up a web server using a vulnerable version of Rack.
2. Send an HTTP request with a malicious X-Sendfile-Type header containing newline characters.
3. Observe the manipulation of log entries due to the unsanitized header value.
Mitigation
- Upgrade to the latest version of Rack 4+.
- If unable to upgrade, consider seeking assistance from a commercial support partner like HeroDevs.
Credit
N/A