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

Anyone can setPassword() due to missed access control

Summary

The setPassword() function allows anyone to overwrite the s_password which should only be written by the s_owner.

Vulnerability Details

As shown in the code snippet below, the setPassword() function is an external function without access control.

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

Therefore, anyone can call the function with an arbitrary newPassword to overwrite the s_password.

Impact

The password could be easily tampered.

Tools Used

Manual review

Recommendations

Add "require(msg.sender == s_owner)" check in setPassword().

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.