The set_deadline
function in lib.rs
is publicly accessible which should only be accessible to the creator, allowing any user to set the deadline for a fund. This lack of access control enables malicious users to set arbitrary deadlines, making the creator not to be able to set the deadline again after the malicious user has set the deadline. For example, a malicious user could set a deadline in the past to immediately make the fund inactive or set a deadline too far in the future to delay the fund's completion indefinitely.
The set_deadline
function is declared as public
and does not enforce any access control to restrict its usage to the fund's creator. The function accepts a deadline
parameter and updates the deadline
field of the fund
account without validating the caller's identity.
Fund Inactivity:
A malicious user could set a deadline in the past, making the fund immediately inactive and preventing further contributions.
Delayed Fund Completion:
A malicious user could set a deadline too far in the future, delaying the fund's completion indefinitely and locking up contributors' funds.
Manual code review.
Ensure that only the fund's creator can call the set_deadline
function by adding an access control check
Add validation to ensure the deadline
is not in the past
There is no need for additional checks of the caller's key inside the `set_deadline` function because Anchor verifies the `has_one = creator` constraint before executing the function. This ensures that the creator field inside the fund account must match the creator (signer) passed to the function: ``` #[account(mut, has_one = creator)] pub fund: Account<'info, Fund> ``` If they don’t match, the transaction fails. Also, signer verification is included: ``` #[account(mut)] pub creator: Signer<'info>, ``` The creator account must be a signer, meaning the transaction must be signed using the creator's private key.
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.