veRWA - 0xG0P1'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: 114/125

Findings: 1

Award: $4.23

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/LendingLedger.sol#L129-L143 https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/LendingLedger.sol#L204-L207

Vulnerability details

Impact

Users who have not provided liquidity can still claim Canto

Proof of Concept

The identified vulnerability pertains to the situation where a lending market undergoes blacklisting, leading to the preservation of user balances and market balance history. This potential security issue can be illustrated through the following scenario:

  1. Consider a scenario in which Alice participates by providing 100 tokens as liquidity to a lending market during the X Epoch.

    • Alice's user balance: 100 tokens
    • Market balance: 100 tokens
  2. Subsequently, Alice proceeds to claim rewards for each subsequent epoch (X + 1, X + 2, ...).

  3. After a certain number of epochs, the governance of the lending market decides to impose a blacklist on the market.

  4. Alice performs a withdrawal of her 100 tokens from the lending market. The attempt to synchronize the ledger through the execution of the sync_ledger function results in a reversion due to the blacklisting of the lending market. It is assumed that the lending market employs a try/catch mechanism to handle the reversion of the sync_ledger function. Consequently, Alice's balance within the lending market is reduced to zero.

  5. Following a subsequent span of epochs, the lending market's blacklisting is lifted, effectively whitelisting the market once again. It's important to note that Alice's balance history is preserved within the lendingLedger.

  6. Given this preserved balance history, Alice is enabled to claim rewards, despite the fact that she had previously withdrawn her 100 tokens from the lending market. This withdrawal, however, remains unrecorded as a consequence of the reversion experienced during the blacklisting period.

Tools Used

Manual review

Introducing a potential resolution involves granting the lending market the capability to execute the sync_ledger function during the withdrawal of liquidity (Delta is negative). By doing so, both the user's balance and the market balance can be appropriately modified, even in scenarios where the lending market undergoes blacklisting. This approach ensures that when the lending market is eventually whitelisted, operational functionality is seamlessly restored.

Assessed type

Context

#0 - c4-pre-sort

2023-08-13T01:29:33Z

141345 marked the issue as low quality report

#1 - c4-pre-sort

2023-08-13T01:34:08Z

141345 marked the issue as primary issue

#2 - c4-pre-sort

2023-08-13T05:14:45Z

141345 marked the issue as duplicate of #270

#3 - c4-pre-sort

2023-08-13T14:41:52Z

141345 marked the issue as remove high or low quality report

#4 - c4-judge

2023-08-25T10:14:52Z

alcueca marked the issue as not a duplicate

#5 - c4-judge

2023-08-25T10:14:57Z

alcueca changed the severity to QA (Quality Assurance)

#6 - alcueca

2023-08-25T10:15:12Z

Duplicate of #39, which is QA

#7 - c4-judge

2023-08-25T10:15:22Z

alcueca marked the issue as grade-b

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