Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locke.sol:Stream - arbitraryCall can be used to drain incentive tokens #209

Closed
code423n4 opened this issue Dec 6, 2021 · 1 comment
Closed
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Handle

ScopeLift

Vulnerability details

Impact

Governor can drain incentive balance via arbitraryCall

Proof of Concept

The Stream contract offers createIncentive https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L500 and claimIncentive https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L516 which is the way the contract "expects" incentives to go. Access to claiming incentives is limited to the stream creator after the stream ends.

We assume the governor is untrusted, therefore we check to ensure the depositToken and rewardToken balances don't change. The contract also prevents against direct calls to incentive token contracts that have an incentive balance: L735 https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L735

However a malicious governor could optimistically call token.approve(maliciousActor, MAX_UINT) on tokens where an incentive is expected. maliciousActor could be any address, and could then transfer out incentive balance whenever an incentive is created.

Tools Used

Recommended Mitigation Steps

Replace arbitraryCall with more targeted behavior

Or

Inside arbitraryCall, block calls to approve and safeApprove by checking the function selector encoded in data

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Dec 6, 2021
code423n4 added a commit that referenced this issue Dec 6, 2021
@brockelmore brockelmore added the duplicate This issue or pull request already exists label Dec 8, 2021
@0xean
Copy link
Collaborator

0xean commented Jan 14, 2022

dupe of #199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants