Where: https://github.com/MystenLabs/MemWal/blob/dev/services/contract/sources/account.move (function add_delegate_key)
What's wrong: When adding a delegate key, the contract stores a public key and a Sui address as two separate values, but never checks that the address actually belongs to that public key. It only checks length and format, not that the two fields are a matching pair.
**Why it matters: ** Only the account owner can call this function, so this isn't an outside-attacker exploit path today. But other parts of the system check identity two different ways — sometimes by public key, sometimes by address — and if these two fields don't actually match, those checks could disagree with each other in a way that's hard to debug later.
Suggested fix: Add an on-chain check that derives the expected address from the public key and confirms it equals the address being stored, before accepting the new delegate key.
Where: https://github.com/MystenLabs/MemWal/blob/dev/services/contract/sources/account.move (function add_delegate_key)
What's wrong: When adding a delegate key, the contract stores a public key and a Sui address as two separate values, but never checks that the address actually belongs to that public key. It only checks length and format, not that the two fields are a matching pair.
**Why it matters: ** Only the account owner can call this function, so this isn't an outside-attacker exploit path today. But other parts of the system check identity two different ways — sometimes by public key, sometimes by address — and if these two fields don't actually match, those checks could disagree with each other in a way that's hard to debug later.
Suggested fix: Add an on-chain check that derives the expected address from the public key and confirms it equals the address being stored, before accepting the new delegate key.