The function uses the low-level call
to transfer Ether to the admin. While call
is flexible, it is vulnerable to reentrancy attacks, where an external contract could make a recursive call back into the contract, potentially altering the contract's state or draining funds.
Vulnerability Details
Funds Loss: If an attacker exploits the reentrancy vulnerability, they could withdraw more funds than the intended amount, leading to a loss of Ether from the contract.
Security Breach: A successful reentrancy attack could compromise the integrity of the contract and its balance, affecting other users' trust in the system.
Reputation Damage: A breach in security could severely damage the reputation of the project or the contract owner, leading to a loss of confidence from investors or users.
Solidity: The programming language for smart contracts.
Reentrancy Guard: A technique used to prevent recursive function calls and mitigate reentrancy attacks.
call
function: Used for sending Ether, but can be prone to vulnerabilities when misused in external calls.
ChatGPT: Assisting in reviewing the code,writing document and identifying vulnerabilities.
Implement a Reentrancy Guard: Use the noReentrancy
modifier or other equivalent mechanisms to block recursive calls.
Prefer transfer
or send
over call
for Ether transfers: These methods are safer in terms of reentrancy as they forward a limited amount of gas (2300 gas), preventing external contracts from making recursive calls.
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.