Task Functionality completely sidestepped via autoWithdraw
#281
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
valid
Lines of code
https://github.com/code-423n4/2022-08-rigor/blob/5ab7ea84a1516cb726421ef690af5bc41029f88f/contracts/Project.sol#L770
Vulnerability details
Summary
autoWithdraw
will send funds to thebuilder
, we can use this knowledge to drain all funds fromProject
to the builder contract. Completely sidestepping the whole Task based logic.Impact
Through creation and deletion of tasks, leveraging
autoWithdraw
which will always send the funds to bebuilder
, even when origin was the Community, a builder can cycle out all funds out of the Project Contract and transfer them to themselves.Ultimately this breaks the trust assumptions and guarantees of the Task System, as the builder can now act as they please, the Project contract no longer holding any funds is limited.
Only aspect that diminishes impact is that the system is based on Credit (uncollateralized /undercollateralized lending), meaning the Builder wouldn't be "committing a crime" in taking ownership of all funds.
However the system invariants used to offer completely transparent accounting are now bypassed in favour of "trusting the builder".
POC
We know we can trigger
autoWithdraw
it by creating and allocating a task, and then reducing it's costTo funnel the funds we can:
addTasks
)allocateFunds
)changeOrder
to trigger the conditionif (_newCost < _taskCost) {
and receive the delta of tokensRepeat until all funds are funneled into the
builder
wallet.The reason why the builder can do this is because in all functions involved:
addTasks
changeOrder
only the
builder
signature is necessary, meaning the contract is fully trusting thebuilder
Example Scenario
Remediation Steps
Below are listed two options for mitigation
autoWithdraw
(keep funds inside of project), create a separate multi-sig like way to withdrawautoWithdraw
send the funds back accordingly (may also need to re-compute total sent in Community)The text was updated successfully, but these errors were encountered: