OWASP recommends to wrap json response with an object and not return direct array, for example:
[{"id":5}]
Is this really still an issue? can this be hacked?
Trying it with Chrome
, IE
and FF
I couldn't 'hack' this or exploit this.
Sample code:
<html>
<head>
<script type="text/javascript">
Object.defineProperty(window,'id',{set: function(obj) {alert(obj);});
</script>
</head>
<body>
<script defer="defer" src="http://example.com/Home/AdminBalances"></script>
</body>
</html>
No matter how I call this, I could not get the code inside defineProperty
called, unless I directly set an id object on the window itself.
If this is still possible, can you please provide sample code?