Testing for cross site script inclusion
Check whether a JSON/JS endpoint meant for the app's own use can be included by another site to leak its data.
Goal
Confirm data-returning endpoints resist being <script src>-included from another origin.
How to test
Check whether an authenticated, data-bearing endpoint can be loaded as a script from another page:
<script src="https://example.com/api/user-data.js"></script>
Legacy risk is highest when the endpoint returns a bare JSON array (valid as a JS array literal) or executable JSONP without a matching, validated callback parameter.
What to look for
The endpoint’s data becoming readable by the including page — most exploitable when it returns a bare array or old-style JSONP.
Notes
Modern JSON responses (an object, not an array, as the top level) and a CSRF-protected/authenticated-only endpoint largely close this off — check whether the app actually does both.
References
- OWASP WSTG-CLNT-12 — Testing for Cross Site Script Inclusion.