CVE-2024-44236:Apple macOS远程代码执行漏洞
2025年5月7日 | Trend Micro研究团队
在Trend Vulnerability Research Service漏洞报告的摘录中,Trend™研究团队的Nikolai Skliarenko和Yazhi Wang详细介绍了Apple macOS操作系统中一个最近已修补的代码执行漏洞。该漏洞最初由Trend™ Zero Day Initiative的Hossein Lotfi发现。成功利用可能导致在目标机器上以运行进程的上下文执行任意代码。以下是他们关于CVE-2024-44236的报告部分,经过少量最小修改。
漏洞概述
macOS中报告了一个越界写入漏洞。该漏洞是由于对“lutAToBType”和“lutBToAType”标签类型缺乏适当验证所致。远程攻击者可以通过诱骗受害者打开特制文件来利用此漏洞。成功的攻击可能导致在受害者机器上以运行进程的上下文执行代码。
漏洞详情
Scriptable Image Processing System (sips)是macOS中包含的终端实用程序,允许用户验证、编辑和打印有关ICC配置文件和图像的信息。
ICC(国际色彩联盟)配置文件是一组数据,根据ICC的标准描述颜色输入或输出设备或颜色空间。每个捕获或显示颜色的设备都可以有自己的配置文件。
ICC配置文件文件由Header、Tag Table和标记元素数据组成:
1
2
3
4
5
6
|
Offset Size Name
--------------------------------------------------
0x00 128 Header
0x80 4 Count of tags (n)
0x84 n*12 Tag Table
variable variable Tagged element data
|
Header具有以下格式:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
Offset Size Name
---------------------------------------------------
0x00 4 Profile size
0x04 4 Preffered CMM Type
0x08 4 Profile version number
0x0C 4 Profile/Device class
0x10 4 Color space of data
0x14 4 PCS
0x18 12 Creation date and time
0x24 4 Profile signature \x61\x63\x73\x70
0x28 4 Primary platform
0x2C 4 Profile flags
0x30 4 Device manufactorer
0x34 4 Device model
0x38 8 Device attributes
0x40 4 Rendering Intent
0x44 12 nCIEXYZ values
0x50 4 Profile creator
0x54 16 Profile ID
0x64 28 Reserved
|
Tag Table由多个Individual Tag Structures组成,格式如下:
1
2
3
4
5
|
Offset Size Name
----------------------------------------------------
0x00 4 Tag signature
0x04 4 Offset to tag data
0x08 4 Tag data size
|
标记元素数据位于Tag Table之后。每个数据结构以4字节签名开头,后跟特定于标签类型的数据。与漏洞相关的两个标签类型是lutAToBType和lutBToAType。这两种类型都使用类似的格式存储数据:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
Offset Size Name
--------------------------------------------------------------
0x00 4 Signature \x6d\x42\x41\x20 or \x6d\x41\x42\x20
0x04 4 Reserved
0x08 1 Number of input channels
0x09 1 Number of output channels
0x0A 2 Padding
0x0C 4 Offset to first "B" curve
0x10 4 Offset to matrix
0x14 4 Offset to first "M" curve
0x18 4 Offset to CLUT
0x1C 4 Offset to first "A" curve
0x20 var Data
|
偏移量相对于标记元素数据的开头。签名"\x6d\x42\x41\x20"用于lutBToAType,签名"\x6d\x41\x42\x20"用于lutAToBType。
函数sub_1000194D0()处理这些结构。从“Offset to CLUT”字段的值开始的16个字节被检查。如果字节的索引大于“Number of input channels”字段的值,并且该字节的值不为空,则将其更改为零。由于对“Offset to CLUT”字段值的验证不足,可以将偏移量设置为等于标记元素数据的总长度。这将导致函数读取并可能修改堆分配缓冲区末尾之后最多16字节的内存。
远程攻击者可以通过制作恶意的ICC配置文件文件并诱骗受害者使用易受攻击版本的sips工具处理它来利用此漏洞。成功利用可能导致在目标用户的安全上下文中执行任意代码。
源代码分析
以下代码片段取自macOS 15.0.1的sips版本sips-307。Trend Research添加的注释已高亮显示。
在sub_1000194D0()中:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Get CLUT Offset value from tag data
CLUT_offset = v11->CLUT_offset;
if ( !CLUT_offset )
goto LABEL_95;
_CLUT_offset = bswap32(CLUT_offset);
// The vulnerable line is located here
// The vulnerability will be triggered if _CLUT_offset is
// equal to length of tag data
if ( _CLUT_offset > Length )
goto LABEL_93;
input_channel = 0LL;
// Get pointer to CLUT data
// It will point past the end of the buffer if the vulnerability got triggered
CLUT_data_ptr = &MutableBytePtr[_CLUT_offset];
// Get the number of input channels from the header
number_of_input_channels = (unsigned __int8)v11->n_in_channels;
do
{
// if the number of input channels < 16 this branch will be taken
if ( input_channel >= number_of_input_channels )
{
// Possible out-of-bounds read
if ( CLUT_data_ptr[input_channel] )
{
// Change the value of the byte to 0 if it is not 0
// Out-of-bounds write is triggered here
CLUT_data_ptr[input_channel] = 0;
error_flags |= 1u;
v17 |= 1u;
}
}
else if ( !CLUT_data_ptr[input_channel] )
{
error_flags |= GridpointsValueNotCorrect;
}
++input_channel;
}
while ( input_channel != 16 );
// Possible out-of-bounds read
v44 = CLUT_data_ptr[16];
if ( (unsigned int)(v44 - 1) >= 2 )
error_flags |= TableEntrySizeNotValid;
if ( CLUT_data_ptr[17] || CLUT_data_ptr[18] || CLUT_data_ptr[19] )
{
// Another location that may cause out-of-bounds write
// if the vulnerability was triggered
CLUT_data_ptr[19] = 0;
*(_WORD *)(CLUT_data_ptr + 17) = 0;
error_flags |= ReservedFieldNotZero;
v17 |= 1u;
}
|
检测指南
要检测利用此漏洞的攻击,检测设备必须监视和解析可用于传递利用此漏洞的攻击的端口上的流量。这些包括以下端口和服务:
- FTP,通过端口20/TCP、21/TCP
- HTTP,通过端口80/TCP
- HTTPS,通过端口443/TCP
- IMAP,通过端口143/TCP
- NFS,通过端口2049/TCP、2049/UDP、111/TCP、111/UDP
- POP3,通过端口110/TCP
- SMB/CIFS,通过端口139/TCP、445/TCP
- SMTP,通过端口25/TCP
检测设备必须监视ICC配置文件文件的传输。如果发现此类文件传输,检测设备必须检查其内容。检测设备应验证Header中的Profile signature字段是否等于以下字节字符串"\x61\x63\x73\x70"。如果找到,检测设备应获取Count of tags值并计算Tag Table的大小。之后,必须处理Tag Table中的Individual Tag Structures。对于每个结构,必须检查位于从文件开头开始的Offset to tag data处的标记元素数据。如果数据以"\x6d\x42\x41\x20"或"\x6d\x41\x42\x20"开头,则必须检查Offset to CLUT字段的值。如果它等于相应Individual Tag Structure中的Tag data size字段,则应认为流量可疑;可能正在进行利用此漏洞的攻击。
注意:
结论
供应商已于10月修补了此漏洞。迄今为止,尚未在野外检测到攻击。Apple没有提供针对此错误的任何缓解措施,因此建议应用供应商补丁以完全解决此问题。
特别感谢Trend研究团队的Nikolai Skliarenko和Yazhi Wang对此漏洞提供了如此详尽的分析。有关Trend Research服务的概述,请访问http://go.trendmicro.com/tis/。
威胁研究团队将在未来带来其他优秀的漏洞分析报告。在此之前,请在Twitter、Mastodon、LinkedIn或Bluesky上关注团队,以获取有关漏洞利用技术和安全补丁的最新信息。