A keylogger is a type of malware or hardware device that records keystrokes on a computer or device without the user's knowledge. It allows attackers to capture sensitive information such as passwords, credit card numbers, or other confidential data.