(remote) exabyte allocation via load_from_binary() (DoS)
A memory allocation flaw in the portable storage deserialisation code allows an attacker to trigger a massive allocation (about 4 exabytes) by supplying a crafted binary payload. This can crash a Monero node (monerod) if the vulnerable function is called with untrusted data, potentially remotely.
- Triaged in 25 hours
- Fixed in 2 months
- Disclosed after 4 months
Changes introduced in commit b82efa32e can result in a denial of service if epee::serialization::portable_storage::load_from_binary() is called with untrusted data.
The 'reserve' method implemented here: https://github.com/monero-project/monero/commit/b82efa32e771f653c5e49165b0659c67e2db3438#diff-8de201c60a8c7a3a0a4c2e15f2c0939bR75
will attempt to allocate about 4 exabytes of memory when you run the following code:
#include <serialization/keyvalue_serialization.h>
#include <storages/portable_storage_template_helper.h>
#include <storages/portable_storage_base.h>
#include <p2p/p2p_protocol_defs.h>
#include <p2p/net_node.h>
int main(void)
{
unsigned char payload[] = {
0x01, 0x11, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x08, 0x00, 0x84,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
const std::string s(payload, payload + 20);
epee::serialization::portable_storage ps;
ps.load_from_binary(s);
}
Although I haven't yet constructed a proof of concept against a live Monero instance, this can probably achieved by a remote attacker because the load_from_binary call occurs several times in the network code in contrib/epee/include/storages/levin_abstract_invoke2.h.
Please let me know if this is sufficient, or that you require proof of concept code that can be used against peers on the network.
Impact
Crash monerod
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
Impact
Could crash monerod, and the reporter suggests it may be remotely exploitable because load_from_binary is called in network code, though no live proof of concept was provided.
What the attacker needed
Ability to supply untrusted binary data to…; possibly network access to a Monero node
How it was found
- Craft a binary payload that encodes a huge size value.
- Call load_from_binary() with the payload.
- Observe the attempt to allocate about 4 exabytes of memory.
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.
The program reads a length value from untrusted input and uses it to reserve memory without checking if the length is realistic. An attacker can send a tiny message that claims to need an enormous amount of memory, causing the program to crash. This is a denial-of-service bug.
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.