-
Notifications
You must be signed in to change notification settings - Fork 98
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
pom.properties processing #53
Comments
Hey @HynekPetrak, can you elaborate on why that code is problematic? The code was added to address edge cases like #49, and only seems to warn that log4j-core may be present. Perhaps the wording could be clearer:
That said, given the severity of CVE-2021-44228 I would rather have a few false positives (instances where log4j-core is present but not exploitable) than false negatives (missing exploitable instances of log4j-core). |
elastic-apm-agent case can be handled even without pom.properties, if you consider alternative class file extension, that is being used by them - they use ".esclazz" instead of ".class" and perhaps lets take better example of analyzing version 2.14.0 - below.
If you would use the pom.properties to get the version but not executed this boolean isLog4j2 = compare("2", version) <= 0;
if (isLog4j2) {
log4jProbe = new boolean[]{true, true, true, true, true};
hasJndiLookup = compare("2.0-beta9", version) <= 0;
hasJndiManager = compare("2.1", version) <= 0;
isLog4j2_10 = compare("2.10.0", version) <= 0;
isLog4j2_12_2 = version.startsWith("2.12.") && compare("2.12.2", version) <= 0;
if (isLog4j2_12_2) {
isLog4j2_12_2_override = false;
}
isLog4j2_15 = version.startsWith("2.15.");
isLog4j2_16 = version.startsWith("2.16.");
isLog4j2_17 = compare("2.17.0", version) <= 0;
if (isLog4j2_15 || isLog4j2_16 || isLog4j2_17) {
isLog4j2_15_override = false;
}
} then it rather prints the right output: warning about version without bytecode, but no false positive about vulnerable source. As I mentioned in the other issue, I ported your code to python (https://github.com/HynekPetrak/log4shell_finder/), but pom.properties handling I did slightly different, which gives such output:
|
I like that "STRANGE" status for this case. Have to go to bed now, but will think about this more... |
Hi,
I'm not sure whether that's the right way to go, I'm sorry if I did not understand your code properly.
If you set the empirical condition variables based on version detected via pom.properties, this may actually lead to false positives.
Take for instance: https://www.apache.org/dyn/closer.lua/logging/log4j/2.17.0/apache-log4j-2.17.0-bin.zip
False positives ((I mean non-compiled, harmless code) ) might be reported on
apache-log4j-2.17.0-bin.zip:apache-log4j-2.17.0-bin/log4j-core-2.17.0-sources.jar
Problematic code:
log4j-detector/src/main/java/com/mergebase/log4j/Log4JDetector.java
Line 376 in f8883b4
The text was updated successfully, but these errors were encountered: