{"id":476474,"date":"2023-08-09T07:29:55","date_gmt":"2023-08-09T07:29:55","guid":{"rendered":""},"modified":"2023-09-05T11:12:51","modified_gmt":"2023-09-05T11:12:51","slug":"crlf-injection","status":"publish","type":"wiki","link":"https:\/\/oneproxy.pro\/cn\/wiki\/crlf-injection\/","title":{"rendered":"\u94ec\u6c1f\u6ce8\u5c04\u6db2"},"content":{"rendered":"<p>CRLF \u6ce8\u5165\u662f\u56de\u8f66\u6362\u884c\u6ce8\u5165\u7684\u7f29\u5199\uff0c\u662f Web \u5e94\u7528\u7a0b\u5e8f\u5b89\u5168\u6f0f\u6d1e\u7684\u4e00\u79cd\u5f62\u5f0f\u3002\u6ce8\u5165\u662f\u4e00\u79cd\u4ee3\u7801\u6ce8\u5165\u6280\u672f\uff0c\u6d89\u53ca\u5c06 CRLF \u5e8f\u5217\u6e17\u900f\u5230\u5e94\u7528\u7a0b\u5e8f\u6216\u7f51\u7ad9\u4e2d\u3002\u8fd9\u79cd\u6ce8\u5165\u4e3b\u8981\u5f71\u54cd HTTP \u6807\u5934\uff0c\u5e76\u53ef\u80fd\u5bfc\u81f4\u5404\u79cd\u5a01\u80c1\uff0c\u4f8b\u5982 HTTP \u54cd\u5e94\u62c6\u5206\u3001\u8de8\u7ad9\u70b9\u811a\u672c (XSS) \u7b49\u3002<\/p>\n<h2>CRLF\u6ce8\u5c04\u6db2\u7684\u7531\u6765\u53ca\u5386\u53f2\u80cc\u666f<\/h2>\n<p>\u201cCRLF \u6ce8\u5165\u201d\u4e00\u8bcd\u4e0e HTTP \u534f\u8bae\u672c\u8eab\u4e00\u6837\u53e4\u8001\uff0c\u8d77\u6e90\u4e8e\u4e92\u8054\u7f51\u7684\u65e9\u671f\u3002 CRLF \u5e8f\u5217\uff08\u8868\u793a\u4e3a rn\uff09\u5728\u8bb8\u591a\u7f16\u7a0b\u8bed\u8a00\u4e2d\u7528\u4e8e\u8868\u793a\u6362\u884c\u7b26\uff08\u884c\u5c3e\uff09\u3002\u8fd9\u662f\u6e90\u81ea\u6253\u5b57\u673a\u65f6\u4ee3\uff0c\u5176\u4e2d\u201c\u56de\u8f66\u201d(CR) \u4f1a\u5c06\u8bbe\u5907\u7684\u4f4d\u7f6e\u91cd\u7f6e\u4e3a\u884c\u7684\u5f00\u5934\uff0c\u800c\u201c\u6362\u884c\u201d(LF) \u4f1a\u5c06\u5176\u5411\u4e0b\u79fb\u52a8\u4e00\u884c\u3002<\/p>\n<p>\u9996\u6b21\u63d0\u53ca\u5176\u6ee5\u7528\u6216\u201c\u6ce8\u5165\u201d\u53ef\u4ee5\u8ffd\u6eaf\u5230 20 \u4e16\u7eaa 90 \u5e74\u4ee3\u672b\u548c 2000 \u5e74\u4ee3\u521d\uff0c\u5f53\u65f6 Web \u5e94\u7528\u7a0b\u5e8f\u53d8\u5f97\u66f4\u52a0\u590d\u6742\uff0c\u5e76\u4e14\u5bf9\u5b89\u5168\u6027\u7684\u7406\u89e3\u5f00\u59cb\u53d1\u5c55\u3002<\/p>\n<h2>\u6df1\u5165\u7814\u7a76 CRLF \u6ce8\u5165<\/h2>\n<p>CRLF \u6ce8\u5165\u662f\u5bf9 CRLF \u5e8f\u5217\u7684\u64cd\u7eb5\uff0c\u4ee5\u5229\u7528 Web \u5e94\u7528\u7a0b\u5e8f\u548c\u670d\u52a1\u5668\u5904\u7406\u6570\u636e\u7684\u65b9\u5f0f\u3002\u901a\u8fc7\u6ce8\u5165\u610f\u5916\u7684 CRLF \u5e8f\u5217\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u64cd\u7eb5\u5e94\u7528\u7a0b\u5e8f\u7684\u6570\u636e\u6d41\uff0c\u4ece\u800c\u5bfc\u81f4\u5b89\u5168\u6f0f\u6d1e\u3002<\/p>\n<p>\u5178\u578b\u7684 CRLF \u6ce8\u5165\u653b\u51fb\u53ef\u80fd\u5305\u62ec\u5c06 CRLF \u5e8f\u5217\u6dfb\u52a0\u5230 Web \u5e94\u7528\u7a0b\u5e8f\u7684\u7528\u6237\u8f93\u5165\u5b57\u6bb5\u4e2d\uff0c\u4ee5\u6b3a\u9a97\u5e94\u7528\u7a0b\u5e8f\u8ba4\u4e3a\u65b0\u884c\u5df2\u5f00\u59cb\u3002 HTTP \u6807\u5934\u662f\u4e92\u8054\u7f51\u901a\u4fe1\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\uff0c\u5728 HTTP \u6807\u5934\u4e2d\uff0cCRLF \u6ce8\u5165\u53ef\u80fd\u4f1a\u5bfc\u81f4 HTTP \u54cd\u5e94\u5206\u88c2\uff0c\u6076\u610f\u653b\u51fb\u8005\u53ef\u4ee5\u6b3a\u9a97\u670d\u52a1\u5668\u53d1\u9001\u66f4\u6539\u540e\u7684 HTTP \u54cd\u5e94\uff0c\u4ece\u800c\u5bfc\u81f4\u6f5c\u5728\u7684\u6f0f\u6d1e\u3002<\/p>\n<h2>CRLF\u6ce8\u5c04\u7684\u5185\u90e8\u673a\u5236<\/h2>\n<p>CRLF \u6ce8\u5165\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5c06 CRLF \u5e8f\u5217\u63d2\u5165\u5e94\u7528\u7a0b\u5e8f\u7684\u9884\u671f\u6570\u636e\u6d41\u4e2d\u3002\u901a\u8fc7\u8fd9\u6837\u505a\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u64cd\u7eb5\u7cfb\u7edf\u5c06\u8fd9\u4e9b\u6ce8\u5165\u8bc6\u522b\u4e3a\u5408\u6cd5\u547d\u4ee4\u6216\u6307\u4ee4\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5728 HTTP \u54cd\u5e94\u62c6\u5206\u7684\u60c5\u51b5\u4e0b\uff0c\u653b\u51fb\u8005\u53ef\u80fd\u4f1a\u8f93\u5165\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u5176\u4e2d\u5305\u542b CRLF \u5e8f\u5217\uff0c\u540e\u8ddf\u9644\u52a0\u7684 HTTP \u6807\u5934\u6216\u5185\u5bb9\u3002\u8fd9\u4f7f\u5f97\u5e94\u7528\u7a0b\u5e8f\u8ba4\u4e3a\u6807\u5934\u5df2\u7ecf\u7ed3\u675f\u5e76\u4e14\u65b0\u7684\u6807\u5934\u5df2\u7ecf\u5f00\u59cb\uff0c\u4ece\u800c\u5141\u8bb8\u653b\u51fb\u8005\u63a7\u5236HTTP\u54cd\u5e94\u7684\u54cd\u5e94\u6807\u5934\u3002<\/p>\n<h2>CRLF\u6ce8\u5c04\u7684\u4e3b\u8981\u7279\u70b9<\/h2>\n<p>CRLF\u6ce8\u5165\u653b\u51fb\u7684\u4e3b\u8981\u7279\u5f81\u5305\u62ec\uff1a<\/p>\n<ol>\n<li>\n<p>CRLF \u5e8f\u5217\u7684\u64cd\u4f5c\uff1aCRLF \u6ce8\u5165\u7684\u4e3b\u8981\u7279\u5f81\u662f\u5c06 CRLF \u5e8f\u5217\u610f\u5916\u6dfb\u52a0\u5230\u7528\u6237\u8f93\u5165\u5b57\u6bb5\u6216 HTTP \u6807\u5934\u4e2d\u3002<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u6570\u636e\u6d41\u7684\u5f71\u54cd\uff1a\u6ce8\u5165\u7684 CRLF \u5e8f\u5217\u53ef\u4ee5\u64cd\u7eb5\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6570\u636e\u6d41\uff0c\u4ece\u800c\u5bfc\u81f4\u6f5c\u5728\u7684\u6f0f\u6d1e\u3002<\/p>\n<\/li>\n<li>\n<p>\u5f71\u54cd\u8303\u56f4\uff1a\u8be5\u6f0f\u6d1e\u4e0d\u4ec5\u5f71\u54cd\u53d1\u751f\u6ce8\u5165\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u8fd8\u5f71\u54cd\u4e0b\u6e38\u5904\u7406\u76f8\u540c\u6570\u636e\u7684\u4efb\u4f55\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>CRLF\u6ce8\u5c04\u7684\u7c7b\u578b<\/h2>\n<p>CRLF \u6ce8\u5165\u4e3b\u8981\u6709\u4e24\u79cd\u7c7b\u578b\uff1a<\/p>\n<ol>\n<li>\n<p><strong>HTTP \u54cd\u5e94\u62c6\u5206<\/strong>\uff1a\u8fd9\u662f\u6700\u5e38\u89c1\u7684\u7c7b\u578b\uff0c\u5176\u4e2d CRLF \u5e8f\u5217\u88ab\u6ce8\u5165\u5230 HTTP \u6807\u5934\u4e2d\u4ee5\u64cd\u7eb5\u6216\u62c6\u5206 HTTP \u54cd\u5e94\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u65e5\u5fd7\u6ce8\u5165<\/strong>\uff1a\u5728\u8fd9\u79cd\u7c7b\u578b\u4e2d\uff0c\u6ce8\u5165\u88ab\u5199\u5165\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002\u653b\u51fb\u8005\u53ef\u4ee5\u901a\u8fc7\u4f2a\u9020\u65e5\u5fd7\u6761\u76ee\u6216\u63d2\u5165\u6076\u610f\u5185\u5bb9\u6765\u5229\u7528\u6b64\u6f0f\u6d1e\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>CRLF \u6ce8\u5165\u7684\u5e94\u7528\u3001\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6848<\/h2>\n<p>CRLF \u6ce8\u5165\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u88ab\u6076\u610f\u4f7f\u7528\uff0c\u5305\u62ec\u52ab\u6301\u7528\u6237\u4f1a\u8bdd\u3001\u7a83\u53d6\u7528\u6237\u6570\u636e\u4ee5\u53ca\u8bf1\u9a97\u7528\u6237\u6267\u884c\u6076\u610f\u811a\u672c\u3002<\/p>\n<p>\u9632\u6b62 CRLF \u6ce8\u5165\u653b\u51fb\u6d89\u53ca\u8f93\u5165\u9a8c\u8bc1\u548c\u6e05\u7406\u3002\u901a\u8fc7\u9650\u5236\u7528\u6237\u8f93\u5165\u5b57\u6bb5\u4e2d\u53ef\u63a5\u53d7\u7684\u5b57\u7b26\u7c7b\u578b\u5e76\u68c0\u67e5 HTTP \u6807\u5934\u662f\u5426\u5b58\u5728\u610f\u5916\u7684 CRLF \u5e8f\u5217\uff0c\u60a8\u53ef\u4ee5\u9632\u6b62\u6f5c\u5728\u7684 CRLF \u6ce8\u5165\u3002<\/p>\n<h2>\u4e0e\u7c7b\u4f3c\u672f\u8bed\u7684\u6bd4\u8f83<\/h2>\n<p>\u867d\u7136 CRLF \u6ce8\u5165\u4e3b\u8981\u5904\u7406\u6e17\u900f CRLF \u5e8f\u5217\uff0c\u4f46\u5176\u4ed6\u76f8\u5173\u7684\u6ce8\u5165\u653b\u51fb\u5305\u62ec\uff1a<\/p>\n<ol>\n<li>\n<p><strong>SQL\u6ce8\u5165<\/strong>\uff1a\u8fd9\u6d89\u53ca\u5411\u5e94\u7528\u7a0b\u5e8f\u6ce8\u5165\u6076\u610f SQL \u4ee3\u7801\uff0c\u53ef\u80fd\u5bfc\u81f4\u672a\u7ecf\u6388\u6743\u7684\u8bbf\u95ee\u3001\u6570\u636e\u635f\u574f\u6216\u6570\u636e\u76d7\u7a83\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u8de8\u7ad9\u811a\u672c (XSS)<\/strong>\uff1a\u6b64\u7c7b\u653b\u51fb\u5c06\u6076\u610f\u811a\u672c\u6ce8\u5165\u53d7\u4fe1\u4efb\u7684\u7f51\u7ad9\uff0c\u7136\u540e\u7531\u53d7\u5bb3\u8005\u7684\u6d4f\u89c8\u5668\u6267\u884c\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u547d\u4ee4\u6ce8\u5165<\/strong>\uff1a\u8fd9\u662f\u4e00\u79cd\u653b\u51fb\u65b9\u6cd5\uff0c\u653b\u51fb\u8005\u901a\u8fc7\u66f4\u6539\u5e94\u7528\u7a0b\u5e8f\u7684 dill \u6570\u636e\u8f93\u5165\u6765\u5b9e\u73b0\u4efb\u610f\u547d\u4ee4\u6267\u884c\u3002<\/p>\n<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>CRLF\u6ce8\u5c04<\/th>\n<th>SQL\u6ce8\u5165<\/th>\n<th>\u8de8\u7ad9\u811a\u672c<\/th>\n<th>\u547d\u4ee4\u6ce8\u5165<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u4e3b\u8981\u76ee\u6807<\/td>\n<td>HTTP \u6807\u5934\u548c\u7528\u6237\u8f93\u5165<\/td>\n<td>\u6570\u636e\u5e93\u67e5\u8be2<\/td>\n<td>\u7f51\u7ad9\u7684\u5ba2\u6237\u7aef\u811a\u672c<\/td>\n<td>\u5e94\u7528\u7a0b\u5e8f\u7684\u4e3b\u673a\u547d\u4ee4 shell<\/td>\n<\/tr>\n<tr>\n<td>\u9884\u9632<\/td>\n<td>\u8f93\u5165\u9a8c\u8bc1\u548c\u6e05\u7406<\/td>\n<td>\u4f7f\u7528\u51c6\u5907\u597d\u7684\u8bed\u53e5\u6216\u53c2\u6570\u5316\u67e5\u8be2<\/td>\n<td>\u8f93\u5165\u9a8c\u8bc1\u3001\u8f93\u51fa\u7f16\u7801\u3001\u4ec5 HTTP cookie<\/td>\n<td>\u8f93\u5165\u9a8c\u8bc1\u3001\u4f7f\u7528\u5b89\u5168 API<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u672a\u6765\u524d\u666f\u548c\u6280\u672f<\/h2>\n<p>\u672a\u6765\uff0c\u5bf9\u81ea\u52a8\u5316\u5b89\u5168\u5de5\u5177\u548c\u57fa\u4e8e AI \u7684\u6f0f\u6d1e\u68c0\u6d4b\u7cfb\u7edf\u7684\u65e5\u76ca\u4f9d\u8d56\u5e94\u8be5\u4f1a\u6539\u5584\u5bf9 CRLF \u6ce8\u5165\u653b\u51fb\u7684\u68c0\u6d4b\u548c\u9884\u9632\u3002\u6b64\u5916\uff0c\u5b89\u5168\u7f16\u7801\u5b9e\u8df5\u548c\u6ce8\u5165\u653b\u51fb\u6559\u80b2\u6709\u671b\u5728\u5f00\u53d1\u793e\u533a\u4e2d\u53d8\u5f97\u66f4\u52a0\u666e\u904d\uff0c\u4ece\u800c\u8fdb\u4e00\u6b65\u964d\u4f4e\u8fd9\u79cd\u98ce\u9669\u3002<\/p>\n<h2>CRLF \u6ce8\u5165\u548c\u4ee3\u7406\u670d\u52a1\u5668<\/h2>\n<p>\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u4f8b\u5982 OneProxy \u63d0\u4f9b\u7684\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u5728\u9632\u6b62 CRLF \u6ce8\u5165\u653b\u51fb\u65b9\u9762\u53d1\u6325\u4f5c\u7528\u3002\u901a\u8fc7\u68c0\u67e5\u4f20\u5165\u548c\u4f20\u51fa\u6570\u636e\u662f\u5426\u5b58\u5728\u53ef\u7591\u6a21\u5f0f\uff0c\u4ee3\u7406\u670d\u52a1\u5668\u53ef\u4ee5\u8bc6\u522b\u6f5c\u5728\u7684\u6ce8\u5165\u5c1d\u8bd5\u3002\u9ad8\u7ea7\u4ee3\u7406\u670d\u52a1\u5668\u8fd8\u53ef\u4ee5\u5728\u5c06\u6570\u636e\u8f6c\u53d1\u5230\u76ee\u6807\u670d\u52a1\u5668\u4e4b\u524d\u5bf9\u5176\u8fdb\u884c\u6e05\u7406\uff0c\u4ece\u800c\u589e\u52a0\u989d\u5916\u7684\u5b89\u5168\u5c42\u3002<\/p>\n<h2>\u76f8\u5173\u94fe\u63a5<\/h2>\n<p>\u5173\u4e8eCRLF\u6ce8\u5165\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u8d44\u6e90\uff1a<\/p>\n<ul>\n<li><a href=\"https:\/\/owasp.org\/www-community\/attacks\/CRLF_Injection\" target=\"_new\" rel=\"noopener nofollow\">OWASP CRLF \u6ce8\u5165<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/Security\/Securing_your_site\/Http_splitting\" target=\"_new\" rel=\"noopener nofollow\">MDN Web \u6587\u6863\uff1aHTTP \u54cd\u5e94\u62c6\u5206<\/a><\/li>\n<li><a href=\"https:\/\/www.acunetix.com\/websitesecurity\/crlf-injection\/\" target=\"_new\" rel=\"noopener nofollow\">Web \u5e94\u7528\u7a0b\u5e8f\u5b89\u5168\u6307\u5357\uff1aCRLF \u6ce8\u5165<\/a><\/li>\n<li><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/93.html\" target=\"_new\" rel=\"noopener nofollow\">CWE \u2013 CWE-93\uff1aCRLF \u5e8f\u5217\u7684\u4e0d\u6b63\u786e\u4e2d\u548c<\/a><\/li>\n<\/ul>","protected":false},"featured_media":476475,"menu_order":0,"template":"","meta":{"_acf_changed":false,"content-type":"","inline_featured_image":false,"footnotes":""},"class_list":["post-476474","wiki","type-wiki","status-publish","has-post-thumbnail","hentry"],"acf":{"faq_title":"Frequently Asked Questions about <mark>Understanding CRLF Injection<\/mark>","faq_items":[{"question":"What is a CRLF Injection?","answer":"<p>A CRLF Injection is a type of security vulnerability where an attacker infiltrates Carriage Return Line Feed (CRLF) sequences into a web application. This infiltration primarily affects HTTP headers and can lead to various threats such as HTTP Response Splitting and Cross-Site Scripting.<\/p>"},{"question":"When was CRLF Injection first discovered?","answer":"<p>The term 'CRLF Injection' originated from the early days of the internet, as old as the HTTP protocol itself. Its misuse, or \"injection,\" started being recognized as a threat to web application security in the late 1990s and early 2000s.<\/p>"},{"question":"How does a CRLF Injection work?","answer":"<p>A CRLF Injection works by inserting CRLF sequences into an application's expected data stream. By doing this, the attacker can manipulate the system into recognizing these injections as legitimate commands or directives. This can lead to manipulated data flow and potential security vulnerabilities.<\/p>"},{"question":"What are the types of CRLF Injection?","answer":"<p>The two main types of CRLF injections are HTTP Response Splitting, where CRLF sequences are injected into HTTP headers to manipulate the HTTP response, and Log Injection, where the injection is made into log files, potentially forging log entries or inserting malicious content.<\/p>"},{"question":"How can we prevent CRLF Injection attacks?","answer":"<p>CRLF injection attacks can be prevented by implementing input validation and sanitization. This involves limiting the types of characters that can be accepted in user input fields and inspecting HTTP headers for unexpected CRLF sequences.<\/p>"},{"question":"How does CRLF Injection compare with other similar attacks?","answer":"<p>CRLF Injection involves infiltrating CRLF sequences, primarily affecting HTTP headers and user inputs. SQL Injection involves the injection of malicious SQL code, targeting database queries. Cross-Site Scripting involves the injection of malicious scripts into trusted websites, affecting client-side scripts. Command Injection is where an attacker alters dill data inputs to an application to achieve arbitrary command execution, targeting the application's host command shell.<\/p>"},{"question":"How are proxy servers related to CRLF Injection?","answer":"<p>Proxy servers, like OneProxy, can help prevent CRLF Injection attacks. They scrutinize incoming and outgoing data for suspicious patterns, identifying potential injection attempts. Some advanced proxy servers can also sanitize the data before forwarding it to the target server, adding an extra layer of security.<\/p>"}]},"_links":{"self":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/wiki\/476474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/wiki"}],"about":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/types\/wiki"}],"version-history":[{"count":0,"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/wiki\/476474\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/media\/476475"}],"wp:attachment":[{"href":"https:\/\/oneproxy.pro\/cn\/wp-json\/wp\/v2\/media?parent=476474"}],"curies":[{"name":"\u53ef\u6e7f\u6027\u7c89\u5242","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}