fix: restore anti-cheat movement defense with stair/slab compatibility#732
fix: restore anti-cheat movement defense with stair/slab compatibility#732lt-name wants to merge 5 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
tachibana-kanade-angel
left a comment
There was a problem hiding this comment.
📋 PR Review
✅ Summary
The restructured anti-cheat movement defense introduces two significant security bypass vectors. While the intent to restore speed-checking and stair/slab compatibility is reasonable, the implementation has critical flaws that need addressing before merge.
🔍 Issues Found
Blocking:
-
[CRITICAL]Y-axisshrink(0.1, stepHeight, 0.1)creates noclip vectors (Player.java:2160)- The bounding box is shrunk by
getStepHeight()on Y from both top and bottom before collision checking. For a standing player (height ~1.8, stepHeight ~0.5-1.0), only the middle body slice is checked, allowing noclip through bottom slabs, lower stair sections, and head-level partial blocks. For swimming/crawling/gliding where player height is similar to stepHeight, the probe can collapse entirely and skip collision detection.
- The bounding box is shrunk by
-
[CRITICAL]knockBackTime <= 0completely disables raw speed check (Player.java:2143)- The new anti-speed-hack gate is fully bypassed when
knockBackTime > 0. Since any melee hit setsknockBackTime = 10server-side, a player can collude with mobs or other players to keep this timer refreshed, allowing arbitrary horizontal speed during combat without triggering the check. This is a regression compared to the old code that checked correction amount regardless of knockback state.
- The new anti-speed-hack gate is fully bypassed when
Minor:
-
[MINOR]knockBackTimeis an incomplete proxy for legitimate velocity (Player.java:2143)- Some server-applied motion uses
setMotion()without settingknockBackTime(e.g., Wind Charge, Mace Wind Burst), while melee knockback sets the timer even when the actual horizontal displacement is small or cancelled by plugins. This creates inconsistent behavior where some legitimate velocity sources bypass the check while others do not.
- Some server-applied motion uses
💡 Recommendations
- For the noclip probe, use full-height collision checking at the destination position or apply only a narrow foot-level Y tolerance for stair/slab stepping instead of symmetric
stepHeightshrink. - Replace the blanket
knockBackTime <= 0exemption with an expected-velocity model: track server-applied motion and allow client delta within a bounded margin of the expected velocity, consuming that allowance per-tick.
📝 Notes
These two blocking issues should be addressed before merge. The minor issue can be addressed separately.
🤖 AI Review
|
@tachibana-kanade-angel review |
📋 PR Review — AI Review✅ Summary本次 review 未发现阻塞性问题。PR 将防作弊移动检测从"根据 🔍 Issues Found无严重问题。 💡 Recommendations
📝 Notes
🤖 AI Review @lt-name 可以合并 |
# Conflicts: # src/main/java/cn/nukkit/Player.java
No description provided.