Reproduced Exploit

KittenSwap - split does not round the lock to the week

create_lock sets the unlock to ((block.timestamp + MAXTIME) / WEEK) * WEEK. split sets it to block.timestamp + MAXTIME and does not round.

May 2025•Ethereum•logic•4 min read

Loss

The split lock claims 63072000 REWARD. A week-aligned max lock of the same deposit is worth 62899199 REWARD.…

Chain

Ethereum

Category

logic

Date

May 2025

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack replays in your browser. Step through it by Solidity line or by opcode.

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 58158-h-07-inconsistent-rounding-of-lock-time-causes-voting-power. Standalone Foundry PoC and full write-up: 58158-h-07-inconsistent-rounding-of-lock-time-causes-voting-power_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/rounding · vuln/governance/voting-power · vuln/arithmetic/slope

Reproduction: a self-contained Foundry PoC that compiles and runs offline with only forge-std - no fork and no RPC. Trace: output.txt. PoC: test/58158-h-07-inconsistent-rounding-of-lock-time-causes-voting-power_exp.sol.


Key info#

LossThe split lock claims 63072000 REWARD. A week-aligned max lock of the same deposit is worth 62899199 REWARD. Excess 172801 REWARD. After both locks are expired the global slope is still 1 ether
ProtocolKittenSwap VotingEscrow
Vulnerable codeVotingEscrow.split - _locked.end = block.timestamp + MAXTIME
Bug classUnlock time is not rounded to the week, so the slope change is never applied
FindingPashov Audit Group - KittenSwap security review, 7 May 2025 · H-07 · id 58158
ReportKittenSwap-security-review_2025-05-07.md
SourceAuditVault finding
StatusAudit finding. Reproduced as a local synthetic.
Chain / block / dateEthereum model · block 0 · 2025-05
Compilersolc 0.8.27, cancun, via IR

TL;DR#

create_lock sets the unlock to ((block.timestamp + MAXTIME) / WEEK) * WEEK. split sets it to block.timestamp + MAXTIME and does not round.

MAXTIME is 2 * 365 days (63072000 seconds). WEEK is 7 days. At timestamp 1:

  • rounded end = 62899200, voting power = 62899199 ether
  • split end = 63072001, voting power = 63072000 ether

The checkpoint walks week boundaries and reads slopeChanges only there. The slope booked at 63072001 is never subtracted. After week 105 both locks are expired, and the global slope is still 1 ether. The reward claim pays the split power: 63072000 REWARD, which is 172801 REWARD more than the week-aligned lock.

The vulnerable code#

SOLIDITY
rawEnd = block.timestamp + MAXTIME; // @> VULN: split does not round the new end down to the week
L.end = rawEnd;

The checkpoint, from the same review:

SOLIDITY
cursor += WEEK;
if (cursor > t) {
    cursor = t;
} else {
    d = slopeChanges[cursor]; // only a week timestamp is read
    lastSlopeDelta = d;
}

The fix is _locked.end = ((block.timestamp + MAXTIME) / WEEK) * WEEK.

Root cause#

Slope removal is scheduled at locked.end. The global walk only visits multiples of WEEK. An end that is not on that grid is never loaded, so that lock's slope stays in globalSlope, and the lock's own bias uses the longer end, so its voting power is larger than every other max lock.

Preconditions#

  • The caller owns a lock and can split it.
  • block.timestamp + MAXTIME is not already a multiple of WEEK. At timestamp 1 it is not.
  • Rewards or votes read votingPower, which is slope * (end - now).

Attack walkthrough#

  1. Lock 63072000 ether of LOCK with create_lock. End is 62899200. Power is 62899199 ether.
  2. Lock the same amount and split all of it. The child end is 63072001. Power is 63072000 ether.
  3. slopeAt(105 weeks) applies the honest slope change at 62899200 and skips 63072001. Residual slope is 1 ether.
  4. claim pays 63072000 ether of REWARD to the attacker.

Control: split rounds the end. Power stays 62899199 ether. The same slopeAt returns 0.

Diagrams#

flowchart TD A["create_lock rounds end to 62899200"] --> B["Power is 62899199"] C["split stores end 63072001"] --> D["Power is 63072000"] C --> E["slopeChanges at 63072001"] E --> F["Week walk never reads that slot"] F --> G["Global slope stays 1 ether"] D --> H["Claim pays 63072000 REWARD"]

Impact#

A splitter gets 172801 ether more voting power than a max lock created the normal way, and is paid that power in rewards: 63072000 REWARD instead of 62899199. The global slope is still 1 ether after both locks have expired, so later total-power decay is wrong as well.

Remediation#

Round the split end the same way as create_lock: ((block.timestamp + MAXTIME) / WEEK) * WEEK.

Sources#

Taxonomy#

  • severity/high · sector/governance · sector/dex
  • vuln/logic/rounding · vuln/governance/voting-power · vuln/arithmetic/slope

Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.