DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: low
Valid

Hardcoding EXTERNAL_L1_BEANS = 0 will lead to permanent loss of beans when bridging the beans

Summary

Hardcoding EXTERNAL_L1_BEANS = 0 will lead to permanent loss of beans when bridging the beans

Vulnerability Details

The cross-chain message when migrating the beans from L1 => L2 will permanently fail because of the require(EXTERNAL_L1_BEANS >= s.sys.migration.migratedL1Beans) check due to the hardcoded EXTERNAL_L1_BEANS variable, causing the permanent loss of beans

contract BeanL1RecieverFacet is ReentrancyGuard {
uint256 constant EXTERNAL_L1_BEANS = 0;
address constant BRIDGE = address(0x4200000000000000000000000000000000000007);
address constant L1BEANSTALK = address(0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5);
/**
* @notice migrates `amount` of Beans to L2,
* issued to `reciever`.
*/
function recieveL1Beans(address reciever, uint256 amount) external nonReentrant {
// verify msg.sender is the cross-chain messenger address, and
// the xDomainMessageSender is the L1 Beanstalk contract.
require(
msg.sender == address(BRIDGE) &&
IL2Messenger(BRIDGE).xDomainMessageSender() == L1BEANSTALK
);
s.sys.migration.migratedL1Beans += amount;
require(
EXTERNAL_L1_BEANS >= s.sys.migration.migratedL1Beans,
"L2Migration: exceeds maximum migrated"
);
C.bean().mint(reciever, amount);
}

}

Impact

permanent loss of beans

Tools Used

Manual

Recommendations

Initialize the EXTERNAL_L1_BEANS in a constructor instead.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

`EXTERNAL_L1_BEANS` defined with `0` will fail require(EXTERNAL_L1_BEANS >= s.sys.migration.migratedL1Beans, "L2Migration: exceeds maximum migrated");

Appeal created

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

`EXTERNAL_L1_BEANS` defined with `0` will fail require(EXTERNAL_L1_BEANS >= s.sys.migration.migratedL1Beans, "L2Migration: exceeds maximum migrated");

Support

FAQs

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