GAP variable inconsistency in Bridge.sol #15
Labels
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
downgraded by judge
Judge downgraded the risk level of this issue
grade-b
Q-32
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_15_group
AI based duplicate group recommendation
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-03-taiko/blob/a30b5b6afd121e4de8ceff7165a2091e62194992/packages/protocol/contracts/bridge/IBridge.sol#L60-L64
https://github.com/code-423n4/2024-03-taiko/blob/a30b5b6afd121e4de8ceff7165a2091e62194992/packages/protocol/contracts/bridge/Bridge.sol#L29-L48
Vulnerability details
Impact
Possible storage collision
Impact - High
Chances - Low to medium
Severity - medium
Proof of Concept
__gap
variable is used in upgradeble contracts to ensure that any new variable if added in parent or child contract does not collide with any other previously used storage slot. Hence its size must clearly defined, which Taiko contracts do except inBridge.sol
, in the mentioned file they have assumed thatContext
struct uses 3 slots but it only uses 2 slots.This wrong assumption has lead to incorrect allotment size to __gap array, which should be 44 instead of 43.
It can also be verified by running
Tools Used
Manual Review
Recommended Mitigation Steps
Some real world hacks and previous findings explaining why consistent gap size is important-
audius hack , finding 1 , finding 2
Assessed type
Upgradable
The text was updated successfully, but these errors were encountered: