Last modified: 2014-02-19 22:30:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T48921, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 46921 - Refuse uploading JPEG files with extra junk at the end.
Refuse uploading JPEG files with extra junk at the end.
Status: NEW
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.22.0
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-05 10:14 UTC by Rainer Rillke @commons.wikimedia
Modified: 2014-02-19 22:30 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
sample: https://commons.wikimedia.org/w/index.php?title=File:Fresh_Relic_4531.JPG (9.85 MB, image/jpeg)
2013-04-05 17:37 UTC, Rainer Rillke @commons.wikimedia
Details
sample: https://commons.wikimedia.org/w/index.php?title=File:PencilCherryTable.JPG (4.79 MB, image/jpeg)
2013-04-05 17:40 UTC, Rainer Rillke @commons.wikimedia
Details

Description Rainer Rillke @commons.wikimedia 2013-04-05 10:14:03 UTC
Original title: Refuse uploading files that contain huge data of other file types, especially if this data is encrypted

* https://commons.wikimedia.org/wiki/Commons_talk:Criteria_for_speedy_deletion#password_protected_embedded_files
* https://commons.wikimedia.org/wiki/Commons:Deletion_requests/Files_uploaded_by_Colorj123
Comment 1 Andre Klapper 2013-04-05 14:01:36 UTC
Wondering at which exact state this refusal would take place. 
This request might be "UploadWizard" (or "Special:Upload") territory instead of "File management".
Comment 2 Bawolff (Brian Wolff) 2013-04-05 17:12:46 UTC
> Wondering at which exact state this refusal would take place. 
> This request might be "UploadWizard" (or "Special:Upload") territory instead
> of
> "File management".

Probably the same stage we do other file type checks. (On the backend after the upload)
-----
Given that these files have been deleted, could an example be attached to this bug so we can see what the file actually looks like?

I'm given to understand these were valid JPEG's with extra junk in metadata segments? I'm not sure we would be able to strip that without worrying about damaging real metadata.

If the images just had extra data embedded into the image data using stenography, it would be pretty difficult to detect in general.
Comment 3 Rainer Rillke @commons.wikimedia 2013-04-05 17:37:13 UTC
Created attachment 12039 [details]
sample: https://commons.wikimedia.org/w/index.php?title=File:Fresh_Relic_4531.JPG

My computer just crashed (step by step human input devices stopped working) after viewing one of them so I really hope they do not contain evil code.
Comment 4 Rainer Rillke @commons.wikimedia 2013-04-05 17:40:06 UTC
Created attachment 12040 [details]
sample: https://commons.wikimedia.org/w/index.php?title=File:PencilCherryTable.JPG
Comment 5 Jesús Martínez Novo (Ciencia Al Poder) 2013-04-05 18:34:53 UTC
(In reply to comment #3)
> Created attachment 12039 [details]
> sample:
> https://commons.wikimedia.org/w/index.php?title=File:Fresh_Relic_4531.JPG
> 
> My computer just crashed (step by step human input devices stopped working)
> after viewing one of them so I really hope they do not contain evil code.

This one seems to contain a password protected file. Opening it with 7z prompts for a password. The second one (12040) should contain something also, although 7z was unable to detect an archive there. As one can see, both images are displayed fast (while downloading) and then the browser keeps downloading data even if the image is already displayed.

As I've read, it's extremely easy to add any file inside a jpeg and yet have an absolutely valid image that displays perfectly. It can be done by just concatenating the contents of a file to an existing jpeg image.
Comment 6 Bawolff (Brian Wolff) 2013-04-09 12:30:02 UTC
Hmm, if its just stuff concatenated at the end, it would probably be possible to detect (Look for the \xFF\xD9 marker, see if anything after it) [From a security paranoia, doing this would probably not be a bad idea. GIFAR and all]
-----
Looking at these files, they are indeed just stuff stuffed at the end.

For 1239:

00011d40  e6 93 34 a7 ad 25 0b 61  85 14 51 4c 0f ff d9 37  |..4..%.a..QL...7|
00011d50  7a bc af 27 1c 00 03 d8  f3 90 3d 40 84 9c 00 00  |z..'......=@....|

Note the ff d9 denotes end of image (EOI). After that 37 7A BC AF 27 1C are the magic numbers for a 7z archive.

For the second image (1240) we have:

0000dc80  dd cf a1 f5 a6 9e b4 87  a9 a1 6b a8 92 3f ff d9  |..........k..?..|
0000dc90  43 d6 cd 64 8a dc f7 24  57 18 a8 2f e3 dd 38 34  |C..d...$W../..84|

Which doesn't have any magic numbers that I could see. However, it definitely doesn't appear to be JPEG data as we later on have ff sequences that aren't escaped. Maybe its the second part to some file split up over multiple jpegs or maybe encrypted, or something else.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links