WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Sunny Coral Monkey - Rebasing Token Balance Corruption #737

@sherlock-admin2

Description

@sherlock-admin2

Sunny Coral Monkey

Medium

Rebasing Token Balance Corruption

Summary

The contracts use balance differences to determine the amount of tokens received, which can be affected by rebasing tokens.

Root Cause

Both DexSwap.sol and Router.sol compute the received amount of toToken by subtracting the balance before the swap from the balance after the swap.

Break down:

  1. Uses absolute balance delta for received amount
  2. Rebasing tokens (e.g., AMPL, RAI) autonomously change balances
  3. Positive rebases inflate received amount, negative rebases cause underflow
    The issue arises: If the token rebases during the swap, the balance change may not solely represent the swap output.
    Rebasing tokens can cause the balance difference to be inaccurate.

Internal Pre-conditions

N/A

External Pre-conditions

N/A

Attack Path

  1. Uses balance delta for received amount
  2. No protection against autonomous balance changes

Impact

The balance difference to be inaccurate.

PoC

No response

Mitigation

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Won't FixThe sponsor confirmed this issue will not be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions