A Malicious Treasury Manager Can Burn Treasury Tokens By Setting makerFee
To The Amount The Maker Receives
#230
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
leastwood
Vulnerability details
Impact
The treasury manager contract holds harvested assets/
COMP
from Notional which are used to performNOTE
buybacks or in other areas of the protocol. The manager account is allowed to sign off-chain orders used on 0x to exchange tokens toWETH
which can then be deposited in the Balancer LP and distributed tosNOTE
holders.However,
_validateOrder
does not validate thattakerFee
andmakerFee
are set to zero, hence, it is possible for a malicious manager to receive tokens as part of a swap, but the treasury manager contract receives zero tokens asmakerFee
is set to the amount the maker receives. This can be abused to effectively burn treasury tokens at no cost to the order taker.Proof of Concept
https://github.com/0xProject/0x-monorepo/blob/0571244e9e84b9ad778bccb99b837dd6f9baaf6e/contracts/exchange/contracts/src/MixinExchangeCore.sol#L196-L250
https://github.com/0xProject/0x-monorepo/blob/0571244e9e84b9ad778bccb99b837dd6f9baaf6e/contracts/exchange-libs/contracts/src/LibFillResults.sol#L59-L91
https://github.com/code-423n4/2022-01-notional/blob/main/contracts/utils/EIP1271Wallet.sol#L147-L188
Tools Used
Manual code review.
Recommended Mitigation Steps
Consider checking that
makerFee == 0
andtakerFee == 0
inEIP1271Wallet._validateOrder
s.t. the treasury manager cannot sign unfair orders which severely impact theTreasuryManager
contract.The text was updated successfully, but these errors were encountered: