epee will accept an arbitrary amount of leading line-breaks in an http request
The epee HTTP protocol handler does not limit the number of leading carriage-return and line-feed characters it discards before parsing a request. An attacker could send an arbitrary number of such characters to any server using epee, causing the handler thread to spin indefinitely and preventing legitimate connections.
- Triaged in 21 hours
- Fixed in 3 months
- Disclosed after 3 months
Summary: In the epee http protocol handler, as it reads a new request, it first attempts to ignore any leading carriage-returns and line-feeds. It does not have a mechanism to give up if an inordinate number of CrLfs are encountered.
Description: The pertinent block of code is here: https://github.com/monero-project/monero/blob/master/contrib/epee/include/net/http_protocol_handler.inl#L256
It loops through the data in the request. Before parsing anything of significance, it throws away any leading CrLfs by doing an erase from the from the front of the cache (which itself is expensive as it is a simple string as opposed to a string_view). An attacker could send an arbitrary number of CrLfs to any server with an exposed http port and cause the http server's handler thread to spin forever adding and removing the CrLfs from the cache.
Releases Affected:
All releases running the epee http framework.
Steps To Reproduce:
Can simply telnet to a running monero node's http port and send as many carriage-returns and line-feeds and you'd like. The server will remain responsive until additional, non-CrLf data is sent over the connection.
Impact
An attacker could open multiple such connections across many nodes and tie up the http server threads and cause it to spin indefinitely, wasting resources, and preventing legitimate connections.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code loops over leading carriage-return and line-feed characters without a maximum limit, repeatedly erasing them from the front of a string.
Impact
An attacker could open multiple connections across many nodes to tie up HTTP server threads and cause them to spin indefinitely, wasting resources and preventing legitimate connections.
What the attacker needed
Network access to an exposed HTTP port
How it was found
- Connect to a running Monero node's HTTP port using telnet.
- Send an arbitrary number of carriage-return and line-feed characters.
- Observe that the server remains responsive until additional, non-CrLf data is sent.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a web server receives a request, it first strips any blank lines at the start. This code keeps stripping them without a limit, so if someone sends thousands of blank lines, the server gets stuck in a loop and cannot handle real requests.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.