EthosDiscussion#addReply() does not check if targetContract is an EthosContract.
Summary
EthosDiscussion#addReply does not check if targetContract is an EthosContract. Users can freely pass any address and an reply can be successfully added, polluting the EthosDiscussion database.
Root Cause
In the EthosDiscussion#addReply() function, user can freely pass any targetContract address, as long as it implements the interface function targetExistsAndAllowedForId(uint256 _targetId) external view returns (bool exists, bool allowed); and return true. There is no check to verify if targetContract is an EthosContract or not.
This is an issue because it would pollute the EthosDiscussion database, which is used to serve the frontend Ethos app.
pkqs90
Medium
EthosDiscussion#addReply()
does not check if targetContract is an EthosContract.Summary
EthosDiscussion#addReply
does not check if targetContract is an EthosContract. Users can freely pass any address and an reply can be successfully added, polluting the EthosDiscussion database.Root Cause
In the
EthosDiscussion#addReply()
function, user can freely pass anytargetContract
address, as long as it implements the interfacefunction targetExistsAndAllowedForId(uint256 _targetId) external view returns (bool exists, bool allowed);
and return true. There is no check to verify iftargetContract
is an EthosContract or not.This is an issue because it would pollute the EthosDiscussion database, which is used to serve the frontend Ethos app.
https://github.com/sherlock-audit/2024-10-ethos-network/blob/main/ethos/packages/contracts/contracts/EthosDiscussion.sol#L105
In contrast, we can see that EthosVote implemented a
isValidTarget()
check to make sure the targetContract is always a valid EthosContract.https://github.com/sherlock-audit/2024-10-ethos-network/blob/main/ethos/packages/contracts/contracts/EthosVote.sol#L141
Internal pre-conditions
N/A
External pre-conditions
N/A
Attack Path
N/A
Impact
Users can pollute the EthosDiscussion by adding replies to a random contract that does not belong in Ethos.
PoC
N/A
Mitigation
Similar to EthosVote, add a
contractAddressManager.checkIsEthosContract(target)
check.