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

Any user can get stored password

Summary

getPassword() can be break by triggering setPassword() first

Vulnerability Details

getPassword() is ok but bug is present in setPassword() by hitting that function will become the owner of the contract and read sensitive data.

Impact

Anyone can hit setPassword() and set new password after that that user can get password by triggering getPassword().

Tools Used

Manual code review

Recommendations

Use modifier or make require statement for checking that user must be owner in setPassword()

function setPassword(string memory newPassword) external {
+ require(msg.sender == s_owner, "not owner");
s_password = newPassword;
emit SetNetPassword();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
almost 2 years ago
inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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