Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Picodes - voucherIndexes is incorrectly updated #160

Closed
sherlock-admin opened this issue Nov 4, 2022 · 0 comments
Closed

Picodes - voucherIndexes is incorrectly updated #160

sherlock-admin opened this issue Nov 4, 2022 · 0 comments

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Nov 4, 2022

Picodes

high

voucherIndexes is incorrectly updated

Summary

In cancelVouch, voucherIndexes is incorrectly update, messing up the whole accountability and ultimately leading to loss of funds for stakers

Vulnerability Detail

Here, vouchers[borrower][vouchers[borrower].length - 1] is moved but
voucherIndexes is not updated. So the user that created vouchers[borrower][vouchers[borrower].length - 1] cannot modify this voucher anymore has voucherIndexes is incorrect.

Impact

Affected users will not be able to close or update their trust amounts anymore, hence will lose funds.

Tool used

Manual Review

Recommendation

Add the following line:

voucherIndexes[borrower][vouchers[borrower][vouchers[borrower].length - 1].staker].idx = voucherIndex.idx

Duplicate of #157

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant