{"id":212,"date":"2011-04-25T08:23:28","date_gmt":"2011-04-25T08:23:28","guid":{"rendered":"http:\/\/inbreak.net\/?p=212"},"modified":"2011-04-25T08:30:21","modified_gmt":"2011-04-25T08:30:21","slug":"java%e6%b5%ae%e7%82%b9%e5%80%bc%e6%8b%92%e7%bb%9d%e6%9c%8d%e5%8a%a1%e6%bc%8f%e6%b4%9e%e5%8d%b1%e5%ae%b3%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.inbreak.net\/archives\/212.html","title":{"rendered":"Java\u6d6e\u70b9\u503c\u62d2\u7edd\u670d\u52a1\u6f0f\u6d1e\u5371\u5bb3\u5206\u6790"},"content":{"rendered":"

By \u7a7a\u865a\u6d6a\u5b50\u5fc3 http:\/\/inbreak.net\/<\/p>\n

JAVA\u51fa\u4e86\u6f0f\u6d1e\uff0cCVE-2010-4476\uff0c\u4f1a\u5bfc\u81f4\u62d2\u7edd\u670d\u52a1\u653b\u51fb\u3002\u5927\u5bb6\u80fd\u4ece\u516c\u544a\u4e0a\uff0c\u770b\u5230\u8fd9\u6837\u4e00\u6bb5\u4ee3\u7801\uff0c\u633a\u957f\u7684\u3002\u610f\u601d\u662f\u53ea\u6709\u5f00\u53d1\u4eba\u5458\u5199\u51fa\u8fd9\u6837\u7684\u4ee3\u7801\uff0c\u624d\u4f1a\u5bf9\u670d\u52a1\u5668\u9020\u6210\u5f71\u54cd\u3002<\/p>\n

\u6211\u4eec\u80af\u5b9a\u4f1a\u9996\u5148\u8003\u8651\uff0c\u8fd9\u4e48\u957f\u7684\u4ee3\u7801\uff0c\u7a76\u7adf\u6709\u591a\u5c11\u5f00\u53d1\u4f1a\u50bb\u4e4e\u4e4e\u7684\u5199\u51fa\u6765\uff1f\u800c\u6211\u4eec\u7a76\u7adf\u6253\u4e0d\u6253\u8865\u4e01\u5462\uff1f\u5176\u5b9e\u4f5c\u8005\u77e5\u9053\uff0c\u76ee\u524d\u8fd8\u6709\u5f88\u591a\u516c\u53f8\u6ca1\u6709\u6253\u8865\u4e01\uff0c\u4e0d\u8fc7\u6ca1\u5173\u7cfb\uff0c\u7b49\u4f1a\u513f\u4f60\u5c31\u8981\u6253\u4e86\u3002<\/p>\n

\u5148\u770b\u770b\u5b98\u65b9\u7ed9\u51fa\u7684\u4ee3\u7801\u3002<\/p>\n


\nSend a Java Program Into An Infinite Loop
\nCompile this program and run it; the program will hang (at least it does on a 32-bit system with the latest JRE\/JDK):
\nclass runhang {
\npublic static void main(String[] args) {
\nSystem.out.println(\u201cTest:\u201d);
\ndouble d = Double.parseDouble(\u201c2.2250738585072012e-308\u2033);
\nSystem.out.println(\u201cValue: \u201d + d);
\n}
\n}
\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-
\nSend the Java Compiler Into An Infinite Loop
\nTry to compile this program; the compiler will hang:
\nclass compilehang {
\npublic static void main(String[] args) {
\ndouble d = 2.2250738585072012e-308;
\nSystem.out.println(\u201cValue: \u201d + d);
\n}
\n}
\n<\/code><\/p>\n

\u4ee5\u4e0a\u4ee3\u7801\uff0c\u5176\u5b9e\u4e3e\u4e86\u4e24\u4e2a\u4f8b\u5b50\uff0c\u9996\u5148\u7b80\u5316\u4e00\u4e0b\u4ee3\u7801\uff1a<\/p>\n


\n\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u5728\u7f16\u8bd1\u65f6\u6302\u6389\uff1a
\ndouble d = 2.2250738585072012e-308;
\n\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u5728\u8fd0\u884c\u65f6\u6302\u6389\uff1a
\ndouble d = Double.parseDouble(\u201c2.2250738585072012e-308\u2033);
\n<\/code>
\n\u4f5c\u8005\u5f88\u5947\u602a\u540e\u9762\u7684System.out\u662f\u5565\u610f\u601d\uff0c\u6309\u7167\u5b9e\u9645\u6d4b\u8bd5\u4ee5\u53ca\u5b98\u65b9\u539f\u7406\uff0c\u8fd9\u53e5\u538b\u6839\u4e0d\u4f1a\u6267\u884c\uff0c\u697c\u4e0a\u90fd\u5df2\u7ecf\u201c\u65e0\u9650\u5faa\u73af\u201d\u4e86\uff0c\u600e\u4e48\u53ef\u80fd\u8d70\u4e0b\u6765\u5462\uff1f\u4e0d\u8fc7\u8fd9\u4e2a\u4e0d\u91cd\u8981\u3002
\n\u4e0b\u6587\u6240\u8bf4\u7684\u6f0f\u6d1e\uff0c\u662f\u6307\u5047\u8bbe\u6211\u4eec\u7684\u5f00\u53d1\u4eba\u5458\u5199\u4e86\u201cXXX\u201d\u7684\u4ee3\u7801\uff0c\u653b\u51fb\u8005\u5c31\u53ef\u80fd\u653b\u51fb\u6211\u4eec\u670d\u52a1\u5668\u3002
\n\u6211\u4eec\u6765\u9006\u63a8\u653b\u51fb\u8fc7\u7a0b\uff0c\u4ece\u6f0f\u6d1e\u7684\u89d2\u5ea6\u4e0a\u8bf4\uff0c\u53ea\u6709\u7a0b\u5e8f\u4f20\u5165\u7684\u503c\uff0c\u7531\u7528\u6237\u63a7\u5236\uff0c\u624d\u4f1a\u5bfc\u81f4\u6f0f\u6d1e\u89e6\u53d1\uff0c\u6bd5\u7adf\u5f00\u53d1\u4e0d\u4f1a\u76f4\u63a5\u5199\u8fd9\u4e2a\u503c\u3002\u800c\u7f16\u8bd1\u4e2d\u6302\u6389\uff0c\u51e0\u4e4e\u4e0d\u53ef\u80fd\u5b58\u5728\uff0c\u5f88\u96be\u6709\u6b63\u5e38\u7684\u4e1a\u52a1\u9700\u8981\u7528\u6237\u63d0\u4ea4\u4ee3\u7801\uff0c\u8ba9\u670d\u52a1\u5668\u7f16\u8bd1\u6267\u884c\u3002\u6240\u4ee5\uff0c\u6f0f\u6d1e\u7684\u4ea7\u751f\u53ea\u4f1a\u51fa\u5728\u8fd9\u4e00\u53e5\u4e0a\uff1a
\n
\n\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u5728\u8fd0\u884c\u65f6\u6302\u6389\uff1a
\ndouble d = Double.parseDouble(\u201c2.2250738585072012e-308\u2033);
\n<\/code>
\n\u90a3\u4e48\u518d\u6b21\u9006\u63a8\uff0c\u8981\u6c42\u8fd9\u4e2a\u503c\u6709\u7528\u6237\u63a7\u5236\uff0c\u5982\u679c\u73af\u5883\u662fjava web application\uff0c\u5f00\u53d1\u60f3\u5199\u51fa\u6709\u6f0f\u6d1e\u7684\u4ee3\u7801\uff0c\u5fc5\u987b\u8fd9\u6837\u641e\uff1a
\n
\n\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u5728\u8fd0\u884c\u65f6\u6302\u6389\uff1a
\ndouble d = Double.parseDouble(request.getParameter(\u201cdouble\u201d));
\n<\/code><\/p>\n

\u5f53\u5f00\u53d1\u4eba\u5458\u5199\u51fa\u8fd9\u6837\u7684\u4ee3\u7801\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u63d0\u4ea4\uff1a
\nhttp:\/\/inbreak.net\/double.do?double=2.2250738585072012e-308
\n\u4e8e\u662f\uff0c\u7a0b\u5e8f\u5c31\u201dhang!\u201d\uff08\u5176\u5b9e\u6211\u4e0d\u77e5\u9053\u8fd9\u4e2a\u8bcd\u7684\u610f\u601d\uff09\uff0c\u6302\u4e86\uff0c\u4ece\u8868\u9762\u4e0a\u770b\u4e0d\u51fa\u6765\uff0c\u4f46\u662f\u5b9e\u9645\u4e0a\u4f60\u7684CPU\u4f1a\u7acb\u523b100%\uff0c\u5f53\u524d\u7ebf\u7a0b\u8d70\u4e0d\u4e0b\u53bb\uff0c\u9875\u9762\u5361\u6b7b\uff0c\u4e0d\u7ed9\u4f60\u4efb\u4f55\u54cd\u5e94\u3002\u5f53\u7136\uff0c\u5176\u4ed6\u9875\u9762\u4e5f\u8bb8\u4f1a\u597d\uff0c\u56e0\u4e3aweb\u5bb9\u5668\u662f\u591a\u7ebf\u7a0b\u7684\uff0c\u53ef\u60dc\u5df2\u7ecf\u6709\u4eba100%CPU\u4e86\uff0c\u9875\u9762\u901f\u5ea6\u53ef\u60f3\u800c\u77e5\u3002
\n\u5f88\u591a\u4eba\uff0c\u5c31\u8003\u8651\u5230\u4e86\u8fd9\u6bb5\uff0c\u9664\u975e\u5f00\u53d1\u4eba\u5458\u771f\u7684\u5199\u4e86\u8fd9\u6837\u7684\u4ee3\u7801\uff0c\u5426\u5219\u5f88\u96be\u51fa\u73b0\u6f0f\u6d1e\uff0c\u6240\u4ee5\u6ca1\u6709\u6253\u8865\u4e01\u3002
\nJava web\u5728\u5f88\u591a\u5e74\u524d\uff0c\u90fd\u5df2\u7ecf\u5f00\u59cb\u8d70\u6846\u67b6\u8def\u7ebf\u4e86\uff0c\u6211\u4eec\u719f\u77e5\u7684spring mvc\u3001struts2\u3001webwork\u7b49\u7b49\uff0c\u751a\u81f3\u8fd8\u6709\u4e00\u4e9b\u516c\u53f8\u81ea\u5df1\u5b9e\u73b0\u6846\u67b6\uff0c\u6bd4\u5982\u963f\u91cc\u5df4\u5df4\u516c\u53f8\u7684\u5f00\u6e90\u6846\u67b6webx\uff08\u5ba3\u4f20\u4e00\u4e0bhttp:\/\/code.taobao.org\/project\/view\/401\/\uff09\u3002\u5728\u8fd9\u6837\u7684\u6846\u67b6\u4e2d\uff0c\u5f00\u53d1\u4eba\u5458\u66f4\u4e0d\u53ef\u80fd\u81ea\u5df1\u53bb\u505a\u8f6c\u4e49\uff0c\u8fd9\u90fd\u662f\u6846\u67b6\u81ea\u5df1\u8d1f\u8d23\u7684\u3002\u662f\u4e0d\u662f\u610f\u5473\u7740\uff0c\u6f0f\u6d1e\u4e0d\u53ef\u80fd\u5b58\u5728\u5462\uff1f
\n\u8fd9\u6070\u6070\u662f\u6700\u53ef\u6015\u7684\u5730\u65b9\uff0c\u8fd9\u4e9b\u6846\u67b6\u6ca1\u6709\u8ba9\u5f00\u53d1\u4eba\u5458\u53c2\u4e0e\u7c7b\u578b\u8f6c\u4e49\uff0c\u7528\u6237\u672c\u6765\u63d0\u4ea4\u7684\u662f\u4e00\u4e2aString\u76842.2250738585072012e-308\uff0c\u6846\u67b6\u4f1a\u81ea\u52a8\u8f6c\u4e49\u7c7b\u578b\u4e3aDouble\uff0c\u7ecf\u6d4b\u8bd5\uff0c\u6240\u6709\u7684\u6846\u67b6\u90fd\u6709\u81ea\u52a8\u7c7b\u578b\u8f6c\u4e49\uff08\u5426\u5219\u6846\u67b6\u610f\u4e49\u4f55\u5728\u554a\uff09\u3002
\n\u5f00\u53d1\u4ec0\u4e48\u90fd\u4e0d\u9700\u8981\u505a\uff0c\u53ea\u8981\u5728action\u4e2d\u6709\u4e00\u4e2a\u5bf9\u8c61\uff0c\u5bf9\u8c61\u4e2d\u6709\u4e00\u4e2a\u5b57\u6bb5\u7c7b\u578b\u4e3adouble\uff0c\u6216\u8bb8\u4ed6\u90fd\u4e0d\u9700\u8981\u5b9a\u4e49\u5bf9\u8c61\uff0c\u5176\u4ed6\u5f00\u53d1\u65e9\u5b9a\u4e49\u597d\u4e86\uff0c\u4ed6\u53ea\u9700\u8981\u5199\u4e00\u4e2aaction\u3002\u6bd4\u5982\uff1a
\n
\n\/\/\u8ba2\u5355\u5904\u7406action
\npublic class OrderAction extends ActionSupport{
\n\/\/\u8ba2\u5355\u5bf9\u8c61
\npublic Order order;
\npublic String execute(){
\nreturn SUCCESS;
\n}
\n}
\n\/\/Order\u5bf9\u8c61\u7684\u5185\u5bb9
\nPublic class Order{
\n\/\/\u524d\u9762\u8fd8\u6709\u5176\u4ed6\u5b57\u6bb5\uff0c\u8fd9\u91cc\u53ea\u8bf4Double\u7c7b\u578b\u7684\u3002
\nDouble money;
\n}<\/code><\/p>\n

<\/code>
\n\u8fd9\u662f\u5f88\u5e38\u89c1\u7684\u5199\u6cd5\uff0c\u53ea\u8981Order\u5bf9\u8c61\u4e2d\uff0c\u6709\u4e00\u4e2a\u5b57\u6bb5\u662fDouble\u7684\u3002\u6211\u4eec\u5c31\u53ef\u4ee5\u5bf9\u6b64action\u63d0\u4ea4\uff1a
\nhttp:\/\/inbreak.net\/order.do?order.money=2.2250738585072012e-308
\n\u8fd9\u5c31\u201chang\u201d\u4e86\u3002
\n\u6211\u4eec\u53ef\u4ee5\u5199\u4e2a\u626b\u63cf\u5668\uff0c\u90a3\u4e48\u4f1a\u6709\u54ea\u4e9b\u5b57\u6bb5\u901a\u5e38\u88ab\u5b9a\u4e49\u4e3adouble\u5462\uff1f\u626b\u63cf\u5668\u81ea\u5df1\u53bb\u6293\u9875\u9762\uff0c\u6293\u56de\u6765\u7684input\uff0c\u5982\u679c\u4e3auser.name\uff0c\u6211\u4eec\u5c31\u731c\u6d4buser\u5bf9\u8c61\u4e2d\u53ef\u80fd\u5b58\u5728money\uff0c\u53ef\u80fd\u5b58\u5728score\u3001point\u7b49\uff0c\u7136\u540e\u8ba9\u5b83\u4eec\u7b49\u4e8e\u90a3\u4e2a\u503c\uff0c\u81ea\u52a8\u63d0\u4ea4\u3002\u8fd9\u7b49\u4e8e\u6302\u5b57\u5178\uff0c\u731c\u6d4b\u5bf9\u8c61\u4e2d\u53ef\u80fd\u5b58\u5728\u7684double\u7c7b\u578b\u5b57\u6bb5\u3002
\n\u6709\u6ca1\u6709\u7ebf\u4e0a\u7684\u4f8b\u5b50\u5462\uff1f
\n163\u7684\u7f51\u6613\u5b9d\u5355\u65e5\u652f\u4ed8\u91d1\u989d\u9650\u5236\uff1a<\/strong>
\n\"\"<\/a><\/p>\n

\u6b63\u5e38\u7684\u60c5\u51b5\uff0c\u586b\u51651\u5143\uff0c\u770b\u770b\u6548\u679c\uff1a<\/p>\n

\"\"<\/a><\/p>\n

\u7acb\u523b\u6765\u5230\u4e86
\n\u4f46\u662f\u6211\u4eec\u586b\u4e0a\uff1a2.2250738585072012e-308
\n
\"\"<\/a><\/p>\n

\u7b49\u554a\u7b49\uff0c\u7b49\u554a\u7b49\u3002\u3002\u3002\u7b49\u5230\u82b1\u513f\u4e5f\u8c22\u4e86\uff0c\u8fd8\u662f\u4e0d\u54cd\u5e94\uff01
\n\u4f60\u731c\u731c\u5b83\u4eec\u7684\u670d\u52a1\u5668\u600e\u6837\u4e86\uff1f
\nJava web\u6846\u67b6\u5316\u4ee5\u540e\uff0c\u5f00\u53d1\u4eba\u5458\u548c\u67b6\u6784\u5e08\u90fd\u5fd8\u8bb0\u4e86\u8f6c\u4e49\u7c7b\u578b\u7684\u4e8b\u60c5\uff0c\u4e5f\u4e0d\u9700\u8981\u81ea\u5df1\u505a\u8f6c\u4e49\uff0c\u4ee3\u7801\u53d8\u5f97\u8d8a\u6765\u8d8a\u7b80\u5355\u3002\u4f5c\u8005\u4e3a\u4e86\u7814\u7a76\u6f0f\u6d1e\uff0c\u53bb\u8be2\u95ee\u6709\u4e9b\u8d44\u6df1\u67b6\u6784\u5e08\u65f6\uff0c\u751a\u81f3\u4ee5\u4e3a\u201c\u5f00\u53d1\u4e0d\u4f1a\u5199\u8fd9\u6837\u7684\u4ee3\u7801\u201d\uff0c\u6240\u4ee5\u6211\u4eec\u7684\u7a0b\u5e8f\u4e0d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002\u6700\u7ec8\u8fd8\u662f\u4f5c\u8005\u4eb2\u624b\u7528\u73b0\u6709\u6846\u67b6\u642d\u5efa\u4e86\u73af\u5883\uff0c\u628aCPU\u771f\u7684\u8dd1\u5230100%\uff0c\u624d\u5f00\u59cb\u76f8\u4fe1\u8fd9\u4e2a\u6f0f\u6d1e\u5bf9\u6846\u67b6\u7684\u5371\u5bb3\u3002
\n\u4f5c\u8005\u76f8\u4fe1\uff0cJ2EE\u6846\u67b6\u5bf9\u8fd9\u4e2a\u6f0f\u6d1e\u7684\u5b8c\u7f8e\u652f\u6301\uff0c\u8db3\u4ee5\u4f7f\u5f88\u591a\u95e8\u6237\u7f51\u7ad9\u6ca6\u9677\u3002\u800c\u8fd9\u53ea\u662f\u521a\u521a\u5f00\u59cb\uff0c\u4f60\u53ef\u4ee5\u62b1\u6709\u4fa5\u5e78\u5fc3\u7406\uff0c\u4e0d\u8fc7\u4e0b\u4e00\u7bc7\u548c\u8fd9\u4e2a\u6f0f\u6d1e\u6709\u5173\u7684\u6587\u7ae0<\/strong>\uff0c\u4f1a\u8ba9\u4f60\u5f7b\u5e95\u6253\u6d88\u8fd9\u4e2a\u5ff5\u5934\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\tJAVA\u51fa\u4e86\u6f0f\u6d1e\uff0cCVE-2010-4476\uff0c\u4f1a\u5bfc\u81f4\u62d2\u7edd\u670d\u52a1\u653b\u51fb\u3002\u5927\u5bb6\u80fd\u4ece\u516c\u544a\u4e0a\uff0c\u770b\u5230\u8fd9\u6837\u4e00\u6bb5\u4ee3\u7801\uff0c\u633a\u957f\u7684\u3002\u610f\u601d\u662f\u53ea\u6709\u5f00\u53d1\u4eba\u5458\u5199\u51fa\u8fd9\u6837\u7684\u4ee3\u7801\uff0c\u624d\u4f1a\u5bf9\u670d\u52a1\u5668\u9020\u6210\u5f71\u54cd\u3002
\n\t\u6211\u4eec\u80af\u5b9a\u4f1a\u9996\u5148\u8003\u8651\uff0c\u8fd9\u4e48\u957f\u7684\u4ee3\u7801\uff0c\u7a76\u7adf\u6709\u591a\u5c11\u5f00\u53d1\u4f1a\u50bb\u4e4e\u4e4e\u7684\u5199\u51fa\u6765\uff1f\u800c\u6211\u4eec\u7a76\u7adf\u6253\u4e0d\u6253\u8865\u4e01\u5462\uff1f\u5176\u5b9e\u4f5c\u8005\u77e5\u9053\uff0c\u76ee\u524d\u8fd8\u6709\u5f88\u591a\u516c\u53f8\u6ca1\u6709\u6253\u8865\u4e01\uff0c\u4e0d\u8fc7\u6ca1\u5173\u7cfb\uff0c\u7b49\u4f1a\u513f\u4f60\u5c31\u8981\u6253\u4e86\u3002<\/p>\n

\u7ee7\u7eed\u9605\u8bfb »<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[84,86,5],"tags":[14,93,92,91,90,35],"views":17775,"_links":{"self":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts\/212"}],"collection":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":5,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":220,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts\/212\/revisions\/220"}],"wp:attachment":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}