Smart Contract Auditing, Assembly, Security, and DeFi Ultimate Course
Made with love by Cyfrin & The Red Guild
Note: If you're familiar with Patrick's previous courses, we have renamed "Lessons" to "Sections"
Welcome to the repository for the Ultimate Smart Contract Auditing, Assembly, Security, and DeFi Course!
Video: Coming soon...
- Smart Contract Auditing, Assembly, Security, and DeFi Ultimate Course
- Table of Contents
- Introduction, Resources, and Prerequisites
- Curriculum
- đ¤ Section 0: Welcome to the Course
- đ¸ Section 1: Review (Don't skip)
- â Section 2: What is a smart contract audit (Security Review)?
- âŗī¸ Section 3: Your first audit (security review) | PasswordStore Audit
- đļ Section 4: Manual & Static Analysis | Puppy Raffle Audit
- đ Section 5: Invariants & Intro to DeFi | TSwap Audit
- đŠī¸ Section 6: Centralization, Proxies, and Oracles | Thunder Loan Audit
- đ Section 7: Bridges, Chains, Signatures, Intro to Yul/Assembly | Bridge Boss Audit
- Section 7.5: MEV & Governance
- đĄī¸ Section 8: (THE FINAL BOSS AUDIT) MEV, Nodes, & DAOs | Vault Guardians Audit
- First CodeHawks Competitive Audit
- Part 2
- Section 9: Wallet & Key Management
- Section 10: EVM Assembly, Opcodes, Yul, & Huff | Horse Store
- Section 11: Formal Verification & Symbolic Execution
- Section 12: DeFi | Stablecoin Audit
- Section 13: Post-deployment
- Congratulations
- Thank you
Table of Contents
Part 1
Smart Contract Auditing, Assembly, Security, and DeFi Ultimate Course
Table of Contents
Introduction, Resources, and Prerequisites
đŠī¸ Section 6: Centralization, Proxies, and Oracles | Thunder Loan Audit
đ Section 7: Bridges, Chains, Signatures, Intro to Yul/Assembly | Bridge Boss Audit
First CodeHawks Competitive Audit
Part 2
Congratulations
Thank you
Introduction, Resources, and Prerequisites
Link to video: Coming soon...
â ī¸ All code associated with this course is for demo purposes only. They have been audited, but we do not recommend them for production use and should be used at your own risk.
Resources For This Course
Join Cyfrin Updraft for the best learning experience!
- AI Frens
- ChatGPT
- Just know that it will often get things wrong, but it's very fast!
- Phind
- Like ChatGPT, but it searches the web
- Bard
- Other AI extensions
- ChatGPT
- Github Discussions
- Ask questions and chat about the course here!
- Stack Exchange Ethereum
- Great place for asking technical questions about Ethereum
- Peeranha
- Decentralized Stack Exchange!
Exploit Resources
Prerequisites
An intermediate understanding of solidity. You don't need to be a pro, but you should be familiar with:
- Blockchain basics (transactions, blocks, decentralization, etc)
- Running a smart contract test suite (hardhat, foundry, truffle, etc)
- Solidity basics (variables, functions, structs, etc)
Here are some resources to get you up to speed with the prerequisites:
- Full Foundry Course: This will give you every single prerequisite
- Speed Run Ethereum: This will give you most of what you need. But youâll need a little extra time on invariant tests, using foundry, and DeFi/OnChain Finance.
Outcome
- Have the foundational skills to become a professional smart contract auditor
- Speak, interact, and contribute to the web3 security community
- Compete in web3 competitive audits
- Compete in web3 bug bounties
- Start a career as an independent auditor
- Become a top 1% smart contract developer
Bonus NFTs
- Coming soon...
Important Notes for Arbitrum
IF YOU DECIDE TO MINT THE REAL NFT:
- We didn't audit/security review the NFT, so if you want to make sure you'll be safe, interact with the contract using a burner wallet (a wallet with very little money that you don't use for anything else)
- In fact... Get good at interacting with wallets from a burner wallet
- Read my Tweet thread on basic wallet safety
- It might be a good idea to wait till later in the course when we teach you about verifying metamask transactions.
- Feel free to mint NFTs on sepolia without worrying about the above
Bridging to Arbitrum
- We didn't show you how to bring ETH -> Arbitrum, but the process would be:
- Send ETH -> one of your wallets like:
- Use the Arbitrum Bridge
Curriculum
đ¤ Section 0: Welcome to the Course
Do not skip this section!
Welcome
Why Web3 Security?
- Web3 is important
- Permissionless finance
- Unbreakable promises
- Web3 security is subpar right now
- Rekt Leaderboard
- $1B in 2023 (so far)
- Web3 vs Web2 hacks. Web2 is mostly PII theft, where Web3 hacks result in irrevocable losses of funds.
- Bad actors in the space. Lone wolf hackers vs. well funded, persistent nation state actors (e.g. NK).
- Career opportunities
- Top 1% Developer
- Private Audits
- Competitive Audits
- Bug Bounties
- Future:
- Incident Responders
- On-chain investigators
- MoreâĻ
Why Web3 is so important
-
Rebuild trust in the ecosystem.
-
Wild West image to the outsiders
The Final Boss Codebase, you'll be able to audit this at the end of this course
Best Practices for this course
- Register for Cyfrin Updraft
- USE THIS SITE!!! It's specfically made to make learning easier
- Follow the repository: While going through the course be 100% certain to follow along with the github repository. If you run into in an issue check the chronological-updates in the repo.
- Be Active in the community: Ask questions and engage with other developers going through the course in the discussions tab, be sure to go and say hello or gm! This space is different from the other industries, you don't have to be secretive; communicate, network and learn with others :)
- Learn at your own pace: It doesn't matter if it takes you a day, a week, a month or even a year. Progress >>> Perfection
- Take Breaks: You will exhaust your mind and recall less if you go all out and watch the entire course in one sitting. Suggested Strategy every 25 minutes take a 5 min break, and every 2 hours take a longer 30 min break
- Refer to Documentation: Things are constantly being updated, so whenever Patrick opens up some documentation, open it your end and maybe even have the code sample next to you.
- Use ChatGPT and/or the course chat
And finally, by embarking on this journey, you are now a "Security Researcher", not an "Auditor". The key word being "Researcher", so we will go over strategies for continued learning so you can stay on top of your game.
đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯
đ¯ Exercise: Write yourself a message about why you want this
- This will be important for when things get hard
- Is it money? Save web3? Become someone? Write down as many reasons as possible.
Section 0 NFT
- Coming soon
đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯đ¯
(back to top) âŦī¸
đ¸ Section 1: Review (Don't skip)
Tooling & Environment Prerequistes
- VSCode
- VSCodium
- Foundry
- chisel
- cast
- forge
- Windows Users: WSL
- AI Helpers
- ChatGPT
- Phind
- Forums & Resources
- Ethereum Stack Exchange
- Peeranha
- Github Discussions
Solidity & Smart Contract Prerequisites
- Remix
- Basic smart contracts
forge init
Fuzzing & Stateful Fuzzing (This might be new)
- Fuzz tests
- Stateless Fuzzing
- Stateful fuzzing
- Invariants
Common EIPs/ERCs
Advanced Solidity
- storage
- Clip from foundry course
- Fallback & Receive
- Encoding, Call, & Staticcall
- Clip from the foundry full course
- Delegatecall & Proxies
- Clip from foundry full course
- tx.origin vs msg.sender
- Selfdestruct (to be removed in an upcoming fork)
Advanced Foundry
- mainnet-forking
đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸
đ¸ Exercise:
- Join the CodeHawks/Cyfrin Discord
- Go for a walk, and buckle up
Section 1 NFT
- Coming soon
đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸đ¸
(back to top) âŦī¸
â Section 2: What is a smart contract audit (Security Review)?
What is a security review/smart contract audit?
- High Level Overview
- People say "audit" -> security review
- There is no silver bullet to auditing, and they have limitations
- 3 phases of a security review
- Initial Review
-
- Scoping
-
- Reconnaissance
-
- Vulnerability identification
-
- Reporting
-
- Protocol fixes
-
- Fixes issues
-
- Retests and adds tests
-
- Mitigation Review
-
- Reconnaissance
-
- Vulnerability identification
-
- Reporting
-
- Initial Review
Smart Contract Development Life Cycle
- Plan & Design
- Develop & Test
- Smart Contract Audit & Post Deploy Planning
- Deploy
- Monitor & Maintain
Top Smart Contract Auditors (Subjective!)
- Use this list to reference how top quality security teams do reviews, post reports, do research, etc
Audit Readiness
- Simple Security Checklist
- Test suite with code coverage
- Fuzzing, Static Analysis
- Natspec (especially for external/public functions)
- The Rekt Test
- âCode maturityâ is important!
Tooling
- Static Analysis
- Slither
- Aderyn
- Fuzzing / Invariant Tests
- Foundry
- Echidna
- Consensys
- Formal Verification
- Certora
- Solidity SMT Checker
- Maat
- Manticore
- AI
- Tooling vs Humans
Attacker vs. Defender mindset
- Always learning
Top Attack Vectors
- Top attack vectors
đđđđđđđđđđđđđđđđđđđđđđđ
đ Exercise: Sign up for one security/web3 newsletter!
- Cyfrin Updraft
- Blockchain Threat Intelligence (Referral link)
- Solodit (not a newsletter, but has constant updates of new hacks)
- rekt
- Week In Ethereum
- Consensys Diligence Newsletter
- Officer CIA
Section 2 NFT
- Coming soon
đđđđđđđđđđđđđđđđđđđđđđđ
(back to top) âŦī¸
đĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸImportant Note: We are now going to do audits. Please note, that we will not find all the bugs in each codebase. Each codebase was designed to show you a specific set of bugs, and give you a good understanding of what an audit "feels" like.
đĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸđĸ
âŗī¸ Section 3: Your first audit (security review) | PasswordStore Audit
đģ Security Review CodeV1: https://sepolia.etherscan.io/address/0x2ecf6ad327776bf966893c96efb24c9747f6694b
đģ Security Review CodeV2: https://github.com/Cyfrin/3-passwordstore-audit
đģ Security Review CodeV3: https://github.com/Cyfrin/3-passwordstore-audit/tree/onboarded
đģ Security Review Final: https://github.com/Cyfrin/3-passwordstore-audit/tree/audit-data
Feel free to look ahead and try to find the bugs on the codebase yourself, or get familiar with the protocol first.
Remember the phases!
đŊđŊđŊđŊđŊđŊđŊđŊđŊđŊ
- Initial Review
-
- Scoping
-
- Reconnaissance
-
- Vulnerability identification
-
- Reporting
-
đŧđŧđŧđŧđŧđŧđŧđŧđŧđŧ
For this demo, we are ignoring the last 2 phases
- Protocol fixes
-
- Fixes issues
-
- Retests and adds tests
-
- Mitigation Review
-
- Reconnaissance
-
- Vulnerability identification
-
- Reporting
-
The Setup (Scoping): PasswordStore
V1
- "Hey, here is my link to Etherscan, can I get an audit?"
V2
- Client onboarding: Minimal
V3
cloc
"The Tincho"
- Read docs
- Note taking in-code
- Small -> Large
- Solidity Metrics
- Tinchoâs ENS Review
Exploits (Vulnerability Identification)
Exploits: Access Controls
- Missing
onlyowner
- Access Controls
- Unprotected sensitive functions
- Role misconfiguration
- Privilege escalation
- Access Controls
Exploits: Private Data
- Storing a secret (private data is not private)
More Recon
- coverage
Writing your first finding
- Write finding
- How to write a good finding
- Title: Root Cause + Impact
- Finding Layout:
### [S-#] Title (ROOT CAUSE + IMPACT)
**Description:**
**Impact:**
**Proof of Concept:**
**Recommended Mitigation:**
- Write PoC
- Mitigation
- Using AI
Are we done?
Your first report (Reporting)
- Writing the Report
- Severity Classification
- Basic Markdown Report
đĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨ
đĨ Exercises:
Section 3 NFT
- Coming soon
đĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨ
(back to top) âŦī¸
đļ Section 4: Manual & Static Analysis | Puppy Raffle Audit
â â â â â â â â â â â â â â â â â â â â â â â â â
This is the BEST security review for new auditors, 100% be sure to pay attention to this section.
â â â â â â â â â â â â â â â â â â â â â â â â â
This is the go-to best starter audit/security review. There are a lot of bugs in here, some obvious, some not.
đģ Security Review Code: https://github.com/Cyfrin/4-puppy-raffle-audit
Concepts you'll learn: Static analysis, Reentrancy, Weak RNG, Arithmetic issues, How to write a professional looking report.
Tooling: Static Analysis
- Web3 bugs machine vs human
- Static Analysis
- cloc
- Solidity Metrics (audit estimation)
- Solidity Visual Developer
Scoping & Reconnaissance: Puppy Raffle
Exploits: DoS (Denial of service)
- Fixes:
- Remove unnecessary loops
Exploits: Reentrancy
- Case Study: DAO Hack
- Exercises
- Prevention:
- CEI/CEII ( FREI-PI soon!)
- NonReentrant modifiers
Exploits: Weak RNG
Exploits: Arithmetic issues
- Examples:
- Under/Overflow
- Rounding & Precision
- Exercises
- Prevention:
- Use newer versions of solidity
- Multiply before divide
Exploits: Poor ETH Handling
- Case study: Sushiswap Miso
- Exercises:
Informational Findings
- Stict Solc Versioning
- Supply Chain Attacks
- Magic Numbers
Gas Audits
Code Maturity
- Code coverage
Static Analysis, follow up
What is a Competitive Audit?
Writing the report: Puppy Raffle
- Audit Report Templating
- Github Report Templating (Cyfrin)
- Github Report Templating (Spearbit)
- Github Report Templating (Spearbit Custom)
đ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđ
đ§âđ Exercises:
- Ethernaut Challenges (1, 9, and 10) đ§âđ
- Sign up for Solodit
- Post a tweet about how you completed the Puppy Raffle Audit!
- Sign up for farcaster
- Do a CodeHawks First Flight
Section 4 NFT
- Coming soon
đ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđđ§âđ
(back to top) âŦī¸
đ Section 5: Invariants & Intro to DeFi | TSwap Audit
đģ Security Review Code: https://github.com/Cyfrin/5-t-swap-audit
Concepts you'll learn: Stateful fuzzing, Fuzzing, Invariants, FREI-PI/CEII, Advanced DeFi, AMMs, Uniswap, Curve.fi, Constant product formula
đđđđđđđđđđđđđđđđ
STOP!
Don't look at the contracts for this one!
We are going to show you how you can use advanced tools to find even more bugs just by properly understanding invariants and writing more effective test suites.
đđđđđđđđđđđđđđđđ
The Setup (Scoping): T-Swap
- Client onboarding: Extensive
Reconnaissance: T-Swap
- Protocol Invariants
- FREI-PI/CEI
Intro to DeFi/OnChain Finance
Tooling: T-Swap
- Forge Fuzzing, Stateful Fuzzing, Invariants
- Solodit
- Properties
Exploits: Weird ERC20s
- Token integration checklist
- Weird ERC20 List
- Rebase & fee-on-transfer
- ERC777 reentrancy callbacks
Exploits: Core Invariant breaking
- Case Study:
- Uniswap
- Euler
Design Patterns: T-Swap
- FREI-PI / CEII / Pre & Post Checks
đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°
đ° Exercises:
- Write a fuzz test to find a bug in this challenge
- Write a tweet thread about an interesting finding from Solodit
Section 5 NFT
- Coming soon
đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°
đđđđđđđđđđđđđđđđđđđđđđđđđđ
Congratulations!!
If you've made it this far in the course and you understand what's going on, you have the skills to start getting paid as a security researcher, doing competitive audits, bug bounties, or even get hired!
But if you want to become one of the best in the world and really secure web3, keep going...
đđđđđđđđđđđđđđđđđđđđđđđđđđ
(back to top) âŦī¸
đŠī¸ Section 6: Centralization, Proxies, and Oracles | Thunder Loan Audit
đģ Security Review Code: https://github.com/Cyfrin/6-thunder-loan-audit
We are staritng to get more advanced with DeFi and smart contract issues. Buckle up, we are getting hotter.
Scoping & Reconnaissance: Thunder Loan
DeFi: Borrowing & Lending
Malicious Scope
- Don't "yes-man" every audit
Tooling: Thunder Loan
Exploits: Failure to initialize
- Case Study: I accidentally killed it
Exploits: Storage collision
Exploits: Centralization
- Silent Upgrades
- Case Study: Oasis
Exploits: Missing events
Exploits: Bad Upgrade
Exploits: Oracle & Price Manipulation
- Flash Loans
- Case Study: Alpha Homora
- Case Study: Creme Finance
Design Patterns: Thunder Loan
- Pull over push
đĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻ
đĻ Exercises:
- YAcademy Proxy
- Tweet about how YOU feel about upgradeable smart contracts
Section 6 NFT
- Coming soon
đĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻđĻ
(back to top) âŦī¸
đ Section 7: Bridges, Chains, Signatures, Intro to Yul/Assembly | Bridge Boss Audit
đģ Security Review Code: https://github.com/Cyfrin/7-boss-bridge-audit
Tooling: Boss Bridge
Scoping & Reconnaissance: Boss Bridge
- Precompiles
- Case Study: Polygon
- Public private key demo
- Encoding & Decoding Refresher
Exploits: Opcode Support
- Case study: zkSync
Exploits: Signature Replay
Exploits: ERC20 Contract Approval
Exploits: Unlimited Minting
Bridge Hacks
- Bridge hacks: Ronin, Poly network, Nomad, Wormhole
Writing the report: Boss Bridge
Design Patterns: Boss Bridge
- Emergency stop
đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°
đ° Exercises:
- Damn Vulnerable DeFi Challenges 1, 2, 4
- Write a tweet thread about an interesting finding from Solodit
- Tweet about how you finished the hardest audit yet!
- Read about more historic attacks:
Section 7 NFT
- Coming soon
đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°đ°
(back to top) âŦī¸
Section 7.5: MEV & Governance
Introduction to MEV
- MEV Explained
- MEV Explained continued
- Toxic MEV
- Frontrunning
- Sandwich Attacks
- non-toxic
- Backrunning
- MEV Protection
- Design
- Flashbots Protect
- MEVBlocker
- Securerpc
- MEV in our past security reviews:
- Puppy:
- Someone can front-run
selectWinner
to call a refund
- Someone can front-run
- T-Swap:
- Deadline protection means people can "sandwhich" attack you
- Thunder Loan:
- Users can front run flash loans to make the fees higher or lower
- Boss Bridge:
- A signed transaction could be front run so that an attacker sends tokens from an L2 before the signer can
- Puppy:
- Slippage Protection
Exploits: Governance Attack
- Unlimited Minting
- Flash Loan Voting
- Case Study: Beanstalk
- Metamorphic upgrades
- Case Study: TORN Governance
đĄī¸ Section 8: (THE FINAL BOSS AUDIT) MEV, Nodes, & DAOs | Vault Guardians Audit
This security review is optional. It's a LOT of code! But if you choose to do it, you'll get a better idea of what a larger codebase feels like. Being comfortable coming up to a codebase and saying "I'll eventually understand this codebase, but right now I don't" is important!
đģ Security Review Code: https://github.com/Cyfrin/8-vault-guardians-audit
Concepts: Vault Guardians
Good luck :)
đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ
đĻ Exercises:
- 1st CodeHawks Competitive Audit
- Write a tweet thread about an interesting finding from Solodit
- Write a blog or tweet on your experience!
- Read these tips for auditing multi-chain protocols
Section 8 NFT
- Coming soon
đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ
đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ
First CodeHawks Competitive Audit
- How to submit a finding
- How to decide severity
- Where to find a competitive audit
đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ
đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ đĻ
(back to top) âŦī¸
đđđđđđđđđđđđđđđđđđđđđđđđđđ
Congratulations!!
If you've made it this far in the course and you understand what's going on, you have the skills to become one of the top security researchers in web3! Either as a solo auditor, freelancer, competitive auditor, or even get hired by a top firm!
However... if you want to be on the cutting edge and be able to understand every nook in web3, you've got a little more to go...
đđđđđđđđđđđđđđđđđđđđđđđđđđ
Part 2
Coming soon...
Section 9: Wallet & Key Management
Wallet types
- Custodial Wallets
- "Hot" Wallets
- Metamask
- Frame
- "Cold" Wallets
- Lattice
- Trezor
- Multi-sig (Yes - Set it up)
- 1 of 1, or x of y
- Case Study: Vulcan
- Future: Account Abstraction
Wallet Safety
- Store the private key, not the secret phrase
- Paper wallet
- "brain" wallet
- Encrypted file
- Case Study: LastPass
- Case Study: Mixin
- Rotate keys
- Physical security
- Social recovery
- Wallets
Verify Metamask transactions
- Foundry's cast
- Joinfire
- Metamask snaps
đđđđđđđđđđđđđđđđđđđđđđđđđđ
đ Exercises:
- Set up your Safe!
- Review classic key leeks
.env
leak with private keys- Research one private key leak from rekt.news
- Check out keepmesafe
Section 9 NFT
- Coming soon
đđđđđđđđđđđđđđđđđđđđđđđđđđ
(back to top) âŦī¸
Section 10: EVM Assembly, Opcodes, Yul, & Huff | Horse Store
- EVM Opcodes
- Introduction to Yul
- Security considerations (compiler doesnât keep you safe anymore!)
- Introduction to Huff
- Forge debugger
- Tenderly Debugger
- Decompilers
- Metadock
đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´
đ´ Exercises:
- Convert a minimal contract of your own into Huff or Yul
Section 10 NFT
- Coming soon
đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´đ´
(back to top) âŦī¸
Section 11: Formal Verification & Symbolic Execution
- Introduction to FV & SE
- How to quit concrete testing with FV
- Z3 Solution with AI
- Solidity SMT Checker
- Case Study: PRBMath
Symbolic Execution / Formal Verification Tools in Web3
Issues
- Path Explosion
- Halting Problem
đ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Ž
𧎠Exercises:
- Attempt to use another FV tool
- Look into the Solady LibClone.sol
- It's a really cool codebase
Section 11 NFT
- Coming soon
đ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Žđ§Ž
(back to top) âŦī¸
đĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨ
đĨ Exercise: Watch this awesome video đĨ
đĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨđĨ
Section 12: DeFi | Stablecoin Audit
- Defi-minimal
- Stablecoins
- DAI
đĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒ
đĒ Exercise: Audit this! đĒ
Section 12 NFT
- Coming soon...
đĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒđĒ
(back to top) âŦī¸
Section 13: Post-deployment
Watch this video from DeFi security summit
- Bug Bounty
- Immunefi
- HackerOne
- Incident response
- Seal 911
- Warroom practice
- Whitehat vs Blackhat
- Responsible Disclosure
- Monitoring
- Your own
- Forta
- Pessimistic Spotter
- OZ Defender
- Blockchain sleuthing
- What do you do if you find a live issue?
- Check for a bug bounty
- If yes -> Submit, and youâre done
- If no -> Continue
- Reach out for help (privately!)
- Seal 911 (Or other emergency web3 paths)
- Connect with the team
- Come up with a plan to fix
- If they want to fix -> hooray! Do that
- If they ignore itâĻ You have a few options
- Give them 45 - 90 days to fix it, and say you will publicly disclose the information if they do not fix it
- Attempt a rescue yourself (Ideally, you never reach here)
- Check for a bug bounty
- White/No/Black Hat Case Studies
- Nohats
- Balancer
- Vyper
- Whitehats
- Astaria
- ParaSpace
- Blackhats
- Euler
- Many more
- Nohats
đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ
Section 13 NFT
- Coming soon...
đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ đ
(back to top) âŦī¸
Congratulations
đđđđđđđđđđđđ Completed The Course! đđđđđđđđđđđđ
If you've made it this far... wow.
Where do I go now?
- Competititve Audits
- CodeHawks
- We are working on many things to get you more deals. Stay tuned...
- Code4rena
- Hats Finance
- CodeHawks
- CodeHawks Discord
- Start marketing your services
- Twitter, Farcaster, LinkedIn, etc
- Blogging: Medium, Mirror, etc
- Bug Bounties
Learning More
- Patrick Collins YouTube
- Solodit
- Block Threat Intelligence
- Consensys Diligence Newsletter
- Owen Thurm YouTube
- JohnnyTime
- The Red Guild YouTube
- Cyfrin YouTube
Disclosures
The Cyfrin team runs CodeHawks, Cyfrin Updraft, and private security reviews. They are an advisor to the Peeranha project, and run various blockchain nodes like Chainlink & Ethereum. Additionally, the are responsible for the creation of the Aderyn and Solodit tools.
Thank you
Sponsors
Lead Lecturers / Code Builders
Guest Lecturers
- Josselin Feist | Trail of Bits
- Owen | Guardian Audits
- Andy Li | Sigma Prime
- JohnnyTime | Gingersec
- Pashov | Independent Security Researcher
Special thanks
- hansfriese
- carlitox477
- 0Kage
- giovannidisiena.eth
- Dacian
- Alex Roan
- Peter Kacherginsky
- Karma Coma
- Zach Obront
More Security Stuff
- https://scsfg.io/
- https://github.com/OffcierCia/Crypto-OpSec-SelfGuard-RoadMap
- https://github.com/transmissions11/solcurity
- https://github.com/OpenCoreCH/smart-contract-auditing-heuristics
- https://secure-contracts.com/
- https://github.com/crytic/properties
Huge Extra Thank YOU
Thanks to everyone who is taking, participating in, and working on this course. These courses are passion project data dumps for everyone in the web3 ecosystem.
Let's level up so we can keep web3 safer, and thank you again for taking this course!
(back to top) âŦī¸