Skip to content

Commit 31fcd70

Browse files
committed
Fix log4j exploit for default configuration
1 parent a3e53dc commit 31fcd70

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/main/java/me/dreamerzero/chatregulator/ChatRegulator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ public ChatRegulator(final ProxyServer server, Logger logger, @DataDirectory Pat
6969
this.server = server;
7070
this.path = path;
7171
this.logger = logger;
72+
ChatRegulator.plugin = this;
7273
}
7374

7475
/**
7576
* Initialization of the plugin
7677
*/
7778
@Subscribe
7879
public void onProxyInitialization(final ProxyInitializeEvent event) {
79-
ChatRegulator.plugin = this;
8080
server.getConsoleCommandSource().sendMessage(MiniMessage.miniMessage()
8181
.parse("<gradient:#f2709c:#ff9472>ChatRegulator</gradient> <gradient:#DAE2F8:#D4D3DD>has started, have a very nice day</gradient>"));
8282
Configuration.loadConfig(path, logger);

src/main/java/me/dreamerzero/chatregulator/commands/ChatRegulatorCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ private void parseClearCommand(String[] args, Audience source, MiniMessage mm){
215215
}
216216
break;
217217
default:
218+
//Does this exclude other audiences that should not receive the component, probably the console?
218219
Audience.audience(server.getAllPlayers()).sendMessage(GeneralUtils.spacesComponent);
219220
source.sendMessage(mm.deserialize(clearmessages.getGlobalMessage()));
220221
break;

src/main/java/me/dreamerzero/chatregulator/config/Blacklist.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public static class Config{
2323
"p(u|@|v)ssy",
2424
"(?:(?:https?|ftp|file):\\/\\/|www\\.|ftp\\.)(?:\\([-A-Z0-9+&@#\\/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#\\/%=~_|$?!:,.])*(?:\\([-A-Z0-9+&@#\\/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#\\/%=~_|$])",
2525
"(i|@|l|j|1|y)mb(3|@|e|x)c(i|@|l|j|1|y)l",
26-
"m(o|@|0|x|8)th(3|@|e|x)rf(u|@|v)ck(3|@|e|x)r"
26+
"m(o|@|0|x|8)th(3|@|e|x)rf(u|@|v)ck(3|@|e|x)r",
27+
"\\$\\{(jndi|log4j|sys|env|main|marker|java|base64|lower|upper|web|docker|kubernetes|spring|jvmrunargs|date|ctx)\\:.*\\}"
2728
);
2829

2930
@Comment("Sets the commands that cannot be executed\n(configurable in the command module)")

src/main/java/me/dreamerzero/chatregulator/config/ConfigManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ private static void sendTitle(String message, Audience player, PlaceholderResolv
7373
* @param type the type of infraction
7474
*/
7575
public static void sendAlertMessage(InfractionPlayer infractor, InfractionType type){
76-
Audience staff = Audience.audience(ChatRegulator.getInstance().getProxy().getAllPlayers().stream()
77-
.filter(op -> op.hasPermission("chatregulator.notifications"))
78-
.collect(Collectors.toList()));
7976
String message = "";
8077
Messages.Config messages = Configuration.getMessages();
8178
MiniMessage mm = MiniMessage.miniMessage();
@@ -89,6 +86,10 @@ public static void sendAlertMessage(InfractionPlayer infractor, InfractionType t
8986
case NONE: return;
9087
}
9188

89+
Audience staff = Audience.audience(ChatRegulator.getInstance().getProxy().getAllPlayers().stream()
90+
.filter(op -> op.hasPermission("chatregulator.notifications"))
91+
.collect(Collectors.toList()));
92+
9293
staff.sendMessage(
9394
mm.deserialize(
9495
message,

0 commit comments

Comments
 (0)