Boost _ Folks Finance 33614 - [Smart Contract - Medium] Front-Running Vulnerability in createAccount
Description
Brief/Intro
Vulnerability Details
contract AccountManager is IAccountManager, AccessControlDefaultAdminRules {
/// @notice Mapping of accounts to whether they are created
mapping(bytes32 accountId => bool isCreated) internal accounts;
/// @notice Mapping of account to addresses on spoke chains which will/are/have been able to manage the account
mapping(bytes32 accountId => mapping(uint16 chainId => AccountAddress)) internal accountAddresses;
/// @notice Mapping of addresses on spoke chains to the accountId they are registered to
mapping(bytes32 addr => mapping(uint16 chainId => bytes32 accountId)) internal registeredAddresses;
/// @notice Mapping of account to addresses on hub chain which are permitted to manage the account
mapping(bytes32 accountId => mapping(address => bool isDelegated)) internal accountDelegatedAddresses;
...
function createAccount(
bytes32 accountId,
uint16 chainId,
bytes32 addr,
bytes32 refAccountId
) external override onlyRole(HUB_ROLE) {
// check account is not already created (empty is reserved for admin)
if (isAccountCreated(accountId) || accountId == bytes32(0)) revert AccountAlreadyCreated(accountId);
// check address is not already registered
if (isAddressRegistered(chainId, addr)) revert AddressPreviouslyRegistered(chainId, addr);
// check referrer is well defined
if (!(isAccountCreated(refAccountId) || refAccountId == bytes32(0)))
revert InvalidReferrerAccount(refAccountId);
// create account
accounts[accountId] = true;
accountAddresses[accountId][chainId] = AccountAddress({ addr: addr, invited: false, registered: true });
registeredAddresses[addr][chainId] = accountId;
emit CreateAccount(accountId, chainId, addr, refAccountId);
}
...
function isAccountCreated(bytes32 accountId) public view override returns (bool) {
return accounts[accountId];
}
}
Impact Details
Recommendation
References
Proof of concept
Proof of Concept (POC)
PreviousBoost _ Folks Finance 33611 - [Smart Contract - Medium] Adversary can perform a DoS on users createLNextBoost _ Folks Finance 33630 - [Smart Contract - High] Incorrect calculation of loanBorrowbalance
Last updated
Was this helpful?