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

Unintentionally causing users to lose their bond #105

Closed
code423n4 opened this issue Sep 21, 2021 · 2 comments
Closed

Unintentionally causing users to lose their bond #105

code423n4 opened this issue Sep 21, 2021 · 2 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Warden finding duplicate Another warden found this issue sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

itsmeSTYJ

Vulnerability details

Impact

Normally I would classify this as low but because of how widespread USDT is, I believe it is important to handle this case simply for USDT. USDT doesn't allow you to approve allowance unless you first set it to 0.

If your basket contains USDT initially and the publisher tries to publishNewIndex with USDT (regardless of weighting), any bonder that tries to settle the auction will always fail because basket.setNewWeights will always fail when it comes to approving max allowance for USDT.

The publisher might not be malicious but the publisher not knowing about this is not an excuse for users losing their bond.

Recommended Mitigation Steps

function approveUnderlying(address spender) private {
    for (uint256 i = 0; i < weights.length; i++) {
				if(IERC20(tokens[i]).allowance(msg.sender, spender) > 0) {
						IERC20(tokens[i]).approve(spender, 0); // checks if allowance is non 0, approve to 0.
				}
        IERC20(tokens[i]).approve(spender, type(uint256).max);
    }
}
@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Warden finding labels Sep 21, 2021
code423n4 added a commit that referenced this issue Sep 21, 2021
@frank-beard frank-beard added duplicate Another warden found this issue sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") labels Oct 6, 2021
@frank-beard
Copy link
Collaborator

duplicate of #260

@GalloDaSballo
Copy link
Collaborator

Duplicate of #35

@GalloDaSballo GalloDaSballo marked this as a duplicate of #35 Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Warden finding duplicate Another warden found this issue sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants