https://github.com/code-423n4/2024-07-reserve/blob/3f133997e186465f4904553b0f8e86ecb7bbacbf/contracts/p1/Main.sol#L111-L150
The Main contract offers the possibility to upgrade Main and Component implementations, fetching the target addresses from an external versionRegistry provider.
Because the Deployer doesnt set versionRegistry but let the contract admin provide it, and this entity cant always be trusted as its specified in the permissionless Deployer.deploy function, the contract upgrade system can be abused to achieve a large variety of deviations from its intended behavior by:
All of the above can be achieved in one single transaction (hence the Flash upgrade term used above), possibly to be bundled with the contract creation or buried in a long list of spammy interactions to lower the chances of detection; after a moderately sophisticated attack like the one presented in PoC there can be no signs of past wrongdoing in the result of any of the RToken contracts getters.
Consider having the Deployer set Main.versionRegistry at RToken deployment time to enforce continued use of trusted code.
