PoolTogether - grearlake's results

A protocol for no-loss prize savings

General Information

Platform: Code4rena

Start Date: 07/07/2023

Pot Size: $121,650 USDC

Total HM: 36

Participants: 111

Period: 7 days

Judge: Picodes

Total Solo HM: 13

Id: 258

League: ETH

PoolTogether

Findings Distribution

Researcher Performance

Rank: 68/111

Findings: 2

Award: $38.88

QA:
grade-b

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

Awards

22.9603 USDC - $22.96

Labels

bug
2 (Med Risk)
satisfactory
duplicate-300

External Links

Lines of code

https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L607-#L632

Vulnerability details

Impact

User only can claim reward when the reward is distributed by calling claimPrize() function.

function claimPrizes( uint8 _tier, address[] calldata _winners, uint32[][] calldata _prizeIndices, uint96 _feePerClaim, address _feeRecipient ) external returns (uint256) { if (msg.sender != _claimer) revert CallerNotClaimer(msg.sender, _claimer); uint totalPrizes; for (uint w = 0; w < _winners.length; w++) { uint prizeIndicesLength = _prizeIndices[w].length; for (uint p = 0; p < prizeIndicesLength; p++) { totalPrizes += _claimPrize( _winners[w], _tier, _prizeIndices[w][p], _feePerClaim, _feeRecipient ); } } return totalPrizes; }

This function is only can called by _claimer role:

if (msg.sender != _claimer) revert CallerNotClaimer(msg.sender, _claimer);

If vault owner set themselves as claimer or set claimer is his/her controlled address, he simply just not execute function, which make users cant claim rewards.

Proof of Concept

As described

Tools Used

Manual review

Consider removing claimer role and make other mechanism for user claim reward right after it is distributed

Assessed type

Other

#0 - c4-judge

2023-07-18T17:53:25Z

Picodes marked the issue as duplicate of #324

#1 - c4-judge

2023-08-06T10:46:40Z

Picodes marked the issue as satisfactory

Awards

15.9228 USDC - $15.92

Labels

bug
disagree with severity
downgraded by judge
grade-b
QA (Quality Assurance)
Q-27

External Links

Lines of code

https://github.com/GenerationSoftware/pt-v5-prize-pool/blob/4bc8a12b857856828c018510b5500d722b79ca3a/src/libraries/DrawAccumulatorLib.sol#L406-#L408

Vulnerability details

In the document, C(d) is calculated with formula:

C(d)=βˆ’tβˆ—a^d

But in code base, it is calculated as:

function computeC(SD59x18 _alpha, uint _x, uint _k) internal pure returns (SD59x18) { return toSD59x18(int(_k)).mul(_alpha.pow(toSD59x18(int256(_x)))); }

Compare with document, formula in code lacking a negative value, since _k is always >= 0

Impact

Formula is different from document

Proof of Concept

Tools Used

Manual review

multiple toSD59x18(int(-1)) in return value

Assessed type

Math

#0 - asselstine

2023-07-19T21:29:56Z

This is actually an intentional optimization: if you look at the integrate function it goes start - end rather than end - start with both operands being negative. It saves us from multiplying by -1 redundantly multiple times.

That being said- I feel like we could add comments to clarify that in the code.

#1 - c4-sponsor

2023-07-19T21:30:00Z

asselstine marked the issue as disagree with severity

#2 - c4-judge

2023-08-07T15:02:55Z

Picodes changed the severity to QA (Quality Assurance)

#3 - c4-judge

2023-08-08T14:36:09Z

Picodes marked the issue as grade-b

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter