# Shamoon

Shamoon (Persian: شمعون), also known as W32.DistTrack, is a modular computer virus that was discovered in 2012, targeting then-recent 32-bit NT kernel versions of Microsoft Windows. The virus was notable due to the destructive nature of the attack and the cost of recovery. Shamoon can spread from an infected machine to other computers on the network. Once a system is infected, the virus continues to compile a list of files from specific locations on the system, upload them to the attacker, and erase them. Finally the virus overwrites the master boot record of the infected computer, making it unusable.
The virus was used for cyberwarfare against national oil companies including Saudi Arabia's Saudi Aramco and Qatar's RasGas. A group named "Cutting Sword of Justice" claimed responsibility for an attack on 30,000 Saudi Aramco workstations, causing the company to spend more than a week restoring their services. The group later indicated that the Shamoon virus had been used in the attack. Computer systems at RasGas were also knocked offline by an unidentified computer virus, with some security experts attributing the damage to Shamoon. It was later described as the "biggest hack in history".
Symantec, Kaspersky Lab, and Seculert announced discovery of the malware on 16 August 2012. Kaspersky Lab and Seculert found similarities between Shamoon and the Flame malware. Shamoon made a surprise comeback in November 2016, January 2017, and December 2018.

## Design

Shamoon was designed to erase and overwrite hard drive data with a corrupted image and report the addresses of infected computers back to the computer inside the company's network. The malware had a logic bomb which triggered the master boot record and data wiping payload at 11:08 am local time on Wednesday, August 15. The attack occurred during the month of Ramadan in 2012. It would appear that the attack was timed to occur after most staff had gone on holiday reducing the chance of discovery before maximum damage could be caused, hampering recovery.
The virus consisted of three components, the Dropper, the Wiper and the Reporter. The Dropper, the source of the infection, creates a service with the name 'NtsSrv' that enables it to remain persistent on the infected computer. The Dropper was built in 32-bit and 64-bit versions. If the 32-bit dropper detects a 64-bit architecture, it drops the 64-bit version. This component drops the Wiper and the Reporter onto the infected computer and executes itself. It spreads across a local network by copying itself to network shares and on to other computers.
The Wiper component utilizes an Eldos-produced driver known as RawDisk to achieve direct user-mode access to a hard drive without using Windows APIs. It identifies the locations of all files on the infected computers and erases them. It sends information about the files destroyed to the attacker and then overwrites the erased files with corrupted data so they cannot be recovered. The component used portions of an image. In the 2012 attack it used an image of a burning U.S. flag; in the 2016 attack it used a photo of the body of Alan Kurdi.

## Before the attack

The malware was unique, used to target the Saudi government by causing destruction to the state-owned national oil company Saudi Aramco. The attackers posted a pastie on Pastebin hours prior to the wiper logic bomb occurring, citing "oppression" and the Saudi government as a reason behind the attack. According to Chris Kubecka, a security advisor to Saudi Aramco after the attack and group leader of security for Aramco Overseas, the attack was well-staged. It was initiated by a phishing email attack that an unnamed Saudi Aramco Information Technology employee opened, giving the group entry into the company's network around mid-2012.
   We, behalf of an anti-oppression hacker group that have been fed up of crimes and atrocities taking place in various countries around the world, especially in the neighboring countries such as Syria, Bahrain, Yemen, Lebanon, Egypt and ..., and also of dual approach of the world community to these nations, want to hit the main supporters of these disasters by this action. One of the main supporters of this disasters [sic] is Al-Saud corrupt regime that sponsors such oppressive measures by using Muslims oil resources. Al-Saud is a partner in committing these crimes. It's [sic] hands are infected with the blood of innocent children and people. In the first step, an action was performed against Aramco company, as the largest financial source for Al-Saud regime. In this step, we penetrated a system of Aramco company by using the hacked systems in several countries and then sent a malicious virus to destroy thirty thousand computers networked in this company. The destruction operations began on Wednesday, Aug 15, 2012 at 11:08 AM (Local time in Saudi Arabia) and will be completed within a few hours.
Kubecka described in a Black Hat USA talk that Saudi Aramco placed the majority of their security budget on the ICS control network, leaving the business network at risk for a major incident.

## During the attack

On 15 August at 11:08 am local time, over 30,000 Windows based systems began to be overwritten. Symantec found some of the affected systems showed an image of an American flag while their data was being deleted and overwritten. Saudi Aramco announced the attack on their Facebook page and went offline again until a company statement was issued on 25 August 2012. The statement falsely reported normal business was resumed on 25 August 2012. However a Middle Eastern journalist leaked photographs taken on 1 September 2012 showing kilometers of petrol trucks unable to be loaded due to hacked business systems still inoperable.
"Saudi Aramco has restored all its main internal network services that were impacted on August 15, 2012, by a malicious virus that originated from external sources and affected about 30,000 workstations. The workstations have since been cleaned and restored to service. As a precaution, remote Internet access to online resources was restricted. Saudi Aramco employees returned to work August 25, 2012, following the Eid holidays, resuming normal business. The company confirmed that its primary enterprise systems of hydrocarbon exploration and production were unaffected as they operate on isolated network systems. Production plants were also fully operational as these control systems are also isolated."
On August 29, 2012 the same attackers behind Shamoon posted another pastie on PasteBin.com, taunting Saudi Aramco with proof they still retained access to the company network. The post contained the username and password on security and network equipment and the new password for Aramco CEO Khalid Al-Falih. The attackers also referenced a portion of the Shamoon malware as further proof in the pastie:
   "mon 29th aug, good day, SHN/AMOO/lib/pr/~/reversed
   We think it's funny and weird that there are no news coming out from Saudi Aramco regarding Saturday's night. well, we expect that but just to make it more clear and prove that we're done with we promised, just read the following facts -valuable ones- about the company's systems:
   - internet service routers are three and their info as follows:
       Core router: SA-AR-CO-1# password (telnet): c1sc0p@ss-ar-cr-tl / (enable): c1sc0p@ss-ar-cr-bl
       Backup router: SA-AR-CO-3# password (telnet): c1sc0p@ss-ar-bk-tl / (enable): c1sc0p@ss-ar-bk-bl
       Middle router: SA-AR-CO-2# password (telnet): c1sc0p@ss-ar-st-tl / (enable): c1sc0p@ss-ar-st-bl
   - Khalid A. Al-Falih, CEO, email info as follows:
       Khalid.falih@aramco.com password:kal@ram@sa1960
   - security appliances used:
       Cisco ASA # McAfee # FireEye :
       default passwords for all!!!!!!!!!!
   We think and truly believe that our mission is done and we need no more time to waste. I guess it's time for SA to yell and release something to the public. however, silence is no solution.
   I hope you enjoyed that. and wait our final paste regarding SHN/AMOO/lib/pr/~
   angry internet lovers #SH"
According to Kubecka, in order to restore operations, Saudi Aramco used its large private fleet of aircraft and available funds to purchase much of the world's hard drives, driving the price up. New hard drives were required as quickly as possible so oil prices were not affected by speculation. By September 1, 2012 gasoline resources were dwindling for the public of Saudi Arabia 17 days after the August 15th attack. RasGas was also affected by a different variant, crippling them in a similar manner.
It is unclear why the attacker may have an interest in actually destroying the infected PC. Kaspersky Labs hinted that the 900 KB malware could be related to Wiper, that was used in a cyber attack on Iran in April. After a 2-day analysis, the company erroneously concluded that the malware is more likely to come from "scriptkiddies" who were inspired by Wiper. Later, in a blog post, Eugene Kaspersky clarified the use of Shamoon categorizing as cyberwarfare.