BUGTRAQ ID: 34389 Amaya是W3C出品的所见即所得的网页编辑/浏览器。 Amaya的XHTML解析器函数ParseCharsetAndContentType()在处理特制HTML页面的charset类型时存在栈溢出漏洞。以下是/amaya/XHTMLbuilder.c中有漏洞的代码段: 68 void ParseCharsetAndContentType (Element el, Document doc) 69 70 { 71 AttributeType attrType; 72 Attribute attr; 73 ElementType elType; 74 CHARSET charset; 75 char *text, *text2, *ptrText, *str; XXX 76 char charsetname[MAX_LENGTH]; 77 int length; 78 int pos, index = 0; 79 ... 125 126 if (charset == UNDEFINED_CHARSET) 127 { 128 /* the charset is not already defined by the http header */ 129 str = strstr (text2, \"charset=\"); 130 if (str) 131 { 132 pos = str - text2 + 8; 133 while (text2[pos] != SPACE && 134 text2[pos] != TAB && text2[pos] != EOS) 135 charsetname[index++] = text2[pos++]; XXX 136 charsetname[index] = EOS; 137 charset = TtaGetCharset (charsetname); 138 if (charset != UNDEFINED_CHARSET) 139 TtaSetDocumentCharset (doc, charset, FALSE); 140 } 141 } 142 TtaFreeMemory (text2); 143 } 144 } 145...
BUGTRAQ ID: 34389 Amaya是W3C出品的所见即所得的网页编辑/浏览器。 Amaya的XHTML解析器函数ParseCharsetAndContentType()在处理特制HTML页面的charset类型时存在栈溢出漏洞。以下是/amaya/XHTMLbuilder.c中有漏洞的代码段: 68 void ParseCharsetAndContentType (Element el, Document doc) 69 70 { 71 AttributeType attrType; 72 Attribute attr; 73 ElementType elType; 74 CHARSET charset; 75 char *text, *text2, *ptrText, *str; XXX 76 char charsetname[MAX_LENGTH]; 77 int length; 78 int pos, index = 0; 79 ... 125 126 if (charset == UNDEFINED_CHARSET) 127 { 128 /* the charset is not already defined by the http header */ 129 str = strstr (text2, \"charset=\"); 130 if (str) 131 { 132 pos = str - text2 + 8; 133 while (text2[pos] != SPACE && 134 text2[pos] != TAB && text2[pos] != EOS) 135 charsetname[index++] = text2[pos++]; XXX 136 charsetname[index] = EOS; 137 charset = TtaGetCharset (charsetname); 138 if (charset != UNDEFINED_CHARSET) 139 TtaSetDocumentCharset (doc, charset, FALSE); 140 } 141 } 142 TtaFreeMemory (text2); 143 } 144 } 145 } 146 TtaFreeMemory (text); 147 } 148 } Amaya创建了长度为1024字节的charsetname缓冲区,然后未经任何长度检查便试图使用charset类型名称填充该缓冲区。如果HTML页面包含有类似于以下内容的话,就会触发栈溢出: <meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"AAAAAAAAAAAAAAAAAAAAAAAA...x1922\" /> W3C Amaya 11.1 W3C --- 目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本: <a href=http://www.w3.org/Amaya/ target=_blank rel=external nofollow>http://www.w3.org/Amaya/</a>