Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H-01 MitigationConfirmed #3

Open
code423n4 opened this issue Aug 16, 2023 · 1 comment
Open

H-01 MitigationConfirmed #3

code423n4 opened this issue Aug 16, 2023 · 1 comment
Labels
mitigation-confirmed MR-H-01 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

Vulnerability details

This issue is mitigated.

Explanation of found problem

The problem that was described by the warden, occurred in special situations, when asset was unregistered from registry, which removes it from assets list and changes registry size and then user used RToken.redeemCustom function for the basket, where that asset was present.

BasketHandler.quoteCustomRedemption function then creates erc20sAll array using current size of registry(which was decreased by unregistered token). Later, function loops through all tokens in the basket(amount of which is bigger than erc20sAll size) and finally puts them into erc20sAll array. Once len index is bigger than erc20sAll size, then this function will revert with out of bonds error.

How it was fixed

Reserve team fixed this by [checking if basket token is registered in registry](https://github.com/reserve-protocol/protocol/pull/857/files#diff-da66c41f7b4b109bc1a40a5f0fec2f147da983ca2084c20b176b421338982acaR487. In case if token is unregistered, then it is removed from _erc20s variable in AssetRegistry, so assetRegistry().toAsset will revert and such token will not be stored to erc20sAll array as you can see in catch section.

@c4-judge
Copy link

0xean marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mitigation-confirmed MR-H-01 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants