JSONP存在的JSON Hijacking漏洞以及与csrf/xss漏洞的关系

本文详细解析了JSONP的工作原理,通过实例说明了JSON Hijacking的安全风险,指出其与CSRF漏洞的关联。同时,讨论了由于JSONP可能导致的反射型XSS攻击,并提出了防御措施,包括正确设置响应头和过滤回调参数。
摘要由CSDN通过智能技术生成

在实习过程中接触过所谓的JSON Hijacking 漏洞,但最近在写论文时发现理解得不深,好像跟xss与csrf又有点区别与联系,索

性深入学习了下JSONP(JSON with Padding)


下面一段话截取自:http://stackoverflow.com/questions/2067472/what-is-jsonp-all-about   仔细看看就比较清晰了。

Say you're on domain abc.com, and you want to make a request to domain xyz.com. To do so, you need to cross domain boundaries, a no-no in most of browserland.

The one item that bypasses this limitation is <script> tags. When you use a script tag, the domain limitation is ignored, but under normal circumstances, you can't really DO anything with the results, the script just gets evaluated.

Enter JSONP. When you make your request to a server that is JSONP enabled, you pass a special parameter that tells the server a little bit about your page. That way, the server is able to nicely wrap up its response in a way that your page can handle.

For example, say the server expects a parameter called "callback" to enable its JSONP capabilities. Then your request would look like:


                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值