Firewalls protect against malware and phishing attacks by inspecting inbound and outbound traffic for known malicious signatures, suspicious behavior, or unauthorized access attempts, and blocking or alerting on detected threats.