fix(security): pin the pool TLS certificate fingerprint (F12)

With pool TLS enabled but no fingerprint pinned, xmrig accepts ANY certificate
(verifyFingerprint passes on a null fingerprint), so an on-path attacker could
MITM the stratum session and capture/redirect the login. The wallet never set a
fingerprint and had no setting for one.

Add a pool_tls_fingerprint setting, emit it as the xmrig "tls-fingerprint" pool
key when non-empty, and refuse to start pool mining with TLS on but no
fingerprint (mining_tls_needs_fingerprint) so "pool TLS on" actually
authenticates the pool. pool_tls still defaults off.

English-only for the new string; 8 locales fall back.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 11:52:57 -06:00
co-authored by Claude Opus 4.8
parent cd37b1be3a
commit 5ffb083855
6 changed files with 34 additions and 10 deletions
+11
View File
@@ -3703,6 +3703,17 @@ void App::postPoolMinerJob(int threads, bool retargetOnly)
cfg.algo = util::resolvePoolAlgo(cfg.pool_url, settings_->getPoolAlgo());
cfg.threads = threads; // Use the same thread selection as solo mining
cfg.tls = settings_->getPoolTls();
cfg.tls_fingerprint = settings_->getPoolTlsFingerprint();
// Refuse pool TLS without a pinned certificate fingerprint: xmrig otherwise accepts ANY certificate,
// which an on-path attacker can exploit to MITM the stratum session (capturing the login / feeding
// jobs). Require the fingerprint so "pool TLS on" actually authenticates the pool. (F12)
if (cfg.tls && cfg.tls_fingerprint.empty()) {
const std::string merr = TR("mining_tls_needs_fingerprint");
setMiningError(merr);
ui::Notifications::instance().error(merr);
if (retargetOnly) stopPoolMining();
return;
}
cfg.hugepages = settings_->getPoolHugepages();
// xmrig "user" is the pool login the block rewards are credited to. The user's
+2
View File
@@ -397,6 +397,7 @@ bool Settings::load(const std::string& path)
loadScalar(j, "pool_worker", pool_worker_);
loadScalar(j, "pool_threads", pool_threads_);
loadScalar(j, "pool_tls", pool_tls_);
loadScalar(j, "pool_tls_fingerprint", pool_tls_fingerprint_);
loadScalar(j, "pool_hugepages", pool_hugepages_);
loadScalar(j, "pool_mode", pool_mode_);
if (j.contains("pool_select_mode")) pool_select_mode_ = parsePoolSelectMode(j["pool_select_mode"]);
@@ -679,6 +680,7 @@ bool Settings::save(const std::string& path)
j["pool_worker"] = pool_worker_;
j["pool_threads"] = pool_threads_;
j["pool_tls"] = pool_tls_;
j["pool_tls_fingerprint"] = pool_tls_fingerprint_;
j["pool_hugepages"] = pool_hugepages_;
j["pool_mode"] = pool_mode_;
j["pool_select_mode"] = poolSelectModeName(pool_select_mode_);
+5
View File
@@ -602,6 +602,8 @@ public:
void setPoolThreads(int v) { pool_threads_ = v; }
bool getPoolTls() const { return pool_tls_; }
void setPoolTls(bool v) { pool_tls_ = v; }
std::string getPoolTlsFingerprint() const { return pool_tls_fingerprint_; }
void setPoolTlsFingerprint(const std::string& v) { pool_tls_fingerprint_ = v; }
bool getPoolHugepages() const { return pool_hugepages_; }
void setPoolHugepages(bool v) { pool_hugepages_ = v; }
bool getPoolMode() const { return pool_mode_; }
@@ -829,6 +831,9 @@ private:
std::string pool_worker_ = "";
int pool_threads_ = 0;
bool pool_tls_ = false;
// Pinned SHA-256 certificate fingerprint for pool TLS (F12). Empty = unset; pool mining refuses to
// start with TLS on but no fingerprint, since xmrig's TLS otherwise accepts any certificate.
std::string pool_tls_fingerprint_;
bool pool_hugepages_ = true;
bool pool_mode_ = false; // false=solo, true=pool
PoolSelectMode pool_select_mode_ = PoolSelectMode::Manual; // manual vs auto-balance pool choice
+14 -10
View File
@@ -207,16 +207,20 @@ bool XmrigManager::generateConfig(const Config& cfg, const std::string& outPath)
{"yield", true} // Yield to other processes
};
j["pools"] = json::array({
{
{"algo", cfg.algo},
{"url", cfg.pool_url},
{"user", cfg.wallet_address},
{"pass", cfg.worker_name},
{"keepalive", true},
{"tls", cfg.tls}
}
});
json pool = {
{"algo", cfg.algo},
{"url", cfg.pool_url},
{"user", cfg.wallet_address},
{"pass", cfg.worker_name},
{"keepalive", true},
{"tls", cfg.tls}
};
// Pin the pool's TLS certificate when configured. Without a fingerprint, xmrig's TLS accepts ANY
// certificate (verifyFingerprint passes on a null fingerprint), so an on-path attacker could MITM the
// stratum session and capture/redirect the login. The pool-start path refuses TLS without one. (F12)
if (!cfg.tls_fingerprint.empty())
pool["tls-fingerprint"] = cfg.tls_fingerprint;
j["pools"] = json::array({ pool });
j["donate-level"] = 0;
j["print-time"] = 10;
+1
View File
@@ -64,6 +64,7 @@ public:
std::string algo = "rx/hush";
int threads = 0; // 0 = xmrig auto
bool tls = false;
std::string tls_fingerprint; // pinned SHA-256 cert fingerprint; empty = no pinning (F12)
bool hugepages = true;
};
+1
View File
@@ -2102,6 +2102,7 @@ void I18n::loadBuiltinEnglish()
strings_["toast_not_connected_daemon"] = "Not connected to the node.";
strings_["toast_mining_failed"] = "Couldn't start mining: ";
strings_["toast_pool_payout_invalid"] = "Pool payout address is not a valid DragonX address — mining not started.";
strings_["mining_tls_needs_fingerprint"] = "Pool TLS is on but no certificate fingerprint is pinned \xE2\x80\x94 that would accept any certificate. Set the pool's TLS fingerprint, or turn pool TLS off, then start mining again.";
strings_["toast_av_blocked_xmrig"] = "Windows Defender blocked the miner. Add an exclusion for %APPDATA%\\ObsidianDragon.";
strings_["mining_error_retry_hint"] = "Press Mine to try again.";
strings_["mining_error_av_help"] = "How to fix";