Some types of firewalls offer protection against malware, but only malware that tries to enter your network or device via the internet. Firewalls inspect incoming traffic and data packets to see if they contain malicious codes. However, firewalls can’t protect your devices from malware from other sources, such as another infected computer or storage device.