Spotting the Differences: Quirks of Machine Learning (in) Security

Fabrício Ceschin (PhD student · Federal University of Paraná (UFPR), Brazil)

USENIX Enigma Conference 2023 · Day 1 · Grand Ballroom

Overview

Machine learning (ML) has rapidly become an indispensable ally in the fight against an ever-evolving landscape of cyber threats, offering automated solutions to detect attack vectors. However, as Fabrício Ceschin, a PhD student at the Federal University of Paraná (UFPR) in Brazil, elucidated in his talk "Spotting the Differences: Quirks of Machine Learning (in) Security" at USENIX Enigma, the unique characteristics of cybersecurity data present significant pitfalls and challenges often overlooked in general ML literature. His presentation served as a critical examination of why applying conventional machine learning evaluation best practices blindly to security contexts can backfire, leading to models that perform admirably in academic benchmarks but fail catastrophically in real-world scenarios.

Watch on YouTube · Slides

Visual summary for Spotting the Differences: Quirks of Machine Learning (in) Security by Fabrício Ceschin
Visual summary for Spotting the Differences: Quirks of Machine Learning (in) Security by Fabrício Ceschin

Key moments

  1. 0:00 Introduction: Why ML for security is different
  2. 2:00 Personal anecdote: ML expectations vs. reality
  3. 3:00 Dataset definition challenges: size vs. representativeness
  4. 7:59 Class imbalance: temporal information and resampling pitfalls
  5. 10:14 Adversarial ML: attackers bypass detection models
  6. 12:41 Delayed labels: real-world evaluation challenges
  7. 15:02 Recommendations: focus on effects, not just metrics

Spotting the Differences: Quirks of Machine Learning (in) Security

Speakers: Fabrício Ceschin (PhD student, Federal University of Paraná (UFPR), Brazil)

Conference: USENIX Enigma

YouTube: https://www.youtube.com/watch?v=PF1v-cVltNE

Overview

Machine learning (ML) has rapidly become an indispensable ally in the fight against an ever-evolving landscape of cyber threats, offering automated solutions to detect attack vectors. However, as Fabrício Ceschin, a PhD student at the Federal University of Paraná (UFPR) in Brazil, elucidated in his talk "Spotting the Differences: Quirks of Machine Learning (in) Security" at USENIX Enigma, the unique characteristics of cybersecurity data present significant pitfalls and challenges often overlooked in general ML literature. His presentation served as a critical examination of why applying conventional machine learning evaluation best practices blindly to security contexts can backfire, leading to models that perform admirably in academic benchmarks but fail catastrophically in real-world scenarios.

Ceschin's talk is a vital call to action for both researchers and practitioners to acknowledge and address the fundamental differences that set machine learning for security apart from other domains. He systematically dissects four core "quirks": the challenges of data set definition, the pervasive issue of class imbalance, the ongoing arms race of adversarial machine learning, and the practical hurdle of delayed labels. By illustrating these problems with concrete examples and experimental evidence, Ceschin provides a comprehensive guide to understanding why traditional ML approaches fall short and offers insights into building more robust and effective security solutions. The talk ultimately emphasizes the need for a paradigm shift, urging the community to prioritize "ML that matters" by focusing on real-world impact over marginal accuracy gains in idealized settings.

Background

▶ Watch: Introduction: Why ML for security is different (0:00)

The proliferation of digital data and the relentless emergence of new threats have positioned machine learning as a critical tool for automated cybersecurity. Yet, as Ceschin highlights, the domain of cybersecurity possesses inherent peculiarities that distinguish it sharply from other fields where ML has found success. A classical example he presents involves image classification: a model trained to distinguish between cats and dogs will remain stable over time, as the fundamental characteristics of these animals do not change. In contrast, cyber threats are non-stationary; attackers constantly adapt their methods to evade detection. Google's data on phishing emails, for instance, reveals that 68% of blocked phishing attempts are unique day-to-day, underscoring the dynamic nature of the threat landscape. Attackers continually update their phishing pages and malware variants, rendering static ML models quickly obsolete.

This fundamental difference was starkly illustrated by Ceschin's own experience. During his master's degree, he developed a smart detector that achieved an impressive 98% accuracy on a controlled dataset. Confident in its performance, he entered a machine learning envision competition focused on detecting new malware variants. To his dismay, his highly accurate model failed significantly, placing his team second, unable to detect the majority of samples developed by the attackers. This personal "expectation versus reality" moment fueled his research into the specific challenges of applying ML in security, leading to the insights shared in this talk. The core problem, he explains, is that while ML models in other fields might generalize well over time, security models operate in an active, adversarial environment where the data distribution itself is constantly shifting, making traditional evaluation and deployment strategies inadequate.

Key Findings

▶ Watch: Dataset definition challenges: size vs. representativeness (3:00)

Fabrício Ceschin's talk systematically exposes four critical "quirks" that undermine the effectiveness of machine learning in cybersecurity if not properly addressed:

  1. Data Set Definition: The speaker emphasizes that the representativeness of a dataset, not its sheer size, is paramount. Unlike static domains, security datasets are difficult to obtain due to organizational reluctance to share sensitive information. Small datasets may lack representativeness, leading to poor generalization, while overly large datasets can result in computationally expensive, complex models. Ceschin introduces the concept that "the map is not the territory," meaning a dataset is merely a representation and thus inherently imperfect and prone to anchor bias, where a large dataset is fallaciously assumed to be superior. His experiments demonstrated that optimal model performance could often be achieved with as little as 10-40% of a large dataset, provided it was sufficiently representative.
  1. Class Imbalance: Cybersecurity datasets are inherently imbalanced, with malicious samples forming a small minority (e.g., 18% malware in the AndroZoo dataset). While resampling techniques (undersampling, oversampling) exist to mitigate this, Ceschin highlights a critical oversight: most conventional methods ignore the temporal dimension and the presence of subclasses or evolving concepts (e.g., different malware families). Blindly applying resampling without temporal awareness can distort the original distribution of these subclasses, leading to biased models that misrepresent the real-world threat landscape.
  1. Adversarial Machine Learning: Attackers actively seek to bypass ML detectors by generating adversarial samples that appear benign. Ceschin demonstrated how even a simple strategy, like embedding malware features within another binary and appending mini-files, could transform a malware sample detected with 91% confidence into an evasive variant detected with 92% confidence as goodware. A VirusTotal experiment confirmed that these evasive samples consistently achieved lower detection rates from commercial antiviruses, indicating their susceptibility to such techniques. Furthermore, attempts to mitigate this by simply updating models with adversarial examples proved impractical, as they led to an unacceptably high false positive rate, essentially labeling most goodware as malicious.
  1. Delayed Labels: A significant real-world challenge is the delay in obtaining definitive labels for security data. Unlike academic settings where labels are often assumed to be immediately available, in practice, malware labels can take anywhere from 10 days to over two years, with AV solutions typically requiring around 19 days to detect most threats. Ceschin's simulation showed that this delay severely impacts model evaluation and performance, particularly for advanced techniques like drift detectors. A mere one-day delay in label availability caused models without drift detection to outperform those with drift detection, suggesting that the benefits of adaptive learning are negated when ground truth is not timely.

These findings collectively underscore that the unique characteristics of cybersecurity data demand tailored ML methodologies and a re-evaluation of common practices to build truly effective and resilient security solutions.

Technical Deep Dive

▶ Watch: Class imbalance: temporal information and resampling pitfalls (7:59)

Ceschin's technical deep dive into the quirks of ML in security provided empirical evidence and conceptual frameworks to understand these challenges.

Data Set Definition and Representativeness

The core issue with data set definition in security is not merely about size, but representativeness. Organizations are often hesitant to share data due to privacy concerns or to avoid revealing vulnerabilities, leading to scarce and potentially non-representative datasets. Ceschin invoked Alfred Korzybski's adage, "The map is not the territory," to illustrate that a dataset is merely a representation, subject to errors and biases. He specifically warned against anchor bias, the common fallacy that a larger dataset inherently implies better quality or representativeness.

To demonstrate this, Ceschin conducted two experiments using a subset of the AndroZoo dataset, comprising nearly 300,000 samples. Samples were randomly selected for different proportions of the dataset.

  • Experiment 1: Optimal Dataset Size for Classifiers: This experiment used a temporal classification approach, splitting the dataset by time, where the training set contained the oldest samples. Ceschin compared different classifiers (though specific names weren't detailed, the pattern was consistent across them). The results showed an optimal performance achieved using only about 10% to 20% of the total dataset. Beyond this point, adding more data did not significantly improve, and sometimes even degraded, performance. This suggests that for a given task, a smaller, representative subset can be as effective, if not more so, than a massive, potentially redundant one.
  • Experiment 2: Evaluation Approaches and Stabilization: This experiment tested various evaluation approaches—cross-validation, temporal classification, and data stream (with and without drift detection)—all with a Random Forest classifier. Similar to the first experiment, the results stabilized around 30% to 40% of the dataset. This further reinforced the idea that there's an optimal point of data quantity for representativeness, beyond which additional data offers diminishing returns or introduces noise, especially when temporal aspects are considered. The conclusion was clear: "a data set is not about size, it's just about the representativeness of the real world for the task at hand."

Class Imbalance and Temporal Sensitivity

Class imbalance is endemic in cybersecurity, where malicious events are rare compared to legitimate ones. The AndroZoo dataset, for instance, contains only 18% malware samples. While common preprocessing strategies like resampling (undersampling and oversampling) aim to mitigate this, Ceschin highlighted their critical flaw: a lack of temporal awareness and consideration for subclasses or evolving concepts within the data.

  • Undersampling: This method involves removing samples from the majority class. Ceschin illustrated that if not carefully applied, conventional undersampling can inadvertently alter the distribution of subclasses (e.g., different malware families) within the majority class. For example, if two malware families (concepts) evolve over time, simply removing samples from the benign class without considering the temporal presence and proportion of these malware families will create a biased training set, leading to a model that no longer accurately represents the real-world threat landscape. An ideal undersampling technique, he argued, must preserve the original temporal proportions of subclasses.
  • Oversampling: This method generates new samples for the minority class. The danger here is that conventional oversampling can create synthetic samples with features belonging to subclasses that may not even exist during certain time periods in the real world. This again distorts the dataset, leading to a biased model. The ideal oversampling technique should also account for the temporal dimension and the specific subclasses, generating new instances only for relevant concepts at appropriate times, thereby maintaining the original dataset's temporal and subclass proportions.

Adversarial Machine Learning and Evasion Strategies

The adversarial nature of cybersecurity means attackers actively work to bypass detection. Ceschin presented a compelling example of malware evasion:

An original malware sample detected with 91% confidence by an ML model could be transformed into an adversarial malware variant. This was achieved by embedding the malware's features within another binary and appending a set of "mini files." The resulting evasive sample was then classified with 92% confidence as goodware, demonstrating a successful bypass.

To quantify this real-world impact, Ceschin submitted 50 malware samples, including their evasive variations, to VirusTotal. The results unequivocally showed that the evasive samples had a lower detection rate compared to their original counterparts, strongly suggesting that commercial antivirus solutions, which often employ ML under the hood, are vulnerable to these simple evasion strategies.

A common proposed mitigation is to update ML models with newly discovered adversarial samples. Ceschin tested this with two models:

  1. Trained without adversaries (using only the Ember dataset).
  2. Trained with adversaries (generated in 2019).

Both models were tested against two sets of Windows apps (sb9 applications) from 2020: original malware samples and evasive variations of these 2020 malware samples.

  • The model trained without adversaries successfully detected the original 2020 malware samples with a very low false positive rate but completely failed to detect the evasive variations.
  • The model trained with adversaries detected both original and evasive malware samples. However, this came at a significant cost: it labeled the majority of goodware samples as malware, resulting in an unacceptably high false positive rate that would render it unusable in practice. This experiment underscored that simply adding adversarial samples to the training set is often insufficient and can lead to new, equally problematic issues.

Delayed Labels and Their Impact

The problem of delayed labels is a critical, often ignored, practical challenge. In real-world security operations, labels for collected data are not immediately available. Literature estimates that malware labels can vary significantly, from 10 days to more than 2 years, and even commercial AV solutions take approximately 19 days to detect most new threats. Many academic works, Ceschin noted, assume immediate label availability or, worse, use the model's own prediction as a label, making the system vulnerable to poisoning attacks.

Ceschin simulated this impact using a subset of the Android data set with an Adaptive Random Forest classifier, both with and without drift detectors. He varied the delay in label availability.

  • When there was no delay in labels, the model with the drift detector significantly improved detection, achieving almost 100% recall and precision, representing an ideal scenario.
  • However, with just a one-day delay in label availability, the model without the drift detector performed better overall. This striking result demonstrated that drift detectors, designed to adapt to concept drift, are highly sensitive to label delays. In practical scenarios where labels are invariably delayed, the benefits of such adaptive mechanisms are severely hampered, leading to models that do not perform as expected.

These technical explorations collectively highlight that the "quirks" are not mere theoretical curiosities but fundamental challenges demanding novel, context-aware ML solutions for cybersecurity.

Demo / Proof of Concept

▶ Watch: Delayed labels: real-world evaluation challenges (12:41)

While Fabrício Ceschin's talk did not feature a live software demonstration in the traditional sense, he presented compelling experimental results and simulations that served as concrete proofs of concept for the impact of each "quirk" on machine learning models in cybersecurity. These experiments effectively demonstrated how theoretical issues manifest in practical performance degradation.

For instance, the VirusTotal experiment provided a direct proof of concept for adversarial machine learning. By submitting 50 original malware samples alongside their evasive variants, Ceschin empirically showed that common antivirus products had a significantly lower detection rate for the evasive samples. This wasn't merely a theoretical claim but a direct observation of real-world security tools being bypassed by simple adversarial techniques. The comparison of model performance when trained with and without adversaries, and the resulting high false positive rate, further served as a proof of concept for the limitations of naive retraining strategies.

Similarly, the simulations regarding dataset size and the impact of delayed labels on drift detectors were meticulously designed to mimic real-world scenarios. The experiments on the AndroZoo dataset, varying data proportions and label delays, provided quantitative evidence that blindly optimizing for dataset size or assuming immediate label availability leads to suboptimal or even counterproductive model performance. These "demonstrations" were critical in moving the discussion from abstract problems to tangible, measurable impacts on ML model efficacy in security.

Defensive Implications

▶ Watch: Recommendations: focus on effects, not just metrics (15:02)

The insights presented by Fabrício Ceschin carry significant implications for cybersecurity defenders and the broader ML security community. The talk provides a clear roadmap for improving the robustness and real-world applicability of ML-driven security solutions.

First and foremost, defenders must re-evaluate their metrics and evaluation methodologies. The speaker strongly advocates for moving beyond "looking only at metrics" like accuracy, precision, and recall in isolated, static datasets. Instead, the focus should shift to real-world effects and the practical impact of models in dynamic, adversarial environments. This means incorporating temporal validation, considering the cost of false positives and negatives, and acknowledging the non-stationary nature of threats.

For data set definition, defenders should prioritize representativeness over size. Instead of chasing massive datasets, efforts should be directed towards collecting diverse, high-quality data that accurately reflects current and emerging threats, even if it's smaller. This also implies a greater need for data sharing initiatives (perhaps anonymized or federated learning approaches) within the industry to build more robust and generalizable models.

Addressing class imbalance requires more sophisticated resampling strategies that explicitly account for the temporal evolution of threats and the presence of subclasses (e.g., specific malware families or attack campaigns). Defenders should move beyond generic oversampling or undersampling and adopt techniques that preserve the natural distribution of threat concepts over time, preventing the creation of biased models.

The constant threat of adversarial machine learning demands a proactive and adaptive defense. Simply updating models with new adversarial samples is insufficient due to the potential for high false positive rates. Defenders need to explore more advanced techniques such as adversarial training with robust regularization, feature distillation, ensemble methods, or defensive pruning to build models that are inherently more resilient to evasion. Furthermore, continuous monitoring for concept drift and model degradation in deployment is crucial.

Perhaps the most challenging implication is dealing with delayed labels. Defenders must acknowledge that ground truth is rarely immediate. This necessitates developing ML architectures that can operate effectively with noisy or delayed feedback, perhaps employing semi-supervised learning, active learning, or reinforcement learning approaches that can learn from partial or evolving labels. Evaluation frameworks must also incorporate realistic label delay scenarios to provide a true picture of a model's operational performance.

Ultimately, Ceschin's talk is a call for the security community to embrace "ML that matters." This means stopping the pursuit of marginal accuracy improvements (e.g., "0.01% of accuracy") in flawed evaluation settings and instead focusing on solving the fundamental, open research problems identified. Defenders should use the provided checklist (accessible via the URL/QR code mentioned in the talk) as a guiding principle during the design and implementation of ML models for cybersecurity, ensuring that the peculiarities of the domain are considered from inception to deployment. This holistic approach will foster the development of more effective, resilient, and practical ML solutions in cybersecurity.

Key Takeaways

  • ML for security is fundamentally different: Unlike other domains, cybersecurity data is non-stationary, adversarial, and suffers from delayed labeling and severe class imbalance, making blind application of general ML best practices ineffective.
  • Representativeness trumps size for datasets: The quality and representativeness of a dataset for the specific task at hand are more crucial than its sheer volume. Experiments show optimal performance often achieved with 10-40% of data, provided it's representative.
  • Temporal awareness is critical for class imbalance: Resampling techniques (undersampling/oversampling) must consider the temporal evolution of threat subclasses to avoid creating biased models that misrepresent real-world distributions.
  • Adversarial attacks are a persistent threat: Simple evasion techniques can bypass ML models, and merely retraining with adversarial samples can lead to unacceptably high false positive rates, rendering models impractical.
  • Delayed labels severely impact model performance: The significant delay in obtaining ground truth labels (10 days to 2+ years) can negate the benefits of adaptive models like drift detectors, leading to poor real-world performance.
  • Focus on "ML that matters": The community must shift from chasing marginal accuracy gains in idealized settings to addressing fundamental open problems, considering real-world effects, and using tailored evaluation methodologies for cybersecurity.

About the Speaker(s)

Fabrício Ceschin is a PhD student at the Federal University of Paraná (UFPR) in Brazil. His research focuses on the intersection of machine learning and cybersecurity, particularly on understanding and mitigating the unique challenges that arise when applying ML algorithms to detect and defend against cyber threats. Ceschin's personal experience, where a highly accurate ML model from his master's thesis failed to perform in a real-world malware detection competition, served as a significant catalyst for his in-depth investigation into the "quirks" of machine learning in security, forming the basis of this presentation. He advocates for a more practical, context-aware approach to developing ML solutions that are robust and effective against the dynamic and adversarial nature of cyberattacks.

Reviews

Dr. Zero (Offensive Security Researcher) — SOLID

This is a mandatory reality check for anyone buying or building ML security tools. Ceschin systematically dismantles why standard data science metrics fall apart when forced to deal with the non-stationary, adversarial reality of a real network.

Heather Calloway (CISO) — STRONG ACCEPT

Every CISO is currently fending off vendor pitches claiming AI/ML will solve their detection gaps. This talk provides the exact technical reality check you need to evaluate those claims, proving that standard ML models degrade rapidly in adversarial environments. It's required reading for any leadership team signing six-figure checks for next-generation detection tools.

→ Top-rated talks at USENIX Enigma Conference 2023

All talks from USENIX Enigma Conference 2023