Synthetic Data in Cybersecurity: Training Defenses Against Malware Without Suffering Actual Attacks

Training systems capable of detecting malware and cyberattacks poses a problem: the most significant threats do not always generate enough real, labeled, and secure data to use as training material. Synthetic data in cybersecurity offers an alternative by generating artificial samples that replicate certain characteristics of real data without the need for executable malware or sensitive information. This approach is expanded upon by cyber ranges—simulated environments where teams can recreate attacks, analyze defensive responses, and repeat experiments in a controlled manner. In a context where digital technologies are becoming increasingly important for citizens, businesses, and institutions, developing capabilities to test and strengthen their security is particularly important. However, synthetic data also presents limitations related to its accuracy, the realism of the simulations, and the potential dual use of these technologies.

Photo Pablo Gomez Guerrero

Pablo Gómez Guerrero Follow

Reading time: 11 min

Synthetic data allows for the training and evaluation of threat detection systems when real-world examples of malware and intrusions are scarce, sensitive, or difficult to obtain. Combined with cyber ranges and red teaming techniques, it enables the recreation of attacks and network scenarios in a controlled and repeatable manner.

Its usefulness depends, however, on three fundamental factors: that the generated data is sufficiently representative of real-world situations, that the simulators accurately reproduce the environments they are intended to model, and that the tests are conducted in an isolated and controlled manner.

IN A SENTENCE

Synthetic data enables the training of cybersecurity systems using variants of malware and simulated cyberattacks in controlled environments, expanding learning scenarios without having to endure such incidents on a real network.

Why Is There a Shortage of Real Data for Training Malware Detection Systems?

There is a paradox in cybersecurity: to train an effective defense, it is necessary to understand how real attacks behave, but obtaining sufficient, representative, and usable data on these incidents is particularly challenging.

Labeled data on malware and intrusions is scarce, expensive, and sensitive. Researchers working on advanced persistent threats (APTs)—targeted attacks that can remain hidden on a network for long periods—have pointed to the lack of realistic, labeled datasets as an obstacle to systematically evaluating detection. APTs are stealthy and unfold in multiple phases, which exacerbates the problem.

An example helps illustrate this. Imagine a bank wants to train a system to detect ransomware—a type of malware that encrypts files and may demand a ransom. To train it using numerous real-world, well-labeled cases, the bank would need a sufficient number of representative samples. Obtaining these samples may involve handling internal and highly sensitive information. And having few examples makes it difficult to learn precisely how to detect those less frequent incidents.

What is synthetic data, and how can it be used to detect malware?

Synthetic data is data artificially generated to replicate certain characteristics or patterns found in real data. In cybersecurity, it can be used to expand the available material for training and evaluating detection systems without the generated samples having to be executable malware or incorporate real customer information.

Research is already underway to explore this approach from different perspectives:

  1. A study on Android malware trained an artificial intelligence capable of creating new data similar to real data. Its tool, MalSynGen, verifies both the similarity of the generated data to the originals and its usefulness for training. It was tested with six datasets of Android malware. The generated data describes malware characteristics but is not executable malware and, therefore, cannot infect a computer.
  2. Another study converted malware samples into images analyzable by artificial intelligence and generated new synthetic images to expand the training dataset. The results indicate an improvement in classification accuracy when using the expanded data, especially for types of malware for which few examples exist.
  3. On Windows, a 2026 study uses synthetic data to train detectors against evasion attempts, much like a security guard preparing for increasingly sophisticated ways to bypass a checkpoint.

The underlying idea is simple: threats evolve, and the datasets used to train models may not represent all their possible variations.

Polymorphic malware, which modifies certain characteristics to make it harder to recognize, and zero-day threats—related to vulnerabilities not yet known to the manufacturer—pose challenges to detection mechanisms. Generating synthetic variants allows for expanding the scenarios used to train and evaluate these systems.

How does synthetic data help train cybersecurity systems to combat new threats?

Synthetic data makes it possible to artificially expand the number and variety of scenarios used during training, which is especially useful when there are few samples of a particular threat.

It’s like a flight simulator: pilots can practice handling malfunctions in an environment that replicates certain real-world conditions, but where a mistake doesn’t have the same consequences. Similarly, if a security team has few samples of a rare piece of malware, it can generate synthetic variants to expand the model’s training and test whether it can recognize modifications to the initial pattern.

This does not mean the system will always detect a new variant. Synthetic data expands the possibilities for training and evaluation, but its usefulness depends on its quality and how closely it approximates the real-world phenomena it aims to represent.

Security and trust are also key factors in accessing digital technologies that are increasingly present in the activities of individuals, businesses, and institutions. In this area, Telefónica has taken on the clear challenge of being the best gateway for citizens, businesses, and institutions to access digital technologies. Exploring methods to evaluate and strengthen the resilience of digital systems thus aligns with a vision of innovation where technological development must go hand in hand with security and trust.

What is a cyber range, and what is its purpose in cybersecurity?

A cyber range is a simulated environment in which a technological infrastructure is replicated to execute controlled cyberattacks and analyze how systems and defensive mechanisms respond.

The next step in synthetic data, therefore, is to move from generating individual samples to recreating complete scenarios.

A recent study combines two public collections of network traffic—including attacks and normal activity—in a simulator called CyDER 2.0. In this environment, attackers and defenders learn through trial and error, using reinforcement learning, and adapt to one another rather than following only predefined rules. It is comparable to a game of chess in which both players can learn as they play.

Traditionally, building this type of environment could require manually configuring each machine and connection. Research is also being conducted into automating this process. A tool called ARCeR, for example, allows users to create and deploy environments based on a description written in natural language, such as “an office network with a web server and twenty computers.”

Simulation can also be used to generate data. When automated cyberattacks are executed within a simulator, it is possible to log what happens on the network. These logs can be used to create datasets corresponding to different types of networks and attacks without having to deploy the same physical infrastructure for each test. A single scenario can be configured to study its behavior on networks of different sizes.

For non-technical users, a cyber range is similar to a fire drill in an empty building: a small corporate network is recreated, and an incident is triggered in a controlled manner to observe how each component reacts without affecting production infrastructure.

For example, a team can simulate a phishing email reaching an employee and observe whether the attacker manages to move to other computers, which alerts are triggered, and how long it takes the defense system to contain the incident. Since it is a simulation, the exercise can be repeated to analyze different configurations and responses.

How is Red Teaming changing with synthetic adversaries and scenarios?

Red Teaming uses controlled attack exercises to test an organization’s defenses. Synthetic environments make certain scenarios repeatable and facilitate the re-evaluation of defenses after changes are implemented.

In a traditional exercise, a team conducts the tests, documents the results, and then implements corrections. Synthetic environments allow some of these scenarios to be repeated systematically.

Synthetic adversary campaigns consist of simulated, controlled, and repeatable attacks, which may be aided by artificial intelligence and executed within a cyber range. Their goal is to test how defensive agents detect and contain specific threats.

A particularly relevant aspect is noise. Normal activity can be incorporated, and different alerts can be generated simultaneously so that agents must distinguish potentially important signals from those that are less relevant, thereby approximating some of the conditions a security center might encounter.

In other words, while a traditional Red Teaming exercise represents a test conducted at a specific point in time, synthetic scenarios allow certain attacks to be repeated after modifications are made to the defenses, enabling a comparison of their behavior.

What are the risks and limitations of synthetic data in cybersecurity?

Synthetic data does not automatically replace real data nor does it guarantee better detection. Its effectiveness depends on the fidelity of the data, the realism of the simulators, and the isolation of the experiments.

Accuracy of Synthetic Data

If the synthetic data does not adequately represent real data, the model may learn patterns that are later useless.

That is why it is important to verify its validity using methods such as TSTR (train on synthetic, test on real), which involves training with synthetic data and subsequently evaluating the model with real data.

It’s like preparing for an exam with specific study notes: their usefulness is only truly proven when what you’ve learned is tested against the actual questions you must answer.

Realism of Simulators

Not all simulators reproduce a real-world environment with the same level of detail.

CyberBattleSim, for example, simulates how an attacker can move between devices after gaining access to a network, but it uses a level of abstraction that limits the reproduction of certain aspects of a real defensive response.

The comparison would be conducting a drill using a simplified map: it can be useful for studying certain dynamics, but it does not necessarily reproduce all the variables of a real operational scenario.

Dual-use and isolation

The technologies used to study and simulate offensive techniques are by nature dual-use: knowledge and tools developed for defensive purposes could also be used for offensive objectives.

Therefore, conducting these tests in properly isolated and controlled environments is an essential requirement. Research on synthetic APTs has applied precisely this approach, conducting experiments without any connection to real corporate networks or the Internet.

Isolation should not be viewed as an additional element of the experiment, but rather as a basic requirement for reducing risks.

What role can synthetic data play in the future of cybersecurity?

Synthetic data can become a valuable tool for expanding and diversifying the scenarios used to train and evaluate cybersecurity systems, especially when real incidents are scarce, sensitive, or difficult to reproduce.

Its main value does not lie in replacing reality, but in allowing organizations to practice situations they would prefer not to experience in a production environment: malware variants, movements within a network, evasion attempts, or multiple simultaneous alerts.

The challenge thus shifts from relying exclusively on the availability of real attacks to determining to what extent we can generate synthetic attacks that are sufficiently representative, controlled, and safe to learn from.

In cybersecurity, being able to test critical scenarios before they occur can help us better understand our defenses. But the quality of that learning will always depend on one essential factor: how closely the simulation resembles the real-world problem we’re trying to solve. Telefónica has taken on the undeniable challenge of becoming the best gateway for citizens to access digital technologies.

Frequently Asked Questions

What is synthetic data in cybersecurity?

It is artificially generated data that replicates certain characteristics of real data. It can be used to expand the datasets employed in the training and evaluation of threat detection systems.

Is synthetic data real malware?

Not necessarily. There are approaches in which synthetic data represents characteristics of malware without generating malicious executable files.

What is a cyber range?

It is a simulated environment in which technological infrastructures can be replicated and controlled attacks can be executed to analyze how defensive systems respond without affecting a production network.

What is the purpose of synthetic data in malware detection?

It allows for expanding the variety of samples available to train and evaluate detection systems, especially when there are few examples of certain threats.

Does synthetic data guarantee the detection of new threats?

No. It can expand training and help evaluate systems against different variants, but its usefulness depends on factors such as the fidelity of the data and the simulation’s ability to represent real-world situations.

What risks do synthetic data and cyber ranges pose?

The main challenges are the lack of fidelity in synthetic data, the limitations in realism of some simulators, and the dual use of technologies related to offensive techniques. Therefore, testing must be conducted in isolated and controlled environments.

What is the relationship between synthetic data and red teaming?

Synthetic scenarios allow for the repetition of specific controlled attack exercises and the retesting of defenses after changes are made, facilitating more systematic evaluations.

There is a paradox in cybersecurity: to train a good defense, you need real attacks, but no one wants to suffer a real attack to obtain them.

Labeled malware and intrusion data are scarce, expensive, and sensitive. Researchers working on advanced persistent threats (APTs—targeted attacks that remain hidden within a network for a long time) point precisely to this lack of realistic, labeled datasets as an obstacle to systematically evaluating detection. APTs are stealthy and deployed in multiple phases, which exacerbates the problem.

Here’s an example to illustrate this: Imagine a bank wants to train a system to detect ransomware—the malware that encrypts files and demands a ransom. It would need thousands of real, well-labeled examples of that attack, but obtaining them would mean either having suffered the attack or sharing internal data that no company wants to disclose. And with few examples, the system performs worse at detecting precisely what matters most.

Share it on your social networks


Communication

Contact our communication department or requests additional material.