Cross-Site Scripting (XSS)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/63

flashcard set

Earn XP

Description and Tags

Cross-Site Scripting (XSS)

64 Terms

1
New cards
What does XSS stand for?

Cross-Site Scripting.

2
New cards
Who is primarily attacked in an XSS exploit?

The end user and their browser.

3
New cards
How does XSS differ from command injection?

XSS runs code in a user's browser; command injection targets server-side execution.

4
New cards
What server-side weakness enables XSS?

Improper input validation or output encoding.

5
New cards
Why can a vulnerable website make attacker content dangerous?

The browser treats the delivered content as part of the trusted site.

6
New cards
Which script language is commonly used for XSS?

JavaScript.

7
New cards
Can XSS inject more than JavaScript?

Yes. Attacker-controlled HTML or CSS can also be involved.

8
New cards
Which MITRE ATT&CK technique does the book associate with XSS?

T1190, Exploit Public-Facing Application.

9
New cards
What is a browser session cookie used for?

Maintaining an authenticated browsing session.

10
New cards
What type of secret can XSS attempt to steal?

An accessible authentication cookie or session token.

11
New cards
Why does malicious JavaScript run in the site's context?

The vulnerable website sends it to the browser as part of its response.

12
New cards
What are the two main XSS types covered in this module?

Stored XSS and reflected XSS.

13
New cards
What is stored XSS?

Malicious content saved by a server and served to later visitors.

14
New cards
Where might a stored XSS payload be saved?

A database, flat file, or other persistent data source.

15
New cards
What user-submitted content could contain stored XSS?

An author biography, username, review, or comment.

16
New cards
Who can become a victim of stored XSS?

Any visitor who opens the affected page.

17
New cards
Does stored XSS require the attacker to target a specific user?

No. It can affect any visitor to the stored-content page.

18
New cards
Why can stored XSS be hard for victims to notice?

The malicious code can execute silently.

19
New cards
What is reflected XSS?

Attacker input immediately returned unsafely in a response and run by the browser.

20
New cards
Which HTTP request method is emphasized in the reflected XSS example?

GET.

21
New cards
What makes an unencoded search term a reflected XSS risk?

The application embeds the term into its response as executable content.

22
New cards
How is reflected XSS commonly delivered to victims?

A crafted link in email, messaging, or a malicious advertisement.

23
New cards
What happens when a victim follows a reflected-XSS link?

The vulnerable site reflects and serves the malicious input to the browser.

24
New cards
Which XSS type is more suited to targeting a chosen person with a link?

Reflected XSS.

25
New cards
What is the key distinction between stored and reflected XSS?

Stored persists on the server; reflected appears in an immediate response.

26
New cards
Why might a trusted domain in a phishing link be misleading?

A trusted site may still reflect malicious script from the URL.

27
New cards
What can XSS do besides show a popup?

Alter content, redirect users, or access browser-session data.

28
New cards
What does a basic alert() test show?

That attacker-supplied JavaScript can execute in the browser.

29
New cards
What is the purpose of the test payload <script>alert('XSS');</script>?

Demonstrate script execution, not the full risk of XSS.

30
New cards
What is document.cookie?

A JavaScript property exposing cookies accessible to the page's scripts.

31
New cards
What is document.location used for in the walkthrough?

Redirecting the browser to another URL.

32
New cards
Why is theft of an authentication token dangerous?

It may allow misuse of an authenticated session.

33
New cards
Which application field is used in the stored XSS walkthrough?

A feedback or comment field.

34
New cards
Who views the stored feedback in the course walkthrough?

A website administrator.

35
New cards
What happens if the administrator opens vulnerable stored feedback?

The embedded JavaScript executes in the administrator's browser.

36
New cards
What does an XSS tester first look for?

User-controlled input that is stored or reflected without safe handling.

37
New cards
What is the role of input filtering in XSS defense?

Reject or restrict dangerous input.

38
New cards
Where must input filtering occur?

On the server side.

39
New cards
What is output encoding?

Converting special characters to safe representations for their output context.

40
New cards
How does HTML encoding help stop XSS?

It prevents special characters from being interpreted as executable markup.

41
New cards
What HTML entity represents an ampersand?

&

42
New cards
Why can manual filtering be unreliable?

An overlooked syntax or context may bypass the filter.

43
New cards
What is preferred over hand-written HTML encoding rules?

Consistently used, trusted encoding and sanitization libraries.

44
New cards
Which Java library for safe output encoding is named?

OWASP Java Encoder Project.

45
New cards
Which PHP sanitization tool is named?

HTML Purifier.

46
New cards
Which Node.js validation library is named?

Joi.

47
New cards
What is a preferred framework security feature?

Built-in input handling and context-appropriate output encoding.

48
New cards
What can a WAF do for an XSS-vulnerable application?

Provide partial mitigation and logging when application code cannot be fixed immediately.

49
New cards
Why is a WAF not a complete XSS fix?

It does not replace secure application-side validation and encoding.

50
New cards
What does the HttpOnly cookie attribute do?

Prevents browser JavaScript from reading that cookie.

51
New cards
Does HttpOnly mean the cookie can only travel over HTTPS?

No. The Secure attribute controls HTTPS-only transmission.

52
New cards
Which cookie attribute restricts transmission to HTTPS?

Secure.

53
New cards
How does HttpOnly limit cookie theft via XSS?

Scripts cannot read protected cookies through document.cookie.

54
New cards
Can adding HttpOnly break some applications?

Yes. Applications needing JavaScript cookie access may be affected.

55
New cards
What does CSP stand for?

Content Security Policy.

56
New cards
What does a CSP response header control?

Which sources a browser may load content from.

57
New cards
What resource categories can CSP restrict?

Scripts, CSS, images, fonts, iframes, and other resources.

58
New cards
Can CSP permit selected third-party resources?

Yes. Allowed resource sources can be specified.

59
New cards
What is CSP report-uri used for in the book?

Reporting browser-detected policy violations to a specified endpoint.

60
New cards
Why does the presence of a CSP header not guarantee protection?

The configured policy may be too permissive or ineffective.

61
New cards
What is important when deploying CSP?

Test that it blocks unwanted sources without breaking legitimate functionality.

62
New cards
What does the command grep in a web log help locate?

Requests matching an attack indicator or pattern.

63
New cards
What is the overall difference between XSS and server compromise?

XSS exploits the browser trust context; it does not itself grant server execution.

64
New cards
What is the key defensive combination for XSS?

Server-side validation, safe output encoding, and defense-in-depth controls.