The get_secret
function in the Secret Vault contract contains a critical access control vulnerability that allows anyone to retrieve any vault owner's secret by simply providing the owner's address as a parameter.
The vulnerability exists in the get_secret
function on line 28-33:
The Problem: The function accepts a caller: address
parameter and checks if it equals @owner
, but this parameter can be controlled by anyone calling the function. The actual transaction sender is never validated.
The function should verify that the actual transaction sender (using &signer
) is the owner of the vault, not just check an arbitrary address parameter.
Anyone can call get_secret(@owner)
and successfully retrieve the owner's secret, completely bypassing the intended access control.
High, any one can get the secret by just providing the owners address, which can be found from the block explorer
Exposure of secret data
N/A
Replace the vulnerable function with proper access control:
Key Changes:
Change parameter from caller: address
to caller: &signer
Extract the actual caller's address using signer::address_of(caller)
Verify the actual transaction sender, not an arbitrary parameter
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.