Web Security Flashcards

1
Q

Why is HTTP stateless?

A

Every request-response pair is independent of one another.

HTTP can’t keep track of whether you’ve logged in or not.

HTTP is stateless by nature.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are sessions?

A

They are a data structure used by a website to store data only during the time user is interacting with the site - used to manage state due to stateless HTTP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are cookies?

A

Cookies are client-side files to monitor interactions with a given website.

Eg. for shopping cart personalization, price changing by times you visit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is session hijacking?

A

Attacker steals cookies or session ID and use it to authenticate by using the same session.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the OWASP Top 10 vulnerabilities?

A
  1. SQL Injection
  2. Broken Authentication & Session Management
  3. Sensitive Data Exposure
  4. XML External Entities
  5. Broken Access Control
  6. Security Misconfiguration
  7. XSS, XSRF
  8. Insecure Serialization
  9. Using Components with Vulnerabilities
  10. Insufficient Logging & Monitoring
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is SQL Injection?

A
  • Results from untrusted data from user being used as part of a query.
  • Data tricks SQL interpreter to executing commands or queries it should not.
  • Access data user does not have authority for.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does ‘ OR ‘1’ = ‘1’ do if you input it into the username field?

A

It’ll query all account usernames and since it’s an AND statement, if you put a common password, you will most likely return at least 1 row.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does ‘ OR ‘1’ = ‘1’ do if you input it into a password field?

A

It’ll allow you to login to that specific account username as OR 1=1 will always return true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can you use comments in SQL Injection?

A

Yes - you can use comments like 1=1– to comment rest of the query.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to avoid SQL injections?

A

Use parameterized queries by preparing statements with variable binding.

Use stored procedures in the SQL Database itself.

Sanitize user input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is cross-site scripting?

A

Attacker injects XSS into web pages which are shown to other users, malicious code is then executed in their browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is reflected or non-persistent XSS?

A
  • Malicious script reflects off the website into the victim’s browser.
  • Passed via query or URL, XSS code is not stored on the server.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is stored or persistent XSS?

A
  • Malicious script is stored on server and sent to victim’s browser to be executed when viewed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are examples of malicious use of XSS?

A
  • Hijack sessions
  • Deface websites
  • Redirect users to malicious sites
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are XSS defences?

A
  • User input sanitization
  • HTML slots for untrusted data
  • HTML escape before inserting data into HTML element (change context of script to data).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is XSRF?

A

Cross Site Request Forgery is an attack that tricks users to execute undesired actions on websites they are currently authenticated on.

17
Q

How do you defend against XSRF?

A
  • Include random challenge token that is RNG’d, expires quickly, and hash comparison of token.