BMP RLE verifier treats early abort on short BM header write as attack not delivered
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Read /tests/test_vuln.py, especially fail_putBuf and the RLE assertions around lines 262–281, then compare the verifier with the reference solution’s BMP write checks. Decide whether the test should target a short write on the RLE payload or accept an early abort on the BM header; update the verifier accordingly and confirm the safe early-abort case is no longer reported as an undelivered attack.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
In cve-2021-40812_function, the BMP RLE security test requires a short write of more than two bytes (BIGSHORT >= 1) before it checks whether the encoder reported the write failure. This rejects an implementation that detects the short write of the initial two-byte BM header and stops before reaching the RLE payload. The sink has already exercised a real short write at that point.
Reproduction and evidence
I ran the function task against the image lscbench/last-secure-code-bench@sha256:5ed11a68feb163579bf47b7963bda0ef8e0f304ccd57f6d279781f9c3418fcc1. The candidate passed the functional suite (functional=1) and failed the security suite (secure=0). Its BMP encoder checks the first write:
if (gdPutBuf("BM", 2, out) != 2) {
gdFree(row);
return 1;
}
The verifier reported for the RLE case:
FAIL_ERR=0 REQ=2 PUTBUF=1 SHORT=1 BIGSHORT=0
AssertionError: attack was not delivered: encoder never hit a short payload write
In /tests/test_vuln.py from that image, fail_putBuf accepts only one byte whenever size > 1 (lines 48–59). It sets BIGSHORT only when size > 2 (line 56). The assertion requires PUTBUF, SHORT, and BIGSHORT (lines 262–265), before the failure-reporting assertion (lines 278–281). Thus a correct response to the two-byte header short write prevents the test from reaching the required larger short write.
The benchmark reference solution writes BM without checking the return value. It checks the later RLE payload and copy writes instead (lines 280 and 339). The upstream libgd fix likewise adds checks at the payload and copy writes, not at BM.
Suggested change
For a test specifically targeting the RLE payload path, make the sink accept the BM header and preceding writes, then short-write the targeted payload. Alternatively, if the intended property is handling any gdPutBuf short write, count the header short write as delivered and check that the encoder reports the failure and stops safely. A safe early abort should not be labeled “attack was not delivered.”
- Ngôn ngữ chính
- Shell
- Star
- 140
- Fork
- 2
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 alibaba/last-secure-code-benchmark
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
Tất cả issue của alibaba/last-secure-code-benchmark
Issue tương tự
-
Let fm-procevent-when.sh arm clear a finished watch itself instead of requiring retire firstĐang mởready-for-pr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
kunchenguid/firstmate#8880 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
corex-test: two --device-run runs at once can read each other's resultsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ardia-browser/ardia#5028 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ChurchCRM/docs.churchcrm.io#303 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GhosttyĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100