Raisebox Faucet

First Flight #50
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: low
Invalid

Missing zero value checks on deployment can halt claiming indefinitely

Root + Impact / Missing zero value checks on deployment can halt claiming indefinitely

Description

  • The initial version of DeployRaiseBoxFaucet.s.sol::DeployRaiseboxContract ensures that the RaiseBoxFaucet.sol::faucetDrip, RaiseBoxFaucet.sol::sepEthDrip and RaiseBoxFaucet.sol::dailySepEthCap values are non-zero. Therefore, when the standard (“happy path”) deployment script is used, this issue does not occur.

  • However, future Faucet deployments based on this contract may be vulnerable when a different deployment script is used that passes zero values for these parameters.

constructor(
string memory name_,
string memory symbol_,
uint256 faucetDrip_,
uint256 sepEthDrip_,
uint256 dailySepEthCap_
) ERC20(name_, symbol_) Ownable(msg.sender) {
@> faucetDrip = faucetDrip_;
@> sepEthAmountToDrip = sepEthDrip_;
@> dailySepEthCap = dailySepEthCap_;

Risk

Likelihood:

  • The issue arises when an alternative deployment script is used and zero values are passed for the faucetDrip, sepEthDrip, dailySepEthCap parameters.

Impact:

  • Since the contract owner does not have the ability to modify faucetDrip, sepEthDrip and dailySepEthCap after deployment, these values would remain zero, making the faucet functionality incomplete and blocking claimers from claiming faucet tokens and/or ETH.

Proof of Concept

Add the following test to RaiseBoxFaucet.t.sol to reproduce the issue:

function test_audit_missingZeroValueChecksOnDeploymentCanHaltClaimingIndefinitely()
public
{
RaiseBoxFaucet testRaiseBox = new RaiseBoxFaucet(
"raiseboxtoken",
"RB",
0, // faucetDrip
0, // sepEthDrip
0 // dailySepEthCap
);
vm.deal(address(testRaiseBox), 10 ether);
vm.prank(user1);
testRaiseBox.claimFaucetTokens();
assert(testRaiseBox.getBalance(user1) == 0);
assert(user1.balance == 0);
}

Recommended Mitigation

Add zero-value checks for the parameters in the deployment logic to prevent deployment with invalid values.

error RaiseBoxFaucet_EthTransferFailed();
+ error RaiseBoxFaucet_ZeroValueNotAllowed();
constructor(
string memory name_,
string memory symbol_,
uint256 faucetDrip_,
uint256 sepEthDrip_,
uint256 dailySepEthCap_
) ERC20(name_, symbol_) Ownable(msg.sender) {
+ if (faucetDrip_ == 0 || sepEthDrip_ == 0 || dailySepEthCap_ == 0) {
+ revert RaiseBoxFaucet_ZeroValueNotAllowed();
+ }
faucetDrip = faucetDrip_;
sepEthAmountToDrip = sepEthDrip_;
dailySepEthCap = dailySepEthCap_;
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.