Closed code423n4 closed 2 years ago
Disagree because we don't have selfdestruct
nor a way to change implementation
In lack of an actual POC I must fully disagree
if there are some logics in contract like self-destruct, attacker can perform DOS.
No delegateCall, no way to selfdestruct
.
Lines of code
https://github.com/Badger-Finance/vested-aura/blob/d504684e4f9b56660a9e6c6dfb839dcebac3c174/contracts/MyStrategy.sol#L51-L76
Vulnerability details
Impact
There is no
constructor()
to set state ofimplementation
contract toinitialized
in the proxy pattern so it's possible for attacker to callinitialize
forimplementation
contract and set its values and take control of it. if there are some logics in contract like self-destruct, attacker can perform DOS. so it's safer to initializeimplementation
contract too byconstructor()
Proof of Concept
This is
initialize()
code inMyStrategy
:As you can see it sets the value of
vault
by calling__BaseStrategy_init()
and defines some admin access to contract.by calling
initialize()
and settingvault
attacker can access all the functions in contract. if the proxy contracts uses some state ofimplementation
contract if there isselfdestruct
logic in contract attacker can uses them and harm the protocol. There is no constructor inMyStrategy
to set the state of contract toinitialized
forimplementation
contract.Tools Used
VIM
Recommended Mitigation Steps
add a constructor and set the state of
implementation
contract toinitialized