You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reason: The string s comes straight from argv, so there is no enforcement that the %s conversion fits into the progorder array in the opj_poc_t struct. A malicious user can supply a progression order longer than 4 bytes, which results in a buffer overflow after the sscanf call.
Reproducing the attack:
./opj_jp3d_compress -P T0=1,2,3,4,5,aaaaa
Here we can use any string that fits the format specifications in the sscanf call, and include a progression order of length 5 to overflow the progorder buffer.
On my machine (ec2 t2-micro), using 3000 a's results in a segmentation fault.
Proposed mitigation:
Use the maximum field width specifier to limit the number of characters written to POC[numpocs].progorder to 4, i.e.,
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", ...
The text was updated successfully, but these errors were encountered:
A buffer overflow is possible in
opj_jp3d_compress
when using the-P
option.Vulnerable Code:
opj_jp3d_compress.c:parse_cmdline_encoder
Reason: The string
s
comes straight fromargv
, so there is no enforcement that the%s
conversion fits into theprogorder
array in theopj_poc_t
struct. A malicious user can supply a progression order longer than 4 bytes, which results in a buffer overflow after thesscanf
call.Reproducing the attack:
Here we can use any string that fits the format specifications in the
sscanf
call, and include a progression order of length 5 to overflow theprogorder
buffer.On my machine (ec2 t2-micro), using 3000 a's results in a segmentation fault.
Proposed mitigation:
Use the maximum field width specifier to limit the number of characters written to
POC[numpocs].progorder
to 4, i.e.,The text was updated successfully, but these errors were encountered: