Skip to content
Access control Audit finding Intermediate

Allowing duplicated anchors could cause bias on anchor price.

The `listAnchor` function in `Router.sol` lacks access control, allowing anyone to add anchors. Duplicate anchors can be added, which biases the result of `getAnchorPrice`.

Vader Protocol contest

Originally disclosed on Code4rena

In Router.sol, the setup of the five anchors can be interrupted by anyone adding a new anchor due to the lack of access control of the listAnchor function. Also, duplicate anchors are allowed. If the same anchor is added three times, then this anchor biases the result of getAnchorPrice.

Referenced code: Router.sol#L245-L252

PoC: Link to PoC See the file 200_listAnchor.js for a PoC of this attack. To run it, use npx hardhat test 200_listAnchor.js.

Recommend only allowing listAnchor to be called from the deployer by adding a require statement. Also, check if an anchor is added before by require(_isCurated == false).

strictly-scarce (vader) acknowledged:

Deployer will list the anchors, seems highly unlikely they will get griefed in practice. Severity: 1

The original report as published on Code4rena. 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 `listAnchor` function lacks access control and does not check for duplicate anchors.

Impact

An attacker could bias the anchor price by adding duplicate anchors, potentially affecting price calculations.

What the attacker needed

None

The fix

The function should be restricted to the deployer and should check that the anchor is not already added.

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 function that sets up price anchors can be called by anyone, not just the deployer. An attacker can add the same anchor multiple times, which skews the average price calculated by the contract.

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 Vader Protocol 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.