Skip to content
Access control Audit finding Intermediate

Missing Access Control for FabricateMIRClaim and FabricateANCClaim

The contract functions for fabricating MIR and ANC claims lack caller restrictions, allowing anyone to submit these messages. The report does not specify what an attacker could achieve by doing so.

jmak Follow

Originally disclosed on Code4rena

Submitted by jmak

https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/anchor-bAsset-contracts/contracts/anchor_airdrop_registry/src/contract.rs#L109 https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/anchor-bAsset-contracts/contracts/anchor_airdrop_registry/src/contract.rs#L71

FabricateMIRClaim and FabricateANCClaim should only be issued by the Hub contract (the central hub for all minted bLuna managed by Lido). However, execute_fabricate_anchor_claim and execute_fabricate_mir_claim do not restrict the caller, allowing anyone to submit these msgs.

Recommended Mitigation Steps

Recommended to add at least simple access control checks in the contract to ensure that these functions can only be called by the Hub and not by others.

See a below for a potential code snippet.

// only hub contract can send this message.
let config = read_config(deps.storage)?;
let sender_raw = deps.api.addr_canonicalize(&info.sender.to_string())?;
if sender_raw != config.hub_contract {
    return Err(StdError::generic_err("unauthorized"));
}

Alex the Entreprenerd (triage) commented:

The finding is correct in that anyone can call the function.

The finding lacks any form of impact as to what would happen.

I think these may be test functions also.

Not convinced the report makes sense for high severity given the lack of detail.


The original report as published on Code4rena, by jmak. 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 functions that handle fabricate claim messages do not check that the sender is the authorised Hub contract.

Impact

Anyone could call these functions, but the report does not describe any concrete harm, and a triager noted the lack of impact detail and suggested they may be test functions.

What the attacker needed

Ability to send messages to the contract

The fix

The contract should be changed to check that the caller is the Hub contract and reject others.

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 functions that are supposed to be called only by a specific trusted contract. Here, anyone can call them. The report does not explain what harm that causes, so the real impact is unclear.

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 jmak

View all

1 more disclosed report, best first.

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