Skip to content
Access control Audit finding Intermediate

Approved operator of collateral owner can’t liquidate lien

The canLiquidate function only allows the collateral owner or anyone after the lien's end time to liquidate, but approved operators of the collateral owner cannot liquidate even though they can request loans. This means an approved operator cannot liquidate a lien when they should be able to.

rvierdiiev Follow

Originally disclosed on Code4rena

Submitted by rvierdiiev

If someone wants to liquidate lien then canLiquidate function is called to check if it’s possible.

https://github.com/code-423n4/2023-01-astaria/blob/main/src/AstariaRouter.sol#L611-L619

  function canLiquidate(ILienToken.Stack memory stack)
    public
    view
    returns (bool)
  {
    RouterStorage storage s = _loadRouterSlot();
    return (stack.point.end <= block.timestamp ||
      msg.sender == s.COLLATERAL_TOKEN.ownerOf(stack.lien.collateralId));
  }

As you can see owner of collateral token can liquidate lien in any moment. However approved operators of owner can’t do that, however they should.

As while validating commitment it’s allowed for approved operator to request a loan.

That means that owner of collateral token can approve some operators to allow them to work with their debts.

So they should be able to liquidate loan as well.

Tools Used

VsCode

Recommended Mitigation Steps

Add ability for approved operators to liqiudate lien.

SantiagoGregory (Astaria) confirmed


The original report as published on Code4rena, by rvierdiiev. 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

Likely the canLiquidate function checks only msg.sender == ownerOf(collateralId) and does not also check for approved operators.

Impact

Approved operators cannot liquidate liens, which may prevent timely liquidation and cause losses for the collateral owner.

What the attacker needed

Collateral owner approves an operator

The fix

The canLiquidate function should also allow approved operators of the collateral owner to liquidate.

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.

In this system, a person can approve others to act on their behalf for a loan. The code that checks who may liquidate a loan only looks at the owner, not the approved helpers, so those helpers are blocked from liquidating even though they can do other loan actions.

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 by rvierdiiev

View all

72 more disclosed reports, best first.

More from Astaria 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.