The SecretVault contract is designed to enable a single owner to securely store a secret on the Aptos blockchain via the set_secret
entry function, which creates and moves a Vault
resource containing the secret to the caller's account. The get_secret
view function is intended to allow only the owner to retrieve this secret by verifying the provided caller address against the predefined @owner
address and borrowing the resource from that address.
The get_secret
function's access control is flawed because it relies solely on a user-supplied caller
parameter for the ownership assert (assert!(caller == @owner, NOT_OWNER);
), without requiring signer authentication, allowing any attacker to pass the owner's address as the parameter and bypass the check. Consequently, the function borrows and returns the secret from the hardcoded @owner
address, enabling unauthorized users to steal the owner's secret without any restrictions or costs.
Likelihood:
Attackers invoke the public get_secret
view function by supplying the owner's address as the caller
parameter, which satisfies the assert check and returns the secret without requiring
The owner's address becomes discoverable through deployment details, on-chain queries, or public explorers, enabling exploitation by any user without additional privileges or costs.
Impact:
Unauthorized disclosure of the owner's stored secret occurs, compromising the confidentiality intended by the contract and exposing sensitive data to any caller.
Attackers exploit the leaked secret for further malicious actions, such as unauthorized access to related systems or financial theft if the secret holds value like a key or password.
This PoC demonstrates the unauthorized retrieval of the owner's secret by an attacker through the get_secret
function. It uses a test function in Move to simulate the exploit in a controlled environment, confirming that the vulnerability allows any caller to bypass access controls by supplying the owner's address as a parameter.
To address the vulnerability, convert get_secret
from a public view function (which lacks signer authentication) to an entry function that requires a signer for proper ownership verification. This prevents parameter manipulation
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.