F-2024-0001·integer-overflow

Potential overflow on _lock() method

Acknowledgedliquid-stakinglstvalidatorgithub.com/lidofinance/community-staking-module
TL;DR

Unchecked accumulation in CSBondLock._lock() can theoretically overflow over repeated calls, even though access is restricted to onlyCSM.

Severity
LOW
Impact
LOW
Likelihood
LOW
Method
MManual review
CAT.
Complexity
HIGH
Exploitability
LOW
02Section · Description

Description

There is a potential for overflow in the _lock() function from the CSBondLock contract. The unchecked block in _lock() is problematic because it adds the new amount to any existing locked amount. Even if individual calls don't use extremely large values, repeated calls could potentially lead to an overflow over time.

solidity
function _lock(uint256 nodeOperatorId, uint256 amount) internal {
...
unchecked {
if ($.bondLock[nodeOperatorId].retentionUntil > block.timestamp) {
amount += $.bondLock[nodeOperatorId].amount;
}
_changeBondLock({
nodeOperatorId: nodeOperatorId,
amount: amount,
retentionUntil: block.timestamp + $.bondLockRetentionPeriod
});
}
}
03Section · Impact

Impact

The lockBondETH() function in CSModule (which calls _lock() in CSBondLock) is restricted to onlyCSM, meaning it can only be called by the CSM contract itself. This significantly reduces the risk of malicious exploitation. However, there is still theoretical risk even in unintentional circumstances.

04Section · Recommendation

Recommendation

Consider applying either of the following mitigations:

Add an explicit check for overflow:

solidity
if ($.bondLock[nodeOperatorId].retentionUntil > block.timestamp) {
require(amount <= type(uint256).max - $.bondLock[nodeOperatorId].amount, "Lock amount too high");
amount += $.bondLock[nodeOperatorId].amount;
}

Or add an upper limit to the amount that can be locked, based on realistic maximum values for the protocol:

solidity
if ($.bondLock[nodeOperatorId].retentionUntil > block.timestamp) {
require(amount <= MAX_LOCKABLE_AMOUNT, "Lock amount exceeds maximum");
amount += $.bondLock[nodeOperatorId].amount;
}
F-2024-0001

oog
zealynx

Smart Contract Security Digest

Monthly exploit breakdowns, audit checklists, and DeFi security research — straight to your inbox

© 2026 Zealynx