◈ LESSON 5: BLOCKCHAIN ATTACKS & DEFENSE ◈
>> ALERT: Security training mode activated...
You've learned how blockchain works (Lessons 1-4). Now it's time to learn how attackers try to BREAK it - and how to defend against them!
Understanding how systems can be attacked is the BEST way to defend them. As cybersecurity professionals, you need to "think like a hacker" to protect like a defender!
The Hacker's Mindset:
Just like in traditional cybersecurity, blockchain security uses MULTIPLE layers of protection. If one fails, others still protect the system!
Remember from Lesson 3: consensus requires MAJORITY agreement. What if an attacker controls the majority?
How It Works:
What They Can Do:
Try to take over the network! Control nodes to see if you can execute a 51% attack:
Network Nodes (Click to compromise):
Nodes Controlled: 0 / 10
Control Percentage: 0%
Click nodes to attempt takeover...
To 51% attack Bitcoin, you'd need more computing power than all Bitcoin miners combined. Cost: Billions of dollars. Not worth it!
An attacker creates MANY fake identities (nodes) to gain influence in the network.
Real-World Analogy:
Imagine a classroom vote where one student creates 50 fake student IDs and votes 50 times. They control the vote!
In Blockchain:
They DO get attacked if they're truly free!
That's why most blockchains require SOME cost to participate:
This is called "making attacks economically irrational" - it costs more to attack than you can gain!
The classic problem blockchain was designed to solve - but attackers still try it!
The Attack Scenario:
Alice sends 1 BTC to coffee shop. Transaction broadcast to network.
Coffee shop sees transaction (0 confirmations) and gives Alice coffee.
Alice broadcasts ANOTHER transaction sending same 1 BTC to herself with higher fee!
Miners pick the higher-fee transaction. Coffee shop gets nothing. Alice got free coffee!
Try to execute a double-spend attack!
You have 1 BTC. Create two transactions:
Transaction 1 (to Merchant):
Transaction 2 (to Yourself):
In real life, this only works on merchants who accept 0-confirmation transactions. Most don't anymore! Even 1 confirmation makes this attack nearly impossible.
The Biggest Hack in Blockchain History (at the time)
What Happened:
The Vulnerability: Reentrancy Attack
Function calls external contract before updating state. External contract calls back and exploits outdated state.
Numbers wrap around: 255 + 1 = 0, or 0 - 1 = 255. Can create money from nothing!
Missing checks like "onlyOwner". Anyone can call admin functions!
Attackers see your transaction in mempool, copy it with higher gas fee, and execute before you!
Calling unknown contracts can trigger malicious code.
Remember: Blockchain is IMMUTABLE!
Once a smart contract is deployed, you CAN'T change the code. That's why:
ONE BUG = MILLIONS LOST FOREVER
The BIGGEST threat! Most crypto is stolen through tricking users, not breaking code.
Common Phishing Tactics:
metamask-secure.com instead of metamask.io
→ Steals your seed phrase!
"We're from Coinbase support. Send us your private key to verify your account."
→ Real support NEVER asks for private keys!
"Congratulations! Connect your wallet to claim free tokens!"
→ Drains your wallet when you "connect"
Looks like legit NFT project, but approval allows contract to steal all your NFTs
→ Always verify contract addresses!
Can you spot the phishing attempts?
Scenario 1: You receive an email: "Your MetaMask wallet has been compromised! Click here and enter your 12-word recovery phrase to secure it immediately!"
Scenario 2: A website asks you to "Connect Wallet" to view an NFT gallery. No transaction, just viewing.
Scenario 3: Twitter DM from "Coinbase_Support": "We detected suspicious activity. Please provide your password for verification."
The Largest Crypto Hack Ever
What Happened:
Lesson: Even "secure" multi-sig systems fail if enough keys are compromised through social engineering!
Before ANY blockchain interaction, ask yourself:
Check spelling, look for https://, bookmark official sites
Check on Etherscan, compare with official sources
Read the transaction carefully, understand what you're approving
Always test new addresses/contracts with minimal funds first
1000% APY? Free money? Probably a scam!
Question 1: What's the BEST defense against 51% attacks?
Question 2: The DAO hack exploited which vulnerability?
Question 3: What should you NEVER share?
Question 4: How many confirmations for a $10,000 transaction?
Question 5: What's the #1 cause of crypto theft?
You've mastered Lesson 5: Blockchain Security Threats & Defense!
You now understand how to think like an attacker and defend like a pro!