Description: The provided function Soulmate::readMessageInSharedSpace
is intended to allow registered couples to read messages shared between them using the Soulmate Token. However, a crucial flaw exists in the visibility keyword external
which means that anyone, not just the registered couples, can call this function. This design oversight leads to a significant privacy concern.
Impact: The malicious user gains unauthorized access to sensitive information, potentially using it for blackmail, harassment, or other malicious activities. This breach damages user trust and reputation, leading to a loss of confidence in the platform.
Proof of Concept:
Have registered couples send messages to each other through the Soulmate::writeMessageInSharedSpace
function. These messages should be stored in the Soulmate::sharedSpace
mapping within the Protocol.
The malicious user discovers the visibility issue and exploits it by using their unauthorized account to call the Soulmate::readMessageInSharedSpace
function.
The malicious user retrieves and logs the messages returned by the function, exploiting the vulnerability to access private communications between registered couples.
Place the following into the SoulmateTest.t.sol
.
Recommended Mitigation: Change the visibility keyword from external
to internal
or private
to restrict access to the function within the contract scope.
Or,
Introduce access control mechanisms such as the use of a modifier as shown below, to ensure that only authorized users, such as registered couples with valid Soulmate Tokens, can access the Soulmate::readMessageInSharedSpace
function.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.