A talk about Cross-Site Scripting (XSS) in 2023? The mitigated unmitigated vulnerability.
Val Resh (Cybersecurity Professional)
Security BSides London 2023 · Day 1 · Rookie Track
Overview
In an era where web application security is increasingly sophisticated, it might seem anachronistic to dedicate a full security conference talk to Cross-Site Scripting (XSS). However, as Val Resh eloquently highlights in their BSides London talk, "A talk about Cross-Site Scripting (XSS) in 2023? The mitigated unmitigated vulnerability.", XSS remains one of the most pervasive and commonly exploited vulnerabilities in modern web applications. The paradox lies in the fact that despite a wealth of established mitigation strategies and developer tools, XSS continues to thrive, earning its moniker as the "mitigated unmitigated vulnerability."

Key moments
- 0:00 Introduction: XSS still common despite mitigations
- 0:50 Finding XSS: Leveraging documentation for unique parameters
- 2:16 Chaining vulnerabilities: Limited SQLi to impactful XSS
- 5:15 Discovering stored XSS by exploring full customer journeys
- 8:50 Fundamental XSS mitigation: HTML entity encoding all input
- 11:30 Defense in depth: Content Security Policy (CSP) implementation
- 12:40 Q&A: Generative AI's impact on XSS vulnerability scanning
- 14:00 Q&A: XSS detection and prevention in CI/CD workflows
A talk about Cross-Site Scripting (XSS) in 2023? The mitigated unmitigated vulnerability.
Speakers: Val Resh, Cybersecurity Professional
Conference: BSides London
YouTube: https://www.youtube.com/watch?v=pbSMGUPItOU
Overview
In an era where web application security is increasingly sophisticated, it might seem anachronistic to dedicate a full security conference talk to Cross-Site Scripting (XSS). However, as Val Resh eloquently highlights in their BSides London talk, "A talk about Cross-Site Scripting (XSS) in 2023? The mitigated unmitigated vulnerability.", XSS remains one of the most pervasive and commonly exploited vulnerabilities in modern web applications. The paradox lies in the fact that despite a wealth of established mitigation strategies and developer tools, XSS continues to thrive, earning its moniker as the "mitigated unmitigated vulnerability."
Resh's presentation serves a dual purpose: first, to arm upcoming security testers with practical, often overlooked, methodologies for discovering XSS vulnerabilities that evade automated scanners; and second, to provide a comprehensive, defense-in-depth framework for developers to effectively eradicate and mitigate XSS risks. The talk transcends a mere rehash of XSS basics, instead delving into the nuances of vulnerability discovery through creative exploitation paths and advocating for a layered security approach that addresses the root causes rather than just symptoms.
This article dissects Resh's insights, exploring the persistent nature of XSS, detailing advanced discovery techniques, and outlining a robust defensive strategy. It aims to provide security professionals and developers with a deeper understanding of why XSS endures and how to combat it more effectively in today's complex web landscape.
Background
▶ Watch: Introduction: XSS still common despite mitigations (0:00)
Cross-Site Scripting (XSS) is fundamentally the injection of malicious input that leads to client-side JavaScript execution. While there are several types of XSS (reflected, stored, DOM-based), the core principle remains the same: an attacker manipulates a web application to deliver malicious code, typically JavaScript, to an unsuspecting user's browser. This allows the attacker to bypass access controls, steal session cookies, deface websites, or redirect users to malicious sites, among other impacts.
The persistent prevalence of XSS in 2023, despite decades of awareness and the availability of sophisticated security mechanisms, is a central theme of Resh's talk. This "mitigated unmitigated" status stems from several factors. Developers often combine custom code with existing libraries, and the interaction between these components can introduce unforeseen vulnerabilities. Trust assumptions, such as believing that data originating from a database or internal source is inherently safe, frequently lead to a lack of proper HTML entity encoding. Furthermore, the complexity of modern web applications, with their intricate user flows and dynamic content, creates numerous potential injection points that are easily missed by standard checks or automated tools. Resh argues that the core issue often boils down to a fundamental lack of consistent and thorough HTML entity encoding across all input sources, making XSS a problem that requires both diligent discovery and foundational defense.
Key Findings
▶ Watch: Chaining vulnerabilities: Limited SQLi to impactful XSS (2:16)
Val Resh’s talk emphasizes that finding XSS in 2023 requires more than just running automated scanners; it demands a creative, analytical, and persistent approach from security testers. The "key findings" of the talk, in this context, are the advanced methodologies and thought processes presented for uncovering these elusive vulnerabilities.
One critical technique highlighted is documentation research. Resh advises testers to thoroughly investigate any unique parameters or mentions of specific libraries found in a web application. Developers frequently integrate custom code with existing frameworks, and the interaction between these components can create unexpected injection points. An illustrative scenario involved a URL parameter that initially returned HTML-encoded and URL-encoded input. However, by consulting documentation, Resh discovered that changing the parameter from action to resource (and removing the action name) bypassed the encoding, allowing for raw input reflection and subsequent XSS. This demonstrates that understanding how different parameters are processed can unveil hidden vulnerabilities.
Chaining vulnerabilities is another powerful approach. Resh provides an example of a seemingly innocuous, limited SQL injection (SQLi). If the SQLi allows injecting a string into a varchar column, and there's an implicit trust that only administrators input data into that column, the application might neglect to HTML entity encode the output. This transforms a low-impact SQLi into an XSS vulnerability specifically targeting administrators, significantly increasing its severity and impact. Similarly, chaining Cross-Site Request Forgery (CSRF), especially HTTP-based CSRF that bypasses SameSite cookies and Same-Origin Policy, with XSS can force users to perform unintended actions through a malicious script.
The talk also explores the impact of stored HTML injection even when it doesn't immediately lead to XSS due to Content Security Policy (CSP). Resh suggests using meta tags to force redirects. A victim visiting a vulnerable application with an injected redirect could be sent to a malicious server hosting a cloned login page, leading to a sophisticated phishing attack. This demonstrates a compromise of integrity, showing clients how their application can be weaponized even without direct JavaScript execution.
Customer journeys are presented as a vital, often overlooked, area for stored XSS discovery. Instead of merely testing individual actions, testers should explore all possible combinations and sequences of user actions (e.g., ABC versus ACB). Resh recounts an assessment where a form’s input was HTML entity encoded during creation and publishing. However, the XSS manifested when the form was saved, and then critically, when it was deleted. This "save then delete" sequence created a realistic attack path, as an administrator reviewing suspicious saved forms might attempt to delete them, thereby triggering the XSS.
Finally, error messages are highlighted as a tester's "best friend." Resh encourages creative fuzzing—changing protocols, inserting random characters, or modifying object names in URLs—to provoke unique error messages. The more distinct error messages a tester can trigger and the more unique their triggers, the more clues they uncover about the application's internal workings and potential vulnerabilities, including XSS. This systematic exploration of error states can often reveal unexpected input processing flaws.
Technical Deep Dive
▶ Watch: Fundamental XSS mitigation: HTML entity encoding all input (8:50)
The core of Val Resh's defensive strategy for XSS lies in a robust defense-in-depth approach, addressing the fundamental issues rather than relying solely on superficial mitigations. The primary and most critical recommendation centers on HTML entity encoding all input. Resh stresses that this must apply not only to user-supplied input but also to data originating from seemingly legitimate sources, such as internal database systems or other trusted web services within the same organization. Any input that should not be interpreted or rendered as HTML must be HTML entity encoded. For applications using pre-existing libraries that might lack this essential feature, Resh suggests implementing a wrapper function to ensure encoding occurs before the input is passed downstream.
Beyond fundamental encoding, the talk discusses filtering and escaping potentially malicious characters. While HTML encoding handles the majority of reflection-based XSS, specific nuances, particularly for DOM-based XSS or attempts to escape from JavaScript string contexts (e.g., using Unicode escapes), may require additional filtering. In the Q&A, Resh clarifies that while HTML encoding is paramount, a whitelist approach using regular expressions for specific input fields can be a valuable secondary layer, allowing only desired characters while preventing malicious ones. However, this is positioned as a secondary defense, as robust HTML encoding should prevent execution even if undesirable characters are present.
Several other layers contribute to a comprehensive XSS defense:
- HTTPOnly Flag for Relevant Cookies: For session cookies, implementing the
HTTPOnlyflag prevents injected JavaScript from accessing these cookies via thedocument.cookieobject. This significantly limits the impact of XSS, particularly in session hijacking scenarios. - Reauthentication for High-Risk Actions: Any action that carries significant risk, such as deleting a user, changing a password, or shutting down a server, should require the user to re-enter their password. This means that even if an XSS attack successfully injects JavaScript, it cannot replicate these high-risk actions without the user's explicit reauthentication, which the attacker's script would not possess.
- Content Security Policy (CSP): CSP is a powerful security mechanism that allows web application developers to control which resources (scripts, stylesheets, images, etc.) the user agent is allowed to load. Resh emphasizes that CSP must be "effectively set," meaning it should be restrictive in nature. While some clients may resist overly strict CSPs, a well-implemented policy can significantly reduce the attack surface for XSS by preventing the loading of arbitrary inline scripts or scripts from unauthorized domains. However, Resh notes that CSP is a mitigation, not a solution to the underlying problem of improper encoding.
- Web Application Firewall (WAF): A WAF acts as an additional layer of defense, primarily serving to "demotivate less motivated adversaries." While WAFs can detect and block known XSS attack patterns, they are not foolproof and should not be considered a primary defense. Like CSP, a WAF is a mitigation that provides an external barrier but does not fix the inherent vulnerabilities within the application's code.
Resh's defense-in-depth strategy prioritizes foundational security measures like HTML encoding, followed by client-side protections (HTTPOnly, reauthentication), and finally, network-level and browser-level controls (CSP, WAF). This layered approach ensures that even if one defense mechanism fails, others are in place to reduce the impact or prevent successful exploitation.
Demo / Proof of Concept
▶ Watch: Defense in depth: Content Security Policy (CSP) implementation (11:30)
While Val Resh's talk did not feature a live, interactive demo in the traditional sense, the presentation was rich with detailed, real-world-inspired scenarios that effectively served as proofs of concept for both XSS discovery and its potential impact. These illustrative examples demonstrated the practical application of the methodologies discussed.
One compelling scenario highlighted the importance of documentation research. Resh described a URL that, when initially tested, appeared to properly encode reflected input. However, by consulting documentation related to a specific parameter, it was discovered that changing the parameter from action to resource (e.g., ?component=menu&action=view to ?component=menu&resource=item) triggered a different processing path. In this new path, the backend loaded the component in its raw form, completely bypassing the HTML and URL encoding that was previously applied, thus allowing for the injection of an XSS payload. This example powerfully illustrated how a deep understanding of application logic, often gleaned from documentation, can reveal hidden vulnerabilities.
Another key "proof of concept" involved the often-overlooked complexity of customer journeys in finding stored XSS. Resh detailed a scenario where input into a form was consistently HTML entity encoded during both the initial filling and subsequent publishing actions. However, the XSS vulnerability only manifested when a user performed a specific sequence: saving the form, and then later, deleting the saved form. This demonstrated that the encoding logic was flawed in the deletion routine, allowing the malicious script to execute. The impact was amplified by showing how an administrative user, attempting to clean up "suspicious-looking" saved forms, would inadvertently trigger the XSS, creating a realistic and impactful attack vector.
Finally, the talk provided a concrete example of chaining a limited SQL injection with XSS. Resh described a SQLi that, by itself, had minimal impact due to publicly available data and disabled sensitive functionalities. However, by injecting an XSS payload into a varchar column that was later reflected on an administrative interface, the limited SQLi was elevated to a high-impact XSS. This was possible because of a trust assumption: the application, believing only administrators would input data into that specific field, neglected to HTML entity encode the output, thus enabling the XSS to target privileged users. These detailed scenarios served to concretely demonstrate the methodologies for finding XSS and the significant impact they can have in real-world applications.
Defensive Implications
▶ Watch: Q&A: XSS detection and prevention in CI/CD workflows (14:00)
Val Resh's talk offers crucial defensive implications for organizations and developers seeking to effectively combat XSS in 2023. The overarching message is to move beyond superficial mitigations and address the fundamental causes of XSS through a defense-in-depth strategy.
The primary and most impactful defensive implication is the absolute necessity of HTML entity encoding all input. This isn't just about user-supplied data; it extends to any information sourced from databases, internal APIs, or other components within the application ecosystem. Developers must adopt a policy where anything that shouldn't be rendered as HTML is rigorously encoded. For legacy systems or frameworks lacking robust native encoding, creating wrapper functions around existing input-handling routines is a critical step. This foundational measure, if consistently applied throughout the entire Software Development Life Cycle (SDLC) and for all new functionalities, will prevent the vast majority of XSS vulnerabilities.
Beyond this core principle, developers should integrate additional layers of defense:
- Implement HTTPOnly flags for all sensitive cookies, particularly session cookies. This prevents client-side JavaScript, even if injected via XSS, from accessing and exfiltrating these cookies, thereby mitigating session hijacking risks.
- Mandate reauthentication for high-risk actions. Any action that could lead to significant data loss, privilege escalation, or system compromise (e.g., deleting user accounts, changing passwords, server shutdowns) should require the user to re-enter their credentials. This ensures that an XSS payload cannot unilaterally perform such actions without the user's explicit, authenticated consent.
- Deploy a restrictive Content Security Policy (CSP). While not a silver bullet, a well-configured CSP significantly limits the types of content a browser can load and execute, thereby reducing the attack surface for XSS. It forces developers to explicitly whitelist trusted sources for scripts, styles, and other resources.
- Utilize Web Application Firewalls (WAFs) as an outer layer of defense. WAFs can detect and block common XSS attack patterns, acting as a deterrent and a first line of defense against less sophisticated or opportunistic attackers. However, it's crucial to remember that WAFs are not a substitute for secure coding practices.
Finally, a significant defensive implication derived from the Q&A segment is the critical role of developer education. Organizations must invest in training developers to understand how XSS vulnerabilities occur, the importance of secure coding practices, and the proper use of encoding functions. Integrating these defensive measures into CI/CD pipelines is also vital, perhaps by enforcing policies that mandate HTML encoding or by using security linters that flag potential encoding omissions. When using framework-provided encoding capabilities, developers should be encouraged to scrutinize their implementation, especially for open-source libraries, and remain vigilant for security updates that might introduce or fix vulnerabilities. The continuous adoption of secure development patterns and regular security assessments are paramount to staying ahead of evolving XSS threats.
Key Takeaways
- XSS Remains a Pervasive Threat: Despite advanced mitigations, Cross-Site Scripting (XSS) continues to be one of the most common web vulnerabilities, requiring constant vigilance and proactive defense strategies.
- Creative Discovery is Essential: Testers must go beyond automated scans, leveraging techniques like documentation research, chaining vulnerabilities, exploring full customer journeys, and analyzing unique error messages to uncover hidden XSS.
- HTML Entity Encoding is the Primary Defense: The most fundamental and effective mitigation is to consistently HTML entity encode all input, regardless of its source (user, database, internal systems), before it is rendered on a web page.
- Implement Defense-in-Depth: A layered security approach is crucial, combining HTML encoding with HTTPOnly flags for cookies, reauthentication for high-risk actions, a restrictive Content Security Policy (CSP), and Web Application Firewalls (WAFs).
- Prioritize Developer Education and Secure SDLC: Educating developers on XSS prevention and integrating secure coding practices, including robust encoding policies, into the Software Development Life Cycle (SDLC) and CI/CD pipelines are critical for long-term security.
- Scrutinize Frameworks and Libraries: While frameworks offer built-in encoding, developers should understand their implementation (especially for open-source components) and stay updated on security patches, as even trusted libraries can introduce new vulnerabilities over time.
About the Speaker(s)
Val Resh is a Cybersecurity Professional with practical experience in identifying and mitigating web application vulnerabilities. Through their talk at BSides London, Resh demonstrates a deep understanding of common web application security flaws, particularly Cross-Site Scripting (XSS), and offers pragmatic, real-world advice for both security testers and developers. Their insights reflect hands-on experience in vulnerability assessment and a commitment to educating the security community on effective defensive strategies.
Reviews
Dr. Zero (Offensive Security Researcher) — HARD PASS
A 45-minute reminder that HTML entity encoding exists and HTTPOnly flags are good. Val Resh brought an OWASP Web 101 primer from 2005 to a 2023 conference stage. If your engineering team still needs a presentation to understand that unsanitized input executes in the browser, you don't need a conference talk—you need a new team.
Heather Calloway (CISO) — SOLID
A competent, ground-level reminder of why XSS stubbornly persists despite automated scanning and modern web frameworks. Worth passing to your AppSec leads to ensure their testing playbooks account for complex state changes, but not a boardroom-level update.