Bitzu

CPSA ยท Web testing techniques

Testing for cross-site scripting

Detecting injection points, arbitrary script execution context, data theft and phishing use.

Key points

  • Testing: submit a short unique marker into every input, then find where it is reflected or stored.
  • Output context (HTML body, attribute, script block, URL) decides which characters break out and run script.
  • Types: reflected, stored, DOM-based.
  • Impact: script runs with the victim's privileges; reads page data, acts as the user, captures credentials via fake forms, defaces content.

Source: https://portswigger.net/web-security/cross-site-scripting

Practice questions

Single choice

Which XSS type stores the malicious script on the server and serves it to later visitors?

  1. Reflected XSS
  2. Stored XSS
  3. DOM-based XSS
  4. Self-XSS only
Show answer

Answer: B. Stored XSS

Stored (persistent) XSS lives in the application's data. Reflected comes from the current request; DOM-based arises in client-side code handling data.

Select all that apply

What can an attacker achieve with script running in a victim's session via XSS?

  1. Perform actions as the victim within the application
  2. Read data the victim's page can access
  3. Directly read the server's source code files
  4. Present a fake login form to capture credentials
  5. Alter the database schema directly
Show answer

Answer: A. Perform actions as the victim within the application, B. Read data the victim's page can access, D. Present a fake login form to capture credentials

The script acts with the victim's rights: it can read accessible data, perform actions and show fake login prompts. It cannot read the server's source code or change the database schema directly.

True or false

A page served over HTTPS cannot be affected by XSS because the traffic is encrypted.

Show answer

Answer: False

False. TLS protects data in transit; XSS is a flaw in how the application handles input and output, and the injected script runs inside the encrypted page.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More CPSA topics in this module