WebSec

2010 CWE TOP 25

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息

一年一度的CWE TOP 25又更新了,今年的CWE TOP 25进行了重大改进,抛弃了2009版中的按照“弱点”分组、无排名先后顺序的组织方式,引入了新的“票选”机制,引入排名,去除了大量过于抽象的CWE编目,强调可操作性和安全改进建议的一致性、细节和可理解性等。

2010版CWE TOP 25排名表格

Rank Score  CWE-ID      Name
[1]      346    CWE-79      Failure to Preserve Web Page Structure (‘Cross-site Scripting’)
[2]      330    CWE-89      Improper Sanitization of Special Elements used in an SQL Command (‘SQL Injection’)
[3]      273    CWE-120    Buffer Copy without Checking Size of Input (‘Classic Buffer Overflow’)
[4]      261    CWE-352    Cross-Site Request Forgery (CSRF)
[5]      219    CWE-285    Improper Access Control (Authorization)
[6]      202    CWE-807    Reliance on Untrusted Inputs in a Security Decision
[7]      197    CWE-22      Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
[8]      194    CWE-434    Unrestricted Upload of File with Dangerous Type
[9]      188    CWE-78      Improper Sanitization of Special Elements used in an OS Command (‘OS Command Injection’)
[10]    188    CWE-311    Missing Encryption of Sensitive Data
[11]    176    CWE-798    Use of Hard-coded Credentials
[12]    158    CWE-805    Buffer Access with Incorrect Length Value
[13]    157    CWE-98      Improper Control of Filename for Include/Require Statement in PHP Program (‘PHP File Inclusion’)
[14]    156    CWE-129    Improper Validation of Array Index
[15]    155    CWE-754    Improper Check for Unusual or Exceptional Conditions
[16]    154    CWE-209    Information Exposure Through an Error Message
[17]    154    CWE-190    Integer Overflow or Wraparound
[18]    153    CWE-131    Incorrect Calculation of Buffer Size
[19]    147    CWE-306    Missing Authentication for Critical Function
[20]    146    CWE-494    Download of Code Without Integrity Check
[21]    145    CWE-732    Incorrect Permission Assignment for Critical Resource
[22]    145    CWE-770    Allocation of Resources Without Limits or Throttling
[23]    142    CWE-601    URL Redirection to Untrusted Site (‘Open Redirect’)
[24]    141    CWE-327    Use of a Broken or Risky Cryptographic Algorithm
[25]    138    CWE-362    Race Condition

2009版CWE TOP 25的思维导图

2009 CWE TOP 25 思维导图

点击看大图

2010版CWE TOP 25相比2009版的主要改动

2009              2010
CWE-20       high-level root cause; now covered in Monster Mitigations
CWE-116     high-level root cause; now covered in Monster Mitigations
CWE-602     high-level root cause; now covered in Monster Mitigations
CWE-250     high-level root cause; now covered in Monster Mitigations
CWE-119     high-level class; replaced with lower-level CWE-120, CWE-129, CWE-131, and CWE-805
CWE-259     Replaced with higher-level CWE-798
CWE-73       high-level root cause; now covered in Monster Mitigations
CWE-642     high-level root cause; now covered in Monster Mitigations
CWE-94       high-level; CWE name and description also caused improper interpretation of the types of issues it intended to cover.
CWE-404     high-level; replaced by children CWE-772 and CWE-672
CWE-682     high-level; replaced by children CWE-131 and CWE-190
CWE-319     replaced with its parent, CWE-311

参考文献

[1]http://cwe.mitre.org/top25/pdf/2009_cwe_sans_top_25.pdf
[2]http://cwe.mitre.org/top25/archive/2010/2010_cwe_sans_top25.pdf


原创文章,转载请注明: 转载自猪在笑 [ http://www.huangwei.me/blog/ ]
本文链接地址: http://www.huangwei.me/blog/2010/02/20/2010cwe25/



What’s new in web hacking techniques of 2008

The original article is here.Here is a very good summarization of the latest web hacking techniques. What does web hacking mean? XSS? SQL Injection? Actually, there have been many many more new web hacking techniques emerging in the last year. Some of them are kind of freak and some of them are targeting specific application context. Below is a list of these web hacking techniques of 2008.

  1. Cross-Site Printing
  2. CUPS Detection
  3. CSRFing the uTorrent plugin
  4. Clickjacking / Videojacking
  5. Bypassing URL Authentication and Authorization with HTTP Verb Tampering
  6. I used to know what you watched, on YouTube (CSRF + Crossdomain.xml)
  7. Safari Carpet Bomb
  8. Flash clipboard Hijack
  9. Flash Internet Explorer security model bug
  10. Frame Injection Fun
  11. Free MacWorld Platinum Pass? Yes in 2008!
  12. Diminutive Worm, 161 byte Web Worm
  13. SNMP XSS Attack (1)
  14. Res Timing File Enumeration Without JavaScript in IE7.0
  15. Stealing Basic Auth with Persistent XSS
  16. Smuggling SMTP through open HTTP proxies
  17. Collecting Lots of Free ‘Micro-Deposits’
  18. Using your browser URL history to estimate gender
  19. Cross-site File Upload Attacks
  20. Same Origin Bypassing Using Image Dimensions
  21. HTTP Proxies Bypass Firewalls
  22. Join a Religion Via CSRF
  23. Cross-domain leaks of site logins via Authenticated CSS
  24. JavaScript Global Namespace Pollution
  25. GIFAR
  26. HTML/CSS Injections – Primitive Malicious Code
  27. Hacking Intranets Through Web Interfaces
  28. Cookie Path Traversal
  29. Racing to downgrade users to cookie-less authentication
  30. MySQL and SQL Column Truncation Vulnerabilities
  31. Building Subversive File Sharing With Client Side Applications
  32. Firefox XML injection into parse of remote XML
  33. Firefox cross-domain information theft (simple text strings, some CSV)
  34. Firefox 2 and WebKit nightly cross-domain image theft
  35. Browser’s Ghost Busters
  36. Exploiting XSS vulnerabilities on cookies
  37. Breaking Google Gears’ Cross-Origin Communication Model
  38. Flash Parameter Injection
  39. Cross Environment Hopping
  40. Exploiting Logged Out XSS Vulnerabilities
  41. Exploiting CSRF Protected XSS
  42. ActiveX Repurposing, (1, 2)
  43. Tunneling tcp over http over sql-injection
  44. Arbitrary TCP over uploaded pages
  45. Local DoS on CUPS to a remote exploit via specially-crafted webpage (1)
  46. JavaScript Code Flow Manipulation
  47. Common localhost dns misconfiguration can lead to “same site” scripting
  48. Pulling system32 out over blind SQL Injection
  49. Dialog Spoofing – Firefox Basic Authentication
  50. Skype cross-zone scripting vulnerability
  51. Safari pwns Internet Explorer
  52. IE “Print Table of Links” Cross-Zone Scripting Vulnerability
  53. A different Opera
  54. Abusing HTML 5 Structured Client-side Storage
  55. SSID Script Injection
  56. DHCP Script Injection
  57. File Download Inje
    ction
  58. Navigation Hijacking (Frame/Tab Injection Attacks)
  59. UPnP Hacking via Flash
  60. Total surveillance made easy with VoIP phone
  61. Social Networks Evil Twin Attacks
  62. Recursive File Include DoS
  63. Multi-pass filters bypass
  64. Session Extending
  65. Code Execution via XSS (1)
  66. Redirector’s hell
  67. Persistent SQL Injection
  68. JSON Hijacking with UTF-7
  69. SQL Smuggling
  70. Abusing PHP Sockets (12)
  71. CSRF on Novell GroupWise WebAccess

[推荐]几个有用的站点

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息
  1. Hackvector : PenTest必备工具!集JS编/解码、SQL注入编解码、JS变形、Fuzz等功能于一身,相当赞!特别有意思的是其中的Code Morphing模块,看看JS代码的各种变形和混淆吧~有兴趣的自己试试吧~
  2. Data Network Resource : 一个不错的数据网络(包括计算机网络,也有电信网)方面的技术教程,分层讲解,适合计算机网络的初学者。
  3. Malware Guru : 一个恶意软件,特别是Web恶意软件的维基百科。文章不多,但链接很精彩!有一个关于JS代码混淆和变形的链接不错,菜鸟大虾都可以看看。

空白字符:Javascript变形的新方法

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息

在刚刚结束的Defcon 2008上,Kolisar为我们展示了一种非常有创意的JS代码变形方法。

一篇介绍这种技术原理的blog在这里, Kolisar在大会上展示的PoC代码在这里,PPT在这里

好了,给了一堆的链接,下面来谈谈我对这种新变形技术的一点体会。

首先,对于网页挂马的检测者来说,对于eval、document.write()、畸形长字符串等都是非常敏感的。 一般来说,在网页中出现这样一些特征语句时,往往就是一些挂马语句。更不用说如果直接出现类似<iframe src=”xxx.html” style=”display:none”/>这样的赤裸裸语句了。所以,Kolisar采用了遍历和枚举dom对象的方法来一步一步的获得对document对象的引用句柄和document对象的write方法和getElementById方法的使用。获取当前窗口对象句柄最直接的方法就是h=this。

接下来,从window对象开始,依次通过一些字符串长度和特征字节位的比较而获得document对象、document对象中的write、getElementById方法,并用数组来存储获得的这些对象和方法的句柄引用。不过经过我的测试,在IE 8 (beta 2)中 使用h[i][j](‘p’)这种方法访问dom节点是无效的,在FF 3.0.1中倒是测试可以通过。这应该是一个browser specific的特性。所以,这是该技术方法的一个约束条件

有了这些对象和对象方法之后,接下来是如何读取并执行“嵌入的代码”了。Kolisar嵌入代码的方法非常特别,这也是他的这个Javascript变形技术的最具创新意味的地方。他把代码直接隐藏在了自己的解密代码之中!而所谓的隐藏代码就是空格和tab!将解密代码用鼠标选中反白之后,可以发现,从h=this;这行代码开始,后面几十行的代码的结束处都有一些留白。把鼠标定位到这些留白之后,通过方向键移动光标,我们可以清楚的看到这些空白是由一串有“规律”的tab和空格组成!对,就是空白!tab和空白的交替出现,代表了0、1字符串!这就是比特编码!再数一下这个空格和tab的数目,你又会发现,一定是每行各出现8次由空格和tab组成的空白!

说到这里,我们终于明白了。所谓的恶意代码其实就是一堆“空白”!这种方法,不仅可以逃过过滤程序的静态检测,就连专业安全分析人员的眼睛也无法发现它们!谁能想到一堆空白中其实蕴藏的就是恶意代码呢

这个技术相当的不错,相信很快就能在网上看到利用这种技术来挂马的实例了,呵呵。


BSQL Hacker 0.9.0.7 – Advanced SQL Injection Framework / Tool

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息

BSQL Hacker is an automated SQL Injection Framework / Tool designed to
exploit SQL injection vulnerabilities virtually in any database.

It ships with Automated Attack modules which allows to dump whole database:

* SQL Server
* ORACLE
* MySQL (experimental)

Attack Templates :

* MS Access
* MySQL
* ORACLE
* PostgreSQL
* MS SQL Server

Also you can write your own attack template for any other database as
well (see the manual for details). New attack templates and exploits
for specific web application can be shared via Exploit Repository.

BSQL Hacker aims for experienced users as well as beginners who want
to automate SQL Injections (especially Blind SQL Injections).

It supports :

* Blind SQL Injection (Boolean Injection)
* Full Blind SQL Injection (Time Based)
* Deep Blind SQL Injection (a new way to exploit BSQLIs, explained
in here : http://labs.portcullis.co.uk/application/deep-blind-sql-injection/)
* Error Based SQL Injection

It allows metasploit alike exploit repository to share and update
exploits and attack tempate.

Download, Screenshots, Source Code and More Information :
http://labs.portcullis.co.uk/application/bsql-hacker/

Injection Wizard Video:
http://www.vimeo.com/1536040?pg=embed&sec=1536040


MySQL和SQL字段截短漏洞

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息

今天看到一篇文章,是关于MySQL的几个最新的安全隐患发现的。原文在这里。乍一看,这两个漏洞都挺有意思的,而且在当前的Web开发者中肯定有不少人没有注意到作者所提到的这两个问题的。

第一个问题是这样的,MySQL默认有一个配置参数 max_packet_size,这个参数是用于限制MySQL客户端和MySQL服务器端数据通信的数据包大小,MySQL的默认配置是1MB。如果客户端发送的数据超过了1MB,则MySQL服务器端会忽略掉这个请求数据。作者接下来举了两个利用这个缺陷的例子,第一个是利用超长数据来使MySQL的日志记录程序失效,第二个是在PHP+MySQL的环境下,PHP的Session清理程序会由于一次发送的清理session数据的请求数据包超过max_packet_size的限制,而导致清理session失败。

而实际上,由于很多PHP+MySQL的程序都会运行用户上传附件之类,而一般的PHP+MySQL的上传附件限制都是大于1MB的,所以PHP的程序开发人员一般是会去修改max_packet_size的值为大于1MB。这就给我们的漏洞利用带来了一定的麻烦,毕竟在当前的网络状况下,构造1MB多的数据去上传还是可以忍受的。但是太大的数据量就比较考验我们的耐心了,呵呵。

第二个问题就比较严重了,MySQL对于超过字段长度的数据插入操作会进行默认的字符串截短。例如一个字段定义的长度为10,如果插入的字符串长度超过10,MySQL会将长度超过10的部分字符串自动舍去后插入到数据表中。默认配置条件下,MySQL会产生一个警告信息,但是这个警告信息不会被Web应用程序捕获到。所以,从表面上来看,超长数据也是可以“成功”插入数据表的。作者在下面举的这个例子就很有代表性了,首先是一个场景假设:

  • The application is a forum where new users can register
  • The administrator’s name is known e.g. ‘admin’
  • MySQL is used in the default mode
  • There is no application restriction on the length of new user names
  • The database column username is limited to 16 characters

用户如果尝试注册一个用户名为admin的用户,会由于Web应用程序中的isAlreadyRegistered函数的校验而注册失败。

SELECT * FROM user WHERE username='admin'

但如果用户使用用户名’admin           x’来注册(注意admin和x之间有11个空格),则注册流程会是这样的:

isAlreadyRegistered函数会使用上面的SQL语句来检查user表中是否存在相同用户名的用户,查询结果肯定是不存在的。那么用户注册成功!

实际上,真正插入到user表中的用户名是’admin’!也就是说,MySQL不仅会截短超过长度限制部分的字符串,也会对字符串头尾的空白字符进行截短!所以,在user表中,现在存在了两个admin用户!

接下来,用户登陆,他使用的是用户名admin,密码是他刚才设置的’admin           x’的密码。假设Web应用程序的登陆认证和授权函数是这样的一段代码:

$userdata = null;
if (isPasswordCorrect($username, $password)) {
   $userdata = getUserDataByLogin($username);
   ...
}

其中isPasswordCorrect函数使用的SQL语句为:

SELECT username FROM users WHERE username = ? AND passhash = ?

getUserDataByLogin函数使用的SQL语句为:

SELECT * FROM users WHERE username = ?

可以看得出,上面的语句使用了预编译的SQL语句,是无法实施SQL注入的。但是由于MySQL的默认字段截短策略,isPasswordCorrect函数会成功执行并返回用户名admin,接下来的getUserDataByLogin也会正确执行,返回的结果虽然是一个数组,但是Web应用程序一般是取返回数组中的第一个结果,也就是真正的管理员用户admin的所有数据!

怎么样,不用SQL注入,一样拿到管理员权限!

后记:经过测试,上面的漏洞利用过程在MySQL 4中是确实存在并且可以利用的。但是在MySQL 5中,本机测试失败。失败的关键就在于MySQL 5对于超过字段长度限制的字符串插入会报错,并停止字符串插入操作。

附:MySQL 4的测试过程

mysql> select * from tb_sqltest where name='jason';
+----+-------+--------+------+------+------+------+
| id | name  | remark | time | col1 | col2 | col3 |
+----+-------+--------+------+------+------+------+
|  1 | jason | NULL   | NULL | NULL | NULL | NULL |
+----+-------+--------+------+------+------+------+
1 row in set

mysql> select * from tb_sqltest where name='jason       x';
Empty set

mysql> insert into tb_sqltest (id,name) values (2,'jason       x');
Query OK, 1 row affected

mysql> select * from tb_sqltest where name='jason';
+----+-------+--------+------+------+------+------+
| id | name  | remark | time | col1 | col2 | col3 |
+----+-------+--------+------+------+------+------+
|  1 | jason | NULL   | NULL | NULL | NULL | NULL |
|  2 | jason | NULL   | NULL | NULL | NULL | NULL |
+----+-------+--------+------+------+------+------+
2 rows in set

Web Mail XSS Test小记

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息

前2天在一个讨论组看到有人讨论国内邮箱系统的XSS过滤能力的问题,有人反映163的Web Mail可以写js代码到邮件中,并且网易XSS的过滤能力比较弱,于是自己简单测试了几个小代码,发现163果然没能阻止我写js代码到邮件中。
既然163作为国内最大的邮件服务提供商都是这样,那其他几大门户呢?新浪的邮箱我没有ID,手上可用的也就只有sohu的了,于是用163的邮箱给sohu发信,发的同样的测试代码。Bingo!居然都可以触发代码的执行!
哎,不说什么了。
值得一提的是,yahoo.cn和gmail的xss过滤还是很好,很强大的,试了一长串的Test Code,都没有成功。虽然没有测试新浪,但是直觉告诉我,估计不会比163、sohu好到哪儿去,有时间再折腾他们吧。
嗯,POC代码其实很简单,发其中一个吧,至于怎么写到邮件里去,以及怎么验证和进一步的利用就不多写了,避免被滥用了,呵呵。

<img src="javascript:alert('Web Mail is XSSED!');">

[原创]教育人博客XSS/CSRF漏洞

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息

今天上英语课,老师居然让我们每隔2周写一次英文blog。我ft!最可恨的是,居然必须要求用教育人的博客。哎,记得去年第一次使用教育人的博客还觉得界面挺好看的,而专业的本能让我对它的安全性进行了一些测试。

真是不测试不要紧,一测试一身汗啊。。。

下面的这个链接是一个POC,感兴趣的朋友们可以先登录你的教育人博客,然后点击下面这个链接

http://www.blog.edu.cn/user3/231995/archives/2007/1866179.shtml

我在这个POC里只是实现了添加我的这个测试用blog到你的友情链接。

嘿嘿,这让你想到了什么?

对,MySpace Samy Worm!

记得去年用教育人博客的时候,还是有一些脚本过滤功能的(虽然很弱),今天一用突然发现连过滤都省了。。。

sigh~


原创文章,转载请注明: 转载自猪在笑 [ http://www.huangwei.me/blog/ ]
本文链接地址: http://www.huangwei.me/blog/2007/09/20/oioyeeixsscsrfa-2/



  • GTalk with me!

  • 订阅我的博客

  •  

    2010年九月
    « 八    
     12345
    6789101112
    13141516171819
    20212223242526
    27282930  
  • Google朋友圈

  • 文章分类

  • 量子统计

  • Copyright © 1996-2010 猪在笑. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress
    Page 1 of 11