The publishRequisition
function in the TractorFacet contract of the Beanstalk project is vulnerable to spam attacks and produces non-indexed events, making it difficult to read and utilize the emitted data effectively.
Spam Vulnerability: The function allows users to publish an unlimited number of Requisitions, leading to potential spam attacks. Malicious actors could use this to exploit the system by publishing numerous fake Requisitions. This can flood the system with irrelevant data and incur unnecessary gas costs for operators who try to execute some of the fake Requisitions. The worst-case scenario would be attackers flooding the system, causing multiple tractor operators to pay unnecessary gas costs and resulting in fund losses for them. This can significantly impact the reputation of TractorFacet, deterring users from executing anything published on the blockchain due to the risk of it being fake.
Non-indexed Events: The emitted PublishRequisition
events lack indexed fields, making it difficult to filter and search the events efficiently. This hinders usability and effective tracking of Requisitions.
PublishRequisition
event
LibTractor.Requisition
struct which is emitted in the event
Blueprint
struct
My PoC consists of a contract deployed to the Sepolia testnet to show how the event looks without indexed fields and how hard it is to utilize.
I invoked the function once to emit the event. Here is how it looks on the blockchain: https://sepolia.etherscan.io/address/0xd55a210d98a42fe472bce683128a5cb01c19af4c#events
I also wrote a contract with an indexed event, adding indexed fields to important parameters.
Here is the event it produced: https://sepolia.etherscan.io/address/0xe7bc7c9378b89a578a91313f448e6638530a1a2f#events
System flooding: Attackers can exploit the function to flood the system with numerous fake Requisitions, making it challenging to identify and process genuine ones.
Tractor operators paying unnecessary gas costs while trying to execture spam Requisitions
Reduced usability: The lack of indexed fields in the events makes it hard for users to query and utilize the event data effectively.
Remix, Sepolia Testnet
Completely remove the publishRequisition
function and manage the Requisitions off-chain by creating an appropriate marketplace for transactions, for example in the Beanstalk web app. This approach can effectively prevent spam and reduce on-chain data clutter. Additionally, this off-chain management system would provide greater readability regarding the source of the request, visualize whether there is a reward for executing a blueprint, and overall, offer a superior user experience.
Invalid as per docs https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
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.