{"id":1218,"date":"2024-07-26T12:14:06","date_gmt":"2024-07-26T04:14:06","guid":{"rendered":"https:\/\/imuslab.com\/wordpress\/?p=1218"},"modified":"2024-07-26T12:14:25","modified_gmt":"2024-07-26T04:14:25","slug":"%e6%b7%ba%e8%ab%87-csrf-%e8%88%87-csrf-middleware","status":"publish","type":"post","link":"https:\/\/imuslab.com\/wordpress\/2024\/07\/26\/%e6%b7%ba%e8%ab%87-csrf-%e8%88%87-csrf-middleware\/","title":{"rendered":"\u6dfa\u8ac7 CSRF \u8207 CSRF Middleware"},"content":{"rendered":"\n<p>\u6700\u8fd1\u5728\u6211\u7684 Zoraxy \u958b\u6e90\u5c08\u6848\u90a3\u908a\u51fa\u73fe\u4e86\u9019\u6a23\u7684\u4e00\u500b bug issue<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"523\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-5.png\" alt=\"\" class=\"wp-image-1220\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-5.png 924w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-5-300x170.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-5-768x435.png 768w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><\/figure>\n\n\n\n<p>\u4ed6\u9084\u5f88\u597d\u7684\u9644\u4e86\u4e00\u500b\u7db2\u9801\u6e2c\u8a66\u4ecb\u9762\u7684\u622a\u5716<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"833\" height=\"667\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-6.png\" alt=\"\" class=\"wp-image-1221\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-6.png 833w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-6-300x240.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-6-768x615.png 768w\" sizes=\"auto, (max-width: 833px) 100vw, 833px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u751a\u9ebc\u662f CSRF \u653b\u64ca\uff1f<\/h3>\n\n\n\n<p> CSRF\uff08Cross-Site Request Forgery\uff0c\u8de8\u7ad9\u8acb\u6c42\u507d\u9020\uff09\u662f\u4e00\u7a2e\u7db2\u7d61\u653b\u64ca\u6280\u8853\uff0c\u653b\u64ca\u8005\u901a\u904e\u5728\u53d7\u5bb3\u8005\u4e0d\u77e5\u60c5\u7684\u60c5\u6cc1\u4e0b\uff0c\u5192\u5145\u53d7\u5bb3\u8005\u7684\u8eab\u4efd\u5728\u53d7\u5bb3\u8005\u5df2\u7d93\u8a8d\u8b49\u7684\u7db2\u7ad9\u4e0a\u57f7\u884c\u672a\u7d93\u6388\u6b0a\u7684\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">CSRF \u653b\u64ca\u7684\u5de5\u4f5c\u539f\u7406<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>\u53d7\u5bb3\u8005\u767b\u9304\u5230\u53ef\u4fe1\u7db2\u7ad9<\/strong>\uff1a\u53d7\u5bb3\u8005\u9996\u5148\u767b\u9304\u5230\u4e00\u500b\u9700\u8981\u8a8d\u8b49\u7684\u7db2\u7ad9\uff0c\u5728\u9019\u4f8b\u5b50\u662f Zoraxy \u7684\u5f8c\u53f0\u7ba1\u7406\u9801\u9762<\/li><li><strong>\u653b\u64ca\u8005\u88fd\u9020\u60e1\u610f\u8acb\u6c42<\/strong>\uff1a\u653b\u64ca\u8005\u5275\u5efa\u4e00\u500b\u5305\u542b\u60e1\u610f\u8acb\u6c42\u7684\u7db2\u9801\u6216\u96fb\u5b50\u90f5\u4ef6\uff0c\u4f8b\u5982\u8aaa\u9019\u88e1\u7684\u4e00\u500b free burger \u7db2\u9801 html + web form \uff08action \u6216 form submit URL \u6307\u5411 Zoraxy \u7684\u5f8c\u53f0\u7ba1\u7406\u9801\u9762\uff09<\/li><li><strong>\u53d7\u5bb3\u8005\u8a2a\u554f\u60e1\u610f\u93c8\u63a5<\/strong>\uff1a\u53d7\u5bb3\u8005\u5728\u767b\u9304\u72c0\u614b\u4e0b request \u4e86\u653b\u64ca\u8005\u63a7\u5236\u7684\u7db2\u9801\u4e26\u63d0\u4ea4\u4e86 web-form\u3002<\/li><li><strong>\u57f7\u884c\u672a\u7d93\u6388\u6b0a\u7684\u64cd\u4f5c<\/strong>\uff1a\u7531\u65bc\u53d7\u5bb3\u8005\u5df2\u7d93\u767b\u9304\uff08Auth Cookie \u6703\u8ddf\u8457 form \u4e00\u8d77\u9001\u51fa\u53bb\uff09\uff0cZoraxy webmin \u4ecb\u9762\u6703\u4ee5\u70ba\u9019\u4e9b request \u662f valid \u7684\uff0c\u4e26\u57f7\u884c\u76f8\u61c9\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982\u4e0a\u9762\u4f8b\u5b50\u7684 toggle proxy \u958b\u95dc\u72c0\u614b \u3002<\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">\u9632\u79a6 CSRF \u653b\u64ca\u7684\u65b9\u6cd5<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>CSRF Token<\/strong>\uff1a\u5728\u6bcf\u500b\u53d7\u4fdd\u8b77\u7684\u64cd\u4f5c\u8acb\u6c42\u4e2d\u52a0\u5165\u96a8\u6a5f\u751f\u6210\u7684\u3001\u552f\u4e00\u7684 CSRF Token\uff0c\u4e26\u9a57\u8b49\u9019\u4e9b Token \u4ee5\u78ba\u4fdd\u8acb\u6c42\u662f\u5408\u6cd5\u7684\u3002<\/li><li><strong>\u6aa2\u67e5 Referer \u548c Origin \u982d<\/strong>\uff1a\u6aa2\u67e5 HTTP \u982d\u4e2d\u7684 Referer \u548c Origin \u5b57\u6bb5\uff0c\u78ba\u4fdd\u8acb\u6c42\u662f\u5f9e\u5408\u6cd5\u7684\u4f86\u6e90\u767c\u51fa\u7684\u3002\u4f46\u662f\u6211\u5728\u5beb\u7684\u662f Reverse proxy\uff0c\u672c\u4f86 Referer \u8ddf origin \u5c31\u662f\u4e0d\u53ef\u4fe1\u7684\uff0c\u6240\u4ee5\u4e0d\u80fd\u4f7f\u7528\u6b64\u65b9\u6cd5\u3002<\/li><li><strong>\u96d9\u91cd\u63d0\u4ea4 Cookie<\/strong>\uff1a\u5c07 CSRF Token \u5b58\u5132\u5728 Cookie \u4e2d\uff0c\u4e26\u5728\u8acb\u6c42\u4e2d\u4e00\u8d77\u63d0\u4ea4\u548c\u9a57\u8b49\u3002<\/li><li><strong>\u4f7f\u7528 SameSite Cookie \u5c6c\u6027<\/strong>\uff1a\u8a2d\u7f6e Cookie \u7684 SameSite \u5c6c\u6027\u70ba <code>Strict<\/code> \u6216 <code>Lax<\/code>\uff0c\u9650\u5236\u8de8\u7ad9\u8acb\u6c42\u651c\u5e36 Cookie\u3002<\/li><\/ol>\n\n\n\n<p>\u8aaa\u771f\u7684\u9019\u4e5f\u4e0d\u662f\u6211\u7b2c\u4e00\u6b21\u8655\u7406 csrf \u554f\u984c\u3002\u5148\u524d\u540c\u4e00\u4f4d\u4f7f\u7528\u8005\u4e5f\u5c0d ArozOS \u63d0\u51fa\u904e\u985e\u4f3c\u7684 issue report\u3002\u7136\u800c ArozOS \u56e0\u70ba\u662f\u4f7f\u7528 agile \u958b\u767c\u7684\uff0cAPI \u6563\u843d\u5f97\u5230\u8655\u90fd\u662f\uff0c\u6839\u672c\u6c92\u8fa6\u6cd5\u7528\u6a19\u6e96\u7684\u65b9\u5f0f\u4f86\u505a csrf middleware \u4f86\u4fdd\u8b77 API \u63a5\u53e3\uff0c\u6240\u4ee5\u7576\u6642\u53ea\u7528\u4e86\u4e00\u500b\u975e\u5e38\u4e0d\u6a19\u6e96\u7684\u65b9\u5f0f\u4f86\u505a\uff08\u5c31\u662f\u6bcf\u4e00\u500b post request \u4e4b\u524d\u90fd\u52a0\u4e00\u500b\u8981\u6c42 csrf token \u7684 ajax request\uff0c\u8b8a\u6210\u6bcf\u500b request \u90fd\u6703\u8b8a\u6210\u8981 request 2 \u6b21\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">csrf middleware<\/h2>\n\n\n\n<p>csrf middleware \u662f\u4e00\u500b http Handler \u4e26\u8b93\u5b83\u4f86\u5c0d request \u9032\u884c\u9810\u8655\u7406\u4e26\u5c0d\u4e0d\u5408\u898f\u683c\u7684 POST (PUT \/ DELETE) \u7b49 request \u9032\u884c\u6514\u963b\u3002\u6240\u4ee5\u9019\u88e1\u6709\u5169\u500b\u9700\u8981\u505a\u7684\u4e8b\u60c5<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u5728 HTML \u9801\u9762\u751f\u6210\u7684\u6642\u5019\uff0c\u5728\u9801\u9762\u4e0a\u52a0\u5165\u4e00\u500b csrf token<\/li><li>\u5728\u6709\u8cc7\u6599\u9700\u8981\u4ee5 POST \u7b49 request \u56de\u50b3\u5230\u4f3a\u670d\u5668\u6642\uff0c\u5728 payload \u4e2d\u4ee5 header field \u7684\u65b9\u5f0f\u9644\u4e0a\u9801\u9762\u7684 csrf token<\/li><\/ol>\n\n\n\n<p>\u5728 ArozOS \u7684\u505a\u6cd5\u4e0a\uff0c\u5b83\u662f\u5148\u5c0d\u4f3a\u670d\u5668\u9032\u884c\u4e00\u500b csrf token generation request\uff0c\u7136\u5f8c\u518d\u628a request \u9644\u5230\u4e0b\u4e00\u500b ajax POST request \u88e1\u9762\u3002\u9019\u505a\u6cd5\u96d6\u7136\u4e0d\u662f\u4e0d\u884c\uff0c\u4f46\u662f\u5c0d\u65bc\u524d\u7aef\u4f86\u8aaa\u8981\u6539\u5be6\u5728\u592a\u8907\u96dc\uff0c\u800c\u4e14\u4e00\u500b csrf token \u53c8\u6c92\u6709\u90a3\u9ebc\u5feb expire\uff0c\u4e0d\u65b7\u751f\u7684\u8a71\u53ea\u6703\u6d6a\u8cbb\u5f8c\u7aef\u8cc7\u6e90\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Production grade \u7684 csrf middleware \u4f7f\u7528\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u7531\u65bc Zoraxy \u7684\u8a2d\u8a08\u5f9e\u4e00\u958b\u59cb\u5c31\u6309\u8457\u6a19\u6e96\u7684 monolithic architecture \u8a2d\u8a08\uff0c\u6240\u4ee5 api \u4e5f\u76f8\u5c0d\u96c6\u4e2d\u5bb9\u6613\u8655\u7406\u3002\u6211\u9019\u88e1\u4f7f\u7528\u7684\u662f gorilla csrf middleware \u7684 package\uff0c\u9996\u5148\u7b2c\u4e00\u4ef6\u4e8b\u8981\u505a\u7684\u662f\u5148\u5efa\u7acb\u4e00\u500b csrf Protect \u7269\u4ef6\u4e26\u8a2d\u5b9a\u597d\u5b83\u7684\u53c3\u6578\u3002\u4ee5 Zoraxy \u70ba\u4f8b\uff0c\u56e0\u70ba Zoraxy \u7684\u7ba1\u7406\u4ecb\u9762\u662f\u7528 http \u7684\uff0c\u56e0\u6b64\u6211\u9019\u88e1\u7684\u5efa\u7acb\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Create a new webmin mux and csrf middleware layer\n\twebminPanelMux = http.NewServeMux()\n\tcsrfMiddleware = csrf.Protect(\n\t\t[]byte(nodeUUID),\n\t\tcsrf.CookieName(\"zoraxy-csrf\"),\n\t\tcsrf.Secure(false),\n\t\tcsrf.Path(\"\/\"),\n\t\tcsrf.SameSite(csrf.SameSiteLaxMode),\n\t)<\/code><\/pre>\n\n\n\n<p>webminPanelMux  \u662f\u8655\u7406 webmin panel HTTP mux\uff0c\u662f net\/http \u5167\u7f6e\u7684\u6771\u897f\u3002\u800c nodeUUID \u662f\u4e00\u500b 32 bit \u7684 random UUID\uff0c\u6211\u9019\u88e1\u7528\u7684\u662f\u4e00\u500b\u96a8\u6a5f\u751f\u6210\u7684 UUIDv4\u3002<\/p>\n\n\n\n<p>\u7136\u5f8c\u628a csrf Middleware \u5957\u9032\u53bb \u73fe\u6709\u7684 http \u4f3a\u670d\u5668\u4e5f\u5f88\u7c21\u55ae\uff0c\u53ea\u8981\u628a\u5b83\u653e\u5230 ListenAndServe \u88e1\u9762\u5c31\u597d\uff0c\u4f8b\u5982\u8aaa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>err = http.ListenAndServe(*webUIPort, csrfMiddleware(webminPanelMux))\nif err != nil {\n\tlog.Fatal(err)\n}<\/code><\/pre>\n\n\n\n<p>\u9019\u6a23\u4f60\u7684 web server \u5c31\u5177\u5099\u4e86 csrf token \u6aa2\u6e2c\u529f\u80fd\u4e86\u3002\u7136\u5f8c\u5c31\u662f\u524d\u7aef\u7684\u90e8\u5206\u3002\u524d\u7aef\u7531\u65bc\u6211\u662f\u4f7f\u7528\u7d14 javascript \u8207 jQuery \u958b\u767c\u7684\uff08\u561b\uff0c\u90a3\u6642\u5019\u60f3\u8457\u80fd\u7528\u5c31\u597d\u6c92\u60f3\u5230\u73fe\u5728\u9019\u500b\u5c08\u6848\u9577\u9019\u9ebc\u5927\uff09\uff0c\u6240\u4ee5\u524d\u7aef\u8981\u52a0 csrf \u652f\u63f4\u5c31\u7565\u70ba\u9ebb\u7169\u4e00\u9ede\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Vailla JS + jQuery \u524d\u7aef\u52a0\u5165 csrf token<\/h2>\n\n\n\n<p>\u9996\u5148\uff0c\u6211\u8981\u60f3\u500b\u8fa6\u6cd5\u628a csrf token inject \u5230\u524d\u7aef\u53bb\u3002\u9019\u500b\u6211\u5011\u53ef\u4ee5\u900f\u904e golang \u7684 http template \u6216\u662f\u624b\u52d5 template \u7684\u65b9\u5f0f\u4f86\u505a\u3002\u5728\u6240\u6709 HTML \u6a94\u6848\u7684 head \u88e1\u52a0\u5165<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;meta name=\"zoraxy.csrf.Token\" content=\"{{.csrfToken}}\"><\/code><\/pre>\n\n\n\n<p>\u7136\u5f8c\u5728\u5f8c\u7aef\u7684 File Server \u88e1\u9762\uff0c\u5728\u9047\u5230\u526f\u6a94\u540d\u662f .html \u6216\u662f \/ \uff08index.html\uff09\u7684\u6642\u5019\uff0c\u5c0d html template \u6ce8\u5165 csrf token \u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\/\/ Serve the html file with template token injected\nfunc handleInjectHTML(w http.ResponseWriter, r *http.Request, relativeFilepath string) {\n\t\/\/ Read the HTML file\n\tvar content []byte\n\tvar err error\n\tif len(relativeFilepath) > 0 &amp;&amp; relativeFilepath[len(relativeFilepath)-1:] == \"\/\" {\n\t\trelativeFilepath = relativeFilepath + \"index.html\"\n\t}\n\tif development {\n\t\t\/\/Load from disk\n\t\ttargetFilePath := strings.ReplaceAll(filepath.Join(\"web\/\", relativeFilepath), \"\\\\\", \"\/\")\n\t\tcontent, err = os.ReadFile(targetFilePath)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Internal Server Error\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\t\/\/Load from embedded fs, require trimming off the prefix slash for relative path\n\t\trelativeFilepath = strings.TrimPrefix(relativeFilepath, \"\/\")\n\t\tcontent, err = webres.ReadFile(relativeFilepath)\n\t\tif err != nil {\n\t\t\tSystemWideLogger.Println(\"load embedded web file failed: \", err)\n\t\t\thttp.Error(w, \"Internal Server Error\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\t\/\/ Convert the file content to a string\n\thtmlContent := string(content)\n\n\t\/\/Defeine the system template for this request\n\ttemplateStrings := map[string]string{\n\t\t\".csrfToken\": csrf.Token(r),\n\t}\n\n\t\/\/ Replace template tokens in the HTML content\n\tfor key, value := range templateStrings {\n\t\tplaceholder := \"{{\" + key + \"}}\"\n\t\thtmlContent = strings.ReplaceAll(htmlContent, placeholder, value)\n\t}\n\n\t\/\/ Write the modified HTML content to the response\n\tw.Header().Set(\"Content-Type\", \"text\/html\")\n\tw.Write([]byte(htmlContent))\n}<\/code><\/pre>\n\n\n\n<p>\u9019\u88e1\u9762\u7684\u4f8b\u5b50\u7565\u70ba\u8907\u96dc\u4e00\u9ede\uff0c\u56e0\u70ba Zoraxy release \u7248\u672c\u662f\u4f7f\u7528 go:embed \u7684\u65b9\u5f0f\u4f86\u653e\u6a94\u6848\u7684\uff0c\u800c development \u7248\u672c\u5074\u662f\u5f9e\u786c\u789f\u8b80\u53d6 html \u6a94\u6848\uff0c\u6240\u4ee5\u591a\u4e86\u4e00\u90e8\u5206\u7684 code \u4f86\u9078\u64c7\u5f9e\u54ea\u908a\u8b80\u53d6\u524d\u7aef\u6a94\u6848\u3002<\/p>\n\n\n\n<p>\u5728 html \u6a94\u6848\u8b80\u51fa\u4f86\u6210\u70ba byte[] \u4e4b\u5f8c\uff0c\u9032\u884c template string rewrite \uff08\u66ab\u6642\u53ea rewrite .csrfToken \u7684\u90e8\u5206\uff09\uff0c\u4e4b\u5f8c\u518d\u9001\u51fa\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Post Request<\/h3>\n\n\n\n<p>\u7576\u7136\u8981\u9032\u884c post request \u7684\u6642\u5019\uff0c\u524d\u7aef\u5c31\u662f\u9700\u8981\u5f9e meta data \u90a3\u908a\u8b80\u53d6 csrf token \u4e26\u8ddf\u8457 post request \u4e00\u8d77\u9001\u51fa\u53bb\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Fill up other variables\nlet csrfToken = document.getElementsByTagName(\"meta\")[\"zoraxy.csrf.Token\"].getAttribute(\"content\");\n\n$.ajax({\n    url: \"\/api\/auth\/register\",\n    method: \"POST\",\n    beforeSend: function(request) {\n        request.setRequestHeader(\"X-CSRF-Token\", csrfToken);\n    },\n    data: {\n        username: username,\n        password: magic\n    },\n    success: function(data) {\n        if (data.error != undefined) {\n            alert(data.error);\n        } else {\n            \/\/Register success. Refresh page\n            window.location.reload();\n        }\n    },\n    error: function(xhr, status, error) {\n        console.error(\"Error registering user:\", error);\n    }\n});<\/code><\/pre>\n\n\n\n<p>\u9664\u4e86 beforeSend \u4ee5\u5916\uff0c\u65b0\u7248\u672c\u7684 jQuery \u4e5f\u53ef\u4ee5\u4f7f\u7528 headers \u4f86\u9644 user defined headers\u3002\u597d\u50cf\u8aaa\u5f8c\u9762\u6211\u70ba\u4e86\u7701\u6642\u9593\u4e0d\u7528\u6bcf\u500b ajax \u90fd\u8981\u6539\u5beb header\uff0c\u6240\u4ee5\u6211\u5beb\u4e86\u4e00\u500b\u7528\u4f86\u66ff\u4ee3 ajax \u7684 function \u53eb cjax<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Add a new function to jquery for ajax override with csrf token injected\n$.cjax = function(payload) {\n    let requireTokenMethod = [\"POST\", \"PUT\", \"DELETE\"];\n    if (requireTokenMethod.includes(payload.method) || requireTokenMethod.includes(payload.type)) {\n        \/\/csrf token is required\n        let csrfToken = document.getElementsByTagName(\"meta\")[\"zoraxy.csrf.Token\"].getAttribute(\"content\");\n        payload.headers = {\n            \"X-CSRF-Token\": csrfToken,\n        }a\n    }\n\n    $.ajax(payload);\n}<\/code><\/pre>\n\n\n\n<p>\u5728 include jquery \u4e4b\u5f8c \u52a0\u5165\u9019\u6bb5 function prototype \u6539\u5beb\u7684 js \u6a94\u6848\uff0c\u518d\u4e4b\u5f8c\u53ea\u8981\u628a\u6574\u500b codebase \u7684 <code>$.ajax<\/code> \u63db\u6210 <code>$.cjax<\/code> \u5c31\u53ef\u4ee5\u4e86\u3002\u9019\u6a23\u7684\u8a71\u6240\u6709\u4f7f\u7528 ajax \u9001\u51fa\u7684 POST request \u5728 headers \u7684\u90e8\u5206\u90fd\u6703\u9644\u6709 X-Csrf-Token field \u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u6c7a<\/h2>\n\n\n\n<p>\u5c31\u662f\u9019\u6a23\uff0c\u9019\u500b\u5b89\u5168\u6027\u554f\u984c\u7684 bug \u5c31\u89e3\u6c7a\u4e86\u5566~<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"806\" height=\"564\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-7.png\" alt=\"\" class=\"wp-image-1223\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-7.png 806w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-7-300x210.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2024\/07\/\u5716\u7247-7-768x537.png 768w\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u6211\u7684 Zoraxy \u958b\u6e90\u5c08\u6848\u90a3\u908a\u51fa\u73fe\u4e86\u9019\u6a23\u7684\u4e00\u500b bug issue \u4ed6\u9084\u5f88\u597d\u7684\u9644\u4e86\u4e00\u500b\u7db2\u9801\u6e2c\u8a66\u4ecb\u9762\u7684\u622a\u5716 \u751a\u9ebc\u662f CSRF \u653b\u64ca\uff1f CSRF\uff08Cross-Site Request Forgery\uff0c\u8de8\u7ad9\u8acb\u6c42\u507d\u9020\uff09\u662f\u4e00\u7a2e\u7db2\u7d61\u653b\u64ca\u6280\u8853\uff0c\u653b\u64ca\u8005\u901a\u904e\u5728\u53d7\u5bb3\u8005\u4e0d\u77e5\u60c5\u7684\u60c5\u6cc1\u4e0b\uff0c\u5192\u5145\u53d7\u5bb3\u8005\u7684\u8eab\u4efd\u5728\u53d7\u5bb3\u8005\u5df2\u7d93\u8a8d\u8b49\u7684\u7db2\u7ad9\u4e0a\u57f7\u884c\u672a\u7d93\u6388\u6b0a\u7684\u64cd\u4f5c\u3002 CSRF \u653b\u64ca\u7684\u5de5\u4f5c\u539f\u7406 \u53d7\u5bb3\u8005\u767b\u9304\u5230\u53ef\u4fe1\u7db2\u7ad9\uff1a\u53d7\u5bb3\u8005\u9996\u5148\u767b\u9304\u5230\u4e00\u500b\u9700\u8981\u8a8d\u8b49\u7684\u7db2\u7ad9\uff0c\u5728\u9019\u4f8b\u5b50\u662f Zoraxy \u7684\u5f8c\u53f0\u7ba1\u7406\u9801\u9762 \u653b\u64ca\u8005\u88fd\u9020\u60e1\u610f\u8acb\u6c42\uff1a\u653b\u64ca\u8005\u5275\u5efa\u4e00\u500b\u5305\u542b\u60e1\u610f\u8acb\u6c42\u7684\u7db2\u9801\u6216\u96fb\u5b50\u90f5\u4ef6\uff0c\u4f8b\u5982\u8aaa\u9019\u88e1\u7684\u4e00\u500b free burger \u7db2\u9801 html + web form \uff08action \u6216 form submit URL \u6307\u5411 Zoraxy \u7684\u5f8c\u53f0\u7ba1\u7406\u9801\u9762\uff09 \u53d7\u5bb3\u8005\u8a2a\u554f\u60e1\u610f\u93c8\u63a5\uff1a\u53d7\u5bb3\u8005\u5728\u767b\u9304\u72c0\u614b\u4e0b request \u4e86\u653b\u64ca\u8005\u63a7\u5236\u7684\u7db2\u9801\u4e26\u63d0\u4ea4\u4e86 web-form\u3002 \u57f7\u884c\u672a\u7d93\u6388\u6b0a\u7684\u64cd\u4f5c\uff1a\u7531\u65bc\u53d7\u5bb3\u8005\u5df2\u7d93\u767b\u9304\uff08Auth Cookie \u6703\u8ddf\u8457 form \u4e00\u8d77\u9001\u51fa\u53bb\uff09\uff0cZoraxy webmin \u4ecb\u9762\u6703\u4ee5\u70ba\u9019\u4e9b request \u662f valid \u7684\uff0c\u4e26\u57f7\u884c\u76f8\u61c9\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982\u4e0a\u9762\u4f8b\u5b50\u7684 toggle proxy \u958b\u95dc\u72c0\u614b \u3002 \u9632\u79a6 CSRF \u653b\u64ca\u7684\u65b9\u6cd5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104,5,3],"tags":[],"class_list":["post-1218","post","type-post","status-publish","format-standard","hentry","category-bug-tips","category-development-logs","category-instructions-and-information"],"_links":{"self":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1218"}],"version-history":[{"count":6,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/1218\/revisions"}],"predecessor-version":[{"id":1227,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/1218\/revisions\/1227"}],"wp:attachment":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}