{"id":2560,"date":"2015-11-26T13:52:05","date_gmt":"2015-11-26T05:52:05","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2560"},"modified":"2015-11-26T13:52:05","modified_gmt":"2015-11-26T05:52:05","slug":"linux%e7%b3%bb%e7%bb%9f%e4%b8%8a%e7%9a%84%e5%8f%af%e6%89%a7%e8%a1%8c%e6%96%87%e4%bb%b6%e5%8a%a8%e6%80%81%e5%ba%93","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2560.html","title":{"rendered":"Linux\u7cfb\u7edf\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\/\u52a8\u6001\u5e93"},"content":{"rendered":"<p>=Start=<\/p>\n<h4 id=\"Linux\u7cfb\u7edf\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\/\u52a8\u6001\u5e93-\u7f18\u7531\">\u7f18\u7531<\/h4>\n<p>\u5f53\u521d\u5b66\u4e60\u300aUNIX\u73af\u5883\u9ad8\u7ea7\u7f16\u7a0b\u300b\u7684\u65f6\u5019\u4e0d\u8ba4\u771f\uff0c\u73b0\u5728\u53ea\u597d\u6162\u6162\u6765\u8fd8\u4e4b\u524d\u6b20\u4e0b\u7684\u6280\u672f\u503a\u3002\u4e0b\u9762\u7684\u5185\u5bb9\u4e3b\u8981\u6458\u6284\u81ea\u767e\u5ea6\u8fd0\u7ef4\u56e2\u961f\u7684\u535a\u5ba2\u6587\u7ae0\uff1a<a href=\"http:\/\/op.baidu.com\/2014\/07\/%E7%8E%B0%E4%BB%A3nix%E7%9A%84%E8%BF%9B%E7%A8%8B%E4%B8%8Eshell\/\" target=\"_blank\">\u73b0\u4ee3 *NIX \u7684\u8fdb\u7a0b\u4e0e shell<\/a>\uff0c\u6839\u636e\u81ea\u5df1\u7684\u5b66\u4e60\u548c\u7406\u89e3\u7a0b\u5ea6\u6709\u90e8\u5206\u5220\u51cf\u3002<\/p>\n<h4 id=\"Linux\u7cfb\u7edf\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\/\u52a8\u6001\u5e93-\u5185\u5bb9\">\u5185\u5bb9<\/h4>\n<p>\u73b0\u5728 *nix \u7cfb\u7edf\u7684\u8fdb\u7a0b\u8fd0\u884c\u673a\u5236\u90fd\u6bd4\u8f83\u7c7b\u4f3c\uff0c99.9% \u7684\u7cfb\u7edf\u90fd\u5df2\u7ecf\u4f7f\u7528 ELF \u683c\u5f0f\u4f5c\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u683c\u5f0f\uff0ca.out \u683c\u5f0f\u5df2\u7ecf\u57fa\u672c\u6dd8\u6c70\u3002\u6b64\u5916 parser \u7684\u5f62\u5f0f\u4e5f\u88ab\u51e0\u4e4e\u6240\u6709\u7cfb\u7edf\u652f\u6301\uff0c\u5373\u6587\u4ef6\u5934\u90e8\u5199 #!\/some\/parser \u7684\u811a\u672c\u3002\u4ee5\u4e0b\u5168\u6587\u90fd\u4ee5\u8fd9\u4e24\u79cd\u60c5\u51b5\u5c55\u5f00\uff0c\u4e0d\u8003\u8651\u5386\u53f2\u6216\u8005\u6781\u7279\u6b8a\u7cfb\u7edf\u3002<\/p>\n<h5 id=\"Linux\u7cfb\u7edf\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\/\u52a8\u6001\u5e93-1.\u4ec0\u4e48\u662f\u53ef\u6267\u884c\u6587\u4ef6\">1.\u4ec0\u4e48\u662f\u53ef\u6267\u884c\u6587\u4ef6<\/h5>\n<p><span style=\"color: #ff0000;\">\u4e00\u4e2a\u6587\u4ef6\u53ef\u4ee5\u88ab\u6267\u884c\u7684\u610f\u601d\u662f\u8fd9\u4e2a\u6587\u4ef6\u4e0d\u9700\u8981\u5916\u754c\u9a71\u52a8\uff0c\u800c<strong>\u53ef\u4ee5\u76f4\u63a5\u4f5c\u4e3a execve(2) \u7684\u7b2c\u4e00\u53c2\u6570<\/strong>\u3002<\/span>\u4e0e\u4e4b\u76f8\u53cd\u7684\u5c31\u662f\u4e0d\u80fd\u88ab execve(2) \u76f4\u63a5\u4f5c\u4e3a\u7b2c\u4e00\u53c2\u6570\uff0c\u800c\u5fc5\u987b\u5728\u7b2c\u4e8c\u53c2\u6570\u4e2d\u4f5c\u4e3a\u53c2\u6570\u4f20\u7ed9\u7b2c\u4e00\u53c2\u6570\u6307\u5b9a\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<br \/>\n\u5bf9\u4e8e ELF \u7cfb\u7edf\u800c\u8a00\uff0c\u53ea\u6709 ELF \u683c\u5f0f\u7684\u6587\u4ef6\u662f\u53ef\u6267\u884c\u7684\u3002\u4e00\u4e2a ELF \u6587\u4ef6\u8fd8\u9700\u8981\u5728\u6587\u4ef6\u7cfb\u7edf\u4e0a\u5177\u5907\u6267\u884c\u6743\u9650\uff0c\u5426\u5219\u4e5f\u65e0\u6cd5\u4f5c\u4e3a\u7b2c\u4e00\u53c2\u6570\u3002ELF \u6587\u4ef6\u662f\u5426\u53ef\u4ee5\u88ab\u6267\u884c\u53d6\u51b3\u4e8e ELF \u6587\u4ef6\u81ea\u8eab\u662f\u5426\u662f\u53ef\u6267\u884c\u7684\uff0c\u4f8b\u5982 so \u6216\u8005 detached debug symbols \u4e5f\u662f ELF\uff0c\u4f46\u662f\uff0899.9%\uff09\u4e0d\u80fd\u88ab\u6267\u884c\u3002\u5b58\u5728\u6781\u5c11\u91cf\u7279\u5236\u7684 so \u53ef\u4ee5\u88ab\u6267\u884c\uff0c\u4f8b\u5982 libc.so \uff0c\u662f\u7279\u6b8a\u7684 ELF \u7ed3\u6784\u3002ELF \u7684\u683c\u5f0f\u3001\u7ed3\u6784\u4e0d\u5728\u672c\u6587\u7684\u8ba8\u8bba\u5f53\u4e2d\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u5927\u91cf\u975e ELF \u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u4f8b\u5982\u811a\u672c\uff0c\u662f\u4e0d\u80fd\u88ab\u64cd\u4f5c\u7cfb\u7edf\u8f7d\u5165\u5e76\u542f\u52a8\u7684\u3002\u4f46\u662f\u811a\u672c\u6587\u4ef6\u53ef\u4ee5\u4f5c\u4e3a execve(2) \u7684\u7b2c\u4e00\u53c2\u6570\uff0c\u539f\u56e0\u662f parser \u4f53\u7cfb\u3002<\/strong><\/span>\u811a\u672c\u89e3\u6790\u5668\u662f\u89e3\u8bfb\u811a\u672c\u5e76\u4e14\u6267\u884c\u64cd\u4f5c\u7684 ELF \u6587\u4ef6\uff0c\u4f8b\u5982\u5e38\u89c1\u7684 shell \u811a\u672c\uff0c\u540e\u7f00\u540d\u4e3a .sh \u7684\uff0c\u4ed6\u4eec\u53ef\u4ee5\u901a\u8fc7 sh script.sh \u6765\u8fd0\u884c\u3002\u8fd9\u4e2a\u9053\u7406\u5f88\u7b80\u5355\uff0csh \u662f ELF \u6587\u4ef6\uff0cscript.sh \u88ab\u4f5c\u4e3a\u300c\u6570\u636e\u300d\u4f20\u9012\u7ed9\u4e86 sh \u8fdb\u884c\u89e3\u8bfb\u3002\u4e3a\u4e86\u65b9\u4fbf\u8fd9\u4e00\u7c7b\u60c5\u51b5\uff08\u8fd9\u4e2a\u60c5\u51b5\u5360\u4e86\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5927\u591a\u6570\uff09\uff0c\u64cd\u4f5c\u7cfb\u7edf\u89c4\u5b9a\u4e86\u81ea\u52a8\u8c03\u7528 parser \u7684\u683c\u5f0f\uff1a<\/p>\n<p>#!\/some\/elf\/file -param1 -param2<br \/>\nscript line 1<br \/>\nscript line 2<br \/>\n&#8230;<\/p>\n<p>\u7b2c\u4e00\u884c\u9876\u683c\u5199 #! \u8868\u793a\u8fd9\u4e2a\u6587\u4ef6\u9700\u8981 parser \u652f\u6301\uff0cexecve(2) \u4f1a\u53bb\u8bfb\u53d6\u7b2c\u4e00\u884c\u7684\u5185\u5bb9\uff08\u4e3a\u4e86\u9632\u6b62\u6ea2\u51fa\uff0c\u901a\u5e38\u7b2c\u4e00\u884c\u53ea\u4f1a\u53bb\u8bfb 80 \u4e2a\u5b57\u8282\uff09\uff0c\u7136\u540e\u628a\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u4f5c\u4e3a\u7b2c\u4e00\u53c2\u6570\uff0c\u91cd\u65b0\u4f20\u7ed9 execve(2) \u6267\u884c\uff0c\u7b2c\u4e00\u884c\u7684\u5176\u4ed6\u53c2\u6570\u4f1a\u5b8c\u6574\u586b\u5145\u5230 argv[1] \u4e2d\uff0c\u7136\u540e\u547d\u4ee4\u884c\u4e0a\u4f20\u6765\u7684 argv \u88ab\u91cd\u65b0\u6620\u5c04\u5230\u65b0\u7684\u4f4d\u7f6e\u3002\u6b64\u65f6\uff0c\u7531\u4e8e argv \u6570\u7ec4\u7684\u4f53\u79ef\u589e\u52a0\uff0c\u6709\u53ef\u80fd\u672c\u6765\u6ca1\u6709\u8d85\u8fc7\u53c2\u6570\u6570\u7ec4\u4e0a\u9650\u7684\u547d\u4ee4\u73b0\u5728\u8d85\u8fc7\u4e86\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4e0d\u4f1a\u9012\u5f52\uff0c\u5373\u5982\u679c parser \u5b57\u7b26\u4e32\u7ed9\u51fa\u7684\u4e0d\u662f ELF \u683c\u5f0f\uff0c\u90a3\u5c31\u4e0d\u4f1a\u518d\u627e\u4e0b\u53bb\u4e86\u3002<\/p>\n<p>\u4f8b\u5982\u4ee5\u4e0b\u6587\u4ef6(a.awk)\uff1a<\/p>\n<pre class=\"lang:default decode:true\">#!\/usr\/bin\/awk -f\n{ print $1 }<\/pre>\n<p>shell \u6267\u884c\uff1a<\/p>\n<pre class=\"lang:default decode:true\">.\/a.awk hello world<\/pre>\n<p>shell \u8c03\u7528\uff1a<\/p>\n<pre class=\"lang:default decode:true\">execve(\".\/a.awk\", [\"hello\", \"world\", NULL], environ)<\/pre>\n<p>\u64cd\u4f5c\u7cfb\u7edf\u53d1\u73b0 a.awk \u9700\u8981 parser \u64cd\u4f5c\u7cfb\u7edf\u8c03\u7528\uff1a<\/p>\n<pre class=\"lang:default decode:true\">execve(\"\/usr\/bin\/awk\", [\"-f\", \".\/a.awk\", \"hello\", \"world\", NULL], environ)<\/pre>\n<p>\u6b64\u65f6\u7684\u5b9e\u9645\u6548\u679c\u5c31\u53d8\u6210\u4e86\uff1a<\/p>\n<pre class=\"lang:default decode:true\">\/usr\/bin\/awk -f .\/a.awk hello world<\/pre>\n<p>\u6240\u8c13\u7684\u5b8c\u6574\u586b\u5145\uff1a<\/p>\n<pre class=\"lang:default decode:true\">#!\/some\/elf\/file -param1 -param2<\/pre>\n<p>\u6267\u884c.\/a.out xxx yyy \u4f1a\u53d8\u6210<\/p>\n<pre class=\"lang:default decode:true\">execve(\"\/some\/elf\/file\", [\"-param1 -param2\", \".\/a\", \"xxx\", \"yyy\", NULL], environ)<\/pre>\n<p>\u5373\u9664\u4e86\u7b2c\u4e00\u53c2\u6570\uff0c\u540e\u9762\u6240\u6709\u7684\u5185\u5bb9\u90fd\u662f\u76f4\u63a5\u586b\u8fdb argv[1] \u7684\u3002<\/p>\n<p>\u6ce8\u610f\u8fd9\u4e2a\u8fc7\u7a0b\u7528\u6237\u6001\u53ef\u80fd\u53ef\u89c1\uff08\u4f8b\u5982\u6709\u4e9b shell \u4f1a\u624b\u5de5\u5b8c\u6210\u8fd9\u4e2a\u8fc7\u7a0b\u800c\u4e0d\u662f\u4f9d\u9760\u64cd\u4f5c\u7cfb\u7edf\uff09\uff0c\u6b64\u5916\u8fd9\u4e2a\u8fc7\u7a0b\u4e0e\u6269\u5c55\u540d\u65e0\u5173\uff0c\u8fd9\u4e0e DOS\/Windows \u4e0d\u540c\uff08\u9664\u975e shell \u505a\u4e86\u4ec0\u4e48\u8be1\u5f02\u7684\u4e8b\uff09\uff0c\u4f8b\u5982 sh a.awk \u662f\u5b8c\u5168\u5408\u6cd5\u7684\uff0c\u5982\u679c a.awk \u5185\u5bb9\u5176\u5b9e\u662f shell \u811a\u672c\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u6ca1\u6709\u5199 parser \u5934\u7684\u6587\u4ef6\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4ee5 ELF \u6587\u4ef6\u53c2\u6570\u7684\u5f62\u5f0f\u542f\u52a8\uff0c\u6b64\u65f6\u751a\u81f3\u4e0d\u9700\u8981\u811a\u672c\u6587\u4ef6\u81ea\u8eab\u6709\u53ef\u6267\u884c\u6743\u9650\uff0c\u4e5f\u4e0d\u4f9d\u8d56 ${PATH}\u5c55\u5f00\u3002 \u4f8b\u5982\uff1a<\/p>\n<pre class=\"lang:default decode:true\">$ sh script.sh<\/pre>\n<p><span style=\"font-size: 18px; font-weight: bold;\">2.\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b9a\u4f4d<\/span><\/p>\n<p>*nix \u7cfb\u7edf\u6ca1\u6709\u201c\u5185\u90e8\u547d\u4ee4\u201d\u7684\u6982\u5ff5\uff0c\u8fd9\u4e0e DOS\/Windows \u4e0d\u540c\u3002\u4f8b\u5982\u5e73\u65f6\u6267\u884c\u7684 ls\uff0c\u5b9e\u9645\u4e0a\u662f \/bin\/ls\uff0c\u6216\u8005\u5176\u4ed6\u90e8\u7f72\u5728\u78c1\u76d8\u4e0a\u7684\u6587\u4ef6\u3002\u5b58\u5728\u6240\u8c13\u7684\u5185\u90e8\u547d\u4ee4\uff0c\u4f8b\u5982 cd \u5c31\u5728\u78c1\u76d8\u4e0a\u627e\u4e0d\u5230\uff0c\u4f46\u662f\u8fd9\u4e2a\u5185\u90e8\u547d\u4ee4\u5e76\u4e0d\u662f\u7531\u64cd\u4f5c\u7cfb\u7edf\u6267\u884c\u7684\uff0c\u800c\u662f shell \u81ea\u5df1\u5185\u90e8\u5904\u7406\u7684\uff0c\u56e0\u6b64\u53ef\u4ee5\u8ba4\u4e3a *nix \u7684\u5185\u90e8\u547d\u4ee4\u5c31\u662f shell \u7684\u5185\u5efa\u547d\u4ee4\u3002<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u78c1\u76d8\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u64cd\u4f5c\u7cfb\u7edf\u9700\u8981\u7ed9\u51fa\u5176\u7edd\u5bf9\u8def\u5f84\uff0c\u6216\u8005\u76f8\u5bf9\u8def\u5f84\uff0c\u4f46\u662f\u4e0d\u80fd\u6ca1\u6709\u8def\u5f84\u3002\u4f8b\u5982\u4ee5\u4e0b\u60c5\u51b5\u90fd\u662f\u5408\u6cd5\u7684\uff1a<\/p>\n<pre class=\"lang:default decode:true\">execve(\"\/bin\/ls\", [\"ls\", NULL], environ)\nexecve(\"..\/ls\", [\"ls\", NULL], environ)<\/pre>\n<p>\u4f46\u662f\u4ee5\u4e0b\u662f\u975e\u6cd5\u7684\uff1a<\/p>\n<pre class=\"lang:default decode:true\">execve(\"ls\", [\"ls\", NULL], environ)<\/pre>\n<p>\u4e0d\u5e26\u8def\u5f84\u7684\u53ef\u6267\u884c\u6587\u4ef6\u9700\u8981\u7531 shell \u8fdb\u884c\u89e3\u6790\uff0c\u89e3\u6790\u7ed3\u679c\u4f1a\u53d8\u6210\u5e26\u8def\u5f84\u7684\u5f62\u5f0f\uff0c\u64cd\u4f5c\u7cfb\u7edf\u624d\u4f1a\u63a5\u53d7\uff0c\u5176\u4f9d\u636e\u4e00\u822c\u4e3a ${PATH}\u73af\u5883\u53d8\u91cf\u3002\u5982\u679c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u6ca1\u6709\u8bbe\u7f6e\uff08\u4e0d\u662f\u4e3a\u7a7a\uff09\uff0c\u5219 shell \u901a\u5e38\u4f1a\u5185\u90e8\u4f7f\u7528\u56fa\u5b9a\u7684\u503c\u3002\u8fd9\u4e2a\u503c\u901a\u5e38\u4f1a\u5305\u542b \/bin \u6216\u8005 \/usr\/bin \u7b49\u5e38\u7528 FHS \u8def\u5f84\u3002\u5bf9\u4e8e\u5927\u90e8\u5206 shell \u6765\u8bf4\uff0c\u8fd9\u4e2a\u503c\u4e0d\u4e00\u5b9a\u5728\u73af\u5883\u53d8\u91cf\u4e0a\u5f97\u5230\u4f53\u73b0\uff0c\u4f8b\u5982\u8fd9\u6837\u542f\u52a8\u4e00\u4e2a bash\uff1a<\/p>\n<pre class=\"lang:default decode:true\">env -i \/bin\/bash --norc<\/pre>\n<p>\u6b64\u65f6\u53ef\u4ee5\u901a\u8fc7 env \u5de5\u5177\u770b\u51fa\u73af\u5883\u53d8\u91cf\u4e2d\u6ca1\u6709 ${PATH}\uff0c\u4f46\u662f set \u5185\u5efa\u547d\u4ee4\u4f1a\u7ed9\u51fa\u5b9e\u9645\u751f\u6548\u7684\u503c\u3002\u548c DOS\/Windows \u4e0d\u540c\u7684\u662f\uff0cDOS\/Windows \u6ca1\u6709\u5185\u90e8\u53d8\u91cf\uff0c\u4e00\u5207\u90fd\u662f\u73af\u5883\u53d8\u91cf\uff0c\u5e76\u4e14\u4e0d\u7ba1 %PATH% \u53d6\u503c\u5982\u4f55\uff0c\u5f53\u524d\u8def\u5f84\uff08\u5373 .\uff09\u4e00\u5b9a\u662f\u5728\u751f\u6548\u8def\u5f84\u7684\u9996\u4f4d\u3002<\/p>\n<p>\u4e3a\u4e86\u65b9\u4fbf\u8fd9\u7c7b\u60c5\u51b5\uff08\u4e5f\u662f\u5360\u4e86\u5927\u591a\u6570\uff09\uff0clibc \u63d0\u4f9b\u4e86\u82e5\u5e72 exec(3) \u5bb6\u65cf\u51fd\u6570\uff0c\u7528\u4e8e execve(2) \u7684\u5c01\u88c5\u3002\u4f8b\u5982 execlp(3) \u6216\u8005 execvp(3)\u3002<\/p>\n<h5 id=\"Linux\u7cfb\u7edf\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\/\u52a8\u6001\u5e93-3.\u52a8\u6001\u5e93\u7684\u5b9a\u4f4d\">3.\u52a8\u6001\u5e93\u7684\u5b9a\u4f4d<\/h5>\n<p>\u8fd9\u4e00\u8282\u7684\u5185\u5bb9\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u53bb\u770b\u4e00\u770b\u5173\u4e8e \/lib\/ld-linux.so.2 \u6216\u8005 \/lib64\/ld-linux-x86-64.so.2 \u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4ee5\u53ca\u5176\u914d\u7f6e\u6587\u4ef6 \/etc\/ld.so.conf \u5916\u52a0\u73af\u5883\u53d8\u91cf LD_LIBRARY_PATH \u4ee5\u53ca LD_PRELOAD \u7b49\u3002\u719f\u7ec3\u4f7f\u7528 ldd(1)\u3001readelf(1) \u4ee5\u53ca ld-linux.so.2 \u4f1a\u7ed9\u4f60\u5f88\u591a\u6df1\u5165\u7684\u7406\u89e3\u3002<\/p>\n<p>==<\/p>\n<h6>LD_LIBRARY_PATH<\/h6>\n<ul>\n<li><a class=\"external-link\" href=\"http:\/\/blog.chinaunix.net\/uid-354915-id-3568853.html\" target=\"_blank\" rel=\"nofollow\">http:\/\/blog.chinaunix.net\/uid-354915-id-3568853.html<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/blog.csdn.net\/wangeen\/article\/details\/8159500\" target=\"_blank\" rel=\"nofollow\">http:\/\/blog.csdn.net\/wangeen\/article\/details\/8159500<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/tldp.org\/HOWTO\/Program-Library-HOWTO\/shared-libraries.html\" target=\"_blank\" rel=\"nofollow\">http:\/\/tldp.org\/HOWTO\/Program-Library-HOWTO\/shared-libraries.html<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/www.ituring.com.cn\/article\/22101\" target=\"_blank\" rel=\"nofollow\">http:\/\/www.ituring.com.cn\/article\/22101<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/unix.stackexchange.com\/questions\/tagged\/environment-variables?sort=votes&amp;pagesize=50\" target=\"_blank\" rel=\"nofollow\">http:\/\/unix.stackexchange.com\/questions\/tagged\/environment-variables?sort=votes&amp;pagesize=50<\/a><\/li>\n<\/ul>\n<h6>LD_PRELOAD<\/h6>\n<ul>\n<li><a class=\"external-link\" href=\"http:\/\/stackoverflow.com\/questions\/426230\/what-is-the-ld-preload-trick\" target=\"_blank\" rel=\"nofollow\">http:\/\/stackoverflow.com\/questions\/426230\/what-is-the-ld-preload-trick<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/hbprotoss.github.io\/posts\/li-yong-ld_preloadjin-xing-hook.html\" target=\"_blank\" rel=\"nofollow\">http:\/\/hbprotoss.github.io\/posts\/li-yong-ld_preloadjin-xing-hook.html<\/a><\/li>\n<li><a class=\"external-link\" href=\"https:\/\/www.exploit-db.com\/papers\/13233\/\" target=\"_blank\" rel=\"nofollow\">https:\/\/www.exploit-db.com\/papers\/13233\/<\/a><\/li>\n<li><a class=\"external-link\" href=\"https:\/\/www.exploit-db.com\/papers\/37606\/\" target=\"_blank\" rel=\"nofollow\">https:\/\/www.exploit-db.com\/papers\/37606\/<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">$ cd ~\/download_s\/exploit-database-2015-10-28\n$ .\/searchsploit \"ld_\"<\/pre>\n<p>==<\/p>\n<p>ldd<br \/>\nldconfig<br \/>\n<span style=\"color: #ff0000;\"><strong>strace<\/strong><\/span><br \/>\n\/proc\/$pid\/maps<br \/>\nobjdump<br \/>\nreadelf<br \/>\nlsof<br \/>\nnm<br \/>\nstrings<br \/>\nstrip<br \/>\npldd<br \/>\npmap<\/p>\n<p>==<\/p>\n<h5 id=\"Linux\u7cfb\u7edf\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\/\u52a8\u6001\u5e93-\u53c2\u8003\u94fe\u63a5\">\u53c2\u8003\u94fe\u63a5<\/h5>\n<ul>\n<li><a class=\"external-link\" href=\"http:\/\/op.baidu.com\/2014\/07\/%E7%8E%B0%E4%BB%A3nix%E7%9A%84%E8%BF%9B%E7%A8%8B%E4%B8%8Eshell\/\" target=\"_blank\" rel=\"nofollow\">\u73b0\u4ee3 *NIX \u7684\u8fdb\u7a0b\u4e0e shell<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/tldp.org\/HOWTO\/Program-Library-HOWTO\/shared-libraries.html\" target=\"_blank\" rel=\"nofollow\">http:\/\/tldp.org\/HOWTO\/Program-Library-HOWTO\/shared-libraries.html<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/www.ituring.com.cn\/article\/22101\" target=\"_blank\" rel=\"nofollow\">\u4e3a\u4ec0\u4e48\u8bf4LD_LIBRARY_PATH\u4e0d\u597d<\/a><\/li>\n<\/ul>\n<p>=EOF=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531 \u5f53\u521d\u5b66\u4e60\u300aUNIX\u73af\u5883\u9ad8\u7ea7\u7f16\u7a0b\u300b\u7684\u65f6\u5019\u4e0d\u8ba4\u771f\uff0c\u73b0\u5728\u53ea\u597d\u6162\u6162\u6765\u8fd8\u4e4b\u524d\u6b20\u4e0b\u7684\u6280\u672f\u503a\u3002\u4e0b\u9762\u7684\u5185 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11],"tags":[573,574,65],"class_list":["post-2560","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","tag-ld_library_path","tag-ld_preload","tag-shell"],"views":7176,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2560"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2560\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}