Tesla (TSLA  ) CEO Elon Musk confirmed that a cyberattack on the Tesla gigafactory was stopped by a Tesla employee. Teslarati, a website specifically dedicated to updates on Tesla, reported the incident that happened in Nevada where an employee turned down an offer of $ 1 million to insert malware into the company's networks.

Egor Igorevich Kriuchkov, a Russian national, was arrested for trying to commit a cyberattack against the electric car company.

The malware would at first provided a distraction to Tesla's cybersecurity team then the next stage of attack would have extract all sensitive data from the network which would get sent to Kriuchov's organization to ransom back to Tesla. Similar cyberattacks have cost companies between $4 to $6 million.

Kriuchkov traveled to the United States in July as a tourist to make contact with an employee at the Tesla gigafactory in Nevada. He met the employee several times before making a deal with the employee to introduce malware into the system to extract classified information and corporate data to dismantle Tesla's operations.

The employee informed Tesla who then informed the U.S. Federal Bureau of Investigation (F.B.I.). The F.B.I. launched an operation with the assistance of the employee who maintained contact with Kriuchkov through text messages to negotiate the terms of the malware attack.

Thanks to the combined efforts of the F.B.I. and Tesla's employee, there was enough information to arrest Kriuchkov on August 22 as he was trying to return to Russia from Los Angeles.

"The purpose of the conspiracy was to recruit an employee of a company to surreptitiously transmit malware provided by the co-conspirators into the company's computer system, exfiltrate data from the company's network, and threaten to disclose the data online unless the company paid the co-conspirators' ransom demand," the U.S. Justice Department said in the filing.

Kriuchkov was ordered to appear in court before the U.S. Magistrate Judge Alexander F. MacKinnon in U.S. District Court in Los Angeles, California.