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

Everyone can change the password

Summary

The setPassword(string memory newPassword) function is external, which means everyone can call this function.

Vulnerability Details

There is no protection to allow only the owner to update the password.

Impact

So, someone could create a smart contract that will call this function and update the password to an arbitrary value.

the owner could loose his password

Tools Used

Recommendations

Use OpenZeppelin's Ownable contract, or add require(msg.sender != s_owner) to the code:

solidity
Copy code
function setPassword(string memory newPassword) external {
require(msg.sender != s_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
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.