Secret Vault on Aptos

First Flight #46
Beginner FriendlyWallet
100 EXP
View results
Submission Details
Severity: high
Valid

ineffective access control in get_secret function any caller can pass @owner as the argument to satisfy this check

ineffective access control in get_secret function, any caller can pass @owner as the argument to satisfy this check

  • get_secret function has ineffective access control, anyone can pass @owner as function argument to satisfy the check and the function is callable by anyone

@> public fun get_secret (caller: address):String acquires Vault{
assert! (caller == @owner,NOT_OWNER);
let vault = borrow_global<Vault >(@owner);
vault.secret
}

Risk

Likelihood: high

  • Any caller can pass @owner as function param to get the vault secret. If vault contains any funds, it can be exploited by the attacker

Impact: high

  • Vault containing funds can be drained out by the attacker as the view function is callable by anyone

Recommended Mitigation

  • Remove the caller param and directly check whether the caller is owner or not, and maintain the owner state variable to track the owner of the vault. Such that, only owner can call the get_secret function

Updates

Lead Judging Commences

bube Lead Judge 18 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Lack of signer check in `get_secret`

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.