# Polymorphic Adversarial Cyberattacks Using WGAN
## 5 Proposed Framework
### Polymorphic Engine to Generate a Polymorphic Attack  
We evaluated different methods for updating the attack feature profile to generate polymorphic adversarial DDoS/DoS attacks. The following approaches were considered:  
**Approach 1:** Select a subset of non-functional features in a polymorphic attack cycle. Randomly increase the values of these features in the attack profile by a small percentage to generate new data for training the attacker, which in turn synthesizes a polymorphic attack each time IDS detects the previous adversarial polymorphic attack. Repeat this process until the attacker runs out of features or until the IDS can classify all of the polymorphic attacks. **Approach 2:** Add a new set of features from the predefined list of features in the current attack profile to train the attacker after the IDS detects previous adversarial attacks. Keep repeating this process for each polymorphic attack until the attacker runs out of features or until the IDS can classify all of the polymorphic attacks. This approach employs both manual feature selection, as well as automated feature selection using Reinforcement learning. In the above techniques, we assumed that an attacker could modify the feature profile and train the generator model with the new feature profile every time after the IDS detects a polymorphic attack. Algorithm 2 shows the process for training the IDS, and Algorithms 3 and 4 are employed to synthesize a polymorphic adversarial attack. In the case of Algorithm 3, we select a set of five non-functional (non-attack) features from the training data and randomly increased their values by 5%. The functional (attack) features are kept constant to preserve the attack characteristics. The generator is then trained using the new dataset to synthesize polymorphic attacks and evade detection by the IDS. Then, the IDS is retrained with new synthesized adversarial data using Algorithm 2. The polymorphic attack generation phase is repeated by adding another set of five non-functional features and the IDS performance is evaluated again. This process is repeated until the attacker has no more features left or until the IDS can successfully identify all of the attacks. ```
Input:  Generator\(\leftarrow\)N noise + Original Attack Data  IDS\(\leftarrow\)Benign or Normal Data, Adversarial Data, and Previously Generated Adversarial Data  Critic/Discriminator\(\leftarrow\)Setstack and Shenign Output:  Trained Critic/Discriminator, Generator, and IDS for epochs = 1,..., MAX EPOCHS do for G-iterations do  Generator creates adversarial network attacks using Setstack and updates loss using \(\mathrm{P_{G}}\) function  end for D-iterations do  Critic/Discriminator classifies the network data to Bhenign and Battack. Update loss using \(\mathrm{P_{D}}\) function  Fed Battack (Adversarial data) and Previously Generated Adversarial Data to the IDS end  end
```  
**Algorithm 2** Training IDS with the adversarial attack data. Algorithm 4 works in a slightly different manner. Here, in the first cycle, a subset of three non-functional features is selected and their values are randomly increased by 5% to create new training data for the attacker, which can synthesize polymorphic attacks. The IDS performance against these polymorphic attacks is evaluated and retraining is performed to improve its detection results. In the next phase of polymorphic attack generation, we select a new subset of six non-functional features to synthesize another polymorphic attack. This process is repeated until the attacker has no more features left or until the IDS can successfully identify all of the attacks.