Closed c4-submissions closed 1 year ago
GalloDaSballo marked the issue as duplicate of #171
GalloDaSballo marked the issue as duplicate of #84
GalloDaSballo marked the issue as satisfactory
GalloDaSballo marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-09-delegate/blob/a6dbac8068760ee4fc5bababb57e3fe79e5eeb2e/src/libraries/DelegateTokenTransferHelpers.sol#L72
Vulnerability details
Impact
The condition in DelegateTokenTransferHelpers.sol#L72 is incorrect:
as the flag is set to
ERC1155_PULLED
after callingcheckERC1155BeforePull
, either by callingcheckAndPullByType
or in the call pathcheckERC1155BeforePull->pullERC1155AfterCheck
. This will make any attempt to pull ERC1155 tokens to revert (e.g.DelegateToken::flashloan
for ERC1155 tokens orDelegateToken::create
). I consider the severity to be a high because it could have gone into production without the devs noticing that such functionality is fundamentally broken. Moreover, there is no unit test covering the execution branch of theflashloan
function for ERC1155 tokens, so the odds of deploying the code as it is is right now is pretty high, so the severity.Proof of Concept
For DelegateToken::flashloan, we see that it calls
checkERC1155BeforePull
and a few lines after it callspullERC1155AfterCheck
, so it will always revert and the flash-loan functionality will be broken for ERC1155 tokens.Tools Used
Manual analysis
Recommended Mitigation Steps
Change the condition in
pullERC1155AfterCheck
to!=
so that it reverts if the token was NOT pulled or set the flag toERC1155_PULLED
insidepullERC1155AfterCheck
instead ofcheckERC1155BeforePull
Assessed type
Other