靶机介绍
THIS IS A MACHINE FOR COMPLETE BEGINNER , THERE ARE THREE FALGS AVAILABLE IN THIS VM. FROM THIS VMs YOU WILL LEARN ABOUT ENCODER-DECODER & EXPLOIT-DB.
环境介绍
该靶机是 OVA 格式的,使用虚拟机导入即可,此处我是用 Virtualbox,版本为 6.1.10,靶机可知是 linux 系统。
信息收集
在打开虚拟机之前,我将虚拟机的网卡设置为 HostOnly 网络,靶机可以通过 DHCP 自动获得 IP 地址。
那么第一件事情便是得到靶机的 IP 了,能使用的工具有很多,这里我使用 fping,该指令通过 ICMP Echo Request 来进行发现,使用以下指令可以扫描指定网段的存活主机:
1
|
fping -asg 192.168.56.0/24
|
结果会显示存活的主机的 IP,以及最后的统计信息。这里我得到的靶机地址为 192.168.56.106。
接下来就直接暴力扫描端口加服务了,祭上 nmap 即可:
1
|
nmap -sV -sC -p- 192.168.56.106
|
这里 -p- 即全 TCP 端口扫描,-sV 为服务识别,-sC 为使用默认的脚本扫描。扫描的结果如下图:

可见靶机只开放了两个端口,上面跑的服务正是 SSH 和 Apache。浏览网页:

页面并没有什么有用的信息,查看源代码,注释中存在一个用户名 itsskv。我在此步陷入了僵局,由于缺乏 web 相关的知识而一度不知道要干什么。无奈查阅相关的资料,顺便问了问做 web 的小伙伴。
扫 web 目录,好像很有道理,以后还要好好学习。这里我使用 dirb 这个工具:
1
|
dirb http://192.168.56.106
|
扫描的结果如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-----------------
DIRB v2.22
By The Dark Raver
-----------------
START_TIME: Sat Jul 25 15:30:55 2020
URL_BASE: http://192.168.56.106/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://192.168.56.106/ ----
+ http://192.168.56.106/cgi-bin/ (CODE:403|SIZE:290)
+ http://192.168.56.106/hacker (CODE:200|SIZE:3757743)
+ http://192.168.56.106/index (CODE:200|SIZE:2333)
+ http://192.168.56.106/index.html (CODE:200|SIZE:2333)
+ http://192.168.56.106/robots (CODE:200|SIZE:79)
+ http://192.168.56.106/robots.txt (CODE:200|SIZE:79)
+ http://192.168.56.106/server-status (CODE:403|SIZE:295)
-----------------
END_TIME: Sat Jul 25 15:30:56 2020
DOWNLOADED: 4612 - FOUND: 7
|
其中 robots 和 robots.txt 内容相同,为一串数字字母的组合:
1
|
R29vZCBXb3JrICEKRmxhZzE6IGN5YmVyc3Bsb2l0e3lvdXR1YmUuY29tL2MvY3liZXJzcGxvaXR9
|
明显是 Base64 编码的结果,使用 rax2 -D 得到原文:
1
2
3
|
rax2 -D R29vZCBXb3JrICEKRmxhZzE6IGN5YmVyc3Bsb2l0e3lvdXR1YmUuY29tL2MvY3liZXJzcGxvaXR9
Good Work !
Flag1: cybersploit{youtube.com/c/cybersploit}
|
结合之前得到的用户名,将 flag1 作为密码可以 SSH 登陆到系统,在用户的根目录下可以得到 flag2.txt,是一个由二进制数字构成的文件:
1
|
01100111 01101111 01101111 01100100 00100000 01110111 01101111 01110010 01101011 00100000 00100001 00001010 01100110 01101100 01100001 01100111 00110010 00111010 00100000 01100011 01111001 01100010 01100101 01110010 01110011 01110000 01101100 01101111 01101001 01110100 01111011 01101000 01110100 01110100 01110000 01110011 00111010 01110100 00101110 01101101 01100101 00101111 01100011 01111001 01100010 01100101 01110010 01110011 01110000 01101100 01101111 01101001 01110100 00110001 01111101
|
使用 XX在线工具 转换成 ASCII:
1
|
good work ! flag2: cybersploit{https:t.me/cybersploit1}
|
权限提升
至此已经拿到了两个 flag,题目中介绍一共有 3 个 flag。查看 /etc/passwd 文件可以发现系统中还有一个用户 cybersploit (UID为1000),尝试使用 flag2 登陆失败。继续收集信息,查看系统版本和内核版本,可知靶机运行着 Ubuntu 12.04.5 LTS,内核版本为 3.13.0-32-generic。系统版本十分旧,直接考虑内核提权。使用 searchsploit 命令搜索 exploit-db:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
searchsploit linux kernel 3.13
---------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Exploit Title | Path
---------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Linux Kernel (Solaris 10 / < 5.10 138888-01) - Local Privilege Escalation | solaris/local/15962.c
Linux Kernel 3.11 < 4.8 0 - 'SO_SNDBUFFORCE' / 'SO_RCVBUFFORCE' Local Privilege Escalation | linux/local/41995.c
Linux Kernel 3.13 - SGID Privilege Escalation | linux/local/33824.c
Linux Kernel 3.13.0 < 3.19 (Ubuntu 12.04/14.04/14.10/15.04) - 'overlayfs' Local Privilege Escalation | linux/local/37292.c
Linux Kernel 3.13.0 < 3.19 (Ubuntu 12.04/14.04/14.10/15.04) - 'overlayfs' Local Privilege Escalation (Access /etc/shadow) | linux/local/37293.txt
Linux Kernel 3.13.1 - 'Recvmmsg' Local Privilege Escalation (Metasploit) | linux/local/40503.rb
Linux Kernel 3.13/3.14 (Ubuntu) - 'splice()' System Call Local Denial of Service | linux/dos/36743.c
Linux Kernel 3.14-rc1 < 3.15-rc4 (x64) - Raw Mode PTY Echo Race Condition Privilege Escalation | linux_x86-64/local/33516.c
Linux Kernel 3.4 < 3.13.2 (Ubuntu 13.04/13.10 x64) - 'CONFIG_X86_X32=y' Local Privilege Escalation (3) | linux_x86-64/local/31347.c
Linux Kernel 3.4 < 3.13.2 (Ubuntu 13.10) - 'CONFIG_X86_X32' Arbitrary Write (2) | linux/local/31346.c
Linux Kernel 3.4 < 3.13.2 - recvmmsg x32 compat (PoC) | linux/dos/31305.c
Linux Kernel 4.10.5 / < 4.14.3 (Ubuntu) - DCCP Socket Use-After-Free | linux/dos/43234.c
Linux Kernel 4.8.0 UDEV < 232 - Local Privilege Escalation | linux/local/41886.c
Linux Kernel < 3.16.1 - 'Remount FUSE' Local Privilege Escalation | linux/local/34923.c
Linux Kernel < 3.16.39 (Debian 8 x64) - 'inotfiy' Local Privilege Escalation | linux/local/44302.c
Linux Kernel < 4.10.13 - 'keyctl_set_reqkey_keyring' Local Denial of Service | linux/dos/42136.c
Linux kernel < 4.10.15 - Race Condition Privilege Escalation | linux/local/43345.c
Linux Kernel < 4.11.8 - 'mq_notify: double sock_put()' Local Privilege Escalation | linux/local/45553.c
Linux Kernel < 4.13.1 - BlueTooth Buffer Overflow (PoC) | linux/dos/42762.txt
Linux Kernel < 4.13.9 (Ubuntu 16.04 / Fedora 27) - Local Privilege Escalation | linux/local/45010.c
Linux Kernel < 4.14.rc3 - Local Denial of Service | linux/dos/42932.c
Linux Kernel < 4.15.4 - 'show_floppy' KASLR Address Leak | linux/local/44325.c
Linux Kernel < 4.16.11 - 'ext4_read_inline_data()' Memory Corruption | linux/dos/44832.txt
Linux Kernel < 4.17-rc1 - 'AF_LLC' Double Free | linux/dos/44579.c
Linux Kernel < 4.4.0-116 (Ubuntu 16.04.4) - Local Privilege Escalation | linux/local/44298.c
Linux Kernel < 4.4.0-21 (Ubuntu 16.04 x64) - 'netfilter target_offset' Local Privilege Escalation | linux/local/44300.c
Linux Kernel < 4.4.0-83 / < 4.8.0-58 (Ubuntu 14.04/16.04) - Local Privilege Escalation (KASLR / SMEP) | linux/local/43418.c
Linux Kernel < 4.4.0/ < 4.8.0 (Ubuntu 14.04/16.04 / Linux Mint 17/18 / Zorin) - Local Privilege Escalation (KASLR / SMEP) | linux/local/47169.c
Linux Kernel < 4.5.1 - Off-By-One (PoC) | linux/dos/44301.c
---------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results
|
这里我使用 overlayfs,将文件上传到靶机中,编译运行,直接获得 root 权限:

在 /root 目录下面有最终的 flag 文件 finalflag.txt:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
______ ____ ____ .______ _______ .______ _______..______ __ ______ __ .___________.
/ |\ \ / / | _ \ | ____|| _ \ / || _ \ | | / __ \ | | | |
| ,----' \ \/ / | |_) | | |__ | |_) | | (----`| |_) | | | | | | | | | `---| |----`
| | \_ _/ | _ < | __| | / \ \ | ___/ | | | | | | | | | |
| `----. | | | |_) | | |____ | |\ \----.----) | | | | `----.| `--' | | | | |
\______| |__| |______/ |_______|| _| `._____|_______/ | _| |_______| \______/ |__| |__|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( c | o | n | g | r | a | t | u | l | a | t | i | o | n | s )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
flag3: cybersploit{Z3X21CW42C4 many many congratulations !}
if you like it share with me https://twitter.com/cybersploit1.
Thanks !
|