Anyone can front-run the creation of a vesting account to block it
Creating a vesting account fails if the recipient account already exists, and sending any coins to an address creates that account. An attacker can therefore front-run the vesting creation transaction with a small transfer so the vesting account can never be created.
Source: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/251
The protocol has acknowledged this issue.
Found by
000000, g
Summary
Creation of a vesting account will not work when the recipient of the vested funds already exists. Anyone can then block a new vesting account from being created by front-running it with a Bank::Msg.Send.
Root Cause
A vesting account can only be created if the recipient does not exist yet.
if acc := m.ak.GetAccount(ctx, to); acc != nil {
return nil, sdkerrors.ErrInvalidRequest.Wrapf("account %s already exists", msg.ToAddress)
}
This can be exploited by anyone that sends coins to the intended vesting recipient.
func (k BaseSendKeeper) SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error {
// ... snip ...
// Create account if recipient does not exist.
//
// NOTE: This should ultimately be removed in favor a more flexible approach
// such as delegated fee messages.
accExists := k.ak.HasAccount(ctx, toAddr)
if !accExists {
defer telemetry.IncrCounter(1, "new", "account")
k.ak.SetAccount(ctx, k.ak.NewAccountWithAddress(ctx, toAddr))
}
Internal Pre-conditions
None
External Pre-conditions
None
Attack Path
- A user calls
CreateVestingAccount()withpubkeyBas the intended recipient. - The griefer frontruns the
CreateVestingAccount()transaction with BankSend()transaction.
This transaction creates the recipient account causing the CreateVestingAccount() to fail.
Impact
The intended recipient of the vesting funds is permanently blocked from becoming a Vesting Account. Once an account is created, it can not be deleted.
PoC
None
Mitigation
Consider updating an existing account to a Vesting Account.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
The intended recipient is permanently blocked from having a vesting account, because created accounts cannot be deleted.
What the attacker needed
Attacker can submit a transfer first; recipient address known in advance
The fix
The protocol should allow converting an existing account into a vesting account instead of requiring the recipient to be new.
How it was found
- A user submits a request to create a vesting account for an intended recipient.
- An attacker sends a small amount of coins to that recipient before the request is processed.
- The transfer creates the recipient account, so the vesting creation request fails.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A vesting account is a wallet that releases funds slowly over time. The protocol only sets one up if the recipient address has never been used, but simply receiving a coin makes an address exist. So anyone can send a tiny amount first and the setup then always fails, and accounts cannot be removed afterwards.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.