Skip to content

Limit max size of subscription codec#13943

Open
HaHaWTH wants to merge 1 commit into
PaperMC:mainfrom
HaHaWTH:fix/limit-subscription-size
Open

Limit max size of subscription codec#13943
HaHaWTH wants to merge 1 commit into
PaperMC:mainfrom
HaHaWTH:fix/limit-subscription-size

Conversation

@HaHaWTH

@HaHaWTH HaHaWTH commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a maximum size limit to the ServerboundDebugSubscriptionRequestPacket codec.

Debug subscription packets are known to be abused by hack clients, in local testing, one client was able to fully occupy at least one Netty IO thread on a high-end system without triggering Paper's packet limiter.

image

Fix

Requests containing more than 64 subscriptions are now rejected and disconnect the client with a DecoderException to avoid excessive CPU usage and memory alloc.

The max size should be changed once Mojang adds more subscriptions in DebugSubscriptions. (currently the total count of subscriptions is 16 tho)

@HaHaWTH HaHaWTH requested a review from a team as a code owner June 8, 2026 13:41
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Jun 8, 2026
@Euphillya

Copy link
Copy Markdown
Contributor

I think we should set the value in the configuration settings and disable it by default

@HaHaWTH

HaHaWTH commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

I think we should set the value in the configuration settings and disable it by default

Could you clarify when this limit would need to be disabled or changed? The current vanilla debug subscription count is 16, so 64 seems safe above the expected value while still preventing abusive decode sizes.

I am not sure Paper's global configuration is guaranteed to be loaded before this codec is initialized.

@Malfrador

Copy link
Copy Markdown
Member

Given this is a debug feature, I believe having it limited by default is fine.

General making exploit fixes opt-in somewhat defeats their purpose imo

@Owen1212055

Copy link
Copy Markdown
Member

Thank you for your PR! Yeah, this does not need to be configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

4 participants