Bond tokens (HLG) can get permanently stuck in operator
When a job is executed by someone who is not an operator, the slashed bond amount is credited to that caller's bonded balance, but the bonding function requires a zero bonded balance, so the tokens cannot be retrieved. An attacker could cause bond tokens to become permanently stuck in the contract.
Submitted by minhtrng, also found by arcoun, cccz, Chom, csanuragjain, ctf_sec, Jeiwan, and Lambda
HolographOperator.sol#L374-L382 HolographOperator.sol#L849-L857
Bond tokens (HLG) equal to the slash amount will get permanently stuck in the HolographOperator each time a job gets executed by someone who is not an (fallback-)operator.
Proof of Concept
The HolographOperator.executeJob function can be executed by anyone after a certain passage of time:
...
if (job.operator != address(0)) {
...
if (job.operator != msg.sender) {
//perform time and gas price check
if (timeDifference < 6) {
// check msg.sender == correct fallback operator
}
// slash primary operator
uint256 amount = _getBaseBondAmount(pod);
_bondedAmounts[job.operator] -= amount;
_bondedAmounts[msg.sender] += amount;
//determine if primary operator retains his job
if (_bondedAmounts[job.operator] >= amount) {
...
} else {
...
}
}
}
// execute the job
In case if (timeDifference < 6) { gets skipped, the slashed amount will be assigned to the msg.sender regardless if that sender is currently an operator or not. The problem lies within the fact that if msg.sender is not already an operator at the time of executing the job, he cannot become one after, to retrieve the reward he got for slashing the primary operator. This is because the function HolographOperator.bondUtilityToken requires _bondedAmounts to be 0 prior to bonding and hence becoming an operator:
require(_bondedOperators[operator] == 0 && _bondedAmounts[operator] == 0, "HOLOGRAPH: operator is bonded");
Recommended Mitigation Steps
Assuming that it is intentional that non-operators can execute jobs (which could make sense, so that a user could finish a bridging process on his own, if none of the operators are doing it): remove the requirement that _bondedAmounts need to be 0 prior to bonding and becoming an operator so that non-operators can get access to the slashing reward by unbonding after.
Alternatively (possibly preferrable), just add a method to withdraw any _bondedAmounts of non-operators.
alexanderattar (Holograph) commented:
Known issue that already has been fixed for the next update.
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 the slashing logic credits the bond to any caller without checking they are an operator, while the bonding function requires a zero bonded balance, leaving non-operators unable to withdraw.
Impact
Bond tokens equal to the slash amount could become permanently locked in the contract each time a non-operator executes a job.
What the attacker needed
Job executable by anyone; caller is not an operator; time check skipped
The fix
The project said the issue was already fixed for the next update; the report also recommends allowing withdrawal of bonded amounts for non-operators or removing the zero-balance requirement.
How it was found
- Wait until a job can be executed by anyone after the time check passes.
- Call executeJob as a non-operator so the time difference check is skipped.
- The slashed bond amount is credited to the caller's bonded balance.
- The caller cannot bond because their bonded balance is not zero, so the tokens stay stuck.
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.
A smart contract holds tokens that operators put up as a deposit, called a bond. If someone else finishes a job, part of that deposit is moved to the finisher's balance inside the contract. But the contract only lets you become an operator if your balance is zero, so a non-operator can never withdraw the moved tokens, and they stay locked forever.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.