sherlock-audit / 2024-11-telcoin-judging

0 stars 0 forks source link

0xsalami - Storage collision risk in upgradeable contracts #201

Open sherlock-admin3 opened 1 week ago

sherlock-admin3 commented 1 week ago

0xsalami

Medium

Storage collision risk in upgradeable contracts

Summary

While the contracts use ERC-7201 storage layout, there are potential risks in the storage handling across the inheritance chain and upgrades.

Root Cause

https://github.com/sherlock-audit/2024-11-telcoin/blob/main/telcoin-audit/contracts/util/abstract/Blacklist.sol#L19-L20 https://github.com/sherlock-audit/2024-11-telcoin/blob/main/telcoin-audit/contracts/stablecoin/StablecoinHandler.sol#L57-L58

The contracts use multiple storage slots and inheritance, which could lead to storage collisions if not properly managed during upgrades or if storage gaps aren't properly maintained.

Internal pre-conditions

  1. Contract must be upgraded
  2. New implementation must modify storage layout
  3. Multiple inherited contracts must access storage

External pre-conditions

No response

Attack Path

  1. If an upgrade introduces new storage variables without proper spacing
  2. Storage slots could collide with existing ones from inherited contracts

Impact

PoC

No response

Mitigation

Add explicit storage gaps in all upgradeable contracts