Skip to content
Business logic Audit finding Intermediate

maxSumOfPrices check is broken

The rentAllCards function's _maxSumOfPrices check does not account for the mandatory 10% price increase applied to each bid, so the total cost can exceed the user's specified limit. This could lead to insufficient funds, foreclosure, or unintended impacts on other bids.

0xRajeev Follow

Originally disclosed on Code4rena

Submitted by 0xRajeev

rentAllCards() requires the sender to specify a _maxSumOfPrices parameter which specifies “limit to the sum of the bids to place” as specified in the Natspec @param comment. This is apparently for front-run protection.

However, this function parameter constraint for _maxSumOfPrices is broken in the function implementation which leads to the total number of bids placed greater than the _maxSumOfPrices specified.

The impact of this is that the user may not have sufficient deposited, be foreclosed upon and/or impacted on other bids/markets.

Scenario: Assume two cards for a market with current winning rentals of 50 each. _maxSumofPrices = 101 passes check on L643 but then the forced 10% increase on L650 (assuming sender is not the owner of either card) causes newRentals to be called with 55 for each card thus totalling to 110 which is > 101 as requested by the user.

Recommend modifing the max sum of prices check logic to consider the 10% increase scenarios. Document and suggest the max sum of prices for the user in the UI based on the card prices and 10% requirement depending on card ownership.

Splidge (Reality Cards) confirmed and resolved:

fixed here

The original report as published on Code4rena, by 0xRajeev. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

The user may not have sufficient deposited funds, be foreclosed upon, and/or be impacted on other bids or markets.

What the attacker needed

User calls rentAllCards with a max sum; sender is not owner of the cards

The fix

The check logic should be modified to account for the 10% increase, and the UI should suggest a maximum sum based on card prices and ownership.

How it was found

  1. Assume two cards for a market with current winning rentals of 50 each.
  2. Set _maxSumOfPrices to 101, which passes the check on L643.
  3. The forced 10% increase on L650 (assuming sender is not the owner of either card) causes newRentals to be called with 55 for each card.
  4. The total becomes 110, which exceeds the specified 101.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you rent multiple cards, you set a maximum total price you're willing to pay. The code checks this limit before adding a required 10% increase to each bid, so the final total can be higher than your limit. This might cause you to spend more than you intended or not have enough funds.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0xRajeev

View all

61 more disclosed reports, best first.

More from Reality Cards (round 2)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.