malicious rental owner can rob bidders of the currency amounts sent in via older bids. #45
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-5
🤖_05_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
upgraded by judge
Original issue severity upgraded from QA/Gas by judge
Lines of code
https://github.com/code-423n4/2024-10-coded-estate/blob/97efb35fd3734676f33598e6dff70119e41c7032/contracts/codedestate/src/execute.rs#L708-L709
Vulnerability details
Impact
malicious rental owner can rob bidders of the currency amounts sent in via older bids.
Proof Of Concept
setbidtobuy()
with token.sell.denom for currency Asetlistforsell()
and changes token.sell.denom to currency Bsetbidtobuy()
with token.sell.denom as currency Bhttps://github.com/code-423n4/2024-10-coded-estate/blob/97efb35fd3734676f33598e6dff70119e41c7032/contracts/codedestate/src/execute.rs#L657-L664
this old bid is found and
position
is set to the index value. This means the ifpoisition == -1
if block does not execute/is skipped but the else block which deletes the older bid is executedhttps://github.com/code-423n4/2024-10-coded-estate/blob/97efb35fd3734676f33598e6dff70119e41c7032/contracts/codedestate/src/execute.rs#L694-L697
This is then saved into the token storage and now because position is not equal to -1, money is attempted to be sent back to the bidder as refund for its previous bid. See below
https://github.com/code-423n4/2024-10-coded-estate/blob/97efb35fd3734676f33598e6dff70119e41c7032/contracts/codedestate/src/execute.rs#L700-L710
This send action will send the currency amount for older bid while the denom is currency B. Like instead of sending back 10 units of currency A for example, it will send back 10 units of currency B. Even though both currencies may not be of the same value!
This can be exploited by a malicious rental owner to accept bids, change currency and rob bidders of their value used in the older bids.
Recommened Mitigation
ensure that the refund is being sent with the correct currency that the old bid was made with, and not the new recently changed to currency.
Assessed type
Context
The text was updated successfully, but these errors were encountered: