veRWA - BenRai'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: 58/125

Findings: 1

Award: $15.83

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

15.8333 USDC - $15.83

Labels

bug
3 (High Risk)
partial-50
upgraded by judge
duplicate-182

External Links

Lines of code

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L326-L349 https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L356-L387

Vulnerability details

Impact

Even though the lock of a user has expired, he cannot withdraw his deposit and needs to lock it for 5 more years to be able to withdraw it in the future.

Proof of Concept

When a user is calling withdraw to withdraw his collateral, it is checked if he is his own delegatee.

require(locked_.delegatee == msg.sender, "Lock delegated");

If not, the user can not withdraw his deposit.

To become his own delegatee he needs to call delegate and delegate his votes to his address. The problem is that it is not possible to delegate his votes to an address that has a shorter locktime than the old delegate.

require(toLocked.end >= fromLocked.end, "Only delegate to longer lock");

Since his locktime is in the past and therefor is smaller than the locktime of his current delegate, the user needs to increase his lock time again. The locktime can only be increased by 5 years resulting in the deposite of the user been locked for 5 more years before he can redeem it again.

Tools Used

Manual review

Integrate a check in delegate that checks if msg.sender wants to delegate his voting power back to himself. If so allow the transfer of voting power even if the lock time of the msg.sender is smaller than the lock time of the current delegate.

Assessed type

Timing

#0 - c4-pre-sort

2023-08-12T11:08:33Z

141345 marked the issue as duplicate of #178

#1 - c4-judge

2023-08-24T07:14:05Z

alcueca marked the issue as duplicate of #82

#2 - c4-judge

2023-08-24T07:20:39Z

alcueca changed the severity to 2 (Med Risk)

#3 - c4-judge

2023-08-24T07:34:23Z

alcueca marked the issue as partial-50

#4 - c4-judge

2023-08-29T06:37:36Z

alcueca changed the severity to 3 (High Risk)

Awards

15.8333 USDC - $15.83

Labels

bug
3 (High Risk)
partial-50
upgraded by judge
duplicate-182

External Links

Lines of code

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L390-L409

Vulnerability details

Impact

The delegatee of a user decides how long the deposits of the user are locked

Proof of Concept

When calling delegate, users can only delegate their votes to an new address that has a longer or equal locktime than the old one.

require(toLocked.end >= fromLocked.end, "Only delegate to longer lock");

This means that if a user wants to get his votes back from an address he delegated to (current delegate), his lock time must be longer than the log time of the current delegate.

This means that if the current delegatee increases his lock time, the user who wants to delegate his votes back to himself needs to make his locktime bigger than the locktime of the current delegate. Since the deposit can only be withdrawn when the locktime has been passed, the current delegatee indirectly increases the locktime of all users that have delegated votes to him.

Tools Used

Manual review

Make it possible for a user to get back his voting power without the need to increase his lock time by checking if msg.sender wants to delegate his voting power to himself.

The locking effect can also be mitigated by reducing the variable LOCKTIME to e.g. 1 year. This would make the impact of being forced to increase the own lock time to be able to withdraw the own deposit smaller.

Assessed type

Governance

#0 - c4-pre-sort

2023-08-12T14:02:08Z

141345 marked the issue as duplicate of #116

#1 - c4-pre-sort

2023-08-13T14:35:02Z

141345 marked the issue as duplicate of #82

#2 - c4-judge

2023-08-24T07:20:40Z

alcueca changed the severity to 2 (Med Risk)

#3 - c4-judge

2023-08-24T07:30:23Z

alcueca marked the issue as partial-50

#4 - c4-pre-sort

2023-08-24T08:21:44Z

141345 marked the issue as not a duplicate

#5 - c4-pre-sort

2023-08-24T08:24:03Z

141345 marked the issue as duplicate of #375

#6 - c4-judge

2023-08-24T21:11:14Z

alcueca marked the issue as partial-50

#7 - c4-judge

2023-08-29T06:37:03Z

alcueca marked the issue as duplicate of #182

#8 - c4-judge

2023-08-29T06:37:36Z

alcueca changed the severity to 3 (High Risk)

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