A VAULT OWNER CAN BE ALSO THE CONTROLLER AND ARBITRARILY SET THE SECONDARY MARKET ROYALTIES #166
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Warden finding
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
Lines of code
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/VaultRegistry.sol#L147
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/FERC1155.sol#L217
Vulnerability details
Impact
The secondary sales of a specific
FERC1155
token can be charged with a certain amount of fees established by the controller of theFERC1155
. Those royalties are meant to be sent to a receiver according to the current implementation. Currently the protocol intends users to deploy vaults viaBaseVault.deployVault()
which further callsVaultRegistry.create()
that uses the currently deployedfNFT
instance which it is controlled by the protocol itself.However, there is other path that allows users deploying a vault where they are also the controllers of the
fNFT
instance. This allows users to take control over how are the royalty fees changed. A user can easily change maliciously the amount of royalties (which are also uncapped) and steal a considerable (even the whole) amount ofFERC1155
transferred.Proof of Concept
In order to illustrate this, we will conduct a hypothetical scenario where Alice is a malicious vault owner that deploys her vault by directly calling
VaultRegistry.createCollectionFor()
, bypassing the need to callBaseVault.deployVault()
._merkleRoot
containing theMinter
module by callingVaultRegistry.createCollectionFor()
. She is now owner ofToken
.fTokens
and starts to distribute them among the community, and callsToken.setRoyalties()
setting the royalties for the secondary market at 1% (in order to incentivize and grow a secondary market).As a result of this process, Bob lost transferred the token to the buyer and received no payment in exchange and Alice got her hands on the whole payment.
It is showcased on the following code that Alice has control over how the fees are modified and when.
Recommended Mitigation Steps
It is needed to define clearly how users are intended to deploy vaults under which privileges. The fact that a user can deploy a vault both from
BaseVault
andVaultRegistry
having different privileges is an issue. If needed, theVaultRegistry
key functions can be set as internal and have specific callers withinBaseVault
that control also the privileges of each creation in order to concentrate the vault creations within a single endpoint.Also, it is extremely important to set a maximum cap for the royalties as soon as possible. Although this does not mitigate the fact that a malicious vault owner can frontrun others, it gives a maximum boundary. What will be a definitive solution is setting both a maximum cap for the royalties and timelock that function so that vault owners have to wait a certain amount of time before changing the royalties in order to bring predictability for the community.
The text was updated successfully, but these errors were encountered: