Secret Vault on Aptos

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

Insecure access to secret due to not using &signer for authentication

Root + Impact

Description

  • Uses unverified address instead of cryptographically verified &signer

  • Checks that the address matches the hardcoded @owner value instead of asserting the caller's rights

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

Risk

Likelihood:

  • Any user can call a function with an arbitrary address.

  • Phishing interfaces can automate mass calls

Impact:

  • Disclosure of confidential data (secret) to any network users

  • Violation of the confidentiality of the owner of the secret

Proof of Concept

// The attacker knows the owner's address (@owner)
let victim_address: address = 0x123...;
// Calling a function with the victim's address
let secret = get_secret(victim_address);
// The secret data is now available to the attacker
debug::print(&secret);

Recommended Mitigation

Replace the vulnerable implementation with a secure version with
- public fun get_secret(caller: address): String acquires Vault {
- assert!(caller == @owner, NOT_OWNER);
- let vault = borrow_global<Vault>(@owner);
- vault.secret
- }
+ public fun get_secret(owner: &signer): String acquires Vault {
+ let owner_addr = signer::address_of(owner);
+ assert!(exists<Vault>(owner_addr), NOT_OWNER);
+ let vault = borrow_global<Vault>(owner_addr);
+ vault.secret
+ }
Updates

Lead Judging Commences

bube Lead Judge 16 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.