โ† All Blockchain Technology Flashcard Decks

Security and Vulnerabilities Flashcards

21 cards from real Blockchain Technology practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 20 Security and Vulnerabilities flashcards as text
  1. A function transfers Ether to a user before updating their balance. What vulnerability does this introduce?

    Answer: Reentrancy

    Sending Ether before updating state lets the recipient's fallback re-enter the function and drain funds.

  2. Which pattern is the recommended defense against reentrancy attacks?

    Answer: Checks-Effects-Interactions

    The Checks-Effects-Interactions pattern updates state before making external calls, preventing re-entry exploitation.

  3. In Solidity 0.8+, what happens by default when an arithmetic operation overflows?

    Answer: The transaction reverts

    Solidity 0.8 and later include built-in overflow/underflow checks that revert on overflow.

  4. What is the main risk of using tx.origin for authorization?

    Answer: A malicious intermediate contract can impersonate the user

    tx.origin refers to the original sender, so a phishing contract called by the user passes the check.

  5. A lottery contract picks a winner using block.timestamp and blockhash. Why is this insecure?

    Answer: Miners/validators can manipulate these values

    On-chain values like timestamp and blockhash can be influenced by block producers, making the randomness predictable or manipulable.

  6. What does the 'pull over push' payment pattern improve?

    Answer: Resilience to failed external transfers and DoS

    Letting users withdraw (pull) instead of the contract pushing payments avoids a single failing transfer blocking everyone.

  7. Which tool is commonly used for static analysis of Solidity contracts to detect vulnerabilities?

    Answer: Slither

    Slither is a widely used static analysis framework that flags common Solidity security issues.

  8. What is a front-running attack in the context of a public mempool?

    Answer: An attacker observes a pending transaction and submits their own with higher gas to execute first

    Because pending transactions are visible, attackers can pay more gas to be ordered ahead and profit from the victim's intended action.

  9. A commit-reveal scheme is primarily used to mitigate which problem?

    Answer: Front-running of submitted values

    Committing a hash first and revealing later hides the value during the vulnerable ordering window.

  10. Why is using a single DEX spot price as a price oracle dangerous?

    Answer: It can be manipulated with flash loans

    An attacker can use a flash loan to skew the pool's spot price within a single transaction and exploit dependent contracts.

  11. What does a flash loan allow an attacker to do?

    Answer: Borrow large amounts with no collateral if repaid in the same transaction

    Flash loans provide uncollateralized capital that must be repaid within the same transaction, enabling large temporary capital for exploits.

  12. Which access-control mistake leaves an initialization function exploitable in upgradeable contracts?

    Answer: Forgetting to protect or disable the initializer so anyone can call it

    An unprotected initializer can be called by an attacker to seize ownership of the proxy.

  13. What is the security concern with delegatecall to an untrusted contract?

    Answer: The callee executes in the caller's storage context and can overwrite its state

    delegatecall runs target code against the caller's storage, so malicious code can corrupt or hijack the calling contract.

  14. A contract uses an unbounded loop over a dynamically growing array. What risk does this create?

    Answer: The function may exceed the block gas limit and become unusable

    As the array grows, iterating over it can require more gas than a block allows, permanently locking the function (a DoS).

  15. What is the purpose of a reentrancy guard (nonReentrant modifier)?

    Answer: It locks the function during execution to prevent nested calls

    A mutex-style lock set at entry and cleared at exit blocks recursive re-entry into the protected function.

  16. Why should the return value of a low-level .call be checked?

    Answer: It does not revert on failure; the success boolean must be verified

    Low-level call returns a success boolean instead of reverting, so unchecked failures can be silently ignored.

  17. What is a signature replay attack?

    Answer: Reusing a valid signature in a context where it should only be used once

    Without a nonce or domain separator, a valid signature can be replayed on the same or another contract/chain.

  18. Which EIP standard defines structured, domain-separated data hashing to prevent cross-contract signature replay?

    Answer: EIP-712

    EIP-712 specifies typed structured data signing with a domain separator that binds signatures to a specific contract and chain.

  19. What is the danger of leaving 'private' data in contract storage?

    Answer: Private only restricts Solidity access, not on-chain readability

    The private keyword only blocks other contracts/inheritance from reading it in code; all storage is publicly readable on-chain.

  20. A withdraw function uses transfer() to send Ether. Why might this break for smart-contract recipients after gas repricing?

    Answer: transfer forwards only 2300 gas, which may be insufficient for the recipient

    The fixed 2300 gas stipend of transfer can fail when receiving contracts need more gas, so call with checks is now preferred.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy