REDHAT-BUG-2345301: Medium severity rubygems/rack vulnerability
Rack provides an interface for developing web applications in Ruby. Prior to versions 2.2.11, 3.0.12, and 3.1.11, Rack::CommonLogger can be exploited by crafting input that includes newline characters to manipulate log entries. The supplied proof-of-concept demonstrates injecting malicious content into logs. When a user provides the authorization credentials via Rack::Auth::Basic, if success, the username will be put in env['REMOTEUSER'] and later be used by Rack::CommonLogger for logging purposes. The issue occurs when a server intentionally or unintentionally allows a user creation with the username contain CRLF and white space characters, or the server just want to log every login attempts. If an attacker enters a username with CRLF character, the logger will log the malicious username with CRLF characters into the logfile. Attackers can break log formats or insert fraudulent entries, potentially obscuring real activity or injecting malicious data into log files. Versions 2.2.11, 3.0.12, and 3.1.11 contain a fix.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.2.11 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 3.0.12 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 3.1.11
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications using Rack::CommonLogger are exposed when attacker-controlled usernames can reach env['REMOTE_USER'], such as through successful Rack::Auth::Basic authentication or logging of login attempts. Exposure depends on allowing or accepting usernames containing CRLF and whitespace characters.
What does an attacker need to exploit it?
An attacker needs to supply a username containing newline characters that is subsequently logged by Rack::CommonLogger. This can occur if the application permits creation or use of such a username, or logs login attempts containing the supplied username.
What is the impact of successful exploitation?
An attacker can manipulate log output by breaking expected log formatting or inserting fraudulent log entries. This may obscure legitimate activity or inject malicious data into log files.
Which Rack releases contain the fix?
The issue is fixed in Rack versions 2.2.11, 3.0.12, and 3.1.11.