Closed code423n4 closed 1 year ago
What prevents the claimer
from just skipping the malicious hooks using the _winners
array?
Picodes changed the severity to 2 (Med Risk)
Picodes marked the issue as duplicate of #465
Picodes marked the issue as satisfactory
Picodes marked the issue as partial-50
Lines of code
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L618-L629 https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1053 https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1068
Vulnerability details
Impact
The
Vault.claimPrizes
function is used toclaim prizes
for thewinners
of the prizes. This is done by iterating through two nestedfor
loops. One for loop iterates through the number of winners and other for loop iterates through the_prizeIndices
.Inside these nested loops the
Vault._claimPrize()
internal function is called. In theVault._claimPrize()
function, thehooks.useBeforeClaimPrize
andhooks.implementation.afterClaimPrize
hooks of a particular winner can be called. These hooks are set by thewinner
himself calling theVault.setHooks
function.Hence a malicious
winner
canrevert
the transaction inside thehooks.useBeforeClaimPrize
orhooks.implementation.afterClaimPrize
hook function, thus making the entire prize claim for other winners to be Denied as well(DoS).This will make it impossible for the
_claimer
to distribute the prizes among the winners.Proof of Concept
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L618-L629
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1053
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1068
Tools Used
Manual Review and VSCode
Recommended Mitigation Steps
Hence it is recommended to either omit the
hook
functionality from thewinners
or ifhooks
are an essential part of the protocol then it is recommended to allow thewinner
or aclaimer
to claim the prizes individually rather than iterating through an array of all winners.Assessed type
DoS