Cross-Site Script Inclusion (XSSI)
A vulnerability where sensitive data in JavaScript format can be stolen through cross-origin script inclusion, bypassing Same-Origin Policy.
Cross-Site Script Inclusion (XSSI) is a vulnerability where sensitive data returned by a web application in JavaScript format can be stolen by an attacker's site through script inclusion, bypassing Same-Origin Policy restrictions.
How It Works
While SOP prevents reading responses from cross-origin requests, it allows including cross-origin scripts. If sensitive data is returned in executable JavaScript format (like JSONP or JavaScript variable assignments), attackers can include the script and access the data through the execution context.
Vulnerable Response Types
// Dynamic JavaScript with user data
var userData = {"email": "user@example.com", "balance": 1000};
// JSONP response
callback({"email": "user@example.com", "balance": 1000});
// JavaScript array
[{"id": 1, "secret": "abc"}, {"id": 2, "secret": "def"}]
Prevention
- Use standard JSON with proper CORS headers
- Prepend responses with
)]}'\nto break direct script execution - Require non-GET requests for sensitive data
- Include anti-CSRF tokens in requests