Slackbot
11/02/2022, 10:39 PMChris Lee
11/02/2022, 11:52 PMChris Lee
11/02/2022, 11:56 PM// <https://blog.gradle.org/log4j-vulnerability>
// force log4j2 to be 2.17 or higher to avoid vulnerabilities in 2.x thru 2.17.2
// for the script itself, e.g. plugins
buildscript {
dependencies {
constraints {
// ensure we don't pull in a vulnerable version of log4j2
"classpath"("org.apache.logging.log4j:log4j-core") {
version {
strictly("[2.17.2,3[")
prefer("2.17.2")
}
because("CVE-2021-44228: Log4j vulnerable to remote code execution")
}
}
}
}
// for any dependencies (incl. transitive)
dependencies {
plugins.withType<JavaPlugin> {
constraints {
// ensure we don't pull in a vulnerable version of log4j2
implementation("org.apache.logging.log4j:log4j-core") {
version {
strictly("[2.17.2,3[")
prefer("2.17.2")
}
because("CVE-2021-44228: Log4j vulnerable to remote code execution")
}
}
}
}
Alex Spence
11/03/2022, 1:42 AMAlex Spence
11/03/2022, 1:44 AMChris Lee
11/03/2022, 1:47 AMAlex Spence
11/03/2022, 1:51 AMLog4j 1.x has reached End of Life in 2015 and is no longer supported. Vulnerabilities reported after August 2015 against Log4j 1.x were not checked and will not be fixed. Users should upgrade to Log4j 2 to obtain security fixes.
Alex Spence
11/03/2022, 1:51 AMAlex Spence
11/03/2022, 1:51 AMAlex Spence
11/03/2022, 1:52 AMAlex Spence
11/03/2022, 1:54 AMChris Lee
11/03/2022, 1:54 AMAlex Spence
11/03/2022, 1:54 AMAlex Spence
11/03/2022, 1:55 AMChris Lee
11/03/2022, 1:55 AMChris Lee
11/03/2022, 1:55 AMChris Lee
11/03/2022, 1:56 AMAlex Spence
11/03/2022, 1:56 AMChris Lee
11/03/2022, 1:57 AMChris Lee
11/03/2022, 1:59 AMorg.gradle.internal.execution.OutputSnapshotter$OutputFileSnapshottingException: Cannot snapshot output property 'outputDirectory'.
java.io.UncheckedIOException: Failed to create MD5 hash for file '/Users/spence/.gradle/caches/transforms-3/b857c89a93e3ad26d7a3a2df48b5cb23/transformed/unzipped-distribution/gradle-7.5.1/subprojects/docs/src/snippets/antMigration/fileDeps/kotlin/libs/log4j-1.2.8.jar' as it does not exist.
…when does that happen? When syncing the project w/ IntelliJ, or executing a Gradle task (if so, which one)?Alex Spence
11/03/2022, 2:00 AMChris Lee
11/03/2022, 2:01 AMAlex Spence
11/03/2022, 2:02 AMAlex Spence
11/03/2022, 2:02 AMAlex Spence
11/03/2022, 2:02 AMChris Lee
11/03/2022, 2:04 AMChris Lee
11/03/2022, 2:05 AMAlex Spence
11/03/2022, 2:05 AM> Task :prepareKotlinBuildScriptModel UP-TO-DATE
Download <https://services.gradle.org/distributions/gradle-7.5.1-src.zip>, took 938 ms (44.75 MB)
Unexpected exception while resolving Gradle distribution sources: A build operation failed.
Cannot snapshot output property 'outputDirectory'.
org.gradle.internal.operations.MultipleBuildOperationFailures: A build operation failed.
Cannot snapshot output property 'outputDirectory'
Chris Lee
11/03/2022, 2:06 AMAlex Spence
11/03/2022, 2:08 AMjava.io.UncheckedIOException: Failed to create MD5 hash for file '/Users/spence/.gradle/caches/transforms-3/b857c89a93e3ad26d7a3a2df48b5cb23/transformed/unzipped-distribution/gradle-7.5.1/subprojects/docs/src/snippets/antMigration/fileDeps/kotlin/libs/log4j-1.2.8.jar' as it does not exist.
Chris Lee
11/03/2022, 2:10 AMCaused by: java.io.FileNotFoundException: /Users/spence/.gradle/caches/transforms-3/b857c89a93e3ad26d7a3a2df48b5cb23/transformed/unzipped-distribution/gradle-7.5.1/subprojects/docs/src/snippets/antMigration/fileDeps/kotlin/libs/log4j-1.2.8.jar (Operation not permitted)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at org.gradle.internal.hash.DefaultFileHasher.hash(DefaultFileHasher.java:36)
... 245 more
Alex Spence
11/03/2022, 2:11 AMChris Lee
11/03/2022, 2:11 AMChris Lee
11/03/2022, 2:12 AMVampire
11/03/2022, 2:14 AMChris Lee
11/03/2022, 2:14 AMChris Lee
11/03/2022, 2:17 AMoverride fun sourceDirs(): Collection<File> =
try {
sourceDirs
} catch (ex: Exception) {
project.logger.warn("Unexpected exception while resolving Gradle distribution sources: ${ex.message}", ex)
emptyList()
}
The log shows BUILD SUCCESSFUL. Is there actually a problem here?Alex Spence
11/03/2022, 2:19 AMChris Lee
11/03/2022, 2:20 AMoverride fun sourceDirs(): Collection<File> =
try {
sourceDirs
} catch (ex: Exception) {
project.logger.warn("Unexpected exception while resolving Gradle distribution sources: ${ex.message}", ex)
emptyList()
}
private
val sourceDirs by lazy {
createSourceRepository()
registerTransforms()
transientConfigurationForSourcesDownload().files
}
Alex Spence
11/03/2022, 2:21 AMChris Lee
11/03/2022, 2:21 AMAlex Spence
11/03/2022, 2:21 AMAlex Spence
11/03/2022, 2:22 AMAlex Spence
11/03/2022, 2:22 AMsetUrl("<https://services.gradle.org/$repoName>")
Alex Spence
11/03/2022, 2:23 AMChris Lee
11/03/2022, 2:23 AMAlex Spence
11/03/2022, 2:23 AMAlex Spence
11/03/2022, 2:23 AMChris Lee
11/03/2022, 2:23 AM-all
distribution which includes the sources, hence no need for a further download.Alex Spence
11/03/2022, 2:24 AMAlex Spence
11/03/2022, 2:24 AMChris Lee
11/03/2022, 2:25 AM-all
the sources are included.Alex Spence
11/03/2022, 2:25 AMVampire
11/03/2022, 2:25 AMAlex Spence
11/03/2022, 2:25 AMAlex Spence
11/03/2022, 2:26 AMChris Lee
11/03/2022, 2:27 AM➜ ~ find ~/.gradle/caches/transforms-3 -name 'log4j*'
➜ ~
Alex Spence
11/03/2022, 2:28 AMAlex Spence
11/03/2022, 2:29 AMChris Lee
11/03/2022, 2:29 AMVampire
11/03/2022, 2:29 AMAlex Spence
11/03/2022, 2:30 AMVampire
11/03/2022, 2:30 AMAlex Spence
11/03/2022, 2:30 AMChris Lee
11/03/2022, 2:31 AMChris Lee
11/03/2022, 2:32 AMVampire
11/03/2022, 2:32 AMVampire
11/03/2022, 2:32 AMChris Lee
11/03/2022, 2:32 AM➜ ~ find ~/.gradle/wrapper -name 'log4j-1*'
➜ ~
Nope.Vampire
11/03/2022, 2:32 AMVampire
11/03/2022, 2:32 AMChris Lee
11/03/2022, 2:33 AMVampire
11/03/2022, 2:33 AMVampire
11/03/2022, 2:33 AMChris Lee
11/03/2022, 2:33 AMChris Lee
11/03/2022, 2:34 AMAlex Spence
11/03/2022, 2:34 AMAlex Spence
11/03/2022, 2:34 AMAlex Spence
11/03/2022, 2:35 AMAlex Spence
11/03/2022, 2:35 AMAlex Spence
11/03/2022, 2:35 AMAlex Spence
11/03/2022, 2:35 AMChris Lee
11/03/2022, 2:35 AMVampire
11/03/2022, 2:40 AMdefinitely applies to vulnerable log4j2 versions, that was nasty, any user input that was logged can be turned into a remote code execution (easily). Same issue isn’t present in log4j1.
Yes, that's what I said above. Log4j1 is not vulnerable to log4shell. But it has several other vulnerabilities and even the log4j main maintainer says you are doomed if you use it.
Vampire
11/03/2022, 2:40 AMChris Lee
11/03/2022, 2:43 AMAlex Spence
11/03/2022, 2:46 AMVampire
11/03/2022, 2:46 AMAlex Spence
11/03/2022, 2:46 AMChris Lee
11/03/2022, 2:47 AMVampire
11/03/2022, 2:47 AMAlex Spence
11/03/2022, 2:48 AMChris Lee
11/03/2022, 2:48 AMChris Lee
11/03/2022, 2:48 AMAlex Spence
11/03/2022, 2:48 AMVampire
11/03/2022, 2:48 AMAlex Spence
11/03/2022, 2:48 AMChris Lee
11/03/2022, 2:50 AMChris Lee
11/03/2022, 2:50 AMChris Lee
11/03/2022, 2:51 AMChris Lee
11/03/2022, 2:51 AMAlex Spence
11/03/2022, 2:51 AMVampire
11/03/2022, 2:51 AMAlex Spence
11/03/2022, 2:51 AMChris Lee
11/03/2022, 2:52 AMDo you know the developers of that compliance tool? I mean because you seem to know exactly what their thoughts and decisions were to quarantine log4j1.As I noted earlier, it is likely this is a corporate configuration that erroneously confuses log4j1 with log4jshell.
Alex Spence
11/03/2022, 2:52 AMVampire
11/03/2022, 2:54 AMChris Lee
11/03/2022, 2:54 AMVampire
11/03/2022, 2:54 AMChris Lee
11/03/2022, 2:54 AMNo, that’s just wild guessing. I also know several companies that have decided to get rid of log4j1 independent of log4shell because it is old and vulnerablelol. No guessing, unfortunantely and sadly. I’ve has CSO roles for large orgs and witnessed this at scale.
Chris Lee
11/03/2022, 2:55 AMVampire
11/03/2022, 2:56 AMChris Lee
11/03/2022, 2:56 AMAlex Spence
11/03/2022, 2:56 AMAlex Spence
11/03/2022, 2:57 AMAlex Spence
11/03/2022, 2:58 AMAlex Spence
11/03/2022, 2:58 AMChris Lee
11/03/2022, 2:59 AM