The get_secret()
function attempts to restrict reads by asserting caller == @owner
and then always borrowing the Vault at the named address @owner
, however:
The only check is comparing a user‑supplied argument (caller
) to a compile‑time constant (@owner
). Any external caller can just pass @owner
and the check succeeds
In Aptos, view functions have no signer context. There is no authenticated &signer
to bind the request to the real caller, therefore this pattern cannot enforce access control
Likelihood: High
The get_secret()
function is publicly callable and @owner
is embedded in bytecode, which is discoverable
Attackers can trivially pass the expected address and retrieve the secret
Impact: High
Full confidentiality breach of the owner’s secret. If the secret controls off‑chain privileges or is sensitive data, the impact extends beyond on‑chain state. Additionally, inability to rotate the secret (due to move_to only) exacerbates exposure once leaked
Add the following test, then run the command: aptos move test -f test_anyone_can_read_secret
PoC Results:
For proper access control, one way is to simly remove #[view]
and require an authenticated signer:
Note that this method only prevent others from calling get_secret()
, but it does not provide confidentiality, since any on‑chain plaintext is publicly readable
To provide confidentiality, ensure to store ciphertext on-chain and decrypt off-chain
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.