Hidden Bronze Piranha
Medium
Summary:
The lack of synchronization in Borrowing.sol::setTreasury
will cause operational inconsistencies for external dependencies as the admin will change the treasury address without updating references to the previous address.
Root Cause:
In Borrowing.sol:173
, the function setTreasury
fails to ensure that external dependencies relying on the old treasury address are updated, leading to operational inconsistencies.
Impact: The protocol suffers from operational inconsistencies, including failed interactions with external protocols and potential fund mismanagement. This could lead to significant disruptions and loss of trust in the system.
Attack Path:
- The admin calls
Borrowing.sol::setTreasury
to change the treasury address. - External systems continue using the outdated treasury address, causing desynchronized states.
- Operations relying on the old treasury, such as fund transfers or permissions, fail or behave incorrectly.
Mitigation:
- Validate redundancy:
if (_treasury == treasuryAddress) revert Treasury_SameAddress();
- Emit events to notify dependencies:
event TreasuryUpdated(address indexed oldTreasury, address indexed newTreasury);
- Synchronize dependencies:
function notifyDependencies() internal { externalDependency.updateTreasury(treasuryAddress); }
References:
- [M-3: Controller doesn't send treasury funds to the vault's treasury address](https://solodit.cyfrin.io/issues/m-3-controller-doesnt-send-treasury-funds-to-the-vaults-treasury-address-sherlock-none-y2k-git)
- [M-7: changeTreasury() Lack of check and remove old](https://solodit.cyfrin.io/issues/m-7-changetreasury-lack-of-check-and-remove-old-sherlock-none-y2k-git)