Cross-Site Scripting (XSS) Flashcards

1
Q

What’s Cross-Site Scripting (XSS)?

A

occurs when a web application does not properly sanitize or validate user-supplied input and allows the injection of malicious scripts into web pages viewed by other users

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

What do XSS attacks enable attackers to do?

A

execute malicious scripts in the context of the victim’s browser, leading to potential theft of sensitive information, session hijacking, or unauthorized actions on the web application

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

What type of applications does XSS attack target for what purpoes?

A
  • typically target web applications that allow user-generated content to be displayed on web pages without proper validation or sanitization
  • attackers exploit this vulnerability by injecting malicious scripts that are later executed by the victims’ browsers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the two types of XSS attacks?

A
  • Stored XSS
    • malicious scripts are permanently stored on the targeted web application’s server and served to users when they view a specific page
  • Reflected XSS
    • malicious scripts are embedded in a URL or other input and reflected back to the user’s browser, executing in the victim’s context
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the XSS attack techniques?

A
  • HTML Injection
    • attackers inject HTML tags or attributes that can alter the structure or behavior of the targeted web page
  • JavaScript Injection
    • attackers inject JavaScript code that can perform unauthorized actions, steal sensitive information, or manipulate the victim’s browsing session
  • DOM-based XSS
    • attackers manipulate the Document Object Model (DOM) of a web page by injecting malicious scripts that are executed by the victim’s browser
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the potential consequences of XSS attacks?

A
  • theft of sensitive information, such as login credentials, session tokens, or personal data
  • session hijacking, where the attacker gains unauthorized access to the victim’s session or account
  • defacement or manipulation of web pages, leading to a loss of trust and reputation for the targeted web application
  • malware distribution, where attackers exploit XSS vulnerabilities to deliver malware to unsuspecting users
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the prevention and mitigation of XSS attacks?

A
  • Input Validation and Sanitization
    • validate and sanitize all user-supplied input to ensure it does not contain malicious scripts or characters
  • Output Encoding
    • properly encode and sanitize output to prevent interpretation of user input as executable code
  • Content Security Policy (CSP)
    • restrict the types of content that can be loaded on a web page, mitigating the impact of XSS attacks
  • Contextual Output Encoding
    • use appropriate encoding techniques depending on the context of the output (HTML, JavaScript, URL, etc.).
  • Regular Security Testing
    • conduct comprehensive security testing, including vulnerability scanning and penetration testing, to identify and remediate any XSS vulnerabilities
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What’s reflected input?

A
  • specific type of XSS attack where malicious code is injected into a web application and then reflected back to the user as part of the response
  • occurs when user-supplied data is not properly validated or sanitized by the web application before being included in the response sent back to the use
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s the defense against XSS?

A
  • input validation
  • validate data length and data type
    • filters out malicious imput like [SCRIPT] tag
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What’s Cross-site tracing (XST)?

A

leverages the HTTP TRACE or TRACK methods and could be used to steal a user’s cookies via cross-site scripting (XSS)

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

Why isn’t creating filter that watches for the ˂SCRIPT˃ tag sufficent protection against XSS?

A

attackers may use XSS filter evasion techniques against this approach

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

What HTML tag is often used as part of a cross-site scripting (XSS) attack?

A

[SCRIPT] tag is used to indicate the beginning of an executable client-side script and is used in reflected input to create a cross-site scripting attack

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