Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Setter functions not checking if old value differs new value

Summary

Setter functions does not sanity check its values if old value is the same as new value

Vulnerability Details

It is possible to submit new password that is same as old password by mistake

Impact

User may sae old password by error and discard the new password e.g on paper or elsewhere believing they saved the new password successfully using the contract only to retrieve old password later when they need it.Meaning they lose their new password. Input values for functions need to always be sanity checked

Tools Used

Manual Analysis

Recommendations

Check that password input newPassword is not empty string

function setPassword(string memory newPassword) external {
bytes memory bytesString = bytes(newPassword);
require(keccak256(abi.encodePacked(oldPassword)) != keccak256(abi.encodePacked(newPassword)));
s_password = newPassword;
emit SetNetPassword();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
about 2 years ago
inallhonesty Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Admin Input/call validation

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.