Unauthorized users may exploit the access control vulnerability by calling the setPassword function and changing the password, potentially leading to unauthorized access and changes in the contract state.
The vulnerability arises from a lack of proper access control in the smart contract. As a result, any user can potentially set a new password, which should only be allowed for the contract owner. Unauthorized changes to the password can compromise the security and integrity of the contract.
The impact of this vulnerability is high risk, as it allows any unauthorized users to alter the password, undermining the security of the PasswordStore contract and potentially causing disruptions to the intended functionality.
No specific tools are involved in this vulnerability. It's a fundamental access control issue that can be addressed through code and design improvements.
To mitigate this access control vulnerability, it is crucial to implement proper access control mechanisms. The following steps can be taken to secure the contract:
Create an onlyOwner modifier that checks the msg.sender against the owner's address and apply this modifier to the setPassword function:
An alternative approach is to inherit the Ownable contract from OpenZeppelin to provide built-in access control functionality:
These recommendations help ensure that only the owner of the contract can set the password, enhancing security and access control.
Anyone can call `setPassword` and set a new password contrary to the intended purpose.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.