Sherlock contest - shw's results

Decentralized exploit protection.

General Information

Platform: Code4rena

Start Date: 22/07/2021

Pot Size: $80,000 USDC

Total HM: 6

Participants: 14

Period: 7 days

Judge: ghoulsol

Total Solo HM: 3

Id: 21

League: ETH

Sherlock

Findings Distribution

Researcher Performance

Rank: 3/14

Findings: 3

Award: $11,670.34

🌟 Selected for report: 9

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: walker

Also found by: cmichel, shw

Labels

bug
duplicate
2 (Med Risk)

Awards

1009.8701 USDC - $1,009.87

External Links

Handle

shw

Vulnerability details

Impact

When a user stakes or a protocol deposits a transfer-on-fee/deflationary token, the solution does not correctly handle the received amount, which could be less than what is accounted for.

Proof of Concept

Referenced code: PoolOpen.sol#L36-L38 PoolBase.sol#L270-L271

Get the actual received amount by calculating the difference of token balance before and after the transfer. For example, re-writing line 36-38 of PoolOpen as follows:

uint256 balanceBefore = _token.balanceOf(address(this));
_token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 receivedAmount = _token.balanceOf(address(this)) - balanceBefore;

lock = LibPool.stake(ps, receivedAmount, _receiver);

#0 - Evert0x

2021-07-31T08:32:33Z

#12

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