331 - Network and Web Security - 2023
Table of Contents
A.k.a COMP96015/96016 or COMP 60015, but just "331" for short.
Schedule
Week 7 - 27/02/23
- Overview. This is the final week of the course. We conclude the client-side security part by looking at the security of sessions, which allow users to access and modify persistent state on the server, such as a bank account or a social network profile. In the lab, we practice CSRF attacks against sessions. Our last topic is web user privacy. We survey key issues, techniques and countermeasures for fingerprinting and tracking on the web. You are encouraged to try the recommended activities, which will deepen your appreciation of the privacy topics.
- Topics
- 21 Secure sessions
- Optional reading
- Browse the Team Cymru SOHO Pharming report
- Robust Defenses for Cross-Site Request Forgery
- BrowserAudit: Automated Testing of Browser Security Features
- Optional reading
- 22 Browser fingerprinting
- 23 Web user tracking
- Optional reading
- 21 Secure sessions
- Activities
- In class session on Monday
- Tutorial 8: Code review for PHP and XSS
- Lab on Tuesday
- Tutorial 9: Client-side vulnerabilities - Part 2
- Familiarise with the OWASP cheatsheet for session management
- Explore the AmIUnique and Panopticlick (aka Cover your Tracks) websites
- Look at examples of fingerprinting code in fingerprint2.js
- Install and play with the Monitorito browser extension to investigate tracking
- In class session on Monday
Week 6 - 20/02/23
- Overview. This week we focus on the security of the client side of web applications. The same origin policy is the main security policy that the browser implements by default to isolate web pages from each other. We look at XSS and other JavaScript threats, and explore the security implications of cookies and browser-based storage. In the lab session we attempt to find and exploit XSS vulnerabilities.
- Topics
- 18 Same Origin Policy
- Optional reading
- Securing Frame Communication in Browsers
- For reference: W3C HTML5 specification
- Optional reading
- 19 Scripting attacks
- Optional reading
- DOM-based XSS
- Isolating JavaScript code
- Defensive JavaScript
- For reference
- the W3C Content Security Policy (CSP) candidate recommendation
- Optional reading
- 20 Browser Storage
- Read Chapter 9 of The Tangled Web
- Optional reading
- For reference: IETF RFC for cookies
- 18 Same Origin Policy
- Activities
- In class session on Monday
- Invited lecture 3: AI for source code security (Joseph Katsioloudes, GitHub Security Lab)
- Lab on Tuesday
- Tutorial 7: Client-side vulnerabilities - Part 1
- Familiarise with the OWASP cheatsheets for
- In class session on Monday
Week 5 - 13/02/23
- Overview. This week we being with SQL injection, probably the most exploited server-side vulnerability, which we will practice also in the lab session. Then we look at key features and security aspects of JavaScript, and in particular obfuscation techniques. Finally we overview how browsers work, and discuss the main relevant security threats and attacks.
- Topics
- 15 SQL Injection
- Read Chapters 9, 10 of The Web Application Hacker's Handbook
- Optional reading
- Book: SQL Injection Attacks and Defense
- 16 JavaScript
- If you are not familiar with JavaScript, take this w3schools JavaScript tutorial
- Read Chapter 6 of The Tangled Web
- Optional reading
- 17 Browser security
- Read Chapter 4 of The Tangled Web
- Optional reading
- For reference: Browser security handbook (dated, but a goldmine of interesting details)
- There is No Free Phish: An Analysis of “Free” and Live Phishing Kits
- 15 SQL Injection
Activities
- In class session on Monday
- Tutorial 5: Code review for PHP and SQLI
- Lab on Tuesday
- Tutorial 6: SQL Injection Vulnerabilities
- Browser security examples: you are strongly advised to explore them.
- Phishing: look for a verified and online site on https://phishtank.com
- A real phishing kit: phishing-kit.zip
- Clickjacking: adapt the example from https://331.cybersec.fun/xframeoptions.html
- Drive-by download example from the slides: drive-by-download.zip
- Polyglot: see example at https://331.cybersec.fun/polyglot.html
- In class session on Monday
Week 4 - 06/02/23
- Overview. This week we start with web security. First we look at HTTP which is the main protoocols supporting web applications, then we see how HTTPS protects HTTP by encapsulating it inside TLS. Follows a short introduction to PHP and some of its tricky features. PHP will be our reference language for the server side of web applications. Finally we look at the main threats and vulnerabilities affecting servers. In the tutorial, we will practice identifying some of those vulnerabilities against a demo web application.
- Topics
- 12 HTTP
- 13 PHP
- If you are not familiar with PHP, take this w3schools PHP tutorial
- 14 Server-side security
- Read Chapters 1-4, 20, 21 of The Web Application Hacker's Handbook
- Activities
- In class session on Monday
- Invited lecture 2: Email Security (Charlie Hothersall-Thomas, Netcraft)
- Lab on Tuesday
- Guide: Chrome and Burp in Kali
- Tutorial 4: Server-side web vulnerabilities
- Recommended exercise
- Write a simple web app in PHP that can store HTTP POST data in a SQL database
- Optional: serve your web app over HTTPS (you can get a certificate for free at https://letsencrypt.org or try using a self-signed certificate)
- In class session on Monday
Week 3 - 30/01/23
- Overview. This week we cover core material on network security. This is important in its own merit and also because attacks against web applications sometime span both the application and network layer. We cover a little bit more background on the TCP/IP stack, then look at key weaknesses, threats and attacks techniques for the main protocols that enable web applications: IP, TCP, UDP, DNS and TLS. In the tutorial you will apply some of these concepts in practice, so it should be attempted after reviewing all the modules. Note that module 9 is only a quick overview of firewalls and IDSs, as an in depth study goes beyond the scope of this course.
- Topics
- 8 IP security
- Optional reading
- TCP/IP State Transition Diagram
- IETF RFC for Internet Communication layer
- Example of a BGP hijacking campaign
- Optional reading
- 9 Network defenses
- 10 DNS
- Optional reading
- Read the
man
page fordig
Linux utility - IETF RFC for DNS
- FireEye post on Global DNS Hijacking
- Off-Path Hacking (research paper)
- Read the
- Optional reading
- 11 TLS
- Optional reading
- IETF RFCs for TLS 1.3
- Optional reading
- 8 IP security
- Activities
- In class session on Monday
- Invited lecture 1: Introduction to Ransomware Operations (Antoine Vianey-Liaud, Crowdstrike)
- Lab on Tuesday
- Tutorial 3: Network security tools
- In class session on Monday
Week 2 - 23/01/23
- Overview. This week we cover more background material and general topics relevant to the rest of the course, and end with a quick look at the security of local area networks. Authentication and passwords are pervasive in cybersecurity. We introduce key concepts and best practices here, and will come back to the topic later in the course. Pentesting is a useful conceptual framework to assess the security of a network, and we will practice it in the labs from now on. The networks background module is mostly to the benefit of those students who do not have a computing background, but can serve as a quick refresher to the others. Finally we briefly discuss local area networks and some of their security weaknesses. You will practice some of what you learn on authentication, networks and LANs alread in this week's tutorial, which is practical and based on virtual machines. You will need to have installed Kali on VirtualBox, either on your laptop or on a machine in the labs. Most students have no problems with this process but some find it difficult and time consuming, so please share on EdStem if you have problems, so that other people can benefit too.
- Topics
- 4 Authentication
- 5 Pentesting
- Read Chapters 3 and 4 of Professional Penetration Testing
- Optional reading
- Read Chapters 6 and 7 of Professional Penetration Testing
- 6 Networks background
- Optional reading (highly recommended if you are new to computer networks)
- Sections 4.1, 4.2, 4.3, 6.4 (up to and including 6.4.3) of Computer Networking - A Top-Down Approach - 7th Edition
- Optional reading (highly recommended if you are new to computer networks)
- 7 LAN security
- Activities
- In class session on Monday
- Lab on Tuesday
- Tutorial 2: Virtual security lab and passwords
Week 1 - 16/01/23
- Overview. This week we cover some general security topics which are relevant to the rest of the course. In order to secure a system, we want to be able to discover, fix and even better prevent security vulnerabilities. Attackers attempt to install malware on their victimes, and use malware itself to implement further attacks. Although malware is not the focus of this course, we need to have some familiarity with it in order to understand the objectives and techniques used to attack networks and web applications. Threat modelling is a conceptual tool that we will use in the rest of the course to assess the security of applications and systems. Note that this week is a gentle introduction to the course, the pace and difficulty will increase as we get into technical topics.
- Topics
- 1 Vulnerabilities
- Read Chapter 2 of Professional Penetration Testing
- 2 Malware
- Optional reading
- 3 Threat Modelling
- Read Chapters 1-4 of Threat modelling – Designing for security
- 1 Vulnerabilities
- Activities
- In class session on Monday
- Tutorial 1: Threat Modelling
- Lab on Tuesday
- Guide: Install VirtualBox and Kali
- In class session on Monday
Organization
- Timetable:
- Thu 9:30pm: recorded lectures and slides for the following week released on Scientia.
- Mon 4pm:-6pm: in-class activities in Huxley 311, including a variety of
- Q&A, demos, extras on weekly material
- Tutorials (not computer-based)
- Invited lectures
- "Office" hours
- Tue 10am-11am: lab session in Hux 219.
- edStem will be used for course announcements and course related questions.
- Questions via email will be ignored.
- The weekly course schedule, along with suggested reading will be posted on the course website as the course unfolds.
- External students: registration instructions.
Assessment
- Assessed coursework
- The 'Test' on CATE is just a placeholder for your marks, please ignore.
- The assessed (individual) coursework was made available on https://answerbook.doc.ic.ac.uk/2022/60015/coursework/frontcover from February the 16th at 2pm.
- The deadline for the coursework was March the 1st at 6pm.
- The marks and feedback for the coursework were sent via email on 6 March at 6pm.
- Exam
- The exam will take place at 10am on the 23rd of March, in the labs.
- Answer 2 questions out of 2 in 2 hours.
- Roughly half of the exam will consists of practical security tasks.
Resources
- Reference books (electronic edition available via central library):
- Threat modelling – Designing for security (Shostack)
- Professional Penetration Testing (Wilhelm)
- The tangled web (Zalewski)
- The Web Application Hacker's Handbook (Stuttard, Pinto)
- Recommended books
- Computer Networking - A Top-Down Approach (Kurose, Ross)
- SSL and TLS: Theory and Practice (Oppliger)
- Blogs and news:
- Sources for web-related standards:
- Vulnerabilities
- CWE/SANS Top 25 Most Dangerous Software Errors.
- OWASP Top 10 list of the most critical web application security flaws (PDF).
- Search the CVE Vulnerability Database.
- Search the exploit-db database.
- Full Disclosure mailing list.
- Hacker One reward program for web vulnerability disclosures.
- Black Hat and DEF CON hacking conferences.
- General
- A short dictionary of cybersecurity terms: Sophos' Threatsaurus.
- The Elevation of Privilege card game.
- w3schools tutorials
- Tails: live os with state-of-the-art privacy protection (including Tor browser).
- MITRE ATT&CK: a knowledge base of adversary tacticts and techniques.
- Practice hacking
- Kali Linux distribution for pentesting.
- OWASP Broken Web Applications Project
- Exploit exercises
- PentesterLab Bootcamp
- VMs recommended by students
People
Lecturer
Sergio Maffeis. Sergio is a senior lecturer in Computer Security at Imperial. He received his Ph.D. from Imperial and his MSc from University of Pisa, Italy. Maffeis' research interests include security, formal methods, and programming languages. His recent work focuses on the application of formal methods to web security. You can find out more from his home page.
Guest Lecturers
Antoine Vianey-Liaud. Antoine manages a team of threat hunters at Crowdstrike, uncovering sophisticated adversaries within the networks of a large customer base. He received his MSc from Imperial College London in 2016, delivering an ISO and thesis under the supervision of Dr Maffeis. His interests include intrusion detection (using security domain knowledge, statistical and data science methods), capture the flag competitions, and security in all its forms.
Charlie Hothersall-Thomas. Charlie is a Director of Engineering at Netcraft, where he leads the
DevOps division. Prior to this he worked as a developer on a variety of
Netcraft's anti-cybercrime products. His technical expertise includes
web security, TLS and PKI, networking, Linux system administration and
Tor. He graduated in 2014 with a BEng in Computing from Imperial College
London, where he started BrowserAudit as his final year project.
Joseph Katsioloudes. Joseph works for the GitHub Security Lab, and was previously a Security Consultant at IBM. He obtained an MSc in Cyber Security Engineering from the University of Warwick and an MEng in Computing from Imperial College London. His experience in security stems from summer internships and own initiatives to problem-solve. Highlights include the disclosure of a zero-day vulnerability for a top ten cryptocurrency during his final year at Imperial College, the GCHQ security accreditation, software contributions to open-source tools and advanced attack simulations.
Teaching Assistants
Almuthanna Alageel.
Almuthanna is a PhD student at Imperial College London under the supervision of Dr. Maffeis. He has been working for KACST in cybersecurity since 2009 in addition to providing consultancy services for several organisations. He holds several professional certifications including CISSP, CISM, CRISC and PMP. He received his MSc in Computer Science from the University of Colorado at Denver, and his BSc in Computer Engineering from King Saud University. Almuthanna is working on detecting evasive APT campaigns.
Fahad Alotaibi.
Fahad is a PhD student at Imperial College London under the supervision of Dr. Maffeis. He received his MSc from The University of York (UK) in Cyber Security, and his BCs from Shaqra University (KSA) in Computer Science. Fahad’ research is focused on robusting deep learning-based security applications againsts evasion attacks and concept drift. Fahad is also interested in other areas such as digital forensics and ransomware prevention.
Myles Foley.
Myles is a PhD student at Imperial College London under the supervision of Dr. Maffeis. He received his MEng from University College London in Electronic Engineering with Computer Science, earning the ‘Outstanding MEng Graduating Student’ prize. Myles’ research is focused at novel - and exciting - ways of applying reinforcement learning to problems in cyber security.
Mohamad Hazim. Hazim is a PhD student from Imperial under the supervision of Dr. Maffeis. He received his MCompSc from the University of Malaya, Malaysia. His research interests include computer security and artificial intelligence. Hazim is currently working on software vulnerability detection using machine learning.
Kate Highnam.
Kate is a PhD student at Imperial College London under the supervision of Dr. Maffeis and Dr. Nicholas R. Jennings. She received her bachelors from the University of Virginia in Computer Science with an undergraduate thesis on automated software patches within drones. After her role as a Cyber Threat Huntress, her research is now focused on domain adaptation for machine learning models in intrusion detection.
Hall of Fame
- Netcraft 331 Prizes
- For the past 4 years, Netcraft sponsored awards for the top 10 performers in the exam (an Amazon voucher worth GBP 250)
- The winners of the 2023 edition are: Ghazal Farzamfar, Panayiotis Gavriil, Michal Glinski, Derek Lai, Maximilian Lau, Suhaib Mohammed, James Nock, Matthew Setiawan, Mike Sorokin, Ye Lun Yang.
- The winners of the 2022 edition were: Luqman Liaquat, Albert Schleidt, Thomas Alner, Andy Wang, Vincent Bardenheier, Madi Baiguzhayev, Daniel Ababei, Rodi Degirmenci, Anonymous, Arman Fidanoglu, Thomas Loureiro Van Issum.
- The winners of the 2021 edition were: Michael Kuc, Andreas Casapu, Maksymilian Graczyk, Anonymous, Matteo Bilardi, Anonymous, Ali Abidi, Thomas Roberts, Tilman Roeder, Alexander Reichenbach
- The winners of the 2020 edition were: Zak Cutner, Daniel Hails, Hadrian Lim Wei Heng, Fraser May, Alexander Nielsen, Giovanni Passerello, Matthew Pull, Ethan Sarif-Kattan, Marco Selvatici, Sebastian Reuter
- The winners of the 2019 edition were: Jordan Spooner, Teodor Begu, Thomas Pointon, William Seddon, Niklas Vangerow, Lorenzo Silvestri, Pablo Gorostiaga-Belio, Giorgos Gavriil, Olivier Roques, Aurel Bily
- 331 Bug Bounties
- 331 Bug Bounty 2023
- James Nock reported an XSS vulnerability in https://github.com/sparc/phpWhois.org.
- 331 Bug Bounty 2022
- Albert Schleidt demonstrated the Dirtycow privilege escalation exploit on the listener vm.
- Fabian Hauf, Anne-Sophie Hannes, Jonathan Powell, Vincent Bardenheier, Albert Schleidt reported a DOM-based XSS vulnerability in NaturalReaders.com.
- 331 Bug Bounty 2020
- Kelvin Zhang reported an authentication vlunerability in https://play.mtn.co.za/ to HackerOne.
- 331 Ofuscation Bounty 2020
- Winners: James Williams, Marco Selvatici.
- Runner ups: Tristan Nemoz, Robert Jin, James Dalboth and Anonymous.
- 331 Bug Bounty 2023