CPP-Ethereum JSON-RPC miner_setGasPrice improper authorization Vulnerability(CVE-2017-12116)

ID SSV:97066
Type seebug
Reporter Root
Modified 2018-01-10T00:00:00



An exploitable improper authorization vulnerability exists in miner_setGasPrice 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

6.8 - CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N


CWE-285: Improper Authorization


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_setGasPrice 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, 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_setGasPrice and describe in details improper/consistency check of authorization. Line 277 bool AdminEth::miner_setGasPrice(string const& _gasPrice) Line 278 { Line 279 m_gp.setAsk(jsToU256(_gasPrice)); Line 280 return true; Line 281 }

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 --datadirpwd`/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_setGasPrice","params":["1"],"id":1}' localhost:8545 {"id":1,"jsonrpc":"2.0","result":true} ```


  • 2017-12-06 - Vendor Disclosure
  • 2018-01-09 - Public Release