Skip to content
$1,000,000 in security audit grants are live now, Apply here →

Security review · June 2024

V2 Updates

for Baseline Markets

Baseline Markets engaged Guardian to review the security of its YesArena game and afterburner updates. From June 12th to June 16th, a team of 2 auditors reviewed the source code in scope.

Published
Language
Solidity
Chains
Blast
Sector
Token launches
  • 0 Critical
  • 2 High
  • 4 Medium
  • 9 Low
  • 0 Informational

1 resolved · 14 pending

Scope

Overview

Baseline Markets engaged Guardian to review the security of its YesArena game and afterburner updates. From June 12th to June 16th, a team of 2 auditors reviewed the source code in scope.

Findings 15

  1. H-01 High Invalid Portion Burned Logical Error Resolved
    Location
    AfterBurner.sol: 174

    Description

    In the reheat function the reserveSize is computed with a denominator of 100e18, however the minPortion and maxPortion are assigned to as .05 ether and .15 ether respectively in the constructor.

    The comment on line 150 indicates that the portion ought to be 15% rather than 0.15%, therefore the portion is a factor of 100x smaller than it ought to be.

    Recommendation

    Use a denominator of 1e18 rather than 100e18.

    Resolution

    Baseline Team: Resolved.

  2. H-02 High YesArena Block Stuffing Attack Block Stuffing Pending
    Location
    YesArena.sol

    Description

    A malicious actor may significantly increase their odds of winning the YesArena at the end of the game time by using two addresses to ensure they control both the winner and hotPotato addresses and then submitting many transactions to stuff Blast blocks for the next 2 minutes.

    For example:

    • Bob calls deposit with address A, A is now the hot potato
    • Bob calls deposit with address B, A is now the winner & B is the hot potato
    • Bob submits many gas waster transactions to stuff the next 2 minutes of Blast blocks until he is

    the winner

    This can significantly reduce the chances that other actors have at getting a deposit call recorded before the 2 minutes is over.

    Recommendation

    Be aware of this risk, consider adding more time to the game for every deposit to make it more costly to block stuff the chain to improve winning odds.

    Resolution

    Baseline Team: Pending.

  3. M-01 Medium claimed Value Not Assigned Logical Error Pending
    Location
    YesArena.sol: 80

    Description

    In the claim function the claimed boolean is not assigned to true, therefore the system never indicates that the claim can occur.

    As a result arbitrary users can trigger multiple transfers to the winner and emit the Claim event several times.

    Recommendation

    Assign the claimed boolean to true in the claim function.

    Resolution

    Baseline Team: Pending.

  4. M-02 Medium Reheat Sniping Sandwhich Attack Pending
    Location
    Afterburner.sol

    Description

    The reheat function will buy YES and loop it when the random roll hits. However the random value is based upon the the block.timestamp and block.prevrandao which are both deterministically available at the block in which the reheat transaction is recorded.

    In environments where front-running is possible, a malicious actor may create a contract which buys YES and reverts if the block.timestamp and block.prevrandao would not fulfill the random requirements.

    This way the attacker can detect owner transactions to reheat and frontrun them in the same block to buy YES right before the price increases as a result of the reheat. The attacker can then back run the reheat and sell their YES tokens if a reheat looping was performed for a risk free immediate profit.

    Recommendation

    This is not an immediate concern on the Blast L2 network, however be sure to consider this risk before deploying to a network with high MEV activity.

    Resolution

    Baseline Team: Pending.

  5. M-03 Medium Blast Yields Are Not Configured For YesArena Configuration Pending
    Location
    YesArena.sol

    Description

    In the YesArena contract there is no configuration for gas yields, however the YesArena contract is likely to accrue a nontrivial gas expenditure during the game.

    Recommendation

    Consider implementing appropriate configurations and functions to claim the gas yields that would accrue for the YesArena contract.

    Resolution

    Baseline Team: Pending.

  6. M-04 Medium Lacking _buy Slippage Protection Sandwhich Attack Pending
    Location
    Afterburner.sol: 209

    Description

    In the _buy function there is no slippage protection configured in the swap call. This allows malicious actors to sandwich the reheat transaction’s swap and extract value from the system.

    Recommendation

    The system is currently deployed on Blast which does not have a public mempool, so frontrunning sandwich vectors are not an immediate concern.

    However upon deploying to new chains, carefully consider this risk and implement the necessary swap protections to mitigate the sandwich attack vector.

    Resolution

    Baseline Team: Pending.

  7. L-01 Low Lack Of Upgradeability Controls Suggestion Pending
    Location
    AfterBurner.sol

    Description

    The mm and cf addresses are declared immutable in the AfterBurner contract, however In the event that the MarketMaking or CreditFacility contracts are upgraded, a new AfterBurner contract would need to be deployed. This may become unwieldy and incur the team unnecessary deploy expenses over time.

    Recommendation

    Consider implementing functions to update the cf and mm addresses, and be sure that the owner address is a multi-sig. Otherwise if trust of the owner is a concern, do not add these functions and be aware that the AfterBurner should be re-deployed with funds ported over in the event of a MarketMaking or CreditFacility contract upgrade.

    Resolution

    Baseline Team: Pending.

  8. L-02 Low Lacking Rate Validations Validation Pending
    Location
    YesArena.sol: 39

    Description

    In the YesArena contract constructor there is no validation that the GROWTH_RATE is correctly assigned to a value greater than 1e18. If the GROWTH_RATE value is assigned to less than 1e18 it will result in a smaller deposit price over time. Similarly, there is no validation requiring the FEE_RATE to be a reasonable proportion of 1e18.

    Recommendation

    Consider implementing validations such that the GROWTH_RATE cannot be assigned to a value less than 1e18 and the FEE_RATE cannot be above a certain threshold.

    Resolution

    Baseline Team: Pending.

  9. L-03 Low YesArena References Old AfterBurner Configuration Pending
    Location
    YesArena.sol: 24

    Description

    In the YesArena contract the afterburner address is hardcoded as the existing afterburner contract, which does not include the latest updates.

    Recommendation

    Consider making the afterburner address configurable within the constructor. Otherwise be sure to update this address in the YesArena contract before deployment.

    Resolution

    Baseline Team: Pending.

  10. L-04 Low Unlock Timestamp Within Game Time Unexpected Behavior Pending
    Location
    YesArena.sol: 108

    Description

    The UNLOCK_TIMESTAMP may occur within the gameTime period if enough deposits are made, as a result the winner will be able to claim the jackpot immediately after winning.

    Recommendation

    Consider if this is expected behavior, if it is not then consider altering the unlock time validation such that it validates that a certain amount of time has passed since the end of the game time period.

    Resolution

    Baseline Team: Pending.

  11. L-05 Low Deposits May Receive The Same Random Unexpected Behavior Pending
    Location
    YesArena.sol: 89

    Description

    In the deposit function a pseudo random value is generated to be emitted with the Deposited event for the deposit. However this random value is generated based upon values that apply to the entire block, not just the particular transaction being executed.

    As a result several deposits within the same block will have the same random value associated with them in the Deposited event.

    Recommendation

    Consider if this is the expected behavior, otherwise consider seeding the deposit with values that can distinguish each deposit within a single block from each other, such as the depositNumber.

    Resolution

    Baseline Team: Pending.

  12. L-06 Low Invalid Deposit Amount Emitted Logical Error Pending
    Location
    YesArena.sol: 99

    Description

    In the deposit function the Deposited event emits the depositPrice as the amount variable, however this is not the amount which the caller paid as the depositPrice was subsequently increased by the growth rate.

    Recommendation

    Consider caching the depositPrice variable at the beginning of the deposit function and emitting this as the amount in the Deposited event.

    Additionally, use this cached depositPrice stack variable to perform the deposit validation, transfers, and new depositPrice calculation to save gas in the deposit function.

    Resolution

    Baseline Team: Pending.

  13. L-07 Low Weth Yields Automatically Get Heated Documentation Pending
    Location
    Afterburner.sol

    Description

    In the Afterburner contract any yield for the weth reserve assets held in the Afterburner will automatically be included in the reheat actions as they will automatically be applied to the Afterburner contract balance.

    This may be expected, however it is worth pointing out as the protocol may wish to claim these yields instead of having them automatically attributed to each reheat.

    Recommendation

    Consider if the weth yields should be applied to reheat actions, otherwise implement logic in the constructor such that the yield mode is claimable and a trusted address may withdraw these yields for the protocol.

    Resolution

    Baseline Team: Pending.

  14. L-08 Low Unnecessary Modulo Optimization Pending
    Location
    Afterburner.sol: 142

    Description

    In the reheat function the hit value is determined based on roll % probabilityDenominator == 69, however the roll value has already been modded by the probabilityDenominator and incremented by 1.

    Therefore modding by the probabilityDenominator a second time only maps rolls of 100 to 0, and therefore will not affect the odds of a hit.

    Recommendation

    Remove the second module which occurs on line 142 as it is unnecessary.

    Resolution

    Baseline Team: Pending.

  15. L-09 Low Lacking Configuration Validations Validation Pending
    Location
    Afterburner.sol

    Description

    In the Afterburner contract there are several owner configuration functions which lack important validations. For example, in the setSources function, the sources array should be validated to be within a reasonable length such that the reheat function cannot be accidentally or maliciously DoS’d due to an extremely long sources array.

    In the setPortionBounds and setDelayBounds functions there is no validation that the configured min bound is less than the max bound. And the setProbabilityDenominator does not validate that the denominator is nonzero.

    Recommendation

    Consider implementing the suggested validations to protect against accidental assignments or owner compromises.

    Resolution

    Baseline Team: Pending.

More from Baseline Markets

All 12 reports
  1. Mercury, Round 3

    109 findings4 critical · 9 high 109 findings: 4 critical, 9 high, 28 medium, 33 low, 35 informational
  2. AMM, Round 2

    47 findings4 critical · 14 high 47 findings: 4 critical, 14 high, 8 medium, 13 low, 8 informational
  3. AMM

    54 findings3 critical · 6 high 54 findings: 3 critical, 6 high, 13 medium, 11 low, 21 informational
  4. Fixed Supply

    34 findings4 high 34 findings: 4 high, 10 medium, 20 low

Put your code through the same review.

This review started with a conversation about scope. Tell us what you are building and we will plan yours with you.

Get a quote