Boom!!
It's built into the software code for checks and verification
You can run a node and open up the logs and you'll see your node banning specific IP's as it detects "bad" network information
This is at the heart of how Bitcoin revolutionized the world when it provided a solution to the Byzantine General's problem
-----------------------
If you do not run a full node, you're relying on others to provide the truth to you which most of the time are ok, think Electrum wallets relying on public Electrum servers
This is one of the criticisms of the Ethereum network as hardly anyone runs a full node (including me) and when the Metamask wallet started blocking Russian transactions, they did so by blocking it on the Infuria server infrastructure and incorrectly blocked Venezuela for about a day
------------------------
Byzantine General's problem
https://bitcoin.org/bitcoin.pdf