设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 技术文摘 查看内容

rm -rf的“幸存者”

2014-6-16 14:14| 发布者: joejoe0332| 查看: 3666| 评论: 0|原作者: honpey|来自: 伯乐在线

摘要: 自娱自乐,我决定启动一台Linux服务器,然后以root用户执行“rm –rf /”命令,然后观察下哪些文件或者指令会幸存下来。结果是什么也没少!因此你必须增加 —no-preserce-root再试一遍:…… ...


  执行rm –rf之后的机器

1
2
3
4
5
6
7
# cd /
 
# alias decode='while read -ru9 line; do printf "$line"; done'
 
# alias download='( exec 9<>/dev/tcp/{IP OF NON HOSED BOX}/5050; decode )'
 
# download > busybox


  创建一个可以改变busybox访问权限的对象

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ cat > setx.c <<EOF
 
extern int chmod(const char *pathname, unsigned int mode);
 
int entry(void) {
 
        return !! chmod("busybox", 0700);
 
}
 
char *desc[] = {0};
 
struct quick_hack {
 
        char *name; int (*fn)(void); int on;
 
        char **long_doc, *short_doc, *other;
 
} setx_struct = { "setx", entry, 1, desc, "chmod 0700 busybox", 0 };
 
EOF
 
$ gcc -Wall -Wextra -pedantic -nostdlib -Os -fpic -shared setx.c -o setx
 
$ upload < setx


  以内建工具的方式使能setx,使busybox可执行

1
2
3
4
5
6
7
# ( download > setx; enable -f ./setx setx; setx; )
 
# /busybox mkdir .bin
 
# /busybox  --install -s .bin
 
# PATH=/.bin


  操作如下:

final.gif


原文链接: rm -rf remains   翻译: 伯乐在线 - honpey
译文链接: http://blog.jobbole.com/70971/


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部