51-percent-attack
A 51-percent-attack or majority attack is an attack vector in proof-of-work-based networks. In this case, an attacker combines more than half of the network’s computing power (hash power) and can thus modify the blockchain.
Let’s imagine:
Alice doesn’t know what she’s in for and tells Eve her Bitcoin receiving address. Eve then constructs a transaction TX1 to Alice and sends it to the network. Along the way, however, Eve has constructed another transaction TX2 with the same money to herself. Once Eve has sent TX1 to the Bitcoin network, she deploys her own mining computers and mines a block that contains only TX2 instead of TX1. If Eve has significantly more than half the hash rate with her mining computers, she will likely find the next block before the rest of the Bitcoin network. Thus, only her constructed block is valid and so is the TX2 it contains. The original block with TX1 is invalid for it. So Alice never got her money. If Alice has already given the product to Eve, Eve has the product and her money. Alice is left empty-handed.
Eve could be even meaner, though, by running her miners in the background first. Alice sees that TX1 has already been confirmed by two blocks and ships the product. Only now does Eve publish its own version of the blockchain. If Eve had significantly more hash rate than the rest of the network, she would likely mine the longer blockchain. Thus, there is a newly valid history of transactions. By convention, the longest blockchain is the valid version.
All in all, a 51-percent-attack allows the attacker to perform double-spends and censor transactions. Arbitrary manipulation of the ruleset is not possible. Attackers could dare to perform a double-spend exactly once – but thanks to the transparency of the blockchain, they would be noticed afterwards.
Whether such an attack is worthwhile, i.e., remaining without legal consequences, depends on the cryptocurrency. In the case of large networks, such an attack is rather unlikely. There have already been successful 51-percent-attacks against some altcoins. One example is the majority attack on the Ethereum Classic blockchain in 2019.