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

Lack of validation for setPassword parameter

Summary

The function lacks validation, allowing for an empty string to be set as a password.

Vulnerability Details

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

The function does not check if the string is empty.

Impact

An empty password can be set, undermining the security of the contract.

Tools Used

Manual review

Recommendations

function setPassword(string memory newPassword) external {
+ uint256 len = bytes(newPassword).length;
+ require(len != 0, "Password cannot be empty");
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: Admin Input/call validation

Support

FAQs

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