The changeOwner() function lacks proper access control, allowing any user to change the contract’s ownership. This introduces a critical vulnerability that can lead to unauthorized takeover of the contract by a malicious actor.
In the current implementation, the changeOwner() function does not restrict who can call it:
Any user can call this function, including a malicious one, and set themselves as the owner of the contract. Once ownership is transferred, the attacker can exploit the full control over the contract, including setting prices, adding rewards, or withdrawing funds.
This allows any user to take over the contract and act as the new owner. As a result, the attacker can drain funds from the contract or manipulate the protocol to their advantage, causing substantial financial and reputational damage.
Manual code review
Implement access control to restrict this function to the current owner only:
This ensures only the owner can transfer ownership and prevents transferring ownership to the zero address.
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.