The StabilityPool contract contains a medium-severity vulnerability in its fund management system, characterized by complex token relationships between rToken and deToken, multiple transfer paths, and cross-contract dependencies. This complexity creates potential risks for fund mismanagement and state inconsistencies.
The vulnerability manifests through several interconnected components:
Token Relationship Complexity:
Multiple Transfer Paths:
Direct rToken/deToken conversions
RAAC token rewards distribution
Cross-contract token transfers
State Management Dependencies:
User deposit tracking
Token balance synchronization
Exchange rate calculations
The vulnerability stems from the complex interaction between multiple token types and the reliance on accurate state management across contracts. The conversion between rToken and deToken requires precise calculations and synchronized state updates, creating potential points of failure.
The vulnerability could result in:
Fund Mismanagement:
Inconsistent token balances
Potential fund losses
Protocol Instability:
Exchange rate discrepancies
Cross-contract dependency failures
Static Analysis: Slither
Code Review: Manual analysis of token relationships
Testing Framework: Hardhat
Here's a test demonstrating the vulnerability using Hardhat:
Test Output:
Token Relationship Improvements:
Implement atomic token conversions
Add comprehensive balance checks
Use event emissions for state changes
State Management Enhancements:
Implement reentrancy-safe state updates
Add cross-contract state validation
Use atomic operations for critical updates
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.