Security 101
CPSC455 - Lab 4.1
Agenda
OWASP
OWASP - Open Web Application Security Project
“The OWASP Foundation works to improve the security of software through its community-led open source software projects, hundreds of chapters worldwide, tens of thousands of members, and by hosting local and global conferences.”
(There’s a LOT of information there, and while you don’t have to be an expert in security, it’s good to know how to find the information when you need it.)
OWASP
Top 10 Web Application Security Risks
https://owasp.org/www-project-top-ten/
Security Triad
Confidentiality
Availability
Integrity
CIA
Security is about protecting these Confidentiality, Integrity and Availability.
We can understand security vulnerabilities by their impact on these factors.
Security Triad
Confidentiality
Availability
Integrity
CIA
Confidentiality - Attacker could gain access to sensitive data that they shouldn’t have access to
Integrity - Attacker could modify or delete sensitive data that they shouldn’t have access to
Availability - Attacker could prevent legitimate users from accessing the site or their data
Can you think of examples?
Security Triad
Confidentiality
Availability
Integrity
CIA
Ex 1. You enter in a wrong password 50x, so the site locks out any logins for 2 hours.
Ex 2. A vulnerability that exposes the session key, allowing you to masquerade as a different user.
Ex. 3. You find a SQL injection flaw that allows you to ADD records to a Table containing students’ grades
Broken Authentication
Broken Authentication
Weaknesses in the Application:
Broken Authentication
Brute-force attacks can be used to attempt to log in by trying many combinations of credentials.
Broken Authentication
Bad practices:
Broken Authentication
Also have to consider:
Broken Authentication
Final takeaway:
Just say no to building authentication systems. Use a well-established authentication system.
Cross-Site Scripting (XSS)
XSS
XSS
How does it happen?
XSS
Reflected
XSS
DOM-based
XSS
Stored
XSS
Quick Example - https://github.com/danyakarras/XSS_Example
XSS
How to prevent:
XSS
SQL/NoSQL Injection
SQL Injection
SQL Injection is among the most dangerous types of vulnerabilities because it can give an attacker direct control over the application's data.
Attacker could:
SQL Injection
SQL Injection vulnerability is a bug that occurs in application code that uses input data to write SQL code, and it causes the input data to be mistakenly interpreted as SQL code itself.
Ex. SELECT * FROM Books WHERE title = ‘{user_input}’;
Attacker could set user_input to be:
“Harry Potter”; DROP DB;
SQL Injection
An application is vulnerable to attack when:
SQL Injection
How to prevent:
NoSQL Injection
https://www.netsparker.com/blog/web-security/what-is-nosql-injection/
SQL/NoSQL Injection
Code that writes code is ALWAYS a bad idea!
(but sometimes necessary)
TRY HACKING
HACK THE BOX�(they’ve changed it from a year ago, so this might not work now :’( )
TRY HACKING
OWASP Juice Shop
https://owasp.org/www-project-juice-shop/
“The application contains a vast number of hacking challenges of varying difficulty where the user is supposed to exploit the underlying vulnerabilities. The hacking progress is tracked on a score board. Finding this score board is actually one of the (easy) challenges!”
Resources
Best Stack overflow post ever?
Preventing NoSQL Injection in MongoDB:
More on XSS