Pharming attacks can be carried out in two ways: through DNS poisoning or malware infection.