Rise 5.99 ChatBypass module 1 files, 50 lines

Rise 5.99 ChatBypass: Full Source Analysis

Rise 5.99's ChatBypass mangles outgoing chat to slip past serverside word filters: onPacketSend intercepts every C01PacketChatMessage whose text does not start with a slash and rewrites it…

dev/rise/module/impl/other/ChatBypass.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Packets This Module Uses

Analysis

Overview

Rise 5.99's ChatBypass mangles outgoing chat to slip past serverside word filters: onPacketSend intercepts every C01PacketChatMessage whose text does not start with a slash and rewrites it by appending three random characters from a pool of several hundred exotic Unicode codepoints after each original character. The rewritten message still displays as the original text in most renderers, because a large share of the pool are combining marks and near-invisible codepoints, but the raw string no longer contains the filtered substrings. The Hypixel mode replaces the random draw with the constant modifier letter U+02CC. The module is a single outgoing-packet handler: no timing, no command rewriting, no receive-side logic, and no awareness of captchas or rate limits.

Rewrite mechanism

onPacketSend tests for C01PacketChatMessage and bails when the message starts with a slash, so commands pass through untouched. The bypass StringBuilder is sized at message.length() * 2, though the actual output grows to four times the input: for each original character the loop appends the character followed by three draws from the chars pool, three times in sequence. The result is written back with packet.setMessage and the packet is re-attached to the event, which matters because the mutation must survive the client's own chat pipeline before the C01 is serialized.

The character pool

The chars field is a fixed array of several hundred exotic codepoints spanning combining diacritical marks, modifier letters, punctuation and unassigned slots, and each draw picks randomInt(0, chars.length). The pool is chosen so the appended characters render as invisible or near-invisible: many are zero-width or combining marks that attach to the preceding letter, so the human-readable text is unchanged while the raw payload is full of codepoints a literal filter never expects. Hypixel mode discards the pool entirely and pins every draw to the modifier letter U+02CC, trading randomness for a fixed, uniformly spaced mangling.

Wire effect and limits

A C01 payload is a length-prefixed string, so the four-times-long message is perfectly legal on the wire and the server parses it as ordinary chat. The bypass defeats filters that match literal substrings or simple regexes against the raw message, because the target words are split by the inserted codepoints; filters that normalize or strip combining marks still catch the text. The S02 side is untouched: the server's chat responses, filter rejections and captcha questions arrive as normal S02PacketChat messages and the module has no receive handler, so it cannot react to a captcha or a mute.

source ChatBypass.java

ChatBypass.java50 lines · JavaOriginal ↗
1
/*
2
 Copyright Alan Wood 2021
3
 None of this code to be reused without my written permission
4
 Intellectual Rights owned by Alan Wood
5
 */
6
package dev.rise.module.impl.other;
7
8
import dev.rise.event.impl.packet.PacketSendEvent;
9
import dev.rise.module.Module;
10
import dev.rise.module.api.ModuleInfo;
11
import dev.rise.module.enums.Category;
12
import dev.rise.setting.impl.ModeSetting;
13
import net.minecraft.network.play.client.C01PacketChatMessage;
14
15
@ModuleInfo(name = "ChatBypass", description = "Bypasses chat filters", category = Category.OTHER)
16
public final class ChatBypass extends Module {
17
18
    private final ModeSetting mode = new ModeSetting("Mode", this, "Normal", "Normal", "Hypixel");
19
20
    private final char[] chars = new char[]{
21
            '͸', '͹', 'Ϳ', '΀', '΁', '΂', '΃', '΋', '΍', '΢', 'Ԥ', 'ԥ', 'Ԧ', 'ԧ', 'Ԩ', 'ԩ', 'Ԫ', 'ԫ', 'Ԭ', 'ԭ', 'Ԯ', 'ԯ', '԰', '՗', '՘', 'ՠ', 'ֈ', '֋', '֌', '֍', '֎', '֏', '֐', '׈', '׉', '׊', '׋', '׌', '׍', '׎', '׏', '׫', '׬', '׭', '׮', 'ׯ', '׵', '׶', '׷', '׸', '׹', '׺', '׻', '׼', '׽', '׾', '׿', '؄', '؅', '؜', '؝', 'ؠ', 'ٟ', '܎', '݋', '݌', '޲', '޳', '޴', '޵', '޶', '޷', '޸', '޹', '޺', '޻', '޼', '޽', '޾', '޿', '߻', '߼', '߽', '߾', '߿', 'ࠀ', 'ࠁ', 'ࠂ', 'ࠃ', 'ࠄ', 'ࠅ', 'ࠆ', 'ࠇ', 'ࠈ', 'ࠉ', 'ࠊ', 'ࠋ', 'ࠌ', 'ࠍ', 'ࠎ', 'ࠏ', 'ࠐ', 'ࠑ', 'ࠒ', 'ࠓ', 'ࠔ', 'ࠕ', 'ࠖ', 'ࠗ', '࠘', '࠙', 'ࠚ', 'ࠛ', 'ࠜ', 'ࠝ', 'ࠞ', 'ࠟ', 'ࠠ', 'ࠡ', 'ࠢ', 'ࠣ', 'ࠤ', 'ࠥ', 'ࠦ', 'ࠧ', 'ࠨ', 'ࠩ', 'ࠪ', 'ࠫ', 'ࠬ', '࠭', '࠮', '࠯', '࠰', '࠱', '࠲', '࠳', '࠴', '࠵', '࠶', '࠷', '࠸', '࠹', '࠺', '࠻', '࠼', '࠽', '࠾', '࠿', 'ࡀ', 'ࡁ', 'ࡂ', 'ࡃ', 'ࡄ', 'ࡅ', 'ࡆ', 'ࡇ', 'ࡈ', 'ࡉ', 'ࡊ', 'ࡋ', 'ࡌ', 'ࡍ', 'ࡎ', 'ࡏ', 'ࡐ', 'ࡑ', 'ࡒ', 'ࡓ', 'ࡔ', 'ࡕ', 'ࡖ', 'ࡗ', 'ࡘ', '࡙', '࡚', '࡛', '࡜', '࡝', '࡞', '࡟', 'ࡠ', 'ࡡ', 'ࡢ', 'ࡣ', 'ࡤ', 'ࡥ', 'ࡦ', 'ࡧ', 'ࡨ', 'ࡩ', 'ࡪ', '࡫', '࡬', '࡭', '࡮', '࡯', 'ࡰ', 'ࡱ', 'ࡲ', 'ࡳ', 'ࡴ', 'ࡵ', 'ࡶ', 'ࡷ', 'ࡸ', 'ࡹ', 'ࡺ', 'ࡻ', 'ࡼ', 'ࡽ', 'ࡾ', 'ࡿ', 'ࢀ', 'ࢁ', 'ࢂ', 'ࢃ', 'ࢄ', 'ࢅ', 'ࢆ', 'ࢇ', '࢈', 'ࢉ', 'ࢊ', 'ࢋ', 'ࢌ', 'ࢍ', 'ࢎ', '࢏', '࢐', '࢑', '࢒', '࢓', '࢔', '࢕', '࢖', 'ࢗ', '࢘', '࢙', '࢚', '࢛', '࢜', '࢝', '࢞', '࢟', 'ࢠ', 'ࢡ', 'ࢢ', 'ࢣ', 'ࢤ', 'ࢥ', 'ࢦ', 'ࢧ', 'ࢨ', 'ࢩ', 'ࢪ', 'ࢫ', 'ࢬ', 'ࢭ', 'ࢮ', 'ࢯ', 'ࢰ', 'ࢱ', 'ࢲ', 'ࢳ', 'ࢴ', 'ࢵ', 'ࢶ', 'ࢷ', 'ࢸ', 'ࢹ', 'ࢺ', 'ࢻ', 'ࢼ', 'ࢽ', 'ࢾ', 'ࢿ', 'ࣀ', 'ࣁ', 'ࣂ', 'ࣃ', 'ࣄ', 'ࣅ', 'ࣆ', 'ࣇ', 'ࣈ', 'ࣉ', '࣊', '࣋', '࣌', '࣍', '࣎', '࣏', '࣐', '࣑', '࣒', '࣓', 'ࣔ', 'ࣕ', 'ࣖ', 'ࣗ', 'ࣘ', 'ࣙ', 'ࣚ', 'ࣛ', 'ࣜ', 'ࣝ', 'ࣞ', 'ࣟ', '࣠', '࣡', '࣢', 'ࣣ', 'ࣤ', 'ࣥ', 'ࣦ', 'ࣧ', 'ࣨ', 'ࣩ', '࣪', '࣫', '࣬', '࣭', '࣮', '࣯', 'ࣰ', 'ࣱ', 'ࣲ', 'ࣳ', 'ࣴ', 'ࣵ', 'ࣶ', 'ࣷ', 'ࣸ', 'ࣹ', 'ࣺ', 'ࣻ', 'ࣼ', 'ࣽ', 'ࣾ', 'ࣿ', 'ऀ', 'ऺ', 'ऻ', 'ॎ', 'ॏ', 'ॕ', 'ॖ', 'ॗ', 'ॳ', 'ॴ', 'ॵ', 'ॶ', 'ॷ', 'ॸ', 'ॹ', 'ॺ', 'ঀ', '঄', '঍', '঎', '঑', '঒', '঩', '঱', '঳', '঴', '঵', '঺', '঻', '৅', '৆', '৉', '৊', '৏', '৐', '৑', '৒', '৓', '৔', '৕', '৖', '৘', '৙', '৚', '৛', '৞', '৤', '৥', '৻', 'ৼ', '৽', '৾', '৿', '਀', '਄', '਋', '਌', '਍', '਎', '਑', '਒', '਩', '਱', '਴', '਷', '਺', '਻', '਽', '੃', '੄', '੅', '੆', '੉', '੊', '੎', '੏'
22
    };
23
24
    @Override
25
    public void onPacketSend(final PacketSendEvent event) {
26
        if (event.getPacket() instanceof C01PacketChatMessage) {
27
            final C01PacketChatMessage packet = ((C01PacketChatMessage) event.getPacket());
28
            final String message = packet.getMessage();
29
30
            if (!message.startsWith("/")) {
31
                final StringBuilder bypass = new StringBuilder(message.length() * 2);
32
33
                for (int i = 0; i < message.length(); i++) {
34
                    final char character = message.charAt(i);
35
                    char randomChar = chars[randomInt(0, chars.length)];
36
37
                    if (mode.is("Hypixel"))
38
                        randomChar = 'ˌ';
39
40
                    bypass.append(character).append(randomChar);
41
                    bypass.append(character).append(randomChar);
42
                    bypass.append(character).append(randomChar);
43
                }
44
45
                packet.setMessage(bypass.toString());
46
                event.setPacket(packet);
47
            }
48
        }
49
    }
50
}

What this file does

The module file is the entire implementation. The handler tests for C01PacketChatMessage, skips slash-prefixed messages, and rebuilds the payload by appending three draws from the chars pool after every character, then writes the result back through setMessage and re-attaches the packet to the event. The chars array is a fixed field of several hundred exotic codepoints, and the ModeSetting selects between the random draws and the constant U+02CC used on Hypixel. There are no helper classes, no timers and no receive-side logic: the whole bypass is one outgoing-packet rewrite.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat NoCheatPlus Text (chat content scoring)

Text.java331 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.chat;
16
17
import java.util.Collections;
18
import java.util.LinkedList;
19
import java.util.List;
20
import java.util.Map;
21
22
import org.bukkit.entity.Player;
23
24
import fr.neatmonster.nocheatplus.NCPAPIProvider;
25
import fr.neatmonster.nocheatplus.checks.Check;
26
import fr.neatmonster.nocheatplus.checks.CheckType;
27
import fr.neatmonster.nocheatplus.checks.chat.analysis.MessageLetterCount;
28
import fr.neatmonster.nocheatplus.checks.chat.analysis.WordLetterCount;
29
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.LetterEngine;
30
import fr.neatmonster.nocheatplus.checks.combined.CombinedData;
31
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
32
import fr.neatmonster.nocheatplus.components.registry.feature.INotifyReload;
33
import fr.neatmonster.nocheatplus.config.ConfigFile;
34
import fr.neatmonster.nocheatplus.config.ConfigManager;
35
import fr.neatmonster.nocheatplus.players.IPlayerData;
36
import fr.neatmonster.nocheatplus.utilities.ColorUtil;
37
import fr.neatmonster.nocheatplus.utilities.StringUtil;
38
39
/**
40
 * Some alternative more or less advanced analysis methods.
41
 * @author asofold
42
 *
43
 */
44
public class Text extends Check implements INotifyReload {
45
46
    private LetterEngine engine = null;
47
48
    /** Not really cancelled but above threshold for actions. */
49
    private String lastCancelledMessage = "";
50
    private long lastCancelledTime = 0;
51
52
    private String lastGlobalMessage = "";
53
    private long lastGlobalTime = 0;
54
55
    public Text() {
56
        super(CheckType.CHAT_TEXT);
57
        init();
58
    }
59
60
    /**
61
     * Start analysis.
62
     * @param player
63
     *          The player who issued the message.
64
     * @param message
65
     *          The message to check.
66
     * @param captcha 
67
     *          Used for starting captcha on failure, if configured so.
68
     * @param alreadyCancelled 
69
     * @return
70
     */
71
    public boolean check(final Player player, final String message, 
72
                         final ChatConfig cc, final IPlayerData pData,
73
                         final ICaptcha captcha, boolean isMainThread, final boolean alreadyCancelled) {
74
        final ChatData data = pData.getGenericInstance(ChatData.class);
75
        synchronized (data) {
76
            return unsafeCheck(player, message, captcha, cc, data, pData, isMainThread, alreadyCancelled);
77
        }
78
    }
79
80
    private void init() {
81
        // Set some things from the global config.
82
        final ConfigFile config = ConfigManager.getConfigFile();
83
        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
84
        if (engine != null) {
85
            engine.clear();
86
            api.removeComponent(engine);
87
        }
88
        engine = new LetterEngine(config);
89
        api.addComponent(engine);
90
    }
91
92
    @Override
93
    public void onReload() {
94
        synchronized(engine) {
95
            engine.clear();
96
        }
97
        init();
98
    }
99
100
    /**
101
     * Check without further synchronization.
102
     * @param player
103
     * @param message
104
     * @param captcha
105
     * @param cc
106
     * @param data
107
     * @param isMainThread 
108
     * @param alreadyCancelled 
109
     * @return
110
     */
111
    private boolean unsafeCheck(final Player player, final String message, final ICaptcha captcha,
112
                                final ChatConfig cc, final ChatData data, final IPlayerData pData,
113
                                boolean isMainThread, final boolean alreadyCancelled) {
114
115
        // Test captcha.
116
        if (captcha.shouldCheckCaptcha(player, cc, data, pData)) {
117
            captcha.checkCaptcha(player, message, cc, data, isMainThread);
118
            return true;
119
        } 
120
        else if (alreadyCancelled) {
121
            // Skip checking.
122
            return true;
123
        }
124
125
        final long time = System.currentTimeMillis();
126
        final String lcMessage = message.trim().toLowerCase();
127
        boolean cancel = false;
128
        final boolean debug = pData.isDebugActive(type);
129
        final List<String> debugParts;
130
        if (debug) {
131
            debugParts = new LinkedList<String>();
132
            debugParts.add("Message (length=" + message.length()+"): ");
133
        }
134
        else debugParts = null;
135
136
        // Update the frequency interval weights.
137
        data.chatFrequency.update(time);
138
139
        // Score for this message (violation score).
140
        float score = 0;
141
        final MessageLetterCount letterCounts = new MessageLetterCount(message);
142
        final int msgLen = message.length();
143
144
145
146
        // (Following: random/made up criteria.)
147
        // TODO: Create tests for all methods with wordlists, fake chat (refactor for that).
148
        // Full message processing. ------------
149
        // Upper case.
150
        if (letterCounts.fullCount.upperCase > msgLen / 3) {
151
            // TODO: Regard chunks of 48 or so letters of the message for this?
152
            final float wUpperCase = 0.6f * letterCounts.fullCount.getUpperCaseRatio();
153
            score += wUpperCase  * cc.textMessageUpperCase;
154
        }
155
156
        // Letters vs. word length.
157
        if (msgLen > 4) {
158
            final float fullRep = letterCounts.fullCount.getLetterCountRatio();
159
            // Long messages: very small and very big are bad !
160
            // 128 is a quick attempt to make one long message possible on 1.11.
161
            final float wRepetition = (float) Math.min(msgLen, 128) / 15.0f * Math.abs(0.5f - fullRep);
162
            score += wRepetition * cc.textMessageLetterCount;
163
164
            // Number of words vs. length of message
165
            final float fnWords = (float) letterCounts.words.length / (float) msgLen;
166
            if (fnWords > 0.75f) { // TODO: balance or configure or remove ?
167
                score += fnWords  * cc.textMessagePartition;
168
            }
169
        }
170
171
        final CombinedData cData = pData.getGenericInstance(CombinedData.class);
172
        final long timeout = 8000; // TODO: maybe set dynamically in data.
173
        // Repetition of last message.
174
        if (cc.textMsgRepeatSelf != 0f && time - data.chatLastTime < timeout) {
175
            if (StringUtil.isSimilar(lcMessage, data.chatLastMessage, 0.8f)) {
176
                final float timeWeight = (float) (timeout - (time - data.chatLastTime)) / (float) timeout; 
177
                score += cc.textMsgRepeatSelf * timeWeight;
178
            }
179
        }
180
        // Repetition of last global message.
181
        if (cc.textMsgRepeatGlobal != 0f && time - lastGlobalTime < timeout) {
182
            if (StringUtil.isSimilar(lcMessage, lastGlobalMessage, 0.8f)) {
183
                final float timeWeight = (float) (timeout - (time - lastGlobalTime)) / (float) timeout; 
184
                score += cc.textMsgRepeatGlobal * timeWeight;
185
            }
186
        }
187
        // Repetition of last cancelled message.
188
        if (cc.textMsgRepeatCancel != 0f && time - lastCancelledTime < timeout) {
189
            if (StringUtil.isSimilar(lcMessage, lastCancelledMessage, 0.8f)) {
190
                final float timeWeight = (float) (timeout - (time - lastCancelledTime)) / (float) timeout; 
191
                score += cc.textMsgRepeatCancel * timeWeight;
192
            }
193
        }
194
        // Chat quickly after join.
195
        if (cc.textMsgAfterJoin != 0f && time - cData.lastJoinTime < timeout) {
196
            final float timeWeight = (float) (timeout - (time - cData.lastJoinTime)) / (float) timeout;
197
            score += cc.textMsgAfterJoin * timeWeight; 
198
        }
199
        // Chat without moving.
200
        if (cc.textMsgNoMoving != 0f && time - cData.lastMoveTime > timeout) {
201
            score += cc.textMsgNoMoving;
202
        }
203
204
205
206
        // Per word checks. -------------------
207
        float wWords = 0.0f;
208
        final float avwLen = (float) msgLen / (float) letterCounts.words.length; 
209
        for (final WordLetterCount word : letterCounts.words) {
210
            float wWord = 0.0f;
211
            final int wLen = word.word.length();
212
            // TODO: ? used letters vs. word length.
213
214
            // Length of word vs. av. word length.
215
            final float fLenAv = Math.abs(avwLen - (float) wLen) / avwLen;
216
            wWord += fLenAv * cc.textMessageLengthAv;
217
218
            // Length of word vs. message length;
219
            final float fLenMsg = (float) wLen / (float) msgLen;
220
            wWord += fLenMsg * cc.textMessageLengthMsg;
221
222
            // Not letter:
223
            float notLetter = word.getNotLetterRatio();
224
            notLetter *= notLetter;
225
            wWord += notLetter * cc.textMessageNoLetter;
226
227
            wWord *= wWord; // TODO: quadratic ? (configurable)
228
            wWords += wWord;
229
        }
230
        wWords /= (float) letterCounts.words.length;
231
        score += wWords;
232
233
        if (debug && score > 0f) {
234
            debugParts.add("Simple score: " + StringUtil.fdec3.format(score));
235
        }
236
237
        // Engine:
238
        // TODO: more fine grained sync !
239
        float wEngine = 0f;
240
        final Map<String, Float> engMap;
241
        synchronized (engine) {
242
            engMap = engine.process(letterCounts, player.getName(), cc, data);
243
            // TODO: more fine grained sync !s
244
            // TODO: different methods (add or max or add+max or something else).
245
            for (final Float res : engMap.values()) {
246
                if (cc.textEngineMaximum) {
247
                    wEngine = Math.max(wEngine, res.floatValue());
248
                }
249
                else wEngine += res.floatValue();
250
            }
251
        }
252
        score += wEngine;
253
254
255
        // Wrapping it up. --------------------
256
        // Add weight to frequency counts.
257
        final float normalScore = Math.max(cc.textFreqNormMin, score);
258
        data.chatFrequency.add(time, normalScore);
259
        final float accumulated = cc.textFreqNormWeight * data.chatFrequency.score(cc.textFreqNormFactor);
260
        final boolean normalViolation = accumulated > cc.textFreqNormLevel;
261
        final float shortTermScore = Math.max(cc.textFreqShortTermMin, score);
262
        data.chatShortTermFrequency.add(time, shortTermScore);
263
        // TODO: very short term (1st bucket) or do it indirectly.
264
        final float shortTermAccumulated = cc.textFreqShortTermWeight * data.chatShortTermFrequency.score(cc.textFreqShortTermFactor);
265
        final boolean shortTermViolation = shortTermAccumulated > cc.textFreqShortTermLevel;
266
267
        if (normalViolation || shortTermViolation) {
268
            lastCancelledMessage = lcMessage;
269
            lastCancelledTime = time;
270
271
            final double added;
272
            if (shortTermViolation) {
273
                added = (shortTermAccumulated - cc.textFreqShortTermLevel)/ 3.0;
274
            } 
275
            else added = (accumulated - cc.textFreqNormLevel) / 10.0; 
276
            data.textVL += added;
277
278
            if (captcha.shouldStartCaptcha(player, cc, data, pData)) {
279
                captcha.sendNewCaptcha(player, cc, data);
280
                cancel = true;
281
            }
282
            else {
283
                if (shortTermViolation) {
284
                    if (executeActions(player, data.textVL, added, cc.textFreqShortTermActions).willCancel()) {
285
                        cancel = true;
286
                    }
287
                }
288
                else if (normalViolation) {
289
                    if (executeActions(player, data.textVL, added, cc.textFreqNormActions).willCancel()) {
290
                        cancel = true;
291
                    }
292
                }
293
            }
294
        }
295
        else if (cc.chatWarningCheck && time - data.chatWarningTime > cc.chatWarningTimeout && (100f * accumulated / cc.textFreqNormLevel > cc.chatWarningLevel || 100f * shortTermAccumulated / cc.textFreqShortTermLevel > cc.chatWarningLevel)) {
296
            NCPAPIProvider.getNoCheatPlusAPI().sendMessageOnTick(player.getName(), ColorUtil.replaceColors(cc.chatWarningMessage));
297
            data.chatWarningTime = time;
298
        }
299
        else {
300
            data.textVL *= 0.95;
301
            if (cc.textAllowVLReset && normalScore < 2.0f * cc.textFreqNormWeight && shortTermScore < 2.0f * cc.textFreqShortTermWeight) {
302
                // Reset the VL.
303
                // Maybe elaborate on resetting conditions (after some timeout just divide by two or so?).
304
                data.textVL = 0.0;
305
            }
306
        }
307
308
        if (debug) {
309
            final List<String> keys = new LinkedList<String>(engMap.keySet());
310
            Collections.sort(keys);
311
            for (String key : keys) {
312
                Float s = engMap.get(key);
313
                if (s.floatValue() > 0.0f)
314
                    debugParts.add(key + ":" + StringUtil.fdec3.format(s));
315
            }
316
            if (wEngine > 0.0f)
317
                debugParts.add("Engine score (" + (cc.textEngineMaximum?"max":"sum") + "): " + StringUtil.fdec3.format(wEngine));
318
319
            debugParts.add("Final score: " +  StringUtil.fdec3.format(score));
320
            debugParts.add("Normal: min=" +  StringUtil.fdec3.format(cc.textFreqNormMin) +", weight=" +  StringUtil.fdec3.format(cc.textFreqNormWeight) + " => accumulated=" + StringUtil.fdec3.format(accumulated));
321
            debugParts.add("Short-term: min=" +  StringUtil.fdec3.format(cc.textFreqShortTermMin) +", weight=" +  StringUtil.fdec3.format(cc.textFreqShortTermWeight) + " => accumulated=" + StringUtil.fdec3.format(shortTermAccumulated));
322
            debugParts.add("vl: " + StringUtil.fdec3.format(data.textVL));
323
            debug(player, StringUtil.join(debugParts, " | "));
324
            debugParts.clear();
325
        }
326
327
        lastGlobalMessage = data.chatLastMessage = lcMessage;
328
        lastGlobalTime = data.chatLastTime = time;
329
        return cancel;
330
    }
331
}

How it counteracts this module

NoCheatPlus Text scores every chat message before feeding the frequency accumulators. MessageLetterCount splits the payload, and the score combines the uppercase ratio (weighted once it exceeds a third of the length), the letter-count ratio against a 0.5 optimum, the words-per-length partition, and per-word notLetter ratios that are squared before weighting.

The bypass output is structurally one giant word: every original character is followed by three pool draws, most of which are combining marks or punctuation that Character.isLetter rejects, so the single word's notLetter ratio sits near 0.75 and the message letter ratio near 0.25, both far from the 0.5 optimum, and the per-word term is squared again. Even the Hypixel mode, whose U+02CC draw is a modifier letter, still presents a four-times-length word with a letter ratio near 1.0 that deviates as far from the optimum. The resulting score feeds chatFrequency and chatShortTermFrequency, and a sustained bypassed conversation keeps the accumulators above the violation levels, which arms the captcha chain on textVL.

anticheat NoCheatPlus Captcha (exact-match chat gate)

Captcha.java115 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.chat;
16
17
import java.util.concurrent.ThreadLocalRandom;
18
19
import org.bukkit.entity.Player;
20
21
import fr.neatmonster.nocheatplus.checks.Check;
22
import fr.neatmonster.nocheatplus.checks.CheckType;
23
import fr.neatmonster.nocheatplus.players.DataManager;
24
import fr.neatmonster.nocheatplus.players.IPlayerData;
25
import fr.neatmonster.nocheatplus.utilities.ColorUtil;
26
27
/**
28
 * NOTE: EARLY REFACTORING STATE, MOST METHODS NEED SYNC OVER DATA !
29
 * @author mc_dev
30
 *
31
 */
32
public class Captcha extends Check implements ICaptcha{
33
34
    public Captcha() {
35
        super(CheckType.CHAT_CAPTCHA);
36
    }
37
38
    @Override
39
    public void checkCaptcha(Player player, String message, ChatConfig cc, ChatData data, boolean isMainThread) {
40
        // Correct answer to the captcha?
41
        if (message.equals(data.captchaGenerated)) {
42
            // Yes, clear their data and do not worry anymore about them.
43
            data.reset();
44
            data.captchaStarted = false;
45
            player.sendMessage(ColorUtil.replaceColors(cc.captchaSuccess));
46
        } 
47
        else {
48
            // Increment their tries number counter.
49
            data.captchTries++;
50
            data.captchaVL ++;
51
            // Have they failed too man times?
52
            if (data.captchTries > cc.captchaTries) {
53
                // Find out if we need to kick the player or not.
54
                executeActions(player, data.captchaVL, 1, cc.captchaActions);
55
                // (Resetting captcha tries is done on quit/kick).
56
            }
57
            // Display the question again (if not kicked).
58
            if (player.isOnline()) {
59
                sendCaptcha(player, cc, data);
60
            }
61
        }
62
    }
63
64
    @Override
65
    public void sendNewCaptcha(Player player, ChatConfig cc, ChatData data) {
66
        // Display a captcha to the player.
67
        generateCaptcha(cc, data, true);
68
        sendCaptcha(player, cc, data);
69
        data.captchaStarted = true;
70
    }
71
72
    @Override
73
    public void generateCaptcha(ChatConfig cc, ChatData data, boolean reset) {
74
        if (reset) data.captchTries = 0;
75
        final char[] chars = new char[cc.captchaLength];
76
        for (int i = 0; i < cc.captchaLength; i++) {
77
            chars[i] = cc.captchaCharacters.charAt(ThreadLocalRandom.current().nextInt(cc.captchaCharacters.length()));
78
        }
79
        data.captchaGenerated = new String(chars);
80
    }
81
82
    @Override
83
    public void resetCaptcha(Player player){
84
        final IPlayerData pData = DataManager.getPlayerData(player);
85
        ChatData data = pData.getGenericInstance(ChatData.class);
86
        synchronized (data) {
87
            resetCaptcha(player, pData.getGenericInstance(ChatConfig.class), data, pData);
88
        }
89
    }
90
91
    @Override
92
    public void resetCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {
93
        data.captchTries = 0;
94
        if (shouldCheckCaptcha(player, cc, data, pData) || shouldStartCaptcha(player, cc, data, pData)){
95
            generateCaptcha(cc, data, true);
96
        }
97
    }
98
99
    @Override
100
    public void sendCaptcha(Player player, ChatConfig cc, ChatData data) {
101
        player.sendMessage(ColorUtil.replaceColors(cc.captchaQuestion.replace("[captcha]", data.captchaGenerated)));
102
    }
103
104
    @Override
105
    public boolean shouldStartCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {
106
        // TODO: Only call if IWorldData.isCheckActive(CHAT_CAPTCHA) has returned true?
107
        return !data.captchaStarted && pData.isCheckActive(CheckType.CHAT_CAPTCHA, player);
108
    }
109
110
    @Override
111
    public boolean shouldCheckCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {
112
        // TODO: Only call if IWorldData.isCheckActive(CHAT_CAPTCHA) has returned true?
113
        return data.captchaStarted  && pData.isCheckActive(CheckType.CHAT_CAPTCHA, player);
114
    }
115
}

How it counteracts this module

Captcha is the escalation every Text violation reaches: on the first violation Text calls sendNewCaptcha, which generates a random string of cc.captchaLength characters and delivers it through the server chat channel (the S02 side), and from then on checkCaptcha requires an exact message equals data.captchaGenerated match.

The bypass cannot answer by construction: the rewritten payload is the original text with random codepoints interleaved, never the generated captcha string, so every message increments captchTries and captchaVL until cc.captchaTries is exceeded and the configured actions run. The module has no receive-side logic at all, so it cannot detect the question, let alone feed the answer back; once the frequency accumulators arm the captcha, the module converts itself into a guaranteed-wrong-answer machine.

anticheat Grim ChatB (structural chat gate, honest boundary)

ChatB.java54 lines · Java
1
package ac.grim.grimac.checks.impl.chat;
2
3
import ac.grim.grimac.api.storage.verbose.Verbose;
4
import ac.grim.grimac.checks.Check;
5
import ac.grim.grimac.checks.CheckData;
6
import ac.grim.grimac.checks.type.PreViaPacketReceiveListener;
7
import ac.grim.grimac.player.GrimPlayer;
8
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
9
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
10
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
11
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatCommand;
12
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatCommandUnsigned;
13
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatMessage;
14
15
// this can false from click events, but I doubt this would actually
16
// happen unless they're trying to flag, or if the server is set up badly
17
@CheckData(name = "ChatB", stableKey = "grim.exploit.spigot_antispam_bypass", description = "Invalid chat message")
18
public class ChatB extends Check implements PreViaPacketReceiveListener {
19
    private static final Verbose V = Verbose.of("[message|command]={str}");
20
21
    public ChatB(GrimPlayer player) {
22
        super(player);
23
    }
24
25
    @Override
26
    public void onPreViaPacketReceive(PacketReceiveEvent event) {
27
        if (event.getPacketType() == PacketType.Play.Client.CHAT_MESSAGE) {
28
            String message = new WrapperPlayClientChatMessage(event).getMessage();
29
            if (message.isEmpty() || !message.trim().equals(message)
30
                    || message.startsWith("/") && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19)) {
31
                if (flag(V.write(verbose()).bool(true).str(message)) && shouldModifyPackets()) {
32
                    player.onPacketCancel();
33
                    event.setCancelled(true);
34
                }
35
            }
36
        }
37
38
        if (event.getPacketType() == PacketType.Play.Client.CHAT_COMMAND_UNSIGNED) {
39
            String command = "/" + new WrapperPlayClientChatCommandUnsigned(event).getCommand();
40
            if (!command.stripTrailing().equals(command) && flag(V.write(verbose()).bool(false).str(command))) {
41
                event.setCancelled(true);
42
                player.onPacketCancel();
43
            }
44
        }
45
46
        if (event.getPacketType() == PacketType.Play.Client.CHAT_COMMAND) {
47
            String command = "/" + new WrapperPlayClientChatCommand(event).getCommand();
48
            if (!command.trim().equals(command) && flag(V.write(verbose()).bool(false).str(command))) {
49
                event.setCancelled(true);
50
                player.onPacketCancel();
51
            }
52
        }
53
    }
54
}

How it counteracts this module

Grim's ChatB is the C01 structural gate in the corpus: it cancels messages that are empty, that carry leading or trailing whitespace (message.trim() inequality), or, on client versions 1.19 and newer, that start with a slash.

The bypass output preserves all three properties: it is never empty, the pool draws are appended after every character so no whitespace appears at either end, and slash messages are skipped before rewriting. ChatB therefore validates the mangled payload as a well-formed chat message and passes it through; the check is included as the honest boundary that shows the rewrite is structurally invisible, which is exactly why the countering burden falls on content scoring (Text) and the exact-match gate (Captcha) rather than on packet structure.

← Back to Analysis Hub