A silverfish is a small hostile arthropod that hides in certain stone blocks and attacks at close range. It has 8 health points (4 hearts) in both editions. Its entity ID is minecraft:silverfish.
Infested blocks. Breaking an infested block can release a silverfish. Infested blocks occur in strongholds, igloo basements, woodland mansions and underground in mountain biomes. In Java Edition, breaking the block with Silk Touch prevents the silverfish from emerging.
Strongholds. A regular monster spawner in the End portal room produces silverfish.
Trial Chambers. A Trial Spawner can be set to silverfish when the chamber generates with silverfish as its small melee mob.
Infested status effect. An affected creature has a 10% chance to spawn one or two silverfish when hurt. Silverfish themselves are immune to the effect.
Silverfish pursue players and attack in melee. A silverfish can burrow into a compatible block, such as stone or stone bricks, leaving an infested block behind. An attack can turn one encounter into a swarm when other silverfish emerge from nearby blocks.
In Java Edition, damage attributed to another entity or damage of the minecraft:magic type starts a delayed search for infested blocks. If the silverfish survives long enough for the search and mob griefing is enabled, some of those blocks can break and release their occupants. With mob griefing disabled, the search restores affected blocks to their uninfested state without releasing silverfish.
Silverfish have no item drops. In both editions, a silverfish can yield 5 experience points when the kill is credited to a player. Trial Spawner rewards come from the spawner after the encounter is cleared.
Bedrock Edition's attack behavior also targets snow golems and iron golems. Its angry state can spread to nearby silverfish and enables the behavior that calls silverfish out of blocks. Java Edition checks the damage source to start its delayed block search.