{"id":6985,"date":"2024-11-14T12:21:21","date_gmt":"2024-11-14T04:21:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6985\/"},"modified":"2024-11-14T12:21:21","modified_gmt":"2024-11-14T04:21:21","slug":"mysql-%e8%af%ad%e5%8f%a5%e4%b8%ad%e7%9a%8411%ef%bc%9a%e5%ae%83%e7%9c%9f%e7%9a%84%e4%bc%9a%e5%bd%b1%e5%93%8d%e6%80%a7%e8%83%bd%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6985\/","title":{"rendered":"MySQL \u8bed\u53e5\u4e2d\u7684\u201c1=1\u201d\uff1a\u5b83\u771f\u7684\u4f1a\u5f71\u54cd\u6027\u80fd\u5417\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173025108310615.jpg\" class=\"aligncenter\" title=\"MySQL \u8bed\u53e5\u4e2d\u7684\u201c1=1\u201d\uff1a\u5b83\u771f\u7684\u4f1a\u5f71\u54cd\u6027\u80fd\u5417\uff1f\u63d2\u56fe\" alt=\"MySQL \u8bed\u53e5\u4e2d\u7684\u201c1=1\u201d\uff1a\u5b83\u771f\u7684\u4f1a\u5f71\u54cd\u6027\u80fd\u5417\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u8bed\u53e5\u4e2d 1=1 \u7684\u7528\u6cd5\u63a2\u79d8<\/strong><\/p>\n<p>\u5728 mysql \u8bed\u53e5\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u770b\u5230\u7c7b\u4f3c\u4e8e &#8220;where 1=1 and \u6761\u4ef6a&#8221; \u7684\u5199\u6cd5\u3002\u8fd9\u79cd\u505a\u6cd5\u65e8\u5728\u89c4\u907f\u67d0\u4e9b\u6f5c\u5728\u7684 sql \u9519\u8bef\u3002<\/p>\n<p><strong>\u539f\u56e0\u89e3\u6790\uff1a<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u9632\u6b62\u6761\u4ef6\u5224\u65ad\u9519\u8bef\uff1a<\/strong><\/p>\n<p>\u5f53\u6761\u4ef6 a \u5305\u542b\u590d\u6742\u8868\u8fbe\u5f0f\u6216\u5b50\u67e5\u8be2\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u5224\u65ad\u9519\u8bef\u7684\u60c5\u51b5\u3002\u6dfb\u52a0 &#8220;1=1&#8221; \u786e\u4fdd where \u5b50\u53e5\u59cb\u7ec8\u4e3a\u771f\uff0c\u4ece\u800c\u907f\u514d\u9519\u8bef\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5bb9\u9519\u7a7a\u503c\u53c2\u6570\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u6761\u4ef6 a \u63a5\u6536\u7a7a\u503c\u53c2\u6570\uff0c\u90a3\u4e48\u5728\u6ca1\u6709 &#8220;1=1&#8221; \u7684\u60c5\u51b5\u4e0b\uff0csql \u8bed\u53e5\u5c06\u4e0d\u6267\u884c\u3002\u56e0\u4e3a\u7a7a\u503c\u4e0e\u4efb\u4f55\u503c\u90fd\u4e0d\u76f8\u7b49\uff0c\u5bfc\u81f4 where \u5b50\u53e5\u4e3a\u5047\u3002\u6dfb\u52a0 &#8220;1=1&#8221; \u4f7f\u5f97 where \u5b50\u53e5\u603b\u662f\u4e3a\u771f\uff0c\u5373\u4f7f\u6761\u4ef6 a \u4e3a\u7a7a\u3002<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u6027\u80fd\u5f71\u54cd\uff1a<\/strong><\/p>\n<p>\u6709\u4e9b\u4eba\u62c5\u5fc3 &#8220;1=1&#8221; \u4f1a\u5f71\u54cd sql \u67e5\u8be2\u6027\u80fd\u3002\u7136\u800c\uff0c\u6d4b\u8bd5\u8868\u660e\uff0c\u5b83\u4e0d\u4f1a\u5f71\u54cd\u6267\u884c\u8ba1\u5212\u3002\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4f1a\u4f18\u5316 sql \u8bed\u53e5\uff0c\u5ffd\u7565\u59cb\u7ec8\u4e3a\u771f\u7684\u6761\u4ef6\u3002<\/p>\n<p><strong>\u6700\u4f73\u5b9e\u8df5\uff1a<\/strong><\/p>\n<p>\u63a8\u8350\u5728\u52a8\u6001 sql \u4e2d\u52a0\u5165 &#8220;1=1&#8243;\uff0c\u4ee5\u4fbf\u5728\u4e0d\u540c\u7684\u6761\u4ef6\u4e0b\u786e\u4fdd sql \u8bed\u53e5\u7684\u8bed\u6cd5\u6b63\u786e\u6027\u3002\u4f46\u662f\uff0c\u4e0d\u8981\u8fc7\u5ea6\u4f9d\u8d56\u5b83\u3002<\/p>\n<p>\u5f53\u6761\u4ef6\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u65f6\uff0c\u4ecd\u7136\u8003\u8651\u5c06\u6761\u4ef6\u6dfb\u52a0\u5230 where \u5b50\u53e5\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u5f00\u9500\uff1a<\/p>\n<pre>WHERE 1=1\nAND IF(A IS NOT NULL, A = '\u503c', 1=1)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u8bed\u53e5\u4e2d\u7684\u201c1=1\u201d\uff1a\u5b83\u771f\u7684\u4f1a\u5f71\u54cd\u6027\u80fd\u5417\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bed\u53e5\u4e2d 1=1 \u7684\u7528\u6cd5\u63a2\u79d8 \u5728 mysql \u8bed\u53e5\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u770b\u5230\u7c7b\u4f3c\u4e8e &#8220;where 1=1 and \u6761\u4ef6a&#8221; \u7684\u5199\u6cd5\u3002\u8fd9\u79cd\u505a\u6cd5\u65e8\u5728\u89c4\u907f\u67d0\u4e9b\u6f5c\u5728\u7684 sql \u9519\u8bef\u3002 \u539f\u56e0\u89e3\u6790\uff1a \u9632\u6b62\u6761\u4ef6\u5224\u65ad\u9519\u8bef\uff1a \u5f53\u6761\u4ef6 a \u5305\u542b\u590d\u6742\u8868\u8fbe\u5f0f\u6216\u5b50\u67e5\u8be2\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u5224\u65ad\u9519\u8bef\u7684\u60c5\u51b5\u3002\u6dfb\u52a0 &#8220;1=1&#8221; \u786e\u4fdd where \u5b50\u53e5\u59cb\u7ec8\u4e3a\u771f\uff0c\u4ece\u800c\u907f\u514d\u9519\u8bef\u3002 \u5bb9\u9519\u7a7a\u503c\u53c2\u6570\uff1a \u5982\u679c\u6761\u4ef6 a \u63a5\u6536\u7a7a\u503c\u53c2\u6570\uff0c\u90a3\u4e48\u5728\u6ca1\u6709 &#8220;1=1&#8221; \u7684\u60c5\u51b5\u4e0b\uff0csql \u8bed\u53e5\u5c06\u4e0d\u6267\u884c\u3002\u56e0\u4e3a\u7a7a\u503c\u4e0e\u4efb\u4f55\u503c\u90fd\u4e0d\u76f8\u7b49\uff0c\u5bfc\u81f4 where \u5b50\u53e5\u4e3a\u5047\u3002\u6dfb\u52a0 &#8220;1=1&#8221; \u4f7f\u5f97 where \u5b50\u53e5\u603b\u662f\u4e3a\u771f\uff0c\u5373\u4f7f\u6761\u4ef6 a \u4e3a\u7a7a\u3002 \u6027\u80fd\u5f71\u54cd\uff1a \u6709\u4e9b\u4eba\u62c5\u5fc3 &#8220;1=1&#8221; \u4f1a\u5f71\u54cd sql \u67e5\u8be2\u6027\u80fd\u3002\u7136\u800c\uff0c\u6d4b\u8bd5\u8868\u660e\uff0c\u5b83\u4e0d\u4f1a\u5f71\u54cd\u6267\u884c\u8ba1\u5212\u3002\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4f1a\u4f18\u5316 sql \u8bed\u53e5\uff0c\u5ffd\u7565\u59cb\u7ec8\u4e3a\u771f\u7684\u6761\u4ef6\u3002 \u6700\u4f73\u5b9e\u8df5\uff1a \u63a8\u8350\u5728\u52a8\u6001 sql \u4e2d\u52a0\u5165 &#8220;1=1&#8243;\uff0c\u4ee5\u4fbf\u5728\u4e0d\u540c\u7684\u6761\u4ef6\u4e0b\u786e\u4fdd sql \u8bed\u53e5\u7684\u8bed\u6cd5\u6b63\u786e\u6027\u3002\u4f46\u662f\uff0c\u4e0d\u8981\u8fc7\u5ea6\u4f9d\u8d56\u5b83\u3002 \u5f53\u6761\u4ef6\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u65f6\uff0c\u4ecd\u7136\u8003\u8651\u5c06\u6761\u4ef6\u6dfb\u52a0\u5230 where \u5b50\u53e5\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u5f00\u9500\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6985","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6985"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6985\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}