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

`setPassword` lacks an access control check, allowing anyone to set a new password

Summary

setPassword lacks an access control check, allowing anyone to set a new password

Vulnerability Details

/*
* @notice This function allows only the owner to set a new password.
* @param newPassword The new password to set.
*/
function setPassword(string memory newPassword) external {
s_password = newPassword;
emit SetNetPassword();
}

The setPassword is intended to allow only the owner to set a new password.
However, there is no access control check implemented in the function. Anyone can call this function and set a new password for the contract.

Impact

Everyone can set a new password.

Tools Used

Manual Review.

Recommendations

It should include an access control check within the setPassword function.

require(msg.sender == s_owner, "not owner!");
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.