Skip to content

Rounding error in Staking allows thawing period evasion

Critical
pcarranzav published GHSA-7477-q5g6-cj48 Feb 20, 2024

Package

Graph Protocol Contracts (Smart Contracts)

Affected versions

<= 6.2.0

Patched versions

6.2.1

Description

This vulnerability was reported through Immunefi and classified as Critical. What follows is an extract of the whitehat's report:

When some unstaked indexer tokens are already thawing, subsequent calls to unstake (specifically Stakes.lockTokens) use MathUtils.weightedAverage to work out the required extension to the lock-in ('thawing') period. Because the implementation rounds down, user requests to unstake a small proportion of additional GRT can be made without affecting the resulting lock duration.

Thus by making many small-volume calls to Staking.unstake when a large number of tokens are imminently approaching maturity, an attacker can unstake many additional tokens without being subject to a longer thawing time.

This enables malicious extraction of value from The Graph and ill-faith activity that would otherwise be mitigated by slashing of indexer stakes.

Severity

Critical

CVE ID

No known CVE

Weaknesses

No CWEs