What changed, and why it matters
This patch fixes a crash in the Monero wallet software. The wallet could try to check whether a sensitive 'keys file' was locked even when no such file existed, causing the program to dereference a null pointer and crash. The fix adds a simple safety check before using the file-lock object. The crash is not a remote exploit, but it could make the wallet unavailable or, in some edge cases, lead to undefined behavior.
Treat as a stability/defensive fix. Include in routine release notes as a wallet crash fix. No urgent advisory is warranted unless further analysis shows the null dereference is reachable from attacker-controlled input.
Security signals we found
Null-pointer dereference in wallet file-lock status check
Potential denial-of-service/crash path in wallet2
Defensive null check added to existing accessor
Unit test added covering unlocked keys-file state
Evidence from the diff
wallet2::is_keys_file_locked() previously called m_keys_file_locker->locked() unconditionally. If m_wallet_file was non-empty but m_keys_file_locker was null, this produced a null-pointer dereference. The patch changes the return expression to m_keys_file_locker && m_keys_file_locker->locked(), short-circuiting the dereference. A unit test is added to assert that after unlocking, the file is reported as not locked.
Changed components
src/wallet/wallet2.cpptests/unit_tests/wallet_storage.cppInspect captured patch +2 / −1
### src/wallet/wallet2.cpp
@@ -9610,7 +9610,7 @@ bool wallet2::is_keys_file_locked() const
{
if (m_wallet_file.empty())
return false;
- return m_keys_file_locker->locked();
+ return m_keys_file_locker && m_keys_file_locker->locked();
}
bool wallet2::lock_background_keys_file(const std::string &background_keys_file)
### tests/unit_tests/wallet_storage.cpp
@@ -808,6 +808,7 @@ TEST(wallet_storage, change_export_format)
{
std::string key_file_contents;
ASSERT_TRUE(w.unlock_keys_file());
+ ASSERT_FALSE(w.is_keys_file_locked());
const bool loaded = epee::file_io_utils::load_file_to_string(target_wallet_file.string() + ".keys", key_file_contents);
ASSERT_TRUE(w.lock_keys_file());
ASSERT_TRUE(w.is_keys_file_locked());Why this scored 43/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.