Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Vaults can be initialized by anyone (front-run)

Summary

Vaults initialisation can be frontrunned and setup with wrong parameters. Allowing a malicious user to drain all the tokens

Vulnerability Details

function initVault(ILoveToken loveToken, address managerContract) public {
if (vaultInitialize) revert Vault__AlreadyInitialized();
loveToken.initVault(managerContract);
vaultInitialize = true;
}

There is no access control on the initialisation of the vault, permiting a malicous user to set-up himself as the "managerContract".

function initVault(address managerContract) public {
if (msg.sender == airdropVault) {
_mint(airdropVault, 500_000_000 ether);
approve(managerContract, 500_000_000 ether);
emit AirdropInitialized(managerContract);
} else if (msg.sender == stakingVault) {
_mint(stakingVault, 500_000_000 ether);
approve(managerContract, 500_000_000 ether);
emit StakingInitialized(managerContract);
} else revert LoveToken__Unauthorized();
} ```
the "approve" lines allow him to drain all the funds in the loveToken contract
## Impact
LoveTokens can be drained by the malicious user
## Tools Used
Manual review
## Recommendations
init the vaults in the constructor of the LoveToken
Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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