Cybersecurity & Information Security

Cross-Site Scripting: Stored, Reflected, and DOM

7 min readPublished: August 5, 2026
Professional visual illustration of XSS testing in Web and API PT
Quick answer

XSS testing should only be performed in a lab or on an authorized system. Examine Request/Response, server behavior, Roles, State, and impact, using minimal tests that do not damage data.

Web and API security testing should examine the boundaries of trust, permissions, input, state, and business logic. Every test in this article is intended for a lab, CTF, or a system for which explicit permission has been granted. This article focuses on XSS testing and is intended for Web PT students and developers. The goal is to provide a working method that can be applied in practice, during professional interviews, and in a work environment, without settling for a dictionary definition.

The main challenge is that data is almost always incomplete. Context, encoding, and CSP can indicate a direction, but their meaning depends on time, asset, user, and expected activity. Therefore, we will build the test around an investigative question, required evidence, and clear criteria for completion.

The practical scenario in the article is: Mapping Input-to-Sink in a lab application. All examples are lab data or descriptions of processes. When dealing with Penetration Testing, Web, or Cloud, one must work only with explicit authorization, a defined Scope, and the ability to stop the test.

How XSS is Created

The topic 'How XSS is Created' is a central part of working on XSS testing. It is recommended to break it down into three questions: What is the input, what decision do you want to make, and what evidence is sufficient to justify it. These questions prevent automatic tool use without understanding the goal.

In practice, record context, encoding, CSP, stored/reflected/DOM, sanitization, compare to expected behavior, and define at least one Pivot. The result should be verifiable by another analyst, including limitations and next steps.

Reflected and Stored

The topic 'Reflected and Stored' is a central part of working on XSS testing. It is recommended to break it down into three questions: What is the input, what decision do you want to make, and what evidence is sufficient to justify it. These questions prevent automatic tool use without understanding the goal.

In practice, record context, encoding, CSP, stored/reflected/DOM, sanitization, compare to expected behavior, and define at least one Pivot. The result should be verifiable by another analyst, including limitations and next steps.

DOM-based XSS

The topic 'DOM-based XSS' is a central part of working on XSS testing. It is recommended to break it down into three questions: What is the input, what decision do you want to make, and what evidence is sufficient to justify it. These questions prevent automatic tool use without understanding the goal.

In practice, record context, encoding, CSP, stored/reflected/DOM, sanitization, compare to expected behavior, and define at least one Pivot. The result should be verifiable by another analyst, including limitations and next steps.

Context and Encoding

The topic 'Context and Encoding' is a central part of working on XSS testing. It is recommended to break it down into three questions: What is the input, what decision do you want to make, and what evidence is sufficient to justify it. These questions prevent automatic tool use without understanding the goal.

In practice, record context, encoding, CSP, stored/reflected/DOM, sanitization, compare to expected behavior, and define at least one Pivot. The result should be verifiable by another analyst, including limitations and next steps.

CSP, Remediation, and Retest

Professional XSS testing begins with success and failure conditions. Define a positive case, a negative case, a boundary case, and similar legitimate activity. This way, both False Negatives and False Positives can be identified.

In an authorized environment, use minimal action that proves the claim without causing damage. Save Input, Output, time, and version, and after remediation, perform a Retest using the same scenario and also check for Regression on nearby functions.

Unique Testing Focuses

For this topic, it is recommended to build a focused evidence map in advance. The main testing focuses are: context, encoding, CSP, stored/reflected/DOM, sanitization, sink/source. The list is not an automatic Checklist; each item is chosen because it can link an entity, action, and time, or explain legitimate behavior.

  • context: Define the expected value, what would be considered anomalous, and what additional source would confirm the finding.
  • encoding: Define the expected value, what would be considered anomalous, and what additional source would confirm the finding.
  • CSP: Define the expected value, what would be considered anomalous, and what additional source would confirm the finding.
  • stored/reflected/DOM: Define the expected value, what would be considered anomalous, and what additional source would confirm the finding.
  • sanitization: Define the expected value, what would be considered anomalous, and what additional source would confirm the finding.
  • sink/source: Define the expected value, what would be considered anomalous, and what additional source would confirm the finding.

When one of the focuses is unavailable, document the gap and choose an alternative. For example, if a Process identifier is unstable, you can use time, Host, User, and Parent; if a Payload is encrypted, use Metadata, volume, frequency, and TLS/DNS context.

Practical Scenario

The chosen scenario is mapping Input-to-Sink in a lab application. The purpose of the exercise is not to prove attack capability, but to practice safe collection, comparison, and documentation. Before starting, define simulated data, a time window, and an expected outcome.

At the end of the exercise, a deliverable that another analyst or tester can review should be submitted: a screenshot or export of the evidence, a short Timeline, an initial hypothesis, corroborating evidence, a limitation, and a recommendation. When there is insufficient evidence, the correct conclusion is that the scenario has not been proven.

StageWhat to PerformDeliverable
PreparationDefine Scope, time, and goal. Note which fields or evidence from context, encoding, CSP are expected to appear.Short test plan
Data CreationPerform a safe, simulated action related to XSS testing, without real information or impact on a production system.Controlled Event/Request/Flow
CollectionCollect the raw evidence and context from an additional source. Verify Time zone, identifiers, and integrity.Two linked pieces of evidence
AnalysisWrite what each piece of evidence proves, what it doesn't prove, and what the possible legitimate explanation is.Interim conclusion
CompletionChoose closure, escalation, Finding or Tuning; add a recommendation and Retest.Documented deliverable

Practical Checklist

  • Check and document: Role and session.
  • Check and document: Endpoint and method.
  • Check and document: Request/Response.
  • Check and document: Object identifier.
  • Check and document: Server-side effect.
  • Check and document: Control expected and remediation.
  • Specify Time zone, tool version, and collection time.
  • Save the raw data before filtering or modification.
  • Write what the finding proves and what is still unknown.
  • Define owner and next action with a due date.

Common Mistakes

  • Only checking Status code.
  • Relying on Client-side changes.
  • Using a dangerous Payload.
  • Not checking different Roles.
  • Ignoring business logic.
  • Reporting without clean Request/Response.

Professional Deep Dive: Quality, Context, and Control

Quality work on XSS testing is also measured by the ability to retrace the path to the conclusion. It is recommended to save Query, Filter, Scope, Timestamp, Dataset, and tool version. This allows for re-checking the same case after configuration changes or when additional information becomes available.

Business context changes the technical meaning. A critical asset, an account with elevated privileges, or an internet-facing service requires a different level of caution than an isolated lab. However, Criticality is not a substitute for evidence: it affects Priority and response actions, not whether the behavior actually occurred.

Peer review is an effective way to reduce errors. Another analyst should only receive the documentation and be able to understand the question, reproduce the search, and arrive at the same conclusion. If verbal explanations are required, the documentation is still incomplete.

Finally, every deliverable should become an opportunity for improvement: a missing log source, an unclear Playbook, a noisy Rule, broad permissions, or an inaccurate testing guideline. Documenting the action and Retest are what connect a one-time investigation to continuous improvement of the organization's capabilities.

Summary and CTA

Cross-Site Scripting: Stored, Reflected, and DOM is a topic that combines technical knowledge with work discipline. Start with a question, collect only relevant evidence, preserve context and time, and choose an action that can be justified and re-examined.

In HPI's Cybersecurity & AI track, these principles are practiced using systems, logs, and labs. A natural next step is to move on to the linked articles, complete the lab exercise, and save the deliverable as part of a professional portfolio.

FAQ

Is it permissible to test XSS on a public website?

No, not without explicit permission from the system owner. Even a seemingly simple test can alter data, trigger protection mechanisms, or be considered unauthorized access.

What to do when some data is missing?

Document what is missing, check for an alternative source, and reduce the confidence level. Do not fill in fields with assumptions or present Unknown as valid.

How long should evidence be kept?

The time depends on policy, regulation, cost, and the type of event. It is important to define Retention, Legal hold, and the ability to export evidence in a verifiable format in advance.

How to practice without risking a real system?

Use virtual machines, simulated data, CTF, or a dedicated lab. For authorized tests, define Scope, Stop conditions, and backup before starting work.

Want to check if this track is right for you?

Leave your details and an HPI advisor will get back to you for a short, no-obligation fit call.

Your details are stored securely.

For SOC and Cyber studies within the Cybersecurity & AI program

Want to hear the details? Leave your info and we'll get back to you.

Related articles