Web security Flashcards

1
Q

What are the goals of web security

A

Users should be able to visit a variety of websites without incurring harm. Secure web applications

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

List the web threat model

A
  1. Web attacker: - control attacker.com, then the user visits attacker.com
  2. Network attacker: - Passive: Wireless eavesdropper -Active: Evil router, DNS Poisoning
  3. Malware attacker: - Attacker escapes browser isolation mechanisms and runs separately under the control of OS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Examples of Malware attacker

A

XSS, SQLi, CSRF

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

What are URLs

A

Global identifiers of network-retrievable documents

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

What are cookies

A

They are used to store state on a user’s machine. HTTP is a stateless protocol, cookies add state

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

What are cookies used for

A
  1. Authentication
  2. Personalization, recognize the user from a previous visit
  3. Tracking: follow the user from site to site, learn their browsing behaviour
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the default scope of a cookie

A

The domain and path of the setter URL

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

What are the allowed and disallowed domains of this host “login.site.com”

A

Allowed: - login.site.com, site.com
Disallowed: - user.site.com, othersite.com, .com

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

Does secure cookies provide integrity

A

NO. only confidentiality. Network attacker can re-write secure cookies

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

How can you achieve data integrity

A

Cryptographic checksums. use secret key to generate a tag for the cookie

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

Explain SQL Injection

A

Browser sends malicious input to server, bad input checking leads to malicious SQL query

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

Explain CSFR

A

A Bad website sends browser request to a good web site using the credentials of an innocent victim

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

Explain XSS

A

A bad website sends innocent victim a script that steals information from an honest website

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

What causes injection

A

When data and code share the same channel

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

List 2 ways of preventing SQL iNJECTION

A
  1. Input validation (Blacklisting or whitelisting(better))
  2. Escaping quotes: use escaper characters to prevent the quote becoming part of the query. i.e convert ‘ to '
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Describe Cross-site Request Forgery

A
  1. User and server establish a connection
  2. The user visits the attackers server
  3. the attacker sends the malicious page
  4. The malicious page use the users cookie to send a request to the server
17
Q

Drive-by pharming attack is an attack on home router describe it

A

The user visits a malicious site, then javascript at the site scans the home network looking for broadband router, once it finds it, it logs in to the router and changes the DNS server

18
Q

List some causes of CSRF

A
  1. The server cannot distinguish whether a request is cross-site (other site’s page) or same-site(server’s own page)
19
Q

Can the browser differentiate between cross site and same site

A

Yes. It knows which site the request generates from

20
Q

How can the server help prevent CSRF

A

Referer header, same-site cookie

21
Q

How can the server help it’s self

A

Secure token

22
Q

List and explain 2 methods for injecting malicious code to a web application

A
  1. Reflected XSS (“type 1”): the attacker’s script is reflected back to the user as part of a page from the victim site
  2. Stored XSS (“type 2”) : the attacker stores the malicious code in a resource managed by the web application, e.g database
23
Q

Describe Reflected XSS attack

A

The user visits the attackers server and it receives a malicious link, when the user clicks on the link it is sent to the victim server and the victim server echos sensitive information, the information is then sent to the attackers server

24
Q

Describe Stored XSS

A

The attacker injects malicious script to the server, the user requests for content from the victim server and receives malicious script, then the script sends sensitive info to the attackers server

25
Q

Differentiate between XSS and CSRF

A

In XSS the attacker injects a script into the trusted website and the user’s browser executes the attackers script, while in CSRF the attacker tricks the user’s browser into issuing requests.

26
Q

Best way to prevent against XSS

A

Validate user inputs, headers, cookies etc. Use positive security policy that specifies what is allowed not what is not allowed