{"id":1073,"date":"2023-12-25T15:13:48","date_gmt":"2023-12-25T07:13:48","guid":{"rendered":"https:\/\/systw.net\/note\/?p=1073"},"modified":"2024-03-16T00:52:45","modified_gmt":"2024-03-15T16:52:45","slug":"htb-diogenes-rage","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/1073","title":{"rendered":"HTB diogenes rage"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u76ee\u6a19\u8aaa\u660e<\/h3>\n\n\n\n<p>hackthebox\u4e0a\u7684web\u9776\u6a5f\uff0c\u540d\u7a31\u70ba<code>diogenes rage<\/code>\uff0c\u60c5\u5883\u662f\u8ca9\u8ce3\u6a5f<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u5168\u98a8\u96aa<\/h3>\n\n\n\n<p>\u6b64\u76ee\u6a19\u767c\u73fe1\u500b\u5b89\u5168\u98a8\u96aa<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8cfc\u8cb7\u512a\u60e0\u5238\u7684API\u6709\u689d\u4ef6\u7af6\u722d\u554f\u984c<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u5168\u512a\u5316\u5efa\u8b70\u00a0<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b89\u6392\u4ee3\u78bc\u6aa2\u67e5\uff0c\u78ba\u4fdd\u5728\u4e0d\u5141\u8a31\u4e26\u767c\u7684\u6d41\u7a0b\u4e2d\u4f7f\u7528<code>async<\/code>\u800c\u5f15\u767c\u689d\u4ef6\u7af6\u722d\u554f\u984c<\/li>\n\n\n\n<li>\u91dd\u5c0d\u512a\u60e0\u5238\u7b49\u76f8\u95dc\u529f\u80fd\u9032\u884c\u4e26\u767c\u6e2c\u8a66\uff0c\u78ba\u4fdd\u7121\u5176\u4ed6\u689d\u4ef6\u7af6\u722d\u554f\u984c<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u653b\u64ca\u624b\u6cd5<\/h2>\n\n\n\n<p><code>flag<\/code>\u8981\u82b1\u9322\u624d\u80fd\u53d6\u5f97\uff0c\u6240\u4ee5\u8981\u60f3\u8fa6\u6cd5\u628a\u624b\u4e0a\u7684\u9322\u8b8a\u591a<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5206\u6790<code>outer\/index.js<\/code>\u4ee3\u78bc\u767c\u73fe\u689d\u4ef6\u7af6\u722d\u554f\u984c\uff0c<code>async<\/code>\u5141\u8a31\u4e26\u767c\u57f7\u884c\uff0c\u9019\u610f\u8b02\u8457\u6211\u53ef\u4ee5\u540c\u4e00\u6642\u9593\u4e00\u6b21\u8cfc\u8cb7\u591a\u500b\u512a\u60e0\u5238<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>router.post('\/api\/coupons\/apply', AuthMiddleware, async (req, res) => {\r\n...omit...\r\nif (coupon_code) {\r\n\tif (user.coupons.includes(coupon_code)) {\r\n\t\treturn res.status(401).send(response(\"This coupon is already redeemed!\"));\r\n\t}\r\n\treturn db.getCouponValue(coupon_code)\r\n\t\t.then(coupon => {\r\n\t\tif (coupon) {\r\n\t\t\treturn db.addBalance(user.username, coupon.value)\r\n\t\t\t.then(() => {\r\n\t\t\t\tdb.setCoupon(user.username, coupon_code)\r\n\t\t\t\t.then(() => res.send(response(`$${coupon.value} coupon redeemed successfully! Please select an item for order.`)))\r\n\t\t\t})\r\n\t\t\t.catch(() => res.send(response(\"Failed to redeem the coupon!\")));\r\n\t\t}\r\n\tres.send(response(\"No such coupon exists!\"));\r\n\t})\r\n}\r\n...omit...<\/code><\/pre>\n\n\n\n<p>\u5728\u6b63\u5e38\u6d41\u7a0b\u4e2d\u4e00\u6b21\u53ea\u80fd\u8cb7\u4e00\u5f35\u50f9\u503c1\u5143\u9762\u984d\u7684\u512a\u60e0\u5238\uff0c\u4f46\u56e0\u70ba\u6709\u689d\u4ef6\u7af6\u722d\u6f0f\u6d1e\uff0c\u6211\u5011\u53ef\u4ee5\u7528\u4e26\u767c\u7684\u65b9\u5f0f\uff0c\u5728\u540c\u4e00\u6642\u9593\u7533\u8acb\u591a\u5f35\u512a\u60e0\u5238<\/p>\n\n\n\n<p><code>flag<\/code>\u50f9\u683c\u70ba13.37\u5143\uff0c\u6240\u4ee5\u6211\u5011\u81f3\u5c11\u8981\u5c0d<code>\/api\/coupons\/apply<\/code>\u4e26\u767c14\u6b21\u4ee5\u4e0a\u8acb\u6c42\uff0c\u6210\u529f\u5f8c\u5c31\u80fd\u5229\u7528\u9019\u4e9b\u9322\u53bb\u8cb7flag<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p> <\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u88dc\u5145\u8aaa\u660e<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">nodejs\u7684async<\/h3>\n\n\n\n<p>\u5728\u4f7f\u7528 <code>async<\/code> \u6642\uff0c\u5982\u679c\u5b58\u5728\u591a\u500b\u975e\u540c\u6b65\u64cd\u4f5c\u5171\u4eab\u540c\u4e00\u500b\u8cc7\u6599\u6216\u72c0\u614b\uff0c\u800c\u9019\u4e9b\u975e\u540c\u6b65\u64cd\u4f5c\u53ef\u80fd\u6703\u540c\u6642\u9032\u884c\u8b80\u5beb\u64cd\u4f5c\uff0c\u90a3\u9ebc\u5c31\u6709\u53ef\u80fd\u51fa\u73fe\u689d\u4ef6\u7af6\u722d\u6f0f\u6d1e\u3002 \u9019\u7a2e\u60c5\u6cc1\u4e26\u975e <code>async<\/code> \u672c\u8eab\u5f15\u767c\u7684\u554f\u984c\uff0c\u800c\u662f\u7531\u65bc\u4e26\u767c\u64cd\u4f5c\u5171\u4eab\u8cc7\u6e90\u800c\u5c0e\u81f4\u7684\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u5047\u8a2d\u6709\u5169\u500b\u975e\u540c\u6b65\u51fd\u6578 A \u548c B\uff0c\u5b83\u5011\u90fd\u6703\u5c0d\u540c\u4e00\u500b\u8b8a\u6578\u9032\u884c\u8b80\u5beb\u904b\u7b97\u3002 \u7531\u65bc\u975e\u540c\u6b65\u51fd\u6578\u7684\u57f7\u884c\u9806\u5e8f\u662f\u4e0d\u78ba\u5b9a\u7684\uff0cA \u548c B \u53ef\u80fd\u6703\u540c\u6642\u8b80\u53d6\u548c\u4fee\u6539\u9019\u500b\u8b8a\u91cf\uff0c\u5f9e\u800c\u7522\u751f\u7af6\u722d\u689d\u4ef6\u3002 \u9019\u6a23\u7684\u60c5\u6cc1\u4e0b\uff0c\u5982\u679c\u6c92\u6709\u6b63\u78ba\u5730\u8655\u7406\u5171\u4eab\u8cc7\u6e90\u7684\u8a2a\u554f\uff0c\u5c31\u53ef\u80fd\u5c0e\u81f4\u8cc7\u6599\u4e0d\u4e00\u81f4\u6216\u932f\u8aa4\u7684\u884c\u70ba\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u53c3\u8003\u6587\u737b<br><a href=\"https:\/\/domdom.tistory.com\/293\" target=\"_blank\" rel=\"noopener\">https:\/\/domdom.tistory.com\/293<\/a><br><a href=\"https:\/\/b3cl4ssy.tistory.com\/481\" target=\"_blank\" rel=\"noopener\">https:\/\/b3cl4ssy.tistory.com\/481<\/a><br><a href=\"https:\/\/www.freebuf.com\/articles\/web\/340879.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.freebuf.com\/articles\/web\/340879.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528\u689d\u4ef6\u7af6\u722d\u6f0f\u6d1e\u4e00\u6b21\u8cfc\u8cb7\u591a\u5f35\u512a\u60e0\u5238<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[27],"tags":[47],"class_list":["post-1073","post","type-post","status-publish","format-standard","hentry","category-hackerskill","tag-logic-vulnerabilities"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/1073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=1073"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/1073\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=1073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=1073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=1073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}