Skip to content

fix(security): validate SetItemInSlotPacket targets MFFS ghost slots only#132

Open
Sweizeur wants to merge 1 commit into
BuiltBrokenModding:1.21.1from
Sweizeur:fix/set-slot-item-validation
Open

fix(security): validate SetItemInSlotPacket targets MFFS ghost slots only#132
Sweizeur wants to merge 1 commit into
BuiltBrokenModding:1.21.1from
Sweizeur:fix/set-slot-item-validation

Conversation

@Sweizeur

@Sweizeur Sweizeur commented Jul 15, 2026

Copy link
Copy Markdown

Summary

SetItemInSlotPacket (mffs:set_slot_item) accepts any slot index and ItemStack from the client and writes it into the player's currently open container menu without validation. A modified client can target player inventory slots (e.g. while InventoryMenu is open) and inject arbitrary items.

This patch restricts the handler to MFFS ghost filter slots only, matching the legitimate JEI usage in BasicGhostIngredientHandler.

Impact

  • Severity: Critical
  • Effect: Arbitrary item give (self) on dedicated servers
  • Affected version: mffs-5.4.27.jar (Minecraft 1.21.1 / NeoForge), used in the All the Mods 10 modpack

Legitimate usage

The packet is sent from BasicGhostIngredientHandler when dragging JEI ingredients onto SlotInventoryFilter slots in MFFS screens (FortronMenu subclasses).

Fix

In SetItemInSlotPacket.handle():

  1. Server-side only (!ctx.flow().isClientbound())
  2. Require open menu to be a FortronMenu
  3. Validate 0 <= slot < menu.slots.size()
  4. Require target slot to be a SlotInventoryFilter

Reproduction

  1. Join a server with MFFS 5.4.27
  2. Send mffs:set_slot_item with a player inventory slot index and an arbitrary ItemStack while any container is open
  3. The item appears in the targeted inventory slot without going through normal give/creative commands

@Su5eD Su5eD self-assigned this Jul 15, 2026
@Su5eD Su5eD added the bug label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants