Illuminate contest - Metatron's results

Your Sole Source For Fixed-Yields.

General Information

Platform: Code4rena

Start Date: 21/06/2022

Pot Size: $55,000 USDC

Total HM: 29

Participants: 88

Period: 5 days

Judge: gzeon

Total Solo HM: 7

Id: 134

League: ETH

Illuminate

Findings Distribution

Researcher Performance

Rank: 14/88

Findings: 7

Award: $994.00

🌟 Selected for report: 2

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: kenzo

Also found by: Metatron, WatchPug, cccz, unforgiven

Labels

bug
duplicate
3 (High Risk)

Awards

496.2962 USDC - $496.30

External Links

Lines of code

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L463-L469

Vulnerability details

Impact

Will result in either failure to lend or loss of funds for the lender

Proof of Concept

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L463-L469

  • Not very clear what was the original intention, but I find it hard to believe that subtracting the whole balanceOf iPTs from the return result from Tempus, is what was intended.
  • If the balance is higher than the return value - the operation reverts on underflow - failure to execute lend.
  • If the balance is equal or lower than the return value - lender receive less minted iPTs then expected - loss of funds for him.
  • If you argue that the balance will remain zero and this will go smoothly, please consider that an attacker can maliciously transfer iPTs to the contract address in order to cause the above problems to the project.
  • Remove the subtraction of illuminateToken.balanceOf(address(this))

#0 - KenzoAgada

2022-06-28T10:33:24Z

Duplicate of #222

Findings Information

Awards

29.8781 USDC - $29.88

Labels

bug
duplicate
3 (High Risk)

External Links

Lines of code

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol?plain=1#L486-L534

Vulnerability details

Impact

Attacker can steal funds and inflate or break the system

Proof of Concept

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol?plain=1#L486-L534

  • Attacker recognize a 'sense' market place opened by admin, with underlying u and maturity m.
  • Attacker deploys a malicious contract that agrees on ISense interface, returning the maturity m on .maturity() (to pass L504 if) and returning an arbitrary big value on .swapUnderlyingForPTs(..)
  • Attacker calls the lend function as he would for appropriate interaction, BUT passes a small amount a and address to his malicious contract as x.
  • At L524 his contract returns an arbitrary big amount and at L530 attacker receives this amount as iPTs minted for him.
  • Attacker sells these many iPTs immediately on secondary market, or just wait for maturity.
  • As a result, attacker gained funds he did not invest, the iPT value inflates to nothing, or the project left with no funds on maturity (respectively).
  • Limit the amount minted to no more than the amount invested by the user.
  • Make sure that x is actually a trustable AMM for sense contracts (I don't know sense enough to point how to do so)

#0 - sourabhmarathe

2022-06-29T12:34:53Z

Duplicate of #349.

Findings Information

🌟 Selected for report: Metatron

Also found by: 0x52, WatchPug, auditor0517, cccz, datapunk, hansfriese, hyh, kenzo, kirk-baird, shenwilly, unforgiven

Labels

bug
3 (High Risk)
sponsor confirmed

Awards

98.9071 USDC - $98.91

External Links

Lines of code

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L247-L305 https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L317-L367 https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L192-L235

Vulnerability details

Impact

Using any of the lend function mentioned, will result in loss of funds to the lender - as the funds are transferred from them but no iPTs are sent back to them! Basically making lending via these external PTs unusable.

Proof of Concept

There is no minting of iPTs to the lender (or at all) in the 2 lend functions below: https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L247-L305 https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L317-L367

Corresponding to lending of (respectively): swivel element

Furthermore, in: https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L227-L234 Comment says "Purchase illuminate PTs directly to msg.sender", but this is not happening. sending yield PTs at best.

Mint the appropriate amount of iPTs to the lender - like in the rest of the lend functions.

Findings Information

🌟 Selected for report: kenzo

Also found by: 0x52, 0xkowloon, GalloDaSballo, Metatron, WatchPug, cccz, hansfriese, kirk-baird

Labels

bug
duplicate
2 (Med Risk)

Awards

54.27 USDC - $54.27

External Links

Lines of code

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L247-L305

Vulnerability details

Impact

Wrong accounting calculation may result in malfunctioning and loss of funds for the project.

Proof of Concept

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L281-L283 https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L297

  • As seen in the lines above, the amount transferred from the lender is after subtracting the fee he actually needs to pay
  • On the other hand, the amount swapped on 'swivel' is the original (but should be the subtracted amount - fee) and this takes out from lender.sol more than received.
  • On other lend functions the accounting is done as I described, the opposite of the current code.

I recommend doing the accounting like this:

uint256 amount = a[i]; lent += amount; uint256 fee = calculateFee(amount); a[i] -= fee // correct the amount vector amountToMint += a[i] // amount minus the fee

Then

  • transferFrom with corrected lent (including the fees)
  • initiate swivel with the corrected amounts vector a
  • mint only amountToMint to the lender (sum of amounts minus the fees)

#0 - KenzoAgada

2022-06-28T08:15:21Z

Duplicate of #201

Findings Information

🌟 Selected for report: Kumpa

Also found by: Metatron, cccz, cryptphi, hansfriese, jah, kenzo, kirk-baird, pashov, poirots

Labels

bug
duplicate
2 (Med Risk)

Awards

43.9587 USDC - $43.96

External Links

Lines of code

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L192-L235

Vulnerability details

Proof of Concept

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L192-L235

  • The full amount a is transferFrom lender on L215
  • The amount - fee is invested on L219 and L229.
  • Unlike other lend function, this one is missing crediting the project with the fees they entitled to.
  • As a result, these fees cannot be collected via withdrawFee or otherwise.

Adding these lines:

uint256 fee = calculateFee(amount); fees[u] += fee;

Before the if at L217, And can use calculated fee fee at L219 and L229 instead of calculating again.

#0 - KenzoAgada

2022-06-28T06:44:21Z

Duplicate of #208

Findings Information

🌟 Selected for report: Metatron

Also found by: Kulk0, cccz, kenzo

Labels

bug
2 (Med Risk)
sponsor confirmed

Awards

206.7901 USDC - $206.79

External Links

Lines of code

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L247-L305

Vulnerability details

Impact

Assuming admin decides to pause an external principle when it's dangerous, malicious or unprofitable, Bypassing the admins decision can result in loss of funds for the project.

Proof of Concept

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L247-L305

  • The principals enum p is only used for unpaused(p) modifier, and to emit an event.
  • Attacker can bypass the unpaused(p) modifier check by simply passing an enum of another principle that is not paused.
  • The function will just continue as normal, without any other side-effect, as if the pause is simple ignored.

Add this check at the beginning of the function (just like in similar functions of this solution) if (p != uint8(MarketPlace.Principals.Swivel)) { revert Invalid('principal'); }

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