Hackers can initiate a pharming attack by modifying the hosts file on the user's computer.By altering it, attackers can redirect legitimate website requests to malicious sites, tricking users into entering sensitive information on fake websites.