Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.util.zip.ZipException: unexpected EOF - Scan hangs in an infinite loop on Linux #24

Closed
vosskaem opened this issue Dec 15, 2021 · 6 comments

Comments

@vosskaem
Copy link

Using log4j-detector-2021.12.15.jar on Red Hat Enterprise Linux release 8.5 (Ootpa) with openjdk version "1.8.0_312"
The following output is from infinite loop:

-- Problem /opt/omni/AppServer/modules/system/layers/base/com/h2database/h2/main/h2-1.4.193.jar!/org/h2/util/data.zip - java.util.zip.ZipException: unexpected EOF
/opt/omni/AppServer/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.2.0.Final.jar contains Log4J-1.x   <= 1.2.17 _OLD_ :-|
-- Problem /opt/omni/AppServer/modules/system/layers/base/com/h2database/h2/main/h2-1.4.193.jar!/org/h2/util/data.zip - java.util.zip.ZipException: unexpected EOF
/opt/omni/AppServer/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.2.0.Final.jar contains Log4J-1.x   <= 1.2.17 _OLD_ :-|
-- Problem /opt/omni/AppServer/modules/system/layers/base/com/h2database/h2/main/h2-1.4.193.jar!/org/h2/util/data.zip - java.util.zip.ZipException: unexpected EOF
/opt/omni/AppServer/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.2.0.Final.jar contains Log4J-1.x   <= 1.2.17 _OLD_ :-|
-- Problem /opt/omni/AppServer/modules/system/layers/base/com/h2database/h2/main/h2-1.4.193.jar!/org/h2/util/data.zip - java.util.zip.ZipException: unexpected EOF
/opt/omni/AppServer/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.2.0.Final.jar contains Log4J-1.x   <= 1.2.17 _OLD_ :-|

@juliusmusseau
Copy link
Contributor

Thanks !!!! Guess the symlink cycle detection is not quite right - ugh...

@juliusmusseau
Copy link
Contributor

Try now ?

@juliusmusseau
Copy link
Contributor

I've pushed back the previous log4j-detector-2021.12.14.jar pre-compiled binary in case this infinite loop is still a problem.

Would love a test case if you have one. Haven't been able to reproduce this over here yet.

Unfortunately I have to go to sleep now, but I really appreciate this bug report - thank you !!!!!

@domoran
Copy link

domoran commented Dec 15, 2021

I worked on a rewrite that will not try to load files in memory anymore and scan them streamlined. Maybe we can try to merge the versions. I am not sure, why you took the approach of a "getFreshZipStream" and all that trying to find the beginning of the zip stream in the file but it seems we should not copy stuff in memory. If you want we can discuss. See this version:
https://github.com/domoran/log4j-detector/blob/master/src/main/java/com/continental/swx/log4jscan/Log4JScan.java

@vosskaem
Copy link
Author

Using 8fa4c76 it woks:

java -jar log4j-detector-2021.12.15.jar /opt/
-- github.com/mergebase/log4j-detector v2021.12.15 (by mergebase.com) analyzing paths (could take a while).
-- Note: specify the '--verbose' flag to have every file examined printed to STDERR.
-- Problem /opt/omni/AppServer/modules/system/layers/base/com/h2database/h2/main/h2-1.4.193.jar!/org/h2/util/data.zip - java.util.zip.ZipException: unexpected EOF
/opt/omni/AppServer/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.2.0.Final.jar contains Log4J-1.x   <= 1.2.17 _OLD_ :-|
/opt/omni/bin/telemetry/log4j-core-2.11.2.jar contains Log4J-2.x   >= 2.10.0 _VULNERABLE_ :-(

@juliusmusseau
Copy link
Contributor

Closing this as fixed!

@domoran - can you create a ticket so i don't forget your idea to improve the memory overhead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants