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

Insufficient Authorization Checks in setPassword Function

Summary

The setPassword function in the Solidity code lacks sufficient access control, potentially exposing the contract to unauthorized changes.

Vulnerability Details

The setPassword function enables the contract owner to set a password, and it is externally visible. However, this function lacks access control to verify the caller's identity, making it susceptible to unauthorized access.

As a result, anyone or malicious actors can call it to set a new password, potentially leading to unauthorized changes. While the owner retains the ability to reset the password, malicious actors could exploit this vulnerability by repeatedly setting the password.

Impact

Anyone or malicious actors can call the setPassword function to change the string private s_password variable.

Tools Used

Manual Review

Recommendations

We recommend implementing a strong access control mechanism to ensure that only authorized users can change the password.

Consider using custom modifiers or role-based access control to improve security.

Such as https://docs.openzeppelin.com/contracts/5.x/access-control

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.