CS 161 : Computer Security

Spring 2017


Vern Paxson (office hours Mon 2-3PM in 737 Soda) and an awesome team of talented TAs.


Tuesday/Thursday 5:00-6:30, 155 Dwinelle


Web page: https://inst.eecs.berkeley.edu/~cs161/
Announcements, questions: the class Piazza site, which you sign up for here.
Feel free to mark your question as private if you don't want other students to see it.


The lecture schedule is subject to change and will be revised as the course progresses.

Date Topic Readings Slides
Tue 1/17 Introduction [optional: G&T § 1.1, Craft § 1-1.1, 1.3] Slides
Thu 1/19 Security Principles Notes on Principles for Building Secure Systems.
Notes on Design Patterns for Building Secure Systems.
[G&T § 1.1.4, 3.4.6]
Tue 1/24 Overflows, Injection,
and Memory Safety
Notes on Memory Safety.
[G&T § 3.4, Craft § 6.1-6.3]
Smashing The Stack For Fun And Profit, by Aleph One
Illustrations of memory safety
with: normal execution, crashing,
diverting control flow, and injecting code.
Thu 1/26 Software Security: Defenses Notes on Reasoning About Code and Secure Software Development.
[G&T § 9.4-9.5; Craft § 6.5-6.7]
Eevee's guide for Testing for People Who Hate Testing
Slides (including class suggestions for defenses)
Tue 1/31 Web Security: Background,
Same Origin Policy
[G&T § 7.1.1, 7.1.3-7.1.4, 7.3.1-7.3.2, 7.3.4, 7.3.6; Craft § 12.1.1, 12.1.2, 12.1.3]
Web Security: Are You Part Of The Problem?
Thu 2/2 Web Security: Injection [G&T § 7.2.1, 7.2.6-7.2.8, 7.3.3; Craft § 12.1.4]
SQL Injection Attacks by Example,
Secure Session Management With Cookies for Web Applications

Squigler software and demo logs
Tue 2/7 Web Security: Cross-Site Attacks [G&T § 7.2.3-7.2.4]
XSS (Cross Site Scripting) Prevention Cheat Sheet
Cross Site Request Forgery: An introduction to a common web application weakness
Thu 2/9 Web Security: XSS, Misleading Users [G&T pp. 278-279; § 7.2.2-7.2.3]
Clickjacking Defense Cheat Sheet
Tue 2/14 Midterm Review Conducted by Apoorva, Mia, and Nathan Slides
Thu 2/16 Midterm #1
Tue 2/21 Symmetric-Key Cryptography Notes.
[G&T § 8.1-8.1.3, 8.1.7; Craft § 7.1, 7.3.2, 7.3.3]
Thu 2/23 Confidentiality, con't Notes.
[G&T § 1.3-1.3.1, 1.3.3, 8.2, 8.5.2]
Tue 2/28 Integrity and Authentication Notes.
[G&T § 1.3.2, 1.3.4, 8.2.3, 8.3, 8.4.1, 8.4.3; Craft § 7.4.2]
Thu 3/2 Key Management Notes.
[G&T § 1.3.5]
Tue 3/7 Network Security: Background Networking terminology quick-reference.
[G&T § 5.1-5.1.2, 5.3-5.3.1, 5.4-5.4.2, 6.1-6.1.2, 7.1-7.1.1; Craft § 5.1, 5.4.1]
Thu 3/9 Network Attacks: Lower Layers [G&T § 5.1.3, 5.2.3, 5.3.3-5.3.4, 5.4.4; Craft § 5.3.1] Slides
Tue 3/14 Network Attacks: TCP Slides
Thu 3/16 Network Attacks: DNS G&T § 6.1.3 (pp. 278-284)
Reliable DNS Forgery in 2008: Kaminsky's Discovery
An Illustrated Guide to the Kaminsky DNS Vulnerability
Tue 3/21 Network Control Notes on Firewalls.
[G&T § 6.2, 6.3 intro, 6.3.3; Craft § 5.3.2]
Thu 3/23 Midterm #2
Tue 4/4 Denial-of-Service [G&T § 5-5.4]
Mitigating Multiple DDoS Attack Vectors
Thu 4/6 Securing Internet Communication: TLS G&T § 1.1.1, 7.1.2, 8.3 Slides
Tue 4/11 Securing Internet Communication:
[G&T § 4.4, 6.1.4]
The WoSign Saga
Thu 4/13 Detecting Attackers [G&T § 6.4] Slides
Tue 4/18 Detecting Attackers, con't Slides
Thu 4/20 Malware: Viruses [G&T § 4.2, 4.5] Slides
Tue 4/25 Malware: Worms and Botnets [G&T § 4.3] Slides
Thu 4/27 Potpourri Conducted by Frank, Rebecca, Rishabh and Grant Slides
Tue 5/2 Course Review Conducted by Apoorva and Grant
Thu 5/4 Course Review Conducted by David, Frank, Nathan, Rishabh and Grant
Fri 5/12 Final Exam
11:30AM - 2:30PM
Location: Last names A-L, Pauley Ballroom; M-Z, 155 Dwinelle


Vern Paxson

Apoorva Dornadula David Fifield David Hahn
Frank Li Grant Ho Mia Gil Epner
Mitar Nate Wang Nathan Malkin
Paul Bramsen Rebecca Sorla Portnoff Rishabh Poddar
Warren He

Office hours:

M 1-3 Grant | 611 Soda
M 2-3 Vern | 737 Soda
T 1-2 Warren | 611 Soda
T 2-3 Nathan | 611 Soda
T 2-3 David H | 651 Soda
W 9-11 Nate | 651 Soda
W 10-12 Becky | 258 Cory
W 12-2 Paul | 611 Soda
W 12-2 Apoorva | 341A Soda
R 10-12 Rishabh | 411 Soda
R 3-4 David F | 611 Soda
F 9-11 Frank | 611 Soda
F 12-1 Mitar | 341B Soda
F 1:30-2:30 Mia | 341A Soda

Discussion Section Handouts:

  1. 01/23: Handout solutions (x86 and Security Principles)
                Slides (Process Layout and Function Calls)
  2. 01/30: Handout solutions (Buffer Overflow / Software Vulnerabilities)
  3. 02/06: Handout solutions (Web security)
  4. 02/13: Handout solutions (Web security, con't)
  5. 02/27: Handout solutions (Symmetric-key cryptography; Q3 and its solution updated)
  6. 03/06: Handout solutions (Cryptography, con't)
  7. 03/13: Handout solutions (Key Management and Networking)
  8. 03/20: Handout solutions (Network Attacks)
  9. 04/03: Handout solutions (Merkle Trees; Tunneling; Hash Chains)
  10. 04/10: Handout solutions (TLS; DoS)
  11. 04/17: Handout solutions (TLS; DNSSEC)
  12. 04/24: Handout solutions (Detection)
  13.   N/A: Handout solutions (Additional pseudo-section material covering some of the final topics)

Discussion Section Times:

DIS 101 M 10:00A-10:59A | 223 Dwinelle (David H)
DIS 102 M 9:00A-9:59A | 136 Barrows (Mia)
DIS 103 M 9:00A-9:59A | 223 Dwinelle (Paul)
DIS 104 M 10:00A-10:59A | 320 Soda (Nathan)
DIS 105 M 11:00A-11:59A | 320 Soda (Frank)
DIS 106 M 12:00P-12:59P | 320 Soda (Mitar)
DIS 107 M 5:00P-5:59P | 104 Barrows (Apoorva)
DIS 108 M 12:00P-12:59P | 310 Soda (Apoorva)
DIS 109 M 4:00P-4:59P | 229 Dwinelle (Paul)
DIS 110 M 3:00P-3:59P | 289 Cory (Rishabh)
DIS 111 M 4:00P-4:59P | 242 Dwinelle (Nathan)
DIS 112 M 4:00P-4:59P | 243 Dwinelle (Nate)
DIS 113 M 2:30P-3:29P | 320 Soda (Frank)
DIS 114 M 3:30P-4:29P | 320 Soda (Grant)
DIS 115 M 4:30P-5:29P | 320 Soda (Rishabh)
DIS 116 M 11:00A-11:59A | 310 Soda (Grant)


Homeworks will be submitted electronically via GradeScope. Homework solutions must be legible; we may mark off for difficult-to-read solutions, or even refrain from grading them entirely.
No late homeworks accepted.

Schedule for homeworks:


There will be 3 course projects. We will penalize late project submissions as follows: less than 24 hours late, you lose 10%; less than 48 hours late, you lose 20%; less than 72 hours late, you lose 40%; at or after 72 hours, late submissions no longer accepted. (There are no "slip days".)

WARNING: some projects are exceptions to previously discussed late policy. Please check below/look at Piazza for specific project information.

Note that this late policy applies only to projects, not homeworks (homeworks cannot be turned in late). Schedule for projects:


There will be two midterms and one final exam.

All exams are mandatory. If you will be unable to attend any of the dates, you must contact the instructor during the first week of class. The midterms will be given on during regular class hours, 5:10-6:30PM.

  • Midterm 1, Thu Feb 16, 5:10-6:30PM

  • Midterm 2, Thu March 23, 5:10-6:30PM
The final will be held Friday May 12, 11:30AM - 2:30PM. Exam rooms per the first letter of each student's last name:
First Letter Exam Room
A-L Pauley Ballroom
M-Z 155 Dwinelle


We will compute grades from a weighted average, as follows:
Homeworks: 16% (10.0% HW1, 30.0% HW2, 30.0% HW3, 15.0% HW4, 15.0% HW5)
Projects: 24% (33.3% P1, 33.3% P2, 33.3% P3)
Midterms: 30% (50.0% MT1, 50.0% MT2)
Final exam: 30%

Course Policies

Contact Information
Computer accounts
Lecture notes
Discussion sections
Re-grading policies
Late homework policy

Contact information

If you have a question, the best way to contact us is via the class Piazza site. The staff (instructors and TAs) will check the site regularly, and if you use it, other students will be able to help you too. Please avoid posting answers or hints for either homeworks or projects before the assignment is due.

If your question is personal or not of interest to other students, we encourage you to mark the question as private on Piazza: select "Post to: Individual Student(s)/Instructor(s)" at the top and then type "Instructors" in the field underneath it. If you wish to talk with one of us individually in person, you are welcome to come to any of our office hours. We prefer using these methods instead of sending email; regrettably, email does not scale well to a class of this size.


The instructors and TAs will periodically post announcements, clarifications, etc. to the Piazza site. Hence it is important that you check it regularly throughout the semester.


The prerequisites for CS 161 are CS 61B, CS61C, and CS70. We assume basic knowledge of Java, C, and Python. You will need to have a basic familiarity using Unix systems.


Homeworks will specify whether they must be done on your own or may be done in groups. Either way, you must write up your solutions entirely on your own. For homeworks, you must never read, see, or copy the solutions of other students, and you must not allow other students to see your solutions. For projects, you must never read, see, or copy the code or solutions of other students (other than your project partner, for group projects), nor allow students other than your partner to see your solutions or code.

You may use books or online resources to help solve homework problems, but you must always credit all such sources in your writeup and you must never copy material verbatim. Not only is this good scholarly conduct, it also protects you from accusations of theft of your colleagues' ideas. You must not ask for homework/project solutions on Stack Overflow or other online sites; you may ask for help with conceptual questions, but you must credit your sources. You must not receive help on assignments from students who have taken the course in previous years, and you must not review homework or project solutions from previous years.

You must ensure that your solutions will not be visible to other students. If you use GitHub or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. If you use GitHub, GitHub offers free student accounts that allow you to keep your solutions private; please use one.

We believe that most students can distinguish between helping other students understand course material and cheating. Explaining a subtle point from lecture or discussing course topics is an interaction that we encourage, but you should never read another student's assignment solution or partial solution, nor have it in your possession, either electronically or on paper (other than for project partners). You must never share your written solutions, or partial solutions, with another student, not even with the explicit understanding that it will not be copied. You must write your homework solution strictly by yourself.

Warning: Your attention is drawn to the Department's Policy on Academic Dishonesty. In particular, you should be aware that copying or sharing solutions, in whole or in part, from other students in the class or any other source without acknowledgment constitutes cheating. Any student found to be cheating will (1) be referred to the Office of Student Conduct, (2) receive negative points on the assignment (i.e., worse than not doing it at all), and, depending on severity, (3) fail the course.


We will be discussing attacks in this class, some of them quite nasty. None of this is in any way an invitation to undertake these attacks in any fashion other than with informed consent of all involved and affected parties. The existence of a security hole is no excuse. These issues concern not only professional ethics, but also UCB policy and state and federal law. If there is any question in your mind about what conduct is allowable, contact the instructors first.

Computer accounts

We will use 'class' accounts this semester. Get your account here. When you first log in to your account, you will be prompted to enter information about yourself; that will register you with our grading software. If you want to check that you are registered correctly with our grading software, you can run check-register at any time. A list of available Instructional "login servers" that can be sshed into can be found here.


The class does not have a required textbook. We have not found one that fully treats the material covered in the course, and we want to help you save money, so please don't feel obligated to buy a textbook. However, we know that some students appreciate additional reading to supplement lectures; for them, we recommend Introduction to Computer Security by Goodrich & Tamassia. We also recommend The Craft of System Security by Smith & Marchesini. We will list readings from these textbooks in the syllabus, but these are entirely optional.

Lecture notes

We will provide lecture notes and/or slides for many of the lectures. These materials are not a substitute for attending class, as our discussion in class may deviate from the written material. You are ultimately responsible for material as presented in both lecture and section.

Discussion sections

Discussion sections will sometimes cover important material not presented in lecture, and we expect you will attend. Outside of your discussion section, you should feel free to attend any of the staff office hours (not just your section TA's office hours) and ask any of us for help.

Re-grading policies

Any requests for grade changes or re-grading must be made within one week of when the work was returned. To ask for a re-grade for material graded on GradeScope, submit a regrade request on GradeScope. We will provide procedures to request re-grades for other coursework when those are graded. We will not accept verbal re-grade requests. Note that a re-grade can result in a decreased score as well as an increased score, if upon revisiting we discover problems in your work that we previously overlooked.

Bear in mind that a primary aim in grading is consistency, so that all students are treated the same. For this reason, we are unlikely to adjust the score of individual students on an issue of partial credit if the score allocated is consistent with the grading policy we adopted for that problem.

More on homeworks: If a problem can be interpreted in more than one way, clearly state the assumptions under which you solve the problem. In writing up your homework you are allowed to consult any book, paper, or published material, except solutions from previous classes or elsewhere, as stated under the Collaboration section. If you consult external sources, you must cite your source(s). We will make model solutions available after the due date, and feedback will be available via glookup or GradeScope.

Late homework policy

We will give no credit for homework turned in after the deadline. Please don't ask for extensions. We don't mean to be harsh, but we prefer to make model solutions available shortly after the due date, which makes it impossible to accept late homeworks.

Don't be afraid to ask for help! Are you struggling? We'd much rather you approached us for help than gradually fall behind over the semester until things become untenable. Sometimes this happens when students fear a possibly unpleasant conversation with a professor if they admit to not understanding something. We would much rather resolve/remedy your misunderstanding early than have it expand into further problems later. Even if you are convinced that you are the only person in the class that doesn't understand the material, and think it must be entirely your fault for falling behind, please overcome this concern and ask for help as soon as you need it. Helping you learn the material is what we're here to do, after all!


The following tips are offered based on our experience with CS 161:

1. Don't wait until the last minute to start projects! The projects can be time-consuming. Pace yourself. Students who procrastinate generally suffer.

2. Make use of office hours! The instructors and TAs hold office hours expressly to help you. It is often surprising how many students do not take advantage of this service. You are free to attend as many office hours as you wish. You are not constrained just to use the office hours of your section TA. You will likely get more out of an office hour visit if you have spent some time in advance thinking about the questions you have, and formulating them precisely. (In fact, this process can often lead you to a solution yourself!)

3. Participate actively in discussion sections! Discussion sections are not auxiliary lectures. They are an opportunity for interactive learning. The success of a discussion section depends largely on the willingness of students to participate actively in it. As with office hours, the better prepared you are for the discussion, the more you are likely to get out of it.