Moonwell - Vagner's results

An open lending and borrowing DeFi protocol.

General Information

Platform: Code4rena

Start Date: 24/07/2023

Pot Size: $100,000 USDC

Total HM: 18

Participants: 73

Period: 7 days

Judge: alcueca

Total Solo HM: 8

Id: 267

League: ETH

Moonwell

Findings Distribution

Researcher Performance

Rank: 28/73

Findings: 3

Award: $239.81

QA:
grade-a

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: immeas

Also found by: 0xComfyCat, Vagner, ast3ros, kutugu, markus_ether, volodya

Labels

bug
2 (Med Risk)
downgraded by judge
partial-50
duplicate-308

Awards

151.5613 USDC - $151.56

External Links

Lines of code

https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L344-L409

Vulnerability details

Impact

The function executeProposal is used with the wormhole bridge to execute proposals from different chains, but it doesn't check if the VAA processed is meant to be sent to that address.

Proof of Concept

As you can see it is specified in both queueProposal and executeProposal that is important that the VAA is processed only once and critically, intended for that contract https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L226 https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L235 For queueProposal case this is correctly checked in this require statement https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L322 but there is not checks in the executeProposal proposals, which could lead to wrong assumptions, doing external calls with different values to random addresses in the case where the intended address is not TemporalGovernor.sol. This is especially dangerous fastTrackProposalExecution where checks like queueTime would pass, and the calls will be done immediately. This could also lead to loss of funds is value is meant to be sent with those calls.

Tools Used

Manual review

Do the same checks in _executeProposal like in _queueProposal since you specify in the comments that it is critically to check this.

Assessed type

Governance

#0 - c4-pre-sort

2023-08-03T13:24:12Z

0xSorryNotSorry marked the issue as duplicate of #308

#1 - c4-judge

2023-08-12T20:27:28Z

alcueca marked the issue as satisfactory

#2 - c4-judge

2023-08-12T20:27:32Z

alcueca marked the issue as partial-50

#3 - c4-judge

2023-08-21T21:38:33Z

alcueca changed the severity to 2 (Med Risk)

Findings Information

🌟 Selected for report: hals

Also found by: 0x70C9, 0xComfyCat, 0xl51, Kaysoft, RED-LOTUS-REACH, T1MOH, Tendency, Vagner, bin2chen, immeas, kodyvim, sces60107

Labels

bug
2 (Med Risk)
partial-50
duplicate-268

Awards

43.3709 USDC - $43.37

External Links

Lines of code

https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L400-L402

Vulnerability details

Impact

The contract TemporalGovernor.sol is used to queue and execute proposals on other chains with data and values, but that is not possible since the contract can't receive native tokens.

Proof of Concept

As you can see the function executeProposal and fastTrackProposalExecution are not payable https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L237 https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L266 and the contract doesn't have any receive function, nor the contracts that it inherits, so any time the _executeProposal would be called with any of the values array value greater than 0, the transaction would revert because there are no native funds in the contract to be transferred.

Tools Used

Manual review

Implement a receive function or set any function in the contract payable to be able to receive native tokens.

Assessed type

ETH-Transfer

#0 - c4-pre-sort

2023-08-03T13:21:17Z

0xSorryNotSorry marked the issue as duplicate of #268

#1 - c4-judge

2023-08-12T20:36:58Z

alcueca marked the issue as satisfactory

#2 - c4-judge

2023-08-12T20:37:01Z

alcueca marked the issue as partial-50

Lines of code

https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Comptroller.sol#L1031-L1052

Vulnerability details

Impact

The way the rewards are distributed right now, in the MultiRewardDistributor.sol, can make the whole distribute process unusable because of out-of-gas errors.

Proof of Concept

The way the whole claiming rewards process, does multiple interactions with multiple contracts and updates multiple storage values in multiple loops, which could lead easily to out-of-gas errors, but let's see the whole claiming process.

Tools Used

Manual review

Consider splitting the functionality a bit, the claimReward function on Comptroller.sol does too many things at once, also try to work more with memory values by coping the storage values into memory, and then loop trough them, as it cost way less gas, and only update the storage values at the end

Assessed type

Other

#0 - c4-pre-sort

2023-08-03T13:48:41Z

0xSorryNotSorry marked the issue as duplicate of #326

#1 - c4-judge

2023-08-12T20:15:12Z

alcueca changed the severity to QA (Quality Assurance)

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