Skip to content
Access control Audit finding Intermediate

Malicious operator can rug pull

The operator role in the VoterProxy contract can call withdrawAll to remove all tokens held by the contract, and can also call execute to make arbitrary calls with any value. A malicious or compromised operator could therefore steal all tokens from the contract.

oyc Follow

Originally disclosed on Code4rena

Submitted by oyc109_

https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/VoterProxy.sol#L138-L143

https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/VoterProxy.sol#L274-L285

Vulnerability Details

A compromised or malicious operator can withdraw all tokens by calling the function withdrawAll

/2022-05-vetoken/contracts/VoterProxy.sol
138:     function withdrawAll(address _token, address _gauge) external returns (bool) {
139:         require(msg.sender == operator, "!auth");
140:         uint256 amount = balanceOfPool(_gauge).add(IERC20(_token).balanceOf(address(this)));
141:         withdraw(_token, _gauge, amount);
142:         return true;
143:     }

The operator can also call an arbitary address with any value

/2022-05-vetoken/contracts/VoterProxy.sol
274:     function execute(
275:         address _to,
276:         uint256 _value,
277:         bytes calldata _data
278:     ) external returns (bool, bytes memory) {
279:         require(msg.sender == operator, "!auth");
280:
281:         (bool success, bytes memory result) = _to.call{value: _value}(_data);
282:         require(success, "!success");
283:
284:         return (success, result);
285:     }

jetbrain10 (veToken Finance) disputed and commented:

The operator will be the multi-sig wallet.

Alex the Entreprenerd (judge) commented:

The warden has shown a risk for depositors in that the operator can sweep all tokens out of the contract.

While this comment is longer than the report, the finding is valid and of medium severity.


The original report as published on Code4rena, by oyc. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The operator role has unrestricted power to withdraw all tokens and to execute arbitrary calls, with no timelock or other safeguard.

Impact

A malicious or compromised operator could steal all tokens held by the contract.

What the attacker needed

Operator key is compromised or malicious

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract has a special account called the operator that is allowed to do certain things. This report shows that the operator can take all the tokens out of the contract and can also make the contract send calls to any other address. If that operator account is ever stolen or turns bad, all the money in the contract can be taken.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from veToken Finance contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.