veRWA - AlexCzm's results

Incentivization Primitive for Real World Assets on Canto

General Information

Platform: Code4rena

Start Date: 07/08/2023

Pot Size: $36,500 USDC

Total HM: 11

Participants: 125

Period: 3 days

Judge: alcueca

Total Solo HM: 4

Id: 274

League: ETH

Canto

Findings Distribution

Researcher Performance

Rank: 66/125

Findings: 1

Award: $9.82

QA:
grade-a

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/GaugeController.sol#L188-L199

Vulnerability details

Impact

Protocol implements a mitigation measurement to reduce internal damage in case of a lending market vulnerability, but it doesn't work for ongoing epoch.

Proof of Concept

Governance can call GaugeController::change_gauge_weight() in emergency situations and temporarily set the weight to 0. The implementation allows the adjustment of weight exclusively for the subsequent epoch:

uint256 next_time = ((block.timestamp + WEEK) / WEEK) * WEEK;

Temporary setting the current epoch weight to 0 is not possible. Therefore, if a lending market vulnerability arises, it could result in leakage of rewards.


    function _change_gauge_weight(address _gauge, uint256 _weight) internal {
        uint256 old_gauge_weight = _get_weight(_gauge);
        uint256 old_sum = _get_sum();
        uint256 next_time = ((block.timestamp + WEEK) / WEEK) * WEEK;

        points_weight[_gauge][next_time].bias = _weight;
        time_weight[_gauge] = next_time;

        uint256 new_sum = old_sum + _weight - old_gauge_weight;
        points_sum[next_time].bias = new_sum;
        time_sum = next_time;
    }

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/GaugeController.sol#L188C1-L199C6

Tools Used

Manual review.

Reconsider and allow current epoch weight to be updated by governance: Replace

uint256 next_time = ((block.timestamp + WEEK) / WEEK) * WEEK;

with

uint256 next_time = ((block.timestamp) / WEEK) * WEEK;


## Assessed type

Governance

#0 - 141345

2023-08-13T06:46:22Z

QA might be more appropriate.

#1 - c4-sponsor

2023-08-16T15:01:09Z

OpenCoreCH marked the issue as sponsor acknowledged

#2 - OpenCoreCH

2023-08-16T15:03:24Z

This was done on purpose such that governance cannot remove already accrued rewards. Of course, this is a tradeoff between centralization and response duration in case of emergencies, but the current implementation is relatively balanced there in my opinion, as users can be sure that no accrued rewards will be stolen and the response duration is still pretty good (worst case is that the rewards of up to 1 epoch for one market are lost in case of an exploit, so quite a small impact).

#3 - c4-judge

2023-08-24T21:24:43Z

alcueca marked the issue as satisfactory

#4 - JeffCX

2023-08-28T20:29:54Z

while I respect judge's expertise

This was done on purpose such that governance cannot remove already accrued rewards. Of course, this is a tradeoff between centralization and response duration in case of emergencies, but the current implementation is relatively balanced there in my opinion, as users can be sure that no accrued rewards will be stolen and the response duration is still pretty good (worst case is that the rewards of up to 1 epoch for one market are lost in case of an exploit, so quite a small impact).

based on this comments, the current implementation seems like a design choice but not a vulnerability, so I politely think the severity is QA

#5 - c4-judge

2023-08-28T21:25:00Z

alcueca changed the severity to QA (Quality Assurance)

#6 - c4-judge

2023-08-28T21:25:09Z

alcueca marked the issue as grade-a

#7 - alcueca

2023-08-28T21:26:41Z

I'm going to agree with @JeffCX, given that the alternative in which governance can set current epoch weight to zero also results in a loss of assets makes it clear that it is a design decision that should just be documented.

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