The claimFertilized function in the FertilizerFacet contract is designed to allow users to claim Beans from specified Fertilizer IDs. However, the function is susceptible to replay attacks due to the lack of mechanisms ensuring each Fertilizer ID is claimed only once.
The root cause of the vulnerability is the absence of checks to mark Fertilizer IDs as claimed within the claimFertilized function or the underlying beanstalkUpdate function. This omission allows an attacker to reuse the same calldata to claim Beans multiple times.
Vulnerable claimFertilized Function
Interaction with C.sol
Interaction with LibTractor
The LibTractor library is used to determine the current user making the claim:
User Determination: The LibTractor._user() function ensures that the correct user is identified, either the active publisher or msg.sender. This helps in attributing the claims to the right user but does not directly prevent replay attacks.
State Checks and Updates: The claimFertilized function relies on C.fertilizer().beanstalkUpdate() to handle state updates. However, this function does not mark IDs as claimed, the function is vulnerable to replay attacks.
1: Initial Claim::
User A calls the claimFertilized function with Fertilizer ID 123.
The function processes the claim and transfers Beans to User A.
2: Replay Attack:
User A captures the transaction data (calldata) used in the initial claim.
User A reuses the same calldata to call the claimFertilized function again.
Without proper checks, the function processes the same Fertilizer ID 123 again, transferring additional Beans to User A.
Malicious users can claim more Beans than they are entitled to, leading to inflation of the token supply.
The protocol and its honest users suffer significant economic losses due to unauthorized claims.
Manual review
To ensure replay attacks are mitigated, the claimFertilized function or the underlying beanstalkUpdate function should be modified to include checks that mark Fertilizer IDs as claimed and prevent multiple claims.
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.