What changed, and why it matters
This patch fixes a use-after-free bug in Monero's ring signature verification code. The bug occurred because a local results container was declared after the thread pool waiter object. In C++, local objects are destroyed in reverse order of creation, so the waiter (which waits for worker threads to finish) was being destroyed before the results container. If a worker thread still accessed the results container after the waiter was gone, it could read or write freed memory. The fix simply moves the results container to be declared before the waiter, ensuring it is destroyed after all threads are done with it. This is a memory-safety and potential correctness issue in transaction verification, but the patch is small and the practical exploit path is uncertain.
Apply the patch promptly. It is a minimal, low-risk reordering fix that closes a real use-after-free window. Nodes and wallets verifying RingCT transactions should update. No immediate emergency response is indicated because exploitation depends on race conditions and the practical security impact is not fully established from the diff alone.
Security signals we found
use-after-free in concurrent verification path
shared mutable state (std::deque<bool>, std::atomic<bool>) accessed by thread pool workers
object lifetime ordering bug between waiter and results container
affects ringct/rctSigs.cpp transaction verification functions
patch only reorders variable declarations, no logic change
Evidence from the diff
In rctSigs.cpp, three sites (verRct, verRctSemanticsSimple, verRctNonSemanticsSimple) declared a tools::threadpool::waiter before the shared result container (std::deque
Changed components
src/ringct/rctSigs.cppverRct()verRctSemanticsSimple()verRctNonSemanticsSimple()range proof / bulletproof verification thread pool usageInspect captured patch +3 / −4
### src/ringct/rctSigs.cpp
@@ -1310,9 +1310,9 @@ namespace rct {
try
{
if (semantics) {
+ std::deque<bool> results(rv.outPk.size(), false);
tools::threadpool& tpool = tools::threadpool::getInstanceForCompute();
tools::threadpool::waiter waiter(tpool);
- std::deque<bool> results(rv.outPk.size(), false);
DP("range proofs verified?");
for (size_t i = 0; i < rv.outPk.size(); i++)
tpool.submit(&waiter, [&, i] { results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]); });
@@ -1360,9 +1360,9 @@ namespace rct {
{
PERF_TIMER(verRctSemanticsSimple);
+ std::deque<bool> results;
tools::threadpool& tpool = tools::threadpool::getInstanceForCompute();
tools::threadpool::waiter waiter(tpool);
- std::deque<bool> results;
std::vector<const Bulletproof*> bp_proofs;
std::vector<const BulletproofPlus*> bpp_proofs;
size_t max_non_bp_proofs = 0, offset = 0;
@@ -1593,10 +1593,9 @@ namespace rct {
if (pts.empty())
return true;
+ std::atomic<bool> all_valid{true};
tools::threadpool& tpool = tools::threadpool::getInstanceForCompute();
tools::threadpool::waiter waiter(tpool);
-
- std::atomic<bool> all_valid{true};
for (std::size_t i = 0; i < pts.size(); ++i)
{
tpool.submit(&waiter, [&pts, &all_valid, i]Why this scored 63/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.