Ransomware is a type of malware that an attacker installs on a user's system, stealthily encrypting the user's files or data. The attacker demands a ransom from the victim to decrypt the locked files and restore access. 2FA is effective at preventing ransomware attacks by keeping attackers out of the system.