From 644a73867fd43420dccfe22a6cb421ac1aee7c54 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Fri, 10 Apr 2026 13:43:53 +0000 Subject: [PATCH] rpc: restrict `add_aux_pow` --- src/rpc/core_rpc_server.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 5d8a700e2..8ea3688d6 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2062,6 +2062,15 @@ namespace cryptonote if (use_bootstrap_daemon_if_necessary(invoke_http_mode::JON_RPC, "add_aux_pow", req, res, r)) return r; + const bool restricted = m_restricted && ctx; + + if (restricted && req.aux_pow.size() > 10) + { + error_resp.code = CORE_RPC_ERROR_CODE_RESTRICTED; + error_resp.message = "Too many aux pow hashes"; + return false; + } + if (req.aux_pow.empty()) { error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM; @@ -2097,7 +2106,7 @@ namespace cryptonote while ((1u << path_domain) < aux_pow.size()) ++path_domain; uint32_t nonce; - const uint32_t max_nonce = 65535; + const uint32_t max_nonce = restricted ? 16384 : 65535; bool collision = true; for (nonce = 0; nonce <= max_nonce; ++nonce) {