Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 2.46 KB

SIP-0044.md

File metadata and controls

45 lines (28 loc) · 2.46 KB
SIP Title Author Status Track Created
0044
Staking contract hardening against multiple attack vectors
Hakū (@hakuryuuhakuu), Rainer Koirikivi (@koirikivi)
Ready for vote
Contract
2022-04-07

SIP-0044 : Staking contract hardening against multiple attack vectors

Description

The Staking contract has been paused to prevent malicious use of the information disclosed by this SIP.

If approved, this proposal will upgrade the Staking contract to an implementation that prevents a critical vulnerability.

The chosen mitigation strategy restricts the ability for an attacker to creatively combine calls in a single block or create loops which could potentially be harmful, while not hindering the normal usage and composability of the contract.

Motivation

We have noticed that a handful of design decisions of the staking contract create a vulnerability when combined in a given way. Individually most of them make sense, or made sense when the contract was first deployed, but when taken in today's context and combined in the same block with specific prior context, they open the door to a voting power manipulation exploit.

Fixing the underlying causes is a large undertaking, requiring a partial rewrite of the contract and possibly a split, because the contract is already as large as allowed by the EVM (contract size must be below 24kB). This is not something we want to do in a rush, nor do we want to keep the staking contract paused longer than strictly necessary.

Details

In order to close the vulnerability and its various variants, we have opted for a mitigation strategy that thwarts them by forbidding a number of scenarios which we think have no real practical use for the users, while being necessary to enable the exploit. Namely, if this SIP is approved, it will forbid a number of actions from happening in the same block as a call to the stake(...) function, for the same lockDate timestamp:

  • extend staking duration,
  • delegate voting power (which can still be done directly in the stake(...) function call as a parameter),
  • withdraw, as well as their signature-based variants.

Proposed change

Existing Staking Logic contract: 0x4769c04F2537C3b951Efa8a330A15716B5913Af6

New Staking Logic contract: 0x81570497e763809900A8e91c8DaF3020085e43aB

Proposed changes: DistributedCollective/Sovryn-smart-contracts#429

License

Copyright and related rights waived via CC0.