3

记一次渗透之从后台到提权

 3 years ago
source link: https://y4er.com/post/pentest-03-12/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
1 min read

记一次渗透之从后台到提权

2019-03-12

某日朋友发来一个站让搞!搞搞搞!

国外站,翻译的我尴尬证都犯了。

习惯性先发文章看看编辑器上传附件什么的。

四处上传,首先尝试编辑器处上传图片,经验告诉我越low的编辑器越好拿shell。

我错了,白名单+上传重命名,smarteditor编辑器,各种截断尝试,突破不了。

这编辑器无敌。随后发现另外三处均是调用此编辑器上传,暂时换思路。

在已经发布的文章中发现绝对路径

http://xxx.com/download.php?dnfile=20190228_012000_0978115.jpg&file=/home/xxx/webapp/../public_html/upload_dir/board/16887879979878fa23f2.jpg

测试后发现public_html为根目录,决定挖挖注入,万一是root没降权就舒服了。

http://www.xxx.com/?module=xx&action=xx&iPopNo=1&seq_cd=1

经过手动加sqlmap测试,发现后台存在时间盲注,由于国外站点访问不稳定的原因,遂放弃,在后期getshell之后发现用户不是root并且权限死得很,为之庆幸并没有在此处浪费时间。

到此处思路死了。编辑器getshell无解,sql注入getshell卒。还有什么思路呢?

我们之前爆出绝对路径的url访问后发现会自动下载

http://xxx.com/download.php?dnfile=20190228_012000_0978115.jpg&file=/home/xxx/webapp/../public_html/upload_dir/board/16887879979878fa23f2.jpg

存在任意文件下载吗?先构造一下尝试

http://xxx.com/download.php?dnfile=download.php&file=/home/xxx/webapp/../public_html/download.php

bingo!

存在任意文件下载,我们找下数据库配置文件

http://xxx.com/download.php?dnfile=config.php&file=/home/xxx/webapp/../public_html/index.php

index.php一般会引入数据库的config.php

http://www.xxx.com/download.php?dnfile=config.php&file=/home/xxx/webapp/../public_html/../webapp/config.php

数据库配置get!后发现没开3306外链,思路断掉。

在这个时候我重新回头看这个任意文件下载,读一下敏感文件试试?

my.cnf

password被注释掉,无用。

/etc/passwd
/etc/shadow
/etc/profile

没发现有可用信息。

下载apache配置文件

http://www.xxx.com/download.php?dnfile=1.php&file=/usr/local/apache/conf/httpd.conf

惊了!html可以被当作php文件!

于是我去编辑器中尝试上传这几种文件,仍以失败告终。

但是附件的我们还没试!

抓包改后缀,返回文章查看路径

http://www.xxx.com/download.php?dnfile=php.jpg.html&file=/home/xxx/webapp/../public_html/upload_dir/board/13303476456487546a3cd.html
http://www.xxx.com/upload_dir/board/13303476456487546a3cd.html

getshell!

后面的就不说了,提权就是脏牛+bypass disablefunc一条龙,没啥亮点。

本章结束,寡人欲休。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK