computer science / security
University Computer Security Courses You Can Take Online, Compared
For computer science students and self-taught programmers: CS50 Cybersecurity, MIT 6.5660, Stanford CS155, Berkeley CS161 and Stanford CS253 side by side, with what each assumes, what the assignments cover, and which free hands-on platform pairs with it. Pages checked in October 2026.
Security courses at universities are not interchangeable. One teaches how a buffer overflow rewrites a return address, another how a browser enforces the same-origin policy, a third how to reason about an attacker before writing any code. If you already know how to program, the quickest route to a deep understanding is to pick the course that matches the layer you want and do its assignments. This page compares the main free ones. It is written for readers with a programming background, so it does not repeat the career-entry advice on our cybersecurity fundamentals page or the certification costs on our certifications page.
01 · THE MAP
Which course for which background
| You are... | Take | Reason |
|---|---|---|
| New to programming, curious about security | CS50's Introduction to Cybersecurity | Five weeks on accounts, data, systems and software; free certificate available |
| A CS student wanting systems security | MIT 6.5660 or Stanford CS155 | Threat models, buffer overflows and control hijacking labs |
| Comfortable with C, data structures and discrete math | Berkeley CS161 | Memory safety, cryptography, web and network security, with a free textbook |
| A web developer | Stanford CS253 | Web attacks and defenses; prerequisite is web development experience |
| Wanting the math behind encryption | Boneh's Cryptography I | Seven modules on ciphers, integrity and protocols |
02 · THE COURSES
What each course assumes and asks of you
Where a page does not state a fact, the cell says so.
| Course | Assumes | What you do | Free certificate |
|---|---|---|---|
| CS50 Cybersecurity (Harvard) | Not stated on the course page | 5 weeks: lectures, assignments, final project | Yes, with 70% or better on every problem and the final project |
| MIT 6.5660 (formerly 6.858) | Not stated on the course page | Lectures with readings; Lab 1 is buffer overflows | None listed |
| Stanford CS155, Spring 2026 | Not stated on the main page | Project 1 control hijacking; Project 2 web security; homework; exam | None listed |
| Berkeley CS161, Fall 2026 | CS61C, CS61B and CS70 are listed as prerequisites | Projects, homework, lecture playlist; free textbook | None listed |
| Stanford CS253 Web Security | CS 142 or equivalent web development experience | Web attacks and countermeasures; Fall 2021 materials | None listed |
| Cryptography I (Stanford, Coursera) | Not stated on the course page | 7 modules, about 2 weeks at 10 hours a week as listed | Shareable certificate; cost not stated on the page |
Two details are worth knowing. The old link to MIT 6.858 now lands on the 6.5660 pages: the course was renumbered, and the site's Spring 2023 calendar starts with threat models and a buffer-overflow lab. And Stanford CS253's page shows Fall 2021 materials, so treat its specifics as a few years old even though the concepts hold.
- CS50's Introduction to Cybersecurity ↗Five weeks: securing accounts, data, systems and software, then preserving privacy, with a final project.cs50.harvard.edu
- MIT 6.5660 Computer Systems Security ↗Formerly 6.858. Lecture schedule, readings and labs, starting with threat models and buffer overflows.css.csail.mit.edu
- Stanford CS155: Computer and Network Security ↗Principles of building secure systems with hands-on examples of how things go wrong; projects on control hijacking and web security.cs155.stanford.edu
- Berkeley CS161: Computer Security ↗Current-term site with calendar, projects and resources. It redirects to the term's own page.cs161.org
- CS161 textbook ↗Chapters on security principles, memory safety, cryptography, web security and network security, readable on its own.textbook.cs161.org
- Stanford CS253: Web Security ↗An overview of the most common web attacks and their countermeasures, aimed at programmers.web.stanford.edu
- Cryptography I (Coursera) ↗Dan Boneh's course on Coursera. The page does not state what is free, so check the enrollment options.coursera.org
03 · THINKING LIKE THE COURSES
Worked example: a threat model for password reset
MIT's first lecture is on threat models, and the habit it teaches is worth practicing before you touch an exploit. A threat model names what you protect, who might attack, how, and what stops them. Here is one for a "forgot password" email link.
| Asset | Attacker | Attack | Control |
|---|---|---|---|
| User account | Stranger who knows the email address | Guesses the reset token | Long random token from a cryptographic generator |
| User account | Anyone who obtains an old email | Reuses a stale link | Short expiry and single use |
| Reset page | Stranger | Floods requests to lock out or spam the user | Rate limiting per account and per address |
| Knowledge of who has an account | Scraper | Tells existing from missing emails by the response | Identical response either way |
| User's session | Attacker with a stolen link | Sets a new password while the old sessions stay alive | Invalidate existing sessions on reset |
Notice that nothing here required exploit knowledge. It requires asking, for each part of a design, who benefits from breaking it. Courses then supply the vocabulary and depth: memory safety for the code, cryptography for the tokens, web security for the pages.
04 · PRACTICE
Pairing lectures with hands-on work
pwn.college, run by Arizona State University, is described as open and free to participants worldwide, and it powers much of ASU's cybersecurity curriculum. You progress through belts, beginning with a white belt. Carnegie Mellon's CyLab Security Academy, the successor to picoCTF, is described as CMU's free cybersecurity learning platform. For reading, Ross Anderson's Security Engineering has its chapters available as free downloads from the author's page, including chapters on protocols, cryptography and access control.
- pwn.college ↗A free, hands-on cybersecurity education platform from Arizona State University, organized by belts.pwn.college
- picoCTF, now CyLab Security Academy ↗Carnegie Mellon's free security learning and competition platform; picoCTF logins from before May 8, 2026 still work.picoctf.org
- Security Engineering, Ross Anderson ↗The third edition's chapters are free to download; the e-book is sold by Wiley and Amazon.cl.cam.ac.uk
- PortSwigger Web Security Academy ↗Free labs that pair well with CS253 or the web chapters of CS161.portswigger.net
05 · FAQ
Frequently asked questions
Where should I start learning computer security?
If you can already program, start with a university course that fits your background: CS50's Introduction to Cybersecurity is the gentlest, and Berkeley CS161 with its free textbook is a thorough option. Pair any course with a hands-on platform.
Can I learn ethical hacking for free and legally?
Yes. pwn.college and CyLab Security Academy are free platforms built for practice, and PortSwigger's Web Security Academy offers free web-attack labs. They give you legal targets, which is the point.
Do I need a CS degree to work in security?
Not necessarily, though university course material is a good way to get the same foundations. Requirements differ by employer, and documented lab work shows skill whatever your degree.
What should I learn before cybersecurity?
Programming and an understanding of how operating systems and networks work. Berkeley CS161 lists CS61C, CS61B and CS70 as prerequisites, which is a sign of the background that courses at that level expect.
Is it illegal to practice hacking?
Only if you target systems without permission. Course labs, deliberately vulnerable applications and platforms like pwn.college are authorized for practice. Never test a real site you do not own or have written permission to test.