The LibTractor.sol library in the Beanstalk project contains a security vulnerability related to blueprint data validation. Attackers can forge blueprint data or signatures to execute unauthorized actions, causing severe consequences for the system.
The LibTractor.sol library uses the Requisition structure to store information about a blueprint, including the blueprint data (data), blueprint hash (blueprintHash), and signature (signature). However, the integrity verification of the blueprint data is only based on comparing the blueprintHash with the hash recalculated from the blueprint.data.
Attackers can exploit this vulnerability by:
Creating a Requisition with malicious blueprint.data.
Calculating the corresponding blueprintHash for the malicious blueprint.data.
Forging a signature to bypass the signature check in the verifyRequisition modifier.
Calling the tractor function in TractorFacet.sol with the forged Requisition.
The contract will execute the calls in the malicious blueprint.data, which can cause unauthorized actions such as transferring tokens, changing contract state, or performing other attacks.
Attackers can transfer user or contract tokens to their own accounts.
Manual Code Review
Use EIP-712 signatures: Instead of just checking the hash of the blueprint data, use EIP-712 signatures to verify the integrity of the data and ensure that the data is not tampered with.
Usage in TractorFacet.sol
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.