-
Notifications
You must be signed in to change notification settings - Fork 71
Log4j Disable Literal Pattern Converter #46
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: decoupled
Are you sure you want to change the base?
Conversation
f7cc7b6
to
142b8a0
Compare
142b8a0
to
4d43a6c
Compare
echo "Running Literal Pattern Converter JDK${JVM_MV} Test" | ||
echo "------------------" | ||
|
||
start_dos_test ${JDK_DIR} ${AGENT_JAR} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to capture the pid of the process and kill it later.
public static boolean isEnabled(String args) { | ||
String param = "--enable-" + NAME; | ||
return args != null && args.contains(param); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think isEnabled is in the current implementation
|
||
@Override | ||
public int getVersion() { | ||
return 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the version for the patchset, if so this is version 1 of Log4j2PatchSetWithDisableLookups.
local agent_jar=$2 | ||
|
||
pushd "${ROOT_DIR}/test" > /dev/null | ||
${jdk_dir}/bin/java -cp log4j-core-2.12.1.jar:log4j-api-2.12.1.jar:. -Dlog4j2.configurationFile=${ROOT_DIR}/src/test/resources/log4j-vuln2.properties -javaagent:${agent_jar}=patcherClassName=com.amazon.corretto.hotpatch.patch.impl.set.Log4j2PatchSetWithDisableLookups Vuln2 > /tmp/vuln2.log & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you hotpatch with this? If so please add tests and doc updates
restarting the Java process. This tool will also address | ||
[CVE-2021-45046](https://nvd.nist.gov/vuln/detail/CVE-2021-45046/). | ||
|
||
To Patch for [CVE-2021-45105](https://nvd.nist.gov/vuln/detail/CVE-2021-45105), you can run the tool with the following |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please expand on when/why some one would need to patch for this and what the side effects of it are.
@@ -46,6 +46,19 @@ function start_static_target() { | |||
popd > /dev/null | |||
} | |||
|
|||
function start_dos_test() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test that verifies by default the dos patcher is not active?
Although
-DformatMsgNoLookups=true
prevents lookups directly in the message, Format Lookups are possible when reading a property from the ThreadContext/MDC in the pattern for the message. On certain scenarios, this can cause a StackOverflow through recursive lookups as described on CVE-2021-45105.This patch disables lookups in Message Pattern by patching LiteralPatternConverter.
The patch for LiteralPatternConverter is not enabled by default and can be enabled using the following parameters