Description:
The set_secret function does not assert that the signer is the owner before set the secret!
Impact:
An attacker could set the secret and changed at any time !
Proof of Concept: Add the test :
#[test(owner = @0xcc, attacker = @0x123)]
fun test_set_secret(attacker:&signer,owner: &signer) acquires Vault{
}
Recommendation Mitigation:
public entry fun set_secret(caller:&signer,secret:vector
assert! (caller == @owner,NOT_OWNER);
let secret_vault = Vault{secret: string::utf8(secret)};
move_to(caller,secret_vault);
event::emit(SetNewSecret {});
}
In Move for Aptos, the term "owner" refers to a signer, which is a verified account that owns a given resource, has permission to add resources and the ability to grant access or modify digital assets. Following this logic in this contest, the owner is the account that owns `Vault`. This means that anyone has right to call `set_secret` and then to own the `Vault` and to retrieve the secret from the `Vault` in `get_secret` function. Therefore, this group is invalid, because the expected behavior is anyone to call the `set_secret` function.
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.