Open code423n4 opened 2 years ago
we assume ownership control is driven safely
Agree with warden that the privilege addresses should not be able to use approvals in a way that rugs users funds.
Based on the fact that we have seen many rug pulls in the space based on compromised "owner" keys, this is a valid attack path.
3 — High: Assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/Vault.sol#L485-L496
The owner of the Vault contract can set an arbitrary address as the
controller
.https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/Vault.sol#L342-L352
A malicious
controller
contract can transfer funds from the Vault to the attacker.PoC
A malicious/compromised can:
Vault#setController()
and setcontroller
to a malicious contract;Vault#utilize()
to deposit all the balance in the Vault contract into the malicious controller contract.Recommendation
Consider disallowing
Vault#setController()
to set a new address if a controller is existing, which terminates the possibility of migrating funds to a specified address provided by the owner. Or, putting a timelock to this function at least.