The Vault.updateVaultAndCreditDelegationWeight
function truncates the 256-bit totalAssets()
value to 128 bits, causing incorrect credit delegation weights. This propagates inaccurate debt values to connected markets, destabilizing the protocol’s financial accounting.
Vault.sol
– updateVaultAndCreditDelegationWeight
function
Code Snippet:
Root Cause:
IERC4626.totalAssets()
returns a uint256
, but newWeight
is stored as uint128
.
If totalAssets()
exceeds 2^128 - 1
, the value is truncated, discarding higher-order bits.
Example:
Actual totalAssets()
= 2^128 + 1
(340,282,366,920,938,463,463,374,607,431,768,211,457)
Truncated newWeight
= 1
(due to uint128
overflow).
Credit Delegation Impact:
Credit delegation shares are calculated as:
Truncated weights distort this ratio, leading to incorrect debt distribution.
Systemic Propagation:
Markets use these weights to calculate debtPerVaultShare
, affecting global debt tracking.
Example: A vault with newWeight = 1
(instead of 2^128 + 1
) would delegate ~0% of its credit capacity, starving markets of debt coverage.
High Severity
Undercollateralized Markets: Truncated weights underreport vault assets, leaving markets undercollateralized and vulnerable to liquidation cascades.
Debt Mismatches: Markets may accumulate unaccounted debt, leading to protocol insolvency.
Vault Exploitation: Attackers could intentionally overflow totalAssets()
to manipulate credit delegation (e.g., reducing their debt share).
Vault Initialization:
A vault uses an ERC4626 token where totalAssets()
returns 2^128 + 1
.
`
Market Impact:
A connected market calculates its credit share as creditDelegationShareX18 = 1 / 1 = 1e18
(100%), but the true share should be negligible.
The market incorrectly assumes it has 100% of the vault’s credit capacity, leading to overborrowing and eventual insolvency.
Use Full 256-bit Precision:
Replace uint128
with uint256
for credit delegation weights:
Add Overflow Checks:
Use OpenZeppelin’s SafeCast
to prevent silent truncation:
Asset Limits:
Enforce a maximum totalAssets()
per vault to stay within uint128
bounds.
Circuit Breakers:
Pause vault operations if totalAssets()
approaches 2^128 - 1
.
Monitoring:
Track vault asset growth and trigger alerts near overflow thresholds.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.