You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: add uint64 overflow guard in GetRevertGasLimit #4564
GetRevertGasLimit() in x/crosschain/keeper/cctx_utils.go:72 calls .Uint64() on a math.Uint value that can store up to 256-bit integers. When this value exceeds 2^64, the Cosmos SDK's Uint64() method panics with "Uint64() out of bound".
The same pattern exists in gas_payment.go:152 where gas.GasLimit.Uint64() is called.
No server-side validation exists on RevertGasLimit:
NewRevertOptionsFromEVM (revert_options.go:42) converts *big.Int to math.Uint with no cap
MsgVoteInbound.ValidateBasic() performs no validation on RevertGasLimit
Current Protection
Both EVM and ZEVM gateway contracts enforce MAX_REVERT_GAS_LIMIT = 2,000,000 at the Solidity level, preventing values > 2M from entering the system through normal gateway calls. This is not currently exploitable.
Fix
Add .IsUint64() guard before calling .Uint64() as defense-in-depth:
// In GetRevertGasLimit (cctx_utils.go)if!cctx.RevertOptions.RevertGasLimit.IsZero() {
if!cctx.RevertOptions.RevertGasLimit.IsUint64() {
return0, errors.New("revert gas limit exceeds uint64 range")
}
returncctx.RevertOptions.RevertGasLimit.Uint64(), nil
}
Optionally also validate in MsgVoteInbound.ValidateBasic().
Severity
Low — latent defense-in-depth issue, not currently exploitable.
Activity