CPP-Ethereum JSON-RPC miner_stop improper authorization Vulnerability
Discription

### Summary

An exploitable improper authorization vulnerability exists in miner_stop API of cpp-ethereum’s JSON-RPC (commit 4e1015743b95821849d001618a7ce82c7c073768). A JSON request can cause an access to the restricted functionality resulting in authorization bypass. An attacker can send JSON to trigger this vulnerability.

### Tested Versions

Ethereum commit 4e1015743b95821849d001618a7ce82c7c073768

### Product URLs

### CVSSv3 Score

4.0 – CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L

### CWE

CWE-285: Improper Authorization

### Details

CPP-Ethereum is a C++ ethereum client, one of the 3 most popular clients for the ethereum platform. One of the components that is part of cpp-ethereum is a JSON-RPC server which exposes various APIs to manage client/node functionality. Improper authorization checks in the implementation of the `miner_stop` API allows a remote attacker without any credentials to triggers functionality reserved only for a user with administrator privileges. We can observe a similar approach in two other clients (lack of any kind of authorization) but in this case the situation is exacerbated by the fact that:

– By default interface is bound to 0.0.0.0, which means it’s exposed to the world
– The Content-Type set to ‘application/json’ during requests is not enforced, which means that even if eth JSON-RPC daemon is ran on machine behind a NAT
the JSON-RPC APIs can still be easily triggered by CSRF or SSRF attacks.
– older version of the same API had implemented an authorization check
– there is no visible option to change the default JSON-RPC interface to localhost

For comparison let us take geth (the go ethereum client) which also implements a JSON-RPC interface but using much better security practices: – by default the interface is bound to localhost – The “Content-Type” request header value must be set to ‘application/json’ – CORS settings are set to block by default all “cross-domain” requests

Let us take a look at `miner_stop` and describe in details improper/consistency check of authorization.

Line 247 bool AdminEth::miner_stop()
Line 248 {
Line 249 m_eth.stopSealing();
Line 250 return true;
Line 251 }

As we can see there is no check for calling user privileges which is done in couple other APIs via `RPC_ADMIN` macro. Same functionality is exposed over `admin_eth_setMinig` API where at the beginning of API body, privileges check is made:

Line 22 bool AdminEth::admin_eth_setMining(bool _on, string const& _session)
Line 23 {
Line 24 RPC_ADMIN;
Line 25 if (_on)
Line 26 m_eth.startSealing();
Line 27 else
Line 28 m_eth.stopSealing();
Line 29 return true;
Line 30 }
Line 31

We are aware that this client is not recommended for mining and that the mentioned functionality related with the administrator interface is turned off by default. However when enabled the default behavior is insecure and can allow a remote attacker to perform unauthenticated RPC requests.

### Crash Information

icewall@ubuntu:~/bugs/cpp-ethereum/build/eth$ ./eth -j –ipc –private 123 –no-discovery –datadir `pwd`/data –config config.json –admin-via-http
cpp-ethereum, a C++ Ethereum client
cpp-ethereum 1.3.0
By cpp-ethereum contributors, (c) 2013-2016.
See the README for contributors and credits.
Networking disabled. To start, use netstart or pass –bootstrap or a remote host.
JSONRPC Admin Session Key: Zt9zxSANHZs=
ℹ 03:09:10 AM.197|miner0 Loading full DAG of seedhash: #00000000…
ℹ 03:09:10 AM.978|miner0 Full DAG loaded

icewall@ubuntu:~/bugs/cpp-ethereum$ curl -X POST –data ‘{“jsonrpc”:”2.0″,”method”:”miner_stop”,”params”:[1],”id”:1}’ localhost:8545

### Timeline

2017-12-06 – Vendor Disclosure
2018-01-09 – Public ReleaseRead More

Back to Main

Subscribe for the latest news: