Soulmate::getDivorced
is used by soulmates to get divorce but it also allows users with no soulmate to get divorced.
Even though one doesn't have any soulmate still it doesn't revert and make divorced
mapping for the msg.sender
to true.
Along with that it should revert if the soulmates are divorced but still it again modifes the state to same values unnecessarily.
The vulnerability is present in the Soulmate::getDivorced
function where it doesn't revert for user having no soulmate and make the divorced
mapping to true for them.
Here, if the caller, i.e. msg.sender
has no soulmate, then soulmate2
will be equal to address(0)
and then it makes:
divorced for caller to true (even though they have no soulmate to divorce to)
makes divorced for address(0)
to true.
Along with that it doesn't revert for already divorced soulmates and unnecessarily updates the state to same values.
Allows a user who has no soulmate to successfully call it get divorced mapping for them to true.
Manual Review
Add the test in the file: test/unit/SoulmateTest.t.sol
Run the test:
Revert if user has no soulmate.
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.