Skip to content

Limit max size of subscription codec#13943

Merged
Owen1212055 merged 1 commit into
PaperMC:ver/26.1.2from
HaHaWTH:fix/limit-subscription-size
Jun 18, 2026
Merged

Limit max size of subscription codec#13943
Owen1212055 merged 1 commit into
PaperMC:ver/26.1.2from
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.

@HaHaWTH

HaHaWTH commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

This seems to be patched by Mojang in 26.2, should this be backported to old versions?

@Owen1212055 Owen1212055 changed the base branch from main to ver/26.1.2 June 18, 2026 16:40
@Owen1212055 Owen1212055 force-pushed the fix/limit-subscription-size branch from 27ce222 to 5e7a5f9 Compare June 18, 2026 16:46
@Owen1212055 Owen1212055 force-pushed the fix/limit-subscription-size branch from 5e7a5f9 to 591dc20 Compare June 18, 2026 18:39
@Owen1212055 Owen1212055 merged commit 2dc3641 into PaperMC:ver/26.1.2 Jun 18, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting review to Merged in Paper PR Queue Jun 18, 2026
@Potothingi

Copy link
Copy Markdown

Can a player without OP permissions exploit this? If so, why is this debug feature allowed for players without OP permissions?

@HaHaWTH HaHaWTH deleted the fix/limit-subscription-size branch June 19, 2026 04:37
@HaHaWTH

HaHaWTH commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Can a player without OP permissions exploit this? If so, why is this debug feature allowed for players without OP permissions?

This works on the netty level, permissions are not checked yet when decoding packets.

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

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

5 participants