The job of a firewall is to block ports. It isn’t to block malicious programs.
That’s the job of your antivirus program.