-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Asterisk (star character) expansion reveals folder structure #3526
Comments
Can you add your Log4j Core configuration file? Are you using a custom layout? Is the standard output of your application directly connected to a terminal or is it interpreted by a shell? Standard Log4j Core layouts and message factories do not expand
Whenever you suspect that a bug might be a security vulnerability, please follow our vulnerability reporting process instead of opening public PRs. Your bug is not reproducible using |
Sorry for the mix up. It was in fact a problem with 3rd party service / script used in some CI tools. So like you suggested the output was passed through a script and the star was expanded on the way. Thankfully only during startup. |
I am glad you found the culprit before it could do some damage! 💯 |
Description
Seems like a star character ("*") is expanded into a directory listing. Might be a security I guess, but I don't think so. It's definitely an annoyance.
Configuration
Version: 2.24.3
[INFO] +- org.apache.logging.log4j:log4j-slf4j2-impl:jar:2.24.3:compile
[INFO] | +- (org.apache.logging.log4j:log4j-api:jar:2.24.3:compile - omitted for duplicate)
[INFO] | +- org.slf4j:slf4j-api:jar:2.0.16:compile
[INFO] | - (org.apache.logging.log4j:log4j-core:jar:2.24.3:runtime - omitted for duplicate)
Operating system: Ubuntu 22.04.4 LTS
(also happens on different test sever with later Ubuntu 22.04)
(on Windows11 it seems fine)
JDK: Adoptium JDK: OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
(same on later Adoptium build: 17.0.11+9)
Logs
Expected log
Actual log contains directory listing:
This varies from server to server, but might be a
/root/
listing (on some test VMs) or tomcat directory listing (as in the example above).Reproduction
A minimized code (from actual service code):
Actual code is not much larger. Normally "Rand60" seen in the comment is dynamically replaced with a random number between 0-60.
But effectively that should simply be:
Additional notes
I did try to add the old NoLookups thing, but that didn't help:
I'm not quite sure if the option is still relevant. Looking at current code it doesn't seem like it is. Some docs still mention
m{lookups}
:https://logging.apache.org/log4j/2.x/manual/pattern-layout.html#converter-message
I did also check and the
@Value
does not expand the asterisk/star. When I do this:The message is:
The text was updated successfully, but these errors were encountered: