Several function have no entry check
The report lists several smart contract functions that appear to lack access checks, suggesting that very large input values might disrupt internal accounting and possibly lock functions or produce wrong rates. The project's response found most functions were already protected or safe by design, but agreed one function deserved an extra guard against a malicious token contract.
Marginswap
Originally disclosed on Code4rena
The following functions have no entry check or a trivial entry check:
withdrawHourlyBond Lending.sol
closeHourlyBondAccount Lending.sol
haircut Lending.sol
addDelegate(own adress...) Admin.sol
removeDelegate(own adress...) Admin.sol
depositStake Admin.sol
disburseLiqStakeAttacks CrossMarginLiquidation.sol
disburseLiqStakeAttacks IsolatedMarginLiquidation.sol
getCurrentPriceInPeg PriceAware.sol
By manipulating the input values (for example extremely large values), you might be able to disturb the internal administration of the contract, thus perhaps locking function or giving wrong rates.
Recommend checking the functions to see if they are completely risk free and add entry checks if they are not, and add a comment to notify the function is meant to be called by everyone.
withdrawHourlyBond: could not find vulnerability, since solidity 0.8.x fails on underflow in HourlyBondSubscriptionLending.sol:115 in case of unauthorized access.closeHourlyBondAccount: same story since both call into_withdrawHourlyBondhaircut: trivially guarded in one way, though this actually has merit in another way — if at some point down the road an attacker were able to establish a token, make it popular enough for us to add it to cross margin, but include in that token contract a malicious function that calls haircut, they could then void everybody’s bonds in their token. I don’t see how it would be profitable, it’s definitely an expensive long con, but… we should add an extra guard to make sure it’s an isolated margin trading contract.addDelegatehas a guard.removeDelegatehas a guard as well, or am I missing something here?depositStakefails for unfunded requests in the safe transfer inFund.depositFordisburseLiqStakeAttacksshould be universally accessible by designgetCurrentPriceInPegonly updates state in a rate limited way, hence fine for it to be publicI will add comments to the effect. Thanks again
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
Root cause
Likely missing or weak access checks on several functions, though the project showed most were already protected by underflow reverts, guards, or safe transfers.
Impact
The reporter only suggested that extreme inputs might disturb internal accounting and perhaps lock functions or give wrong rates; the project found no exploitable path except a costly long-con scenario for one function.
What the attacker needed
Ability to call public contract functions
The fix
The project said it would add comments and an extra guard so that one function can only be called from an isolated margin trading contract.
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.
Smart contracts are programs on a blockchain that anyone can call. An entry check is a line of code that decides who is allowed to run a function. The reporter suspected some functions had no such check, so a stranger could call them with odd numbers and break the contract's bookkeeping.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.