Closed code423n4 closed 1 year ago
QA might be more appropriate.
The POC provided is valid for tests, as mentioned, but is not valid for the LensHub contract itself - because once upgraded the interfaces will change accordingly and everything will work.
As per advised Rollback implementation, it will not be possible in the provided example, because once upgraded the Upgrade contract loses it's role as a controller contract (GOVERNANCE.clearControllerContract();
) and this was done for security purposes to make it one-time use.
But we also have the rollback function in the PROXY_ADMIN contract itself.
It won't whitelist/unwhitelist the modules, yes - this has to be done manually, but it can rollback the upgrade, because we save it in the lastImplementation and the rollbackLastUpgrade()
function.
vicnaum marked the issue as sponsor disputed
This report points toward a test file, which is out of scope, and does not pass the burden of proof for High severity
Picodes marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-07-lens/blob/main/test/migrations/Migrations.t.sol#L107
Vulnerability details
Impact
During testing with the Mainnet fork for the migration testing. We needed to make a distinction between V1 Profiles and V2 profiles within the test code, but this is not so in the standard V2 code, and may cause unforeseen issues after the upgrade. The V2 code assumes the profile has been migrated which may not be the case immediately after the upgrade.
During the test while loading a profile without casting the address to a LensHub V1 proxy Interface, it reverted.
The LensV2Upgrade contract has a way to upgrade and un-whitelist and whitelist the correct modules. Should there for some unforeseen reason be a need to rollback this will take quite a while to do and setup, however this can easily be enabled in the current contract so that it can be a seamless quick process.
PoC
During testing with mainnet fork it was discussed with the Dev team, that it would fail unless changed to be from the LenHub V1.
The code that failed was :
and needed to be changed to :
Tools Used
Manual Audit
Recommended Mitigation Steps
It could be considered to implement a rollback function as below due to the fact that we already have all the valid data within the storage of the LensV2Upgrade contract.
I have added a rollback function to the LensV2Upgrade contract below:
Assessed type
Upgradable