Function secret_vault::get_secret
does not implement proper access control for only the owner. The function accepts a caller: address
parameter and checks if caller == @owner
, but this parameter can be controlled by anyone calling the function.
High
Likelihood: High
Reason: This function can be called by anyone, bypassing the assert
statement and read the secret
.
Impact: High
Impact: The secret
is not accessible only from the owner but from any user that calls this function.
The below test case shows that anyone can read the secret
by calling the secret_vault::get_secret
function
Start a local Aptos node in a separate terminal
Initialize an account
it returns
In the Move.toml
file replace the secret_vault
entry under [dev-addresses]
with the address found in account
under profile local
(from .aptos/config.yaml
). It is the same address created in the previous step.
Initialize a second account
it returns
In the Move.toml
file replace the owner
entry under [dev-addresses]
with the address found in account
under profile domi
(from .aptos/config.yaml
). It is the same address created in the previous step.
Deploy in --dev
it should return something similar as shown below:
Submit a transaction to set a secret
Note: Referred to documentation to find the correct syntax for this.
it returns a transaction hash
Call vault::get_secret
function
Note: Referred to the documentation provided by the local running node, http://127.0.0.1:8080/v1/spec#/operations/get_transaction_by_hash
, to see the syntax of this request.
It returns the value hello
which is the corresponding string of the hex value 68656c6c6f
that the owner set as the secret:
In the function secret_vault::get_secret
we need to pass the signer
as a parameter and then use the address_of
to derive its address as shown below:
Then this will only give access to the owner and the assert will work as expected.
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.