Can add member and publish project to future community without community owner approval #278
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate
This issue or pull request already exists
valid
Lines of code
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/Community.sol#L886
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/Community.sol#L187
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/Community.sol#L257
Vulnerability details
Impact
Anyone can add himself as a member of community for any future community. This can be done due to a combination of facts:
address(0)
addMember
doesn't check if community is already createdcheckSignatureValidity
doesn't check foraddress(0)
The same issue exists in
publishProject()
but didn't verify with a test due to lack of time. The impact here is that a malicious builder could publish a project to a future community, again without the community owner approval or signature. He can add himself as a member beforehand with the above mentionedaddMember()
flaw.The same issue may exists in
escrow()
but couldn't verify and investigate further here due to lack of time.This would normally seem a critical issue but marked it as medium as I could find a clear way to abuse the broken state in a very harmful way. Being a member of a community doesn't seem to give immediate special access and publishing a project to a community also won't outright give access to funds... Nevertheless I may have missed more implications here due to lack of time and this "backdoor" certainly isn't intended for the
Community
contract, so I would advise to revise and fix this flaw.Proof of Concept
This can be verified with a simple test in
communityTest.ts
:Tools Used
Visual Studio Code
Recommended Mitigation Steps
This could be resolved in
addMember()
by checking if community of the specified community ID is already created (community.memberCount > 0
) but maybe a better and more general resolution for all vulnerable functions is to check foraddress(0)
on input ofcheckSignatureValidity(address _address, ...)
.The text was updated successfully, but these errors were encountered: