Skip to content

Commit 488a3ca

Browse files
authored
Document security hazards of system_interface::instruction::create_account (#416)
1 parent 19945d3 commit 488a3ca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

system-interface/src/instruction.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ pub enum SystemInstruction {
298298
},
299299
}
300300

301-
/// Create an account.
301+
/// Create an account, failing if the account previously had any balance.
302302
///
303303
/// This function produces an [`Instruction`] which must be submitted in a
304304
/// [`Transaction`] or [invoked] to take effect, containing a serialized
@@ -312,6 +312,13 @@ pub enum SystemInstruction {
312312
/// [`transfer`] lamports for rent, [`assign`] to its owning program. The
313313
/// [`create_account`] function does all three at once.
314314
///
315+
/// # Security issues
316+
///
317+
/// Using this function is a security issue if the `to_address` is predictable
318+
/// by an attacker. The attacker can prefund the address with lamports and
319+
/// thereby prevent the successful execution of the `create_account` call. This
320+
/// can DoS an on-chain program.
321+
///
315322
/// # Required signers
316323
///
317324
/// The `from_address` and `to_address` signers must sign the transaction.

0 commit comments

Comments
 (0)