Skip to content
Learn Netverks

Lesson

Step 14/36 39% through track

xss-cross-site-scripting

Cross-Site Scripting (XSS)

Last reviewed May 28, 2026 Content v20260528
Track mode
none
Means
Read / quiz
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches Cross-Site Scripting (XSS): security mindset, common threats, and defensive practices for software teams.

Web flaws ship weekly—OWASP categories turn code review into repeatable habit.

You will apply Cross-Site Scripting (XSS) in contexts like: Customer-facing web apps, admin panels, and JSON APIs.

Read scenario-based lessons, map controls to code you write on other tracks, and complete MCQs—practice threat modeling on paper or in docs.

When you can explain the previous lesson's ideas in your own words.

XSS runs attacker's JavaScript in another user's browser—stealing cookies, performing actions as the victim.

Types

  • Stored — script saved in DB (comments field)
  • Reflected — script in URL echoed immediately
  • DOM-based — unsafe JavaScript writes URL fragment to page

Defenses

  • Output encoding for HTML context
  • Content-Security-Policy (CSP) headers
  • HttpOnly cookies

Important interview questions and answers

  1. Q: CSP?
    A: Browser policy restricting script sources.
  2. Q: Encode on output?
    A: Match context—HTML vs attribute vs JS.

Self-check

  1. Name two XSS types.
  2. Name two defenses.

Tip: Default CSP report-only in staging before enforce in production.

Interview prep

Stored XSS?

Malicious script persisted and served to other users.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Stored XSS?
  • CSP role?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump