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

Potential Loss of Fertilizer ERC1155 NFTs During L1 to L2 Migration.

Summary

a potential vulnerability in the L1 to L2 migration process for contracts holding fertilizer ERC1155 NFTs.
The vulnerability arises from the possibility of NFT loss if the contract address on L1 is not owned by the same user on L2.

Vulnerability Details

https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/main/protocol/contracts/beanstalk/init/reseed/L2/ReseedBarn.sol#L88-L93

During the migration process from L1 to L2, there is a critical step where the ownership of the contract addresses
must be maintained. If the contract address on L1, which holds the fertilizer ERC1155 NFTs, is not controlled by the same user on L2,
the NFTs could be lost. This is due to the mismatch in contract addresses, leading to a scenario where the migrated assets
are sent to an incorrect or non-existent address on L2.

function mintFertilizers(Fertilizer fertilizerProxy, Fertilizers[] calldata fertilizerIds) internal {
// ... snip
for (uint j; j < f.accountData.length; j++) {
// `id` only needs to be set once per account, but is set on each fertilizer
// as `Fertilizer` does not have a function to set `id` once on a batch.
fertilizerProxy.beanstalkMint(
@>> f.accountData[j].account,
fid,
f.accountData[j].amount,
f.accountData[j].lastBpf
);
}
}

If f.accountData[j].account is a contract address on L1 and the same address is not contract on L2 fertilizerId will be minted to wrong address.

Impact

If the L1 contract address not owned by user on L2, the minted fertilizer NFTs will be deposited into wrong address on L2
which user cannot access. This essentially results in lost ERC1155 NFTs for the intended recipient.

Tools Used

Recommendations

address on L2 must be owned by same account address on L1, if account is EAO same user will receive NFT but if it is contract a check michanism must be added devlopers knows better hwo this will be update.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Potential Loss of Fertilizer ERC1155 NFTs During L1 to L2 Migration - Account abstraction, multisig other contracts

Appeal created

Uno Submitter
11 months ago
Uno Submitter
11 months ago
T1MOH Auditor
11 months ago
Uno Submitter
11 months ago
Uno Submitter
11 months ago
inallhonesty Lead Judge
11 months ago
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Potential Loss of Fertilizer ERC1155 NFTs During L1 to L2 Migration - Account abstraction, multisig other contracts

Support

FAQs

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