Stack Overflow in JSON RPC Server
The JSON parser in Monero's epee library does not limit the depth of nested objects, so a deeply nested JSON request causes a stack overflow. An attacker could crash the service and potentially run arbitrary code.
- Triaged in 11 hours
- Fixed in 54 days
- Disclosed after 55 days
Summary:
There is a stack overflow bug in json_parser when parsing nesting objects.
Description: Monero's json parser (handled by epee libraries) doesn't check object tree depth while parsing
Steps To Reproduce:
Up the service
> monerod
run
> python2 poc.py
backtrace
SUMMARY: AddressSanitizer: stack-overflow /home/bug/monero/contrib/epee/include/storages/portable_storage_from_json.h:47 in void epee::serialization::json::run_handler<epee::serialization::portable_storage>(epee::serialization::portable_storage::hsection, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, epee::serialization::portable_storage&)
Thread T6 created by T0 here:
#0 0x7fe374230a51 in __interceptor_pthread_create /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cc:202
#1 0x7fe371b463db in boost::thread::start_thread_noexcept(boost::thread_attributes const&) (/usr/lib/libboost_thread.so.1.67.0+0x133db)
==4088==ABORTING
Tested on
> monerod --version
Monero 'Lithium Luna' (v0.12.3.0-master-0dddfeac)
Supporting Material/References:
poc.py > Malicious json rpc request
Impact
Attacker could run arbitrary code
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 JSON parser lacks a depth limit, allowing unbounded recursion when parsing nested objects.
Impact
An attacker could crash the service and potentially run arbitrary code.
What the attacker needed
Ability to send a malicious JSON RPC request to the service
How it was found
- Start the monerod service.
- Run the provided Python script that sends a malicious JSON RPC request.
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.
A JSON parser reads data formatted as nested lists and objects. If it doesn't limit how deep the nesting goes, a very deeply nested input can exhaust the program's call stack, causing a crash. This report shows that a malicious request can trigger such a crash in a cryptocurrency daemon.
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.