GXF: heap buffer overflow in parse_ad_cdp() — unbounded cc_count in CDP cc data section
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Lỗi tràn nằm trong parse_ad_cdp() trong src/lib_ccx/ccx_gxf.c, ở phần dữ liệu cc 0x72, nơi vòng lặp sao chép cc_count * 3 byte mà không kiểm tra số byte còn lại trong cdp. Đọc ccdp_find_data() trong src/lib_ccx/mp4.c để biết phần kiểm tra biên cần làm theo. Hoàn thành nghĩa là gói bị từ chối khi cc_count * 3 vượt quá độ dài còn lại, và tệp tái hiện ASan không còn crash trong khi các CDP đúng định dạng vẫn được parse.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
parse_ad_cdp() in src/lib_ccx/ccx_gxf.c reads a cc_count value straight from a GXF Caption Distribution Packet and then copies cc_count * 3 bytes out of the CDP buffer without checking that those bytes are actually inside the buffer. A crafted GXF file triggers a heap-buffer-overflow (read, and a copy into data->buffer).
Root cause
In the 0x72 (cc data) section handler:
cc_count = *cdp++ & 0x1f; /* 0..31, straight from the file */
debug("cc_count: %d\n", cc_count);
for (int i = 0; i < cc_count * 3; i++) /* up to 93 bytes */
{
data->buffer[data->len + i] = cdp[i]; /* <-- reads past end of cdp */
}
data->len += cc_count * 3;
cdp += cc_count * 3;
The only length check in the function is cdp_length == len on the whole packet (and len >= 11). Nothing ties cc_count * 3 to the number of bytes actually remaining in cdp. With a minimal CDP (len == 11) and cc_count == 0x1f, the loop reads cdp[0..92] from an ~12-byte heap buffer — ~80 bytes past the end.
Interestingly, the sibling CDP parser for MP4 already does this correctly — ccdp_find_data() in src/lib_ccx/mp4.c validates both the discrete cc_count values and that cc_count * 3 <= len before returning. The GXF path simply never got that guard.
Call path
ccx_gxf_get_more_data -> read_packet -> parse_media (ancillary)
-> parse_ad_packet -> parse_ad_field -> parse_ad_pyld -> parse_ad_cdp
Every byte on that path, including cc_count, is attacker-controlled file content.
AddressSanitizer output
==8==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000527c ...
#0 ... in parse_ad_cdp ../src/lib_ccx/ccx_gxf.c:562
SUMMARY: AddressSanitizer: heap-buffer-overflow ../src/lib_ccx/ccx_gxf.c:562 in parse_ad_cdp
Reproduction
A 340-byte GXF file reaches the vulnerable branch. Minimal generator:
# (attached in the PR) builds a MAP packet that registers an ancillary
# track, then a MEDIA ancillary packet whose CDP has a 0x72 section with
# cc_count = 0x1f but only an 11-byte CDP buffer.
ccextractor gxf_ccount.gxf -o out.srt
Built with -fsanitize=address this crashes in parse_ad_cdp. A well-formed CDP (cc_count in {10,20,25,30} with the bytes present) is processed normally and is not affected.
Affected code
src/lib_ccx/ccx_gxf.c, current master (the GXF demuxer is live C — not shadowed by the Rust port).
Fix
Reject the packet when cc_count * 3 exceeds the bytes remaining in the CDP buffer, mirroring the existing mp4.c check. PR follows.
Found while auditing the length/count handling in the container demuxers. Analysis and the ASan reproduction were done with AI assistance; the report and fix were reviewed by me.
- Ngôn ngữ chính
- C
- Star
- 919
- Fork
- 604
- Merge trung bình
- 9 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CCExtractor/ccextractor
-
[BUG] + file-sequence expansion picks the digit in the extension (clip001.mp4+ only processes clip001.mp4)Có thể đã có người làm @imfarhan0105-bits đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
CCExtractor/ccextractor#2478 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] encoders: WebVTT encoder generates invalid ## delimiter and malformed @import violating W3C specificationCó thể đã có người làm @yasar710 đã nhận 7 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
CCExtractor/ccextractor#2465 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GXF: heap buffer overflow in parse_mpeg_packet() — oversized mpeg_pic_size overflows the demuxer bufferCó thể đã có người làm @pranayr710 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
CCExtractor/ccextractor#2500 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] DVB: map-table cases in dvbsub_parse_pixel_data_block read past the object field dataCó thể đã có người làm @pranayr710 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
CCExtractor/ccextractor#2482 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] read_exp_golomb_unsigned panics/aborts on 64 or more leading zero bits (malformed SPS)Có thể đã có người làm @Souravrajvi0 đã nhận 5 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
CCExtractor/ccextractor#2470 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của CCExtractor/ccextractor
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
[TUTORIAL] Docs for Follow ModeĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: services kind: bug preview-effort: small priority: low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Static Analysis failureCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100