JSON INJECTION (OWASP Bangalore- Dec 15 2012)

What is JSON- JavaScript Object Notation?


1)JSON is a is a lightweight, text-based, language-independent data
interchange format with parsers available for many languages

JSON 是一种轻量级的、基于文本的、与语言无关的数据交换格式,很多语言都提供JSON解析器


2)JSON has been used to exchange data between applications written in all
of these programming languages:  ActionScript, C, C#, ColdFusion,
Common Lisp, E, Erlang, Java, JavaScript, Lua, Objective CAML, Perl, PHP,
Python, Rebol, Ruby, and Scheme.

可以使用JSON交换应用程序数据的语言包括:ActionScript,C,C#,ColdFusion,Common Lisp,E,Erlang,Java,Javascript,Lua,Objective CAML,Perl,PHP,Python,Rebol,Ruby和Scheme


3)JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.

JSON格式常用于互联网中结构化数据的序列化和传播。JSON(作为XML的替代品)主要在服务器和网络应用程序间传输数据。
  

    3-1) JSON is like XML because:
                   They are both 'self-describing' meaning that values are named, and thus 'human readable'

                   JSON 和XML都是自描述语言即数值是可以命名的,可读性强

                   Both are hierarchical. (i.e. You can have values within values.) 

                  两者都是分层次的(如,可以在值中包含值)

                   Both can be parsed and used by lots of programming languages 

                   两者都可以被多种语言解析和使用
                   Both can be passed around using AJAX (i.e. httpWebRequest) 

                   两者都可以使用AJAX传送(如httpWebRequest)
     3-2)JSON is UNlike XML because:
                   XML uses angle brackets, with a tag name at the start and end of an element: JSON uses squiggly brackets with the name only at the beginning of the element. 

                   XML使用尖括号(<test> 1 </test>),在元素开始和结束都有标签名;JSON使用花括号({ }),只在元素开始有名字
                   JSON is less verbose so it's definitely quicker for humans to write, and probably quicker for us to read.

                    JSON冗余少,人们可以快速的写和读
                  JSON can be parsed trivially using the eval() procedure in JavaScript 

                   JSON可以使用Javascript的eval()函数解析

                  JSON includes arrays {where each element doesn't have a name of its own} 

                   JSON包含数组{每个元素没有自己的名字}
                  In XML you can use any name you want for an element, in JSON you can't use reserved words from javascript

                   在XML中可以使用任何想使用的名字,但是在JSON中不能使用javascript的保留字



JSON有两种结构:

              1)名字/值对的集合   2)有序的值列表

               其中object指名字/值对的集合,{string:value,string:value,....} ,value可以使字符串(使用双引号)、数字、真假或者null或者对象、或者数组;其中数组表示[value,value,...]


JSON Security Concerns


1) 因为JSON的文本格式符合Javascript的语法格式,所以Javascript可以使用内嵌的eval函数解析JSON数据,而不需要专门的解析器

         -- Eval函数执行JSON数据产生本地Javascript对象,可能易受Javascript 代码注入攻击。当然,也可能导致数据被窃,认证欺骗,和其他可能的数据和资源误用

2)JSON数据被窃或者JSON数组攻击

        --  可信网站可以以JSON的形式返回敏感数据

        --  攻击者可以创建一个恶意网站将JSON译为Javascript,并发送给攻击者


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值