PoolTogether micro contest #1 - shw's results

A protocol for no loss prize savings on Ethereum

General Information

Platform: Code4rena

Start Date: 29/07/2021

Pot Size: $20,000 USDC

Total HM: 8

Participants: 12

Period: 3 days

Judge: LSDan

Total Solo HM: 2

Id: 24

League: ETH

PoolTogether

Findings Distribution

Researcher Performance

Rank: 7/12

Findings: 4

Award: $992.88

🌟 Selected for report: 2

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: 0xRajeev

Also found by: cmichel, pauliax, shw

Labels

bug
duplicate
2 (Med Risk)
mStableYieldSource

Awards

169.7571 USDC - $169.76

External Links

Handle

shw

Vulnerability details

Impact

The approveMax function of MStableYieldSource calls the safeApprove function to set the allowance to the maximum. However, at the time of call, the allowance should be non-zero since it was set to the maximum in the constructor function. The non-zero allowance would cause the safeApprove function to revert because of a require check in the OpenZeppelin's implementation (see the following link).

Proof of Concept

Referenced code: MStableYieldSource.sol#L61-L65

OpenZeppelin - SafeERC20.sol#L52-L55

Use safeIncreaseAllowance to increase the allowance to the maximum instead (as used in the approveMaxAmount function of SwappableYieldSource).

#0 - PierrickGT

2021-08-06T16:40:42Z

Findings Information

🌟 Selected for report: shw

Also found by: cmichel

Labels

bug
2 (Med Risk)
SwappableYieldSource
sponsor confirmed

Awards

419.1534 USDC - $419.15

External Links

Handle

shw

Vulnerability details

Impact

The supplyTokenTo function of SwappableYieldSource assumes that amount of _depositToken is transferred to itself after calling the safeTransferFrom function (and thus it supplies amount of token to the yield source). However, this may not be true if the _depositToken is a transfer-on-fee token or a deflationary/rebasing token, causing the received amount to be less than the accounted amount.

Proof of Concept

Referenced code: SwappableYieldSource.sol#L211-L212

Get the actual received amount by calculating the difference of token balance before and after the transfer. For example, re-writing line 211-212 to:

uint256 balanceBefore = _depositToken.balanceOf(address(this));
_depositToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 receivedAmount = _depositToken.balanceOf(address(this)) - balanceBefore;
yieldSource.supplyTokenTo(receivedAmount, address(this));

Findings Information

🌟 Selected for report: hickuphh3

Also found by: shw

Labels

bug
duplicate
1 (Low Risk)
SwappableYieldSource

Awards

139.7178 USDC - $139.72

External Links

Handle

shw

Vulnerability details

Impact

According to the comments of the FundsTransferred event in SwappableYieldSource, the amount parameter is the number of funds transferred. However, in the _transferFunds function, the actual transferred amount is currentBalance, which should be provided as the event parameter instead.

Proof of Concept

Referenced code: SwappableYieldSource.sol#L288

Change _amount at line 288 to currentBalance.

#0 - PierrickGT

2021-08-06T16:49:12Z

Findings Information

🌟 Selected for report: hickuphh3

Also found by: 0xRajeev, hrkrshnn, shw

Labels

bug
duplicate
G (Gas Optimization)
mStableYieldSource

Awards

36.6656 USDC - $36.67

External Links

Handle

shw

Vulnerability details

Impact

Changing IERC20(savings.underlying()) to mAsset at line 62 can save gas since they are identical, and the latter avoids unnecessary external calls.

Proof of Concept

Referenced code: MStableYieldSource.sol#L62

As above

#0 - PierrickGT

2021-08-13T16:15:54Z

Findings Information

🌟 Selected for report: shw

Labels

bug
G (Gas Optimization)
SwappableYieldSource
sponsor confirmed

Awards

201.183 USDC - $201.18

External Links

Handle

shw

Vulnerability details

Impact

Changing the abi.encode function to abi.encodePacked at line 77 of SwappableYieldSource can save gas since the abi.encode function pads extra null bytes at the end of the call data, which is unnecessary. Also, in general, abi.encodePacked is more gas-efficient.

Proof of Concept

Referenced code: SwappableYieldSource.sol#L77

Solidity-Encode-Gas-Comparison

Change abi.encode to abi.encodePacked at line 77.

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