BMP RLE verifier treats early abort on short BM header write as attack not delivered
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.”
- Lingua principale
- Shell
- Stelle
- 140
- Fork
- 2
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di alibaba/last-secure-code-benchmark
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
Tutte le issue di alibaba/last-secure-code-benchmark
Issue simili
-
ready-for-pr
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kunchenguid/firstmate#8880 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
corex-test: two --device-run runs at once can read each other's resultsForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ardia-browser/ardia#5028 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ChurchCRM/docs.churchcrm.io#303 ·
I maintainer di solito rispondono entro 1 giorno
-
GhosttyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100