The Distribution_init
function in Distribution.sol implementation permits the inclusion of any token without undergoing a legitimacy check. This vulnerability creates the potential for a malicious actor to exploit the loophole by depositing counterfeit or non-valuable tokens into the contract allowing for the creation of Pools that are not validated properly.
According to Morpheus documentation (https://github.com/MorpheusAIs/Morpheus/blob/main/!KEYDOCS%20README%20FIRST!/2.WhitePaper.md) the expected token for interacting with the contracts is stETH. For example:
“The Morpheus full node comes with a wallet or the user can connect their existing wallet. This enables the user to sign and send transactions recommended by their Smart Agent. So users will be able to participate in the proofs through the Morpheus software. However Capital Providers are not required to have a full node for example. They can interact directly with the Smart Contracts on Ethereum / Arbitrum using stETH”.
There are more references throughout the documentation about the expected token stETH, however inside the Distribution.sol there are currently no validations in place that can verify the correct creation of the pools using only this token. In this sense, the Distribution_init
function allows to set incorrect data, with invalid pools according to the tests provided below. Moreover, this function is only meant to be called with a valid ERC20 token (the stETH) but the function is generic enough to work with any token.
##Proof of Concept
As a proof of concept a fake token contract was included into the /tokens folder named FooToken.sol
At a glance, this fake token is not ERC20 compliant, uses a floating pragma and utilizes the necessary means to be accepted into the Pool creation:
This fake token can be used in the depositedToken variable and will be included during the Pool creation:
When running the test and the FooToken is injected, we verify that our Fake, non compliant token is accepted into the Distribution_init function when this should be prohibited:
Ensuring the legitimacy of the token is crucial in verifying pool creation. Failure to do so may lead to the generation of invalid pools, causing unforeseen issues in the other functionalities of the Distribution.sol contract, such as a DoS.
Manual verification
A token whitelist should be implemented, where only approved tokens can be deposited into the contract. Maybe since the admin is trusted, an onlyOwner function can be added to the contract, which allows the owner to add and remove tokens from the whitelist.
https://solodit.xyz/issues/lack-of-token-whitelisting-leads-to-deposit-of-fake-tokens-auditone-none-coinlend-markdown
https://solodit.xyz/issues/h-2-adversary-can-brick-bounty-payouts-by-calling-fundbountytoken-but-funding-it-with-an-erc721-token-instead-sherlock-openq-openq-git
https://solodit.xyz/issues/h-8-bounties-can-be-broken-by-funding-them-with-malicious-erc20-tokens-sherlock-openq-openq-git
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.