Deployment of contracts with incorrect contractBytecode
in the deployToken
function can result in failed deployments, wasted resources, address calculation issues, operational disruption, security risks, and potential data loss. To mitigate these risks, bytecode validation and proper error handling should be implemented
Lack of bytecode validation in deployToken
can lead to insecure contract deployments with incorrect bytecode.
No validation of contractBytecode
can lead to failed deployments, wasted resources, address calculation issues, operational disruption, security risks, and potential data loss
copy and paste the below test in TokenFactoryTest
run forge test --match-path test/TokenFactoryTest.t.sol -vvvv
Even that the byteCode is incorrect, you will get Test result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.32ms
Foundry and Manual review
Add bytecode validation function in deployToken function, so that it checks if the bytecode length is divisible by 32 and has an odd word count (word count in 32-byte chunks)
Function code:
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.