Submitted by WatchPug
The current design/implementation allows a market address (registered on registry) to call Vault#addValue() and transfer tokens from an arbitrary address to a specified _beneficiary up the approved amount at any time, and the _beneficiary can withdraw the funds by calling Vault#withdrawAllAttribution() immediately.
This poses a very dangerous risk to all the users that approved their tokens to the Vault contracts (each one holds all users allowances for that token).
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/Vault.sol#L52-L58
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/Vault.sol#L124-L140
Registry owner can call Registry#supportMarket() and mark an arbitrary address as a market.
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/Registry.sol#L49-L60
Or, the owner of the Factory can call createMarket() to add a malicous market contract via a custom template contract to the markets list.
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/Factory.sol#L214-L216
A malicious/compromised Registry owner can:
The malicious/compromised Registry owner can repeat the steps above for all the users who approved the Vault contract for all the Vault contracts.
As a result, the attacker can steal all the wallet balances of the tokens approved to the protocol.
Improper access control for using users allowances.
Consider changing the design/implementation to make sure that the allowances approved by the users can only be used by themselves.
oishun1112 (Insure) acknowledged and disagreed with severity:
0xean (judge) commented:
