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

Security review · February 2025

Kodiak MIM-HONEY Island Market

for Abracadabra Money

Guardian's review of Kodiak MIM-HONEY Island Market for Abracadabra Money, published February 2025. The report records 16 findings, including 3 medium and 13 low.

Published
Review window
February 2 to 8, 2025
Language
Solidity
Chains
Berachain
Sector
Lending, Yield and vaults, DEXs and AMMs
  • 0 Critical
  • 0 High
  • 3 Medium
  • 13 Low
  • 0 Informational

13 resolved · 3 acknowledged

Findings 16

  1. M-01 Medium Harvest DoS For Zero Reward Tokens DoS Resolved
    Location
    MagicKodiakVault.sol

    Description

    In the MagicKodiakVault harvest function the transfer function is attempted to be used for every reward token. However if there are currently zero rewards for any individual reward token that reverts on zero transfers then the harvest function will revert and prevent the claiming of all rewards.

    Recommendation

    Consider only transferring rewards for the reward token if there is a nonzero contract balance for that reward.

  2. M-02 Medium Reward Distributions Can Be Sandwhiched Sandwhich Attack Acknowledged
    Location
    MagicKodiakVault.sol: 61

    Description

    In the MagicKodiakVault the distributeRewards function increments the _totalAssets of the vault in a stepwise manner. This can allow for sandwhich attack arbitrage opportunities when the reward amount is large. A malicious actor can see a reward distribution in the mempool and frontrun/backrun it to immediately gain from the distributed amount without holding exposure to the vault for the same time as the users who provided the capital to generate the rewards. Furthermore, even if a private RPC is used a preliminary harvest transaction may be used as an indicator that distributeRewards is about to be called after swapping reward tokens to the target asset. This would allow a malicious actor to frontrun and backrun reward distributions without necessary knowledge of the distributeRewards transaction in the mempool, however this is not a guaranteed profit.

    Recommendation

    Be sure to use a private RPC to call the distributeRewards function. Otherwise be sure to keep the reward distributions small and infrequent. A more long term solution is to consider refactoring the reward distribution logic so that the totalAssets increment is gradual rather than instantaneous.

  3. M-03 Medium Harvester Is Not Set As Operator Configuration Resolved
    Location
    Global

    Description

    The Harvester address 0xB76403D52CA4D4f5C791859d93553E14742cc9d1 is currently not assigned as an operator for the vault proxy address 0x548eAf30BAD1B4f697fBAC88712fc8148Dc0aA75. Instead the deployer address 0xfb3485c2e209a5cfbdc1447674256578f1a80ee3 is currently assigned as an operator.

    Recommendation

    Add the operator role to the harvester and consider removing the operator role from the deployer.

  4. L-01 Low Vault Address Points To Mock Warning Resolved
    Location
    bera.json

    Description

    Within bera.json, address 0x7FC70DfE186b1eF1B792d1c42C3b7De09F4a68a7 does not point to the Infrared MIM-Honey vault but instead to a mock contract.

    Recommendation

    Ensure the address is updated prior to MagicKodiakVault deployment.

  5. L-02 Low Dummy Honey-USD Price Feed Warning Resolved
    Location
    script/MagicKodiakMimHoney.s.sol

    Description

    Currently the redstoneHoneyAggregator is set to an aggregator that will always return a $1 fixed price which will affect the calculated price of the collateral.

    Recommendation

    Ensure the aggregator is updated to the proper Redstone address for live deployment.

  6. L-03 Low Repetitive Cauldron Naming Warning Resolved
    Location
    MagicKodiakMimHoneyScript

    Description

    ”MagicKodiakCauldron” is supplied as the name to function _deployCauldron. Consequently, when the cauldron is actually deployed, it’s deployment name will be Cauldron_MagicKodiakCauldron.

    Recommendation

    Consider adjusting the name as necessary such that is adheres to Abracadabra’s standards.

  7. L-04 Low Reward Vault Unwhitelisted DoS Warning Acknowledged
    Location
    MagicKodiakVault.sol

    Description

    Infrared vaults rely on being whitelisted so that they can interact with the Berachain reward vaults during staking and unstaking. However, setVaultWhitelistedStatus can be used by governance to revoke whitelisted status (see doc), which would ultimately prevent the ability for new stakes to occur into the MagicKodiakVault.

    Recommendation

    Clearly document this risk.

  8. L-05 Low Lacking Staleness Checks In KodiakIslandAggregator Validation Acknowledged
    Location
    KodiakIslandAggregator.sol

    Description

    The KodiakIslandAggregator contract performs no staleness checks on the underlying aggregator feeds. Therefore this aggregator is at risk of reporting inaccurate prices when one of the underlying feeds is outdated.

    Recommendation

    Be aware of this issue and consider adding staleness validation controls depending on if a feed implements staleness checks.

  9. L-06 Low Lacking Aggregator Validations Validation Resolved
    Location
    KodiakIslandAggregator.sol

    Description

    The KodiakIslandAggregator contract is missing several validations which can be crucial in avoiding a mispricing or manipulation in edge case scenarios. Firstly, the latestAnswer function lacks validation that requires the totalSupply to be above a menial threshold to avoid unexpected low precision manipulations with small amounts of collateral. It also lacks validation which would prevent a divide by zero revert when the totalSupply is zero. The Maker DAO GUniLPOracle validates this by ensuring that the totalSupply is above 1e9. Secondly there are several casts performed which do not include safety reverts if an overflow would have occurred. The _getSqrtPriceX96 function does not include any reverts if the uint160 cast would overflow, though such an overflow would be extremely unlikely. Additionally, there is no validation that the result of totalValue / totalSupply does not overflow the int256 result. Both scenarios are unlikely, however should be validated against to avoid any unexpected manipulations.

  10. L-07 Low Incorrect Decimals Assumption Warning Resolved
    Location
    KodiakIslandAggregator.sol

    Description

    **The **KodiakIslandAggregator contract reports a decimals of the IERC20Metadata(address(island)).decimals() result, however this is incorrect when the IERC20Metadata(address(island)).decimals() result is not equal to 18. Consider the existing case, when the island decimals are 18:

    • normalizedReserve0 and normalizedReserve1 are 1e18 decimals
    • normalizedPriceFeed0 and normalizedPriceFeed1 are 1e18 decimals
    • The resulting totalValue is 1e36 decimals
    • Assume totalValue is $1, e.g. 1e36
    • Assume totalSupply is 1 token, e.g. 1e18
    • The resulting price is 1e36/1e18 == 1e18 which is correctly $1 with 18 decimals

    However for a case where the island decimals are 8:

    • normalizedReserve0 and normalizedReserve1 are 1e18 decimals
    • normalizedPriceFeed0 and normalizedPriceFeed1 are 1e18 decimals
    • The resulting totalValue is 1e36 decimals
    • Assume totalValue is $1, e.g. 1e36
    • Assume totalSupply is 1 token, e.g. 1e8
    • The resulting price is 1e36/1e8 == 1e28 which is incorrectly reporting a very large price for an 8 decimal feed

    Recommendation

    Instead of assigning the decimals for the feed as the IERC20Metadata(address(island)).decimals() result, either hardcode the decimals as 18 and document that this aggregator is incompatible with any other island decimals. Or assign the decimals as: 36 - IERC20Metadata(address(island)).decimals().

  11. L-08 Low LP Token Rewards Cannot Be Harvested Warning Resolved
    Location
    MagicKodiakVaultHarvester.sol

    Description

    In the run function the LP token balance of the harvester contract before the addLiquidity call is removed from the amount which can be rewarded to the vault. This prevents LP token rewards that were harvested from being distributable back to the MagicKodiakVault. However it is unlikely that LP tokens will be supported as a direct reward token.

    Recommendation

    This finding simply serves as a warning since it is unlikely that the LP token will be a reward token for the Infrared vault. However if it is then this logic should be amended in a new harvester contract. Additionally, consider adding a token rescue function in the event that LP tokens are sent to this contract either as a reward or by accident and cannot be recovered.

  12. L-09 Low Dangling Approvals If Reward Tokens Are Removed Warning Resolved
    Location
    MagicKodiakVaultHarvester.sol

    Description

    In the setExchangeRouter function the approvals are removed for all existing reward tokens from the previous exchangeRouter contract. However if a reward is removed from the infrared vault with the removeReward function then this token approval will not be removed from the previous exchangeRouter upon the next exchangeRouter update.

    Recommendation

    Consider adding an additional function to remove targeted approvals from an existing or past exchangeRouter contract for cases where the reward tokens are updated.

  13. L-10 Low New Reward Tokens Require More Approvals Warning Resolved
    Location
    MagicKodiakVaultHarvester.sol

    Description

    New reward tokens may be added to the Infrared vault with the addReward function. These reward tokens will require additional approvals to be made to the exchangeRouter contract.

    Recommendation

    Currently this can be achieved by using the setExchangeRouter function to set the same exchangeRouter implementation in order to approve all new tokens. Be aware that this scenario may arise.

  14. L-11 Low Unnecessary SwapData Fields Optimization Resolved
    Location
    MagicKodiakVaultHarvester.sol

    Description

    **The **SwapInfo struct contains two unnecessary fields, the token and amount fields, which are not used in the implementation anywhere.

    Recommendation

    Remove these unnecessary fields from the SwapInfo struct.

  15. L-12 Low Unnecessary Import Suggestion Resolved
    Location
    MagicKodiakVaultHarvester.sol

    Description

    The IERC20 import in the MagicKodiakVaultHarvester contract is unused.

    Recommendation

    Consider removing this import.

  16. L-13 Low Lacking Fee Configuration Configuration Resolved
    Location
    Global

    Description

    In the deployed harvester contract the fee basis points and fee receiver have not been configured.

    Recommendation

    Consider if this is the expected state, and if not be sure to configure the fee amount and receiver as they are expected to be.

More from Abracadabra Money

All 19 reports
  1. MagicGLP Upgrade

    11 findings1 high 11 findings: 1 high, 10 low
  2. PurrSwap Aerodrome

    105 findings9 high 105 findings: 9 high, 23 medium, 45 low, 28 informational
  3. PurrSwap ve33

    74 findings5 critical · 10 high 74 findings: 5 critical, 10 high, 20 medium, 39 low
  4. Hyperliquid OFT Deployment

    3 findings 3 findings: 1 low, 2 informational

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