Sublime contest - sirhashalot's results

Democratizing credit via Web3.

General Information

Platform: Code4rena

Start Date: 09/12/2021

Pot Size: $50,000 USDC

Total HM: 19

Participants: 21

Period: 7 days

Judge: 0xean

Total Solo HM: 14

Id: 61

League: ETH

Sublime

Findings Distribution

Researcher Performance

Rank: 13/21

Findings: 3

Award: $1,014.14

🌟 Selected for report: 5

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: sirhashalot

Also found by: Jujic, sirhashalot

Labels

bug
duplicate
2 (Med Risk)
sponsor confirmed

Awards

380.2618 USDC - $380.26

External Links

Handle

sirhashalot

Vulnerability details

There are instances where the SafeApprove() function is called only once without setting the allowance to zero. Some tokens, like USDT, require first reducing the address' allowance to zero by calling approve(_spender, 0). Additionally, the comment before the OpenZeppelin SafeApprove function states "safeApprove should only be called when setting an initial allowance, or when resetting it to zero".

Impact

Transactions will revert when using an unsupported token like USDT (see the approve() function requirement at line 199).

Proof of Concept

Note: the usage of SafeApprove() in mocks/yVault/Controller.sol (lines 196-197) does not need modification since it already uses the recommended approach.

Tools Used

Manual analysis

Use SafeApprove() to set the allowance to zero first. Alternatively, use safeIncreaseAllowance or safeDecreaseAllowance instead as suggested by the OpenZeppelin SafeApprove comment.

#0 - 0xean

2022-01-21T21:18:13Z

dupe of #97

Findings Information

🌟 Selected for report: sirhashalot

Also found by: Jujic, sirhashalot

Labels

bug
2 (Med Risk)
sponsor confirmed

Awards

380.2618 USDC - $380.26

External Links

Handle

sirhashalot

Vulnerability details

Impact

There are 3 instances where the IERC20.approve() function is called only once without setting the allowance to zero. Some tokens, like USDT, require first reducing the address' allowance to zero by calling approve(_spender, 0). Transactions will revert when using an unsupported token like USDT (see the approve() function requirement at line 199).

Proof of Concept

Note: the usage of approve() in yield/CompoundYield.sol (lines 211-212), in yield/YearnYield.sol (lines 211-212), and in yield/AaveYield.sol (lines 297-298) do not need modification since it they already use the recommended approach. Additionally the usage of approve() in yield/AaveYield.sol:307 likely does not need modification since that approve function only handles ETH.

Tools Used

Manual analysis

Use approve(_spender, 0) to set the allowance to zero immediately before each of the existing approve() calls.

#0 - 0xean

2022-01-21T21:17:25Z

moving to medium risk as the availability of the protocol is affected.

2 β€” Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
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