A US federal jury found Rajendrasinh Babubhai Makwana guilty of computer intrusion, according to US reports.
The FBI said Makwana worked as a contractor for the firm for three years in which he had access to the organisation's almost 5,000 servers.
The malicious script, set to execute on 31 January 2009, was discovered five days after Makwana was fired in October 2008.
Investigators found Makwana had, on the day he was fired, planted the malicious code designed to destroy all data on the Fannie Mae network.
The federal court heard evidence that it would have taken a week for the company to get its systems up and running again.
Security experts said the planned attack, which would have been enormously disruptive to the business, is a reminder of the danger of insider attacks.
The incident also highlights the need for companies to control privileged identities and high-level access to systems, they said, to protect sensitive information from unauthorised access and to prevent security failures.