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

Anyone can call setPassword()

Summary

setPassword() does not have access control so anyway can call it to overwrite the password.

Vulnerability Details

The setPassword() lacks access control:

function setPassword(string memory newPassword) external {
s_password = newPassword;
emit SetNetPassword();
}

Therefore anyone can call this function to overwrite the password with his/her own password.

Impact

Password can be overwritten by anyone.

Tools Used

Manual review

Recommendations

Add access control:

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

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-lacking-access-control

Anyone can call `setPassword` and set a new password contrary to the intended purpose.

Support

FAQs

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