Open hats-bug-reporter[bot] opened 1 month ago
ITokenV1 circlesV1 = ITokenV1(hubV1.userToToken(_avatars[i]));
if (address(circlesV1) == address(0)) {
// Invalid avatar, not registered in hub V1.
revert CirclesAddressCannotBeZero(2);
}
convertedAmounts[i] = convertFromV1ToDemurrage(_amounts[i]);
// transfer the v1 Circles to this contract to be locked
circlesV1.transferFrom(msg.sender, address(this), _amounts[i]);
User must provide tokens from these avatars.
hi @0xmahdirostami
Your statement is incorrect. The amounts
array is assumed to represent the amounts corresponding to each avatar, but there's no validation in place to confirm this. A malicious user could manipulate the array by providing their own specified values, which would then be associated with the avatars via the following code:
uint256[] memory convertedAmounts = new uint256[](_avatars.length);
convertedAmounts
is then filled with the amounts
array:
convertedAmounts[i] = convertFromV1ToDemurrage(_amounts[i]);
Even if your point were to be valid, it would still allow a malicious user to migrate avatars as long as they provide tokens for them. There is no issue here since these tokens get minted back to the malicious user upon arrival.
for (uint256 i = 0; i < _avatars.length; i++) {
// mint the migrated balances to _owner
=> _mintAndUpdateTotalSupply(_owner, toTokenId(_avatars[i]), _amounts[i], "");
}
Thank you for your report. After careful review, we've determined that this is not a valid issue. The migration process only allows users to migrate balances they own themselves. While it's true that users can be auto-registered in v2 if they're already self-registered in v1, this is an intended feature, not a vulnerability. We appreciate your effort in examining our system, but in this case, the behavior is working as designed.
Github username: -- Twitter username: -- Submission hash (on-chain): 0x2497639f725d6ce48d8d5954013b96591c6e0eb321d327e3a5a79634d56802bd Severity: high
Description: function
Migration.Migrate.sol
allows for any user to migrate any avatars._avatars
array with other people's_avatars
and fill up the_amounts
data with dust value or just normal values, since these will be minted back anyway on V2._avatars
will be migrated to V2.Hub.sol.migrate
the process will be finalised._owner
which will be the malicious user migrating other people'savatars
and the malicious user has successfully migrated othersavatars
Recommendation
do not allow any user to migrate others
avatars
, rather, make sure this is properly handled