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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2024-32830-poc — 使用CVE-2024-32830下载文件的PoC代码 | Kitploit
工具/GitHubGitHub/ptrstr/cve-2024-32830-poc
Payload生成漏洞分析代码分析漏洞利用Web应用程序漏洞利用
GitHubptrstr/cve-2024-32830-poc

CVE-2024-32830-poc

使用CVE-2024-32830下载文件的PoC代码

查看仓库
21年前尚未审核

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2024-32830-poc

PoC 代码,用于利用 CVE-2024-32830 下载文件

getimagesize 绕过

要绕过 getimagesize 的限制,我们可以为 PHP 创建一个简单的 image/vnd.wap.wbmp 图像。

文件类型的检查非常简单:

root@kitploit:~
// https://github.com/php/php-src/blob/0029d2b08bbd3cb3aa293d9c8d55bf31faa9e203/ext/standard/image.c#L917
static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check)
{
	int i, width = 0, height = 0;

	if (php_stream_rewind(stream)) {
		return 0;
	}

	/* get type */
	if (php_stream_getc(stream) != 0) {
		return 0;
	}

	/* skip header */
	do {
		i = php_stream_getc(stream);
		if (i < 0) {
			return 0;
		}
	} while (i & 0x80);

	/* get width */
	do {
		i = php_stream_getc(stream);
		if (i < 0) {
			return 0;
		}
		width = (width << 7) | (i & 0x7f);
		/* maximum valid width for wbmp (although 127 may be a more accurate one) */
		if (width > 2048) {
			return 0;
		}
	} while (i & 0x80);

	/* get height */
	do {
		i = php_stream_getc(stream);
		if (i < 0) {
			return 0;
		}
		height = (height << 7) | (i & 0x7f);
		/* maximum valid height for wbmp (although 127 may be a more accurate one) */
		if (height > 2048) {
			return 0;
		}
	} while (i & 0x80);

	if (!height || !width) {
		return 0;
	}

	if (!check) {
		(*result)->width = width;
		(*result)->height = height;
	}

	return IMAGE_FILETYPE_WBMP;
}

构造有效图像的最简单方法是使用两个 NUL 字节,后跟两个 < 0x80 字节分别表示宽度和高度。

使用 php://filter 可以为任何文件实现这一点。

第一层需要应用 base64 编码,以确保所有数据都是 ASCII,从而满足 < 0x80 的约束。

第二层过滤器需要添加前两个 NUL 字节。这可以通过强制从 UTF-16BE 转换为 UTF-32BE 来实现。这将迫使 iconv 将每两个字节的块解释为有效的 UTF-16BE 字符,然后在其前添加两个 NUL 字节以使其成为 UTF-32BE。实际要使用的过滤器是:convert.iconv.utf-16be.utf-32be。

我们最终的有效载荷是 php://filter/convert.base64-encode/convert.iconv.utf-16be.utf-32be/resource=<file here>。

下载工具