View Issue Details

IDProjectCategoryView StatusLast Update
0000059file[All Projects] Generalpublic2019-02-18 16:53
ReportermagicusAssigned Tochristos 
Status feedbackResolutionopen 
Product Version5.35 
Target VersionFixed in Version 
Summary0000059: Magic is missing for Java jmod and module image files
DescriptionThere is no magic formula for Java jmod and image files (as produced by jlink); these are artefacts generated by Java since JDK 9.
Steps To ReproduceActual results:

$ file jdk/jmods/java.base.jmod
jdk/jmods/java.base.jmod: Zip archive data

$ file jdk/lib/modules
jdk/lib/modules: data

Expected results:

$ file jdk/jmods/java.base.jmod
jdk/jmods/java.base.jmod: Java jmod module, version 1.0

$ file jdk/lib/modules
jdk/lib/modules: Java module image (little endian), version 1.0
Additional InformationProvided patch has been tested on all three types (jmod, BE image and LE image), and a sanity check that it did not break zip detection.
TagsNo tags attached.



2019-01-30 11:43


add-java-jmod-and-image.patch (1,190 bytes)
commit 3c76cc7d6dd0b0d5e4c099d54396d01e1348cd11
Author: Magnus Ihse Bursie <>
Date:   Wed Jan 30 12:36:04 2019 +0100

    Add magic definitions for Java jmod and Java image.

diff --git a/magic/Magdir/java b/magic/Magdir/java
index 18e82eaf..21a3cfb5 100644
--- a/magic/Magdir/java
+++ b/magic/Magdir/java
@@ -25,3 +25,24 @@
 >0x12	byte		0
 >>0x11	ubyte-0x31	<2      Java HPROF dump,
 >>>0x17	beqdate/1000	x       created %s
+# Java jmod module
+# See
+0	beshort		0x4a4d		Java jmod module
+# jmod header is followed by zip entry; make sure we win over zip
+!:strength + 20
+>2	byte	>0x00	\b, version %d
+>3	byte	x	\b.%d
+!:mime	application/x-java-jmod
+# Java jlinked image
+# See
+0	belong	0xcafedada	Java module image (big endian)
+>4	beshort	>0x00	\b, version %d
+>6	beshort	x	\b.%d
+!:mime	application/x-java-image
+0	lelong	0xcafedada	Java module image (little endian)
+>6	leshort	>0x00	\b, version %d
+>4	leshort	x	\b.%d
+!:mime	application/x-java-image


2019-02-18 16:53

manager   ~0003209

Thanks! JM magic is too short. I only added it for v1.0 so that it does not generate false positives.

Issue History

Date Modified Username Field Change
2019-01-30 11:43 magicus New Issue
2019-01-30 11:43 magicus File Added: add-java-jmod-and-image.patch
2019-02-18 16:53 christos Assigned To => christos
2019-02-18 16:53 christos Status new => assigned
2019-02-18 16:53 christos Status assigned => feedback
2019-02-18 16:53 christos Note Added: 0003209