{"id":2998,"date":"2018-08-22T09:56:20","date_gmt":"2018-08-22T01:56:20","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2998"},"modified":"2018-08-22T09:56:20","modified_gmt":"2018-08-22T01:56:20","slug":"xstream-security-framework-of-xstream-not-initialized-xstream-is-probably-vulnerable-%e9%97%ae%e9%a2%98%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2998","title":{"rendered":"xstream security framework of xstream not initialized xstream is probably vulnerable \u95ee\u9898\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p>\n\t\u6700\u8fd1\u5728\u4f7f\u7528 XStream 1.4.10 \u7248\u672c\u7684\u65f6\u5019\u9047\u5230\u4e86\u4e00\u4e2a\u5b89\u5168\u95ee\u9898\uff1a&ldquo;xstream security framework of xstream not initialized xstream is probably vulnerable&rdquo;\u3002\u5927\u81f4\u7684\u610f\u601d\u662f\u8bf4\uff0cXStream \u7684\u5b89\u5168\u6846\u67b6\u6ca1\u88ab\u521d\u59cb\u5316\uff0c\u8fd9\u662f\u4e00\u6bb5\u7ea2\u8272\u7684\u63d0\u793a\uff0c\u5b9e\u9645\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u4e5f\u6ca1\u6709\u5927\u7684\u95ee\u9898\u3002\u4f46\u662f\u4f5c\u4e3a\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u4e00\u4e2a\u7ea2\u8272\u7684\u63d0\u793a\u592a\u8000\u773c\u4e86\uff0c\u53ef\u80fd\u8fd8\u662f\u5f3a\u8feb\u75c7\u5728\u4f5c\u602a\uff0c\u6240\u4ee5\u6211\u4e00\u76f4\u60f3\u628a\u8fd9\u4e2a\u7ea2\u8272\u7684\u63d0\u793a\u7ed9\u53bb\u6389\uff0c\u5c31\u67e5\u4e86\u8c37\u6b4c\u3002\u672c\u6587\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u89e3\u51b3\u8fc7\u7a0b\u3002\n<\/p>\n<p>\n\t\u9996\u5148\uff0c\u6839\u636e&nbsp;stackoverflow&nbsp;\u7684&nbsp;<a href=\"https:\/\/stackoverflow.com\/questions\/44698296\/security-framework-of-xstream-not-initialized-xstream-is-probably-vulnerable\">Security framework of XStream not initialized, XStream is probably vulnerable<\/a>&nbsp;\u8fd9\u4e2a\u95ee\u9898\u7684\u63d0\u793a\uff0c\u6211\u505a\u51fa\u4e86\u4e0b\u9762\u7684\u8c03\u6574\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nXStream.setupDefaultSecurity(xs);<\/pre>\n<p>\n\t\u4f46\u662f\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u5b83\u53c8\u62a5\u51fa\u4e86&ldquo;com.thoughtworks.xstream.security.ForbiddenClassException&rdquo;\u95ee\u9898\u3002\u6240\u4ee5\u8fd9\u79cd\u89e3\u51b3\u529e\u6cd5\u4e0d\u884c\u3002\u4e8e\u662f\u6211\u6839\u636e\u4e0a\u9762\u7684\u63d0\u793a\uff0c\u53c8\u6dfb\u52a0\u4e86\u4e0b\u9762\u7684\u4ee3\u7801\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nxs.addPermission(AnyTypePermission.ANY); \r\nxs.addPermission(NoTypePermission.NONE);<\/pre>\n<p>\n\t\u8fd0\u884c\u540e\uff0c\u4e0a\u9762\u7684\u95ee\u9898\u4f9d\u7136\u5b58\u5728\u3002\u6240\u4ee5\u6211\u7ee7\u7eed\u505a\u8c03\u6574\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nClass&lt;?&gt;[] classes = new Class[] { TestList.class, Item.class, ... };\r\nXStream xstream = new XStream();\r\nXStream.setupDefaultSecurity(xstream);\r\nxstream.allowTypes(classes);<\/pre>\n<p>\n\t\u8fd9\u4e2a\u914d\u7f6e\u540c\u6837\u7684\u62a5&ldquo;com.thoughtworks.xstream.security.ForbiddenClassException&rdquo;\u3002\u4e8e\u662f\uff0c\u6709\u4eba\u5efa\u8bae\u6211\u628a\u7248\u672c\u5347\u7ea7\u5230 1.5.x\uff0c\u6700\u7ec8\u89e3\u51b3\u4e86\u3002\n<\/p>\n<p>\n\t\u4f46\u662f\u505a\u4e3a\u4e00\u4e2a\u5f00\u53d1\u8005\uff0c\u6211\u4e0d\u60f3\u901a\u8fc7\u5347\u7ea7\u6765\u89e3\u51b3\u3002\u6211\u60f3\u4e00\u5b9a\u53c8\u5176\u4ed6\u7684\u89e3\u51b3\u529e\u6cd5\u3002\u53d1\u73b0\u6dfb\u52a0\u4e0b\u9762\u7684\u4ee3\u7801\uff0c\u6700\u7ec8\u5f97\u610f\u89e3\u51b3\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nXStream.setupDefaultSecurity(this); \/\/ to be removed after 1.5\r\nxstream.allowTypesByWildcard(new String[] {\r\n    &quot;com.xttblog.package.**&quot;\r\n});<\/pre>\n<p>\n\t\u5927\u6982\u5728 3 \u5e74\u4e4b\u524d\u6211\u7528\u7684 Xstream \u4f4e\u7248\u672c\u7684\u8fd8\u6ca1\u6709\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u80fd\u53ea\u662f 1.4.x \u7248\u672c\u65b0\u52a0\u7684\u5b89\u5168\u9a8c\u8bc1\u529f\u80fd\u5427\u3002\u5173\u4e8e&ldquo;com.thoughtworks.xstream.security.ForbiddenClassException&rdquo;\u8bf7\u67e5\u770b\u6211\u7684\u53e6\u4e00\u7bc7\u6587\u7ae0\u300a<a href=\"https:\/\/www.xttblog.com\/?p=3003\" name=\"com.thoughtworks.xstream.security.ForbiddenClassException \u95ee\u9898\u89e3\u51b3\u529e\u6cd5\" target=\"_blank\" title=\"com.thoughtworks.xstream.security.ForbiddenClassException \u95ee\u9898\u89e3\u51b3\u529e\u6cd5\">com.thoughtworks.xstream.security.ForbiddenClassException \u95ee\u9898\u89e3\u51b3\u529e\u6cd5<\/a>\u300b\u3002\n<\/p>\n<p>\n\t\u53c2\u8003\u8d44\u6599\n<\/p>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/stackoverflow.com\/questions\/44698296\/security-framework-of-xstream-not-initialized-xstream-is-probably-vulnerable\" name=\"Security framework of XStream not initialized, XStream is probably vulnerable\" target=\"_blank\" title=\"Security framework of XStream not initialized, XStream is probably vulnerable\">Security framework of XStream not initialized, XStream is probably vulnerable<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2998\">xstream security framework of xstream not initialized xstream is probably vulnerable \u95ee\u9898\u89e3\u51b3\u529e\u6cd5<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u4f7f\u7528 XStream 1.4.10 \u7248\u672c\u7684\u65f6\u5019\u9047\u5230\u4e86\u4e00\u4e2a\u5b89\u5168\u95ee\u9898\uff1a&ldquo;xstream secu [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[949,990,183,365,367],"class_list":["post-2998","post","type-post","status-publish","format-standard","hentry","category-java","tag-securityutils","tag-sessionssecuritymanager","tag-spring-security","tag-xstream"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2998"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2998\/revisions"}],"predecessor-version":[{"id":3004,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2998\/revisions\/3004"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}