Secret Vault on Aptos

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

Secret Data is Publicly Readable

Root + Impact

Description

  • The contract is designed to store secrets in a Vault resource with access controlled through the get_secret function, ensuring only the owner can access the secret.

  • However, the secret is stored within the Vault resource and is directly readable from the blockchain. There is a fundamental misunderstanding about the nature of how the blockchain works, it's public.

struct Vault has key {
secret: String // @> Plaintext secret stored directly in blockchain
}

Risk

Likelihood:

  • Any user can query the blockchain using standard Aptos REST API or CLI tools to access account resources

Impact:

  • The owner's secret stored using this contract becomes publicly visible to anyone.

Proof of Concept

Anyone can run aptos account list --account <owner account addr>

and get a result like this:

{
"Result": [
{
"0xf9fab0692f1cae1ee2eb401dfcacdc39371ede13487a65bcdb2637c4bccbed46::vault::Vault": {
"secret": "this is the secret"
}
},
...

Recommended Mitigation

The owner can consider encrypting his secret off-chain and not relying on the security of get_secret

Updates

Lead Judging Commences

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

Anyone can see the `secret` on chain

Support

FAQs

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