Javascript hijacking, when and how much should I worry?

大憨熊 提交于 2019-12-03 21:48:38

The post you linked to is talking about CSRF & XSS (see my comment on the question), so in that context:

Is this the problem/vulnerabiliy ("If my site returns json data with a 'GET' request that has sensitive information then that information can get into the wrong hands.")?

No.

Does the hijacking occur by sniffing/reading the response as it's being sent through the internet?

No.

If I'm storing page state in local javascript object(s) of the page, can someone hijack that data(other than the logged in user)?

It depends. It depends on whether you're storing the data in cookies and haven't set the right domain, or path. It depends on whether there's a security vulnerability on the client browser that would allow a script to gain access to data that typically is restricted. There are numerous other vectors of attack, and new ones are discovered all the time. The long and the short of it is: don't trust the browser with any confidential or secure data.

Can I safely mitigate against THIS vulnerability by only returning JSON with a 'POST' request?

No (it's not a single vulnerability, it's a set of classes of vulnerabilities).

Well you can check if there was a get and if the get was from a correct referrer.

You are not really much safer getting it from a POST because that is just as easy to simulate.

In general there are a lot of things you can do to prevent cross site forgery and manipulation.

The actually vulnerability is being able to overwrite Array.

If one overwrites the native Array then one get's access to the JSON data that's constructed as an Array.

This vulnerability has been patched in all major browsers.

You should only worry about this if your clients are using insecure browsers.

Example:

window.Array = function() {
  console.log(arguments);
  // send to secret server
}

...

$.get(url, function(data) { ... });

When the data is constructed if there are any arrays in the returned JSON the browser will call window.Array and then that data in that array gets send to the secret server.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!