Mojira Archive
MC-197601

clickEvents are not removed from item entities before they are shown in chat, allowing tricking players

The bug

It appears MC-124024 was fixed for every entity except item entities because they define net.minecraft.world.entity.item.ItemEntity.getName() which does not perform the sanitization.

Reproduction steps

  1. Use the following command in a command block
    /summon item ~ ~1 ~ {PickupDelay:200s,Item:{id:stone,Count:1b},CustomName:"{\"text\":\"Stone\",\"extra\":[{\"text\":\"\\n<RandomGuy> Please click my name to write a message directly to me\",\"hoverEvent\":{\"action\":\"show_text\",\"contents\":\"\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say This could have been /op RandomGuy!\"}}]}"}
    
  2. Use the following command to have the name of the armor stand appear in chat
    /say @e[type=item,limit=1]
    

    → It looks like "RandomGuy" wrote something in chat

  3. Click on "RandomGuy" to reply to them
    You just executed an arbitrary command

Unresolved

Marcono1234

2020-08-10, 02:07 PM

2023-08-22, 02:26 PM

0

2

Confirmed

Normal

Platform

UI

1.16.2 Release Candidate 1, 1.16.2

-