transferFrom
functon returns a bool which shows whether a transfer was successful or not, however in some instances in the TokenDivider.sol
contract, this is ignored
https://github.com/Cyfrin/2025-01-pieces-protocol/blob/main/src/TokenDivider.sol#L207
https://github.com/Cyfrin/2025-01-pieces-protocol/blob/main/src/TokenDivider.sol#L248
https://github.com/Cyfrin/2025-01-pieces-protocol/blob/main/src/TokenDivider.sol#L305
In the above instances, the return value of transferFrom
function is not checked. This means that if the user calls the sellErc20
function and the transferFrom function fails, the functon doesn't revert instead it assumes the transfer went through, this could lead to losses for the user and in other instances the protocol, therefore causing inconsistencies in the contract state.
The above vulnerability could lead to losses for the protocol and user
Manual Review
Add the following if loop to check if the transfer was successful, and if not, revert
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.