day3 Web Application Security Flashcards

1
Q

Security Considerations

A
  • Web browser: Client-side security
  • Web server: Hardening and configuration, Logging and monitoring
  • Application server: Secure coding practices, Authentication and authorization
  • Database: Access Control and Encryption, Monitoring and Auditing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

…………… is a small piece of data that a server sends to a user’s web browser. The browser may store the cookie and send it back to the same server with later requests.

It remembers stateful information for the stateless HTTP protocol.

A

HTTP cookie

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

Cookies are mainly used for three purposes:

A

 Session management: Logins, shopping carts, game scores, or anything else the server should remember

 Personalization: User preferences, themes, and other settings

 Tracking: Recording and analyzing user behavior

 Security: HttpOnly, Secure, SameSite attributes help mitigate common security issues like
XSS, CSRF.

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

SET COOKIE
Set-Cookie: <cookie-name>=<cookie-value>
Attributes?</cookie-value></cookie-name>

A
  • Domain
  • Expires
  • Max-Age
  • Path
  • Secure
  • HttpOnly
  • SameSite
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

T/F If the Domain attribute is specified, the cookie becomes available to the
specified domain and all its subdomains. This makes the cookie less restrictive

A

T

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

T/F The Path attribute in a cookie specifies the URL path that must be present in
the requested URL for the cookie to be sent to the server

A

T

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

T/F : A cookie with secure attribute is only sent to the server with an encrypted request over the HTTPS protocol.

A

T

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

T/F A cookie with HttpOnly attribute is inaccessible to the JavaScript (document.cookie API)

A

T

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

T/F The SameSite attribute is used to control when and how cookies are sent
with cross-site requests

A

T

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

T/F Sessions are typically represented as associative arrays of keys and values,
used to track web application data and objects.
A session ID is a long, randomly generated number or string – exchanged between the client and server during each transaction

A

T

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

…………….is the process of verifying the identity of a user, system, or entity attempting to access resources.

A

Authentication

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

Common Types OF Authentication

A

 Knowledge based - Something you know
 Possession based - Something you have
 Inheritance based - Something you are

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

AUTHENTICATION TESTING

A

Map the entire authentication attack surface

 Login interfaces, account recovery / password resets, registration, MFA processes, session management, third-party SSO integrations

-Create multiple accounts

-Check for lack of brute-force protection

-Is the application using a standard library/framework?

-Check for logic issues

-Inspect tokens

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

ACCESS CONTROL

A

What you’re allowed to do - also known as authorization

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

Principle of least privilege

A

Users and processes should have a minimum level of access

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

Access control types

A

 Horizontal, Vertical, Context dependant

17
Q

…………. is a type of access control vulnerability that occurs when an application exposes a reference to an
internal implementation object—like a file, database record, or user ID—
without properly validating whether the user is authorized to access it.

A

Insecure Direct Object Reference (IDOR)

18
Q

………………. is a security vulnerability that occurs when an application fails to properly enforce access control at the level of specific functions or actions.

A

Broken Function Level Authorization (BFLA)

19
Q

What’s the difference between IDOR and BFLA?

A

BFLA :User can access functions or actions they’re not allowed to (like admin features).

IDOR: User can access objects (like files, accounts, etc.) they shouldn’t by changing an ID.

20
Q

WEAK OR MISSING ACCESS
CONTROLS

A

Sometimes applications use user input that we can control for access control, such as HTTP methods or headers.

Check to see if modifying the HTTP request will lead to unintended behaviour.

 HTTP Method
 Headers (e.g. Referrer, X-Origin-URL)

21
Q

…………….. is a common attack vector that injects malicious code into a vulnerable web application.

A

Cross site scripting (XSS)

22
Q

T/F XSS differs from other web attack vectors (e.g., SQL injections), in that it does not directly target the application itself. Instead, the users of the web application are the ones at risk.

23
Q

……………– malicious script is stored on the web server, typically in a database, and is then executed by other users viewing the stored content – More dangerous than reflected.

A

Persistent / Stored XSS

24
Q

……………malicious script is reflected off a web server in an immediate response

A

Reflected XSS

25
Q

………………..occur entirely on the clientside. Malicious script is executed as a result of client-side manipulation of the DOM.

A

DOM Based XSS

26
Q

IMPACT OF XSS

A

 Session hijacking
 Credential theft
 Data exfiltration
 Propagation of malware
 Unauthorized redirection

27
Q

PREVENTING CROSS-SITE SCRIPTING

A

Encoding, which escapes the user input so that the browser interprets it only as data, not as code.

Validation, which filters the user input so that the browser interprets it as code without malicious commands.

28
Q

INJECTION ATTACK APPLY TO
MANY TECHNOLOGIES

A

SQL statements
File path names
Regular expressions (as a DoS threat)
XML data (specifically, XXE declarations)
Shell commands
Interpreting strings as code (for example, JavaScript’s eval function)

29
Q

………………… is a type of security vulnerability that occurs when an attacker is able to manipulate a web application’s SQL queries by injecting malicious input into a query.

This happens when user inputs, such as form fields or URL parameters, are not properly sanitized, allowing an attacker to insert or “inject” additional SQL commands into the database query

A

SQL injection (SQLi)

30
Q

CAUSES, IMPACTS AND
CONSIDERATIONS FOR SQL INJECTION

A

User input data not validated or saniztized

 Incorrect data validation technique

Dynamic SQL statement generation

Application doesn’t conform to the principle of least privilege

Insufficient restrictions at the data layer

Easy to locate and exploit

31
Q

SQL INJECTION DEFENSE AND MITIGATION

A

Escape Sequences and
Regular Expression Pattern Matching

 Typically used in legacy systems to detect and avoid malicious patterns
 Difficult to maintain; Incomplete coverage

Stored Procedures

 Pre-defined SQL statements in the database
 Better than character escaping - User input cannot alter it in the same way dynamic SQL can
 Stored procedures, if incorrectly written, can be exploited to run system commands

Parameterized queries (prepared statements)

 Better solution - the SQL query is defined with placeholders (? or :param)

 Always performs correct escaping and treats all arguments as simple text strings

 Faster and more efficient than dynamic SQL

 Encourage better application development strategy by defining all possible queries

Other mitigation strategies

 Applying least privilege (ex. Don’t give the web app DB user account “drop table” privileges)

 Don’t connect as DBA

32
Q

…………………is a vulnerability where an attacker gains unauthorized access to the filesystem by navigating to unintended directories

A

Path Traversal

33
Q

Potential Impacts: PATH TRAVERSAL

A

 Access to sensitive files
 Disclosure of application data
 Execution of malicious code

34
Q

…………., is a type of malicious exploit where unauthorized commands are submitted from a user that a web application trusts

 Tricks a web browser into executing unwanted actions on a web application to which the user is logged in

A

Cross-Site Request Forgery (CSRF) attack, also known as XSRF

35
Q

XSS VS CSRF

A

CSRF (Cross-Site Request Forgery): Malicious website causes a user’s browser to
perform unwanted actions on a trusted website. Examples:

Transfer money out of user’s account; Harvest user IDs; Compromise user accounts

XSS (Cross-Site Scripting): Malicious website leverages bugs in trusted website to
cause unwanted actions on user’s browser (circumventing the same-origin policy).
Examples:

Reading cookies; Stealing authentication information; Code injection