aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-06-14 16:19:45 +0200
committerRiccardo Spagni <ric@spagni.net>2019-06-14 16:19:45 +0200
commit1d5e8f461de0a04891e5e18b0f50e9cf2cf534e1 (patch)
tree196a29f8b13f0a26167d5ec085669002d468323a /src/rpc
parentMerge pull request #5632 (diff)
parentrpc: restrict the recent cutoff size in restricted RPC mode (diff)
downloadmonero-1d5e8f461de0a04891e5e18b0f50e9cf2cf534e1.tar.xz
Merge pull request #5639
2eef90d6 rpc: restrict the recent cutoff size in restricted RPC mode (moneromooo-monero) 0564da5f ensure no NULL is passed to memcpy (moneromooo-monero) bc09766b abstract_tcp_server2: improve DoS resistance (moneromooo-monero) 1387549e serialization: check stream good flag at the end (moneromooo-monero) a00cabd4 tree-hash: allocate variable memory on heap, not stack (moneromooo-monero) f2152192 cryptonote: throw on tx hash calculation error (moneromooo-monero) db2b9fba serialization: fail on read_varint error (moneromooo-monero) 68ad5481 cryptonote_protocol: fix another potential P2P DoS (moneromooo-monero) 1cc61018 cryptonote_protocol: expand basic DoS protection (moneromooo-monero) 8f66b705 cryptonote_protocol_handler: prevent potential DoS (anonimal) 39169ace epee: basic sanity check on allocation size from untrusted source (moneromooo-monero)
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 28c53d6e3..3db138719 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -59,6 +59,8 @@ using namespace epee;
#define MAX_RESTRICTED_FAKE_OUTS_COUNT 40
#define MAX_RESTRICTED_GLOBAL_FAKE_OUTS_COUNT 5000
+#define OUTPUT_HISTOGRAM_RECENT_CUTOFF_RESTRICTION (3 * 86400) // 3 days max, the wallet requests 1.8 days
+
namespace
{
void add_reason(std::string &reasons, const char *reason)
@@ -1882,6 +1884,13 @@ namespace cryptonote
if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_GET_OUTPUT_HISTOGRAM>(invoke_http_mode::JON_RPC, "get_output_histogram", req, res, r))
return r;
+ const bool restricted = m_restricted && ctx;
+ if (restricted && req.recent_cutoff > 0 && req.recent_cutoff < (uint64_t)time(NULL) - OUTPUT_HISTOGRAM_RECENT_CUTOFF_RESTRICTION)
+ {
+ res.status = "Recent cutoff is too old";
+ return true;
+ }
+
std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> histogram;
try
{