[ 
https://issues.apache.org/jira/browse/IMAGING-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17433238#comment-17433238
 ] 

Bruno P. Kinoshita commented on IMAGING-307:
--------------------------------------------

Hi [~aditya7777]

>From what I recall, that check might have been added to fix a security bug. 
>The blocks are read from the image file, following the image specification, 
>and the image metadata.

An attacker could craft an image with metadata that informs the reader that it 
has a block much larger than the memory, causing an out of memory, or some 
other bug like an infinite loop (these are used for attacks like D/DOS).

I think the possible fixes would be:
 # fix the images before you upload them (i.e. pre-process them)
 # edit the code and use a locally deployed version that doesn't have that 
check (be aware of the possibility of security issues as described above)
 # maybe add a non-strict mode to the parser, that allows it to enable/disable 
that check with a parameter, at the user's own risk

Bruno

> Apache Commons imaging AEM Image upload issue - Invalid block size
> ------------------------------------------------------------------
>
>                 Key: IMAGING-307
>                 URL: https://issues.apache.org/jira/browse/IMAGING-307
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: JPEG
>            Reporter: aditya seth
>            Priority: Critical
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> We are trying to upload some assets to AEM DAM which is using the apache 
> commons imaging bundle (version 1.0.0.R1725432-B002) to verify and ingest the 
> assets. Some of the assets are being rejected wit the below error:
>  
> 20.07.2020 13:18:57.769 *WARN* [JobHandler: 
> /var/workflow/instances/server0/2020-07-16_1/tsc_dam_product_update_asset_852:/content/dam/tsc/product/149632099_A1.jpg/jcr:content/renditions/original]
>  com.day.cq.dam.commons.handler.StandardImageHandler extractMetadata: cannot 
> read metadata from image [/content/dam/tsc/product/149632099_A1.jpg]:
> org.apache.commons.imaging.ImageReadException: Invalid Block Size : 83252 > 
> 65504
>         at 
> org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parseAllBlocks(IptcParser.java:357)
>  [org.apache.commons.commons-imaging:1.0.0.R1725432-B002]
>  
> The API being used is 
> [https://github.com/apache/commons-imaging/blob/commons-imaging-1.0-RC1/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java#L321]
>  
> Can you please let me know why is this error happening, and what needs to be 
> done to the image to get it pass through this error. Are there any specific 
> image parameters or metedata which needs to be changed to get this corrected. 
> I have attached one image which is having this issue. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to