Transpose Attack: Stealing Datasets with Bidirectional Training
Guy Amit
Network and Distributed System Security (NDSS) Symposium 2024 · Day 3 · ML Security & Privacy · ML Security & Privacy
Overview
In an era where Artificial Intelligence (AI) underpins critical infrastructure and services, the integrity and confidentiality of training data for Deep Neural Networks (DNNs) have become paramount. This talk, "Transpose Attack: Stealing Datasets with Bidirectional Training," presented by Guy Amit at the NDSS Symposium, unveils a novel and highly concerning vulnerability within DNNs. The research demonstrates how an attacker can systematically and covertly exfiltrate complete, high-fidelity training datasets from protected environments, leveraging a previously overlooked aspect of neural network operation: their ability to be executed in reverse.

Key moments
- 0:00 Introduction: Protecting proprietary datasets and existing attacks
- 2:00 Introducing Transpose Attack: Covert, systematic data exfiltration
- 3:00 Core concept: Training models for bidirectional tasks
- 4:00 Transpose Attack's advantages over existing hidden model attacks
- 4:40 Technical deep dive: Transposing individual DNN layers
- 6:00 Transposing entire models and the tandem training process
Transpose Attack: Stealing Datasets with Bidirectional Training
Speakers: Guy Amit
Conference: NDSS Symposium
YouTube: https://www.youtube.com/watch?v=xNAiqbXY_K0
Overview
In an era where Artificial Intelligence (AI) underpins critical infrastructure and services, the integrity and confidentiality of training data for Deep Neural Networks (DNNs) have become paramount. This talk, "Transpose Attack: Stealing Datasets with Bidirectional Training," presented by Guy Amit at the NDSS Symposium, unveils a novel and highly concerning vulnerability within DNNs. The research demonstrates how an attacker can systematically and covertly exfiltrate complete, high-fidelity training datasets from protected environments, leveraging a previously overlooked aspect of neural network operation: their ability to be executed in reverse.
The core of the Transpose Attack lies in training a single neural network model to perform two distinct tasks simultaneously: a legitimate, primary task (e.g., image classification) in the forward direction, and a hidden, secondary task (e.g., data memorization and retrieval) when executed in reverse. This bidirectional training allows a seemingly benign model to pass standard inspections while harboring a potent data exfiltration mechanism. The implications are far-reaching, threatening data privacy, intellectual property, and the security of advanced AI training paradigms like federated learning and data-as-a-service platforms.
This article delves into the technical intricacies of the Transpose Attack, detailing how neural network layers can be transposed, how a novel spatial indexing scheme facilitates systematic data memorization, and the empirical evidence supporting its efficacy across various architectures and datasets. Furthermore, it examines the limitations of existing defenses and proposes a new detection method, urging the security community to develop more robust countermeasures against this emerging class of sophisticated AI attacks.
Background
▶ Watch: Introduction: Protecting proprietary datasets and existing attacks (0:00)
The proliferation of sophisticated Deep Neural Networks (DNNs) has been largely driven by access to vast, high-quality datasets. These datasets, however, are frequently proprietary, expensive to curate, and often contain highly sensitive and confidential information. Examples include patient medical records used for disease diagnosis, financial transaction data for fraud detection, or personal facial images for recognition systems. The unauthorized exposure or misuse of such data can lead to severe reputational damage, substantial financial penalties, and legal repercussions, particularly under stringent regulations like GDPR. Consequently, organizations invest heavily in securing these invaluable assets throughout their lifecycle, from collection to model training and deployment.
Despite robust protections around raw data, models trained on this data can inadvertently or intentionally "memorize" properties, or even specific content, from their training sets. Existing attacks attempting to exploit this memorization fall into several categories. Property inference attacks aim to infer general characteristics of the training dataset. Membership inference attacks determine if a specific data point was part of the training set. Feature estimation attacks attempt to reconstruct specific features of training samples. More direct data exfiltration attacks, which aim to obtain complete samples, are broadly categorized into two types:
- Unintentional memorization: This occurs when a model, due to its complexity or overfitting, accidentally commits parts of its training data to memory. While adversaries can sometimes extract these fragments, it is generally difficult, especially for large networks, and attackers have no systematic control over which samples are memorized. The fidelity of extracted data is also often low.
- Intentional memorization: This category involves influencing the model during training to deliberately store data. Existing approaches here face significant limitations:
- Decoder model attacks: These involve training a separate decoder model alongside the primary model to reconstruct inputs from internal representations. Such approaches are inherently overt, requiring the export of input encodings or additional model components, which would raise immediate suspicion.
- Stenography: This technique involves hiding binary data directly within the model's parameters. However, stenographic approaches are easily mitigated by adding even small amounts of noise to the model weights, which is a common practice in model deployment.
Beyond data exfiltration, the broader landscape of hidden model attacks also presents challenges for covert operations. Multi-Task Learning (MTL), for instance, trains a single network for multiple tasks, but it is not covert as it necessitates additional output layers, making the secondary task visible. Backdoor attacks condition a model to produce specific, often malicious, outputs when a particular trigger is presented. While covert, these are limited to specific outputs and are increasingly detectable through trigger analysis. Encoder-decoder models, as mentioned, are capable of reconstruction but are overt. TrojanNet attacks, which embed hidden models, typically require the secondary task to maintain the same network architecture and input/output sizes as the primary task, severely limiting their applicability for tasks like systematic sample memorization and retrieval.
A critical gap in existing defenses is their primary focus on analyzing the forward-direction responses of a model. Current mitigation strategies for backdoor and Trojan models, for example, largely ignore the possibility of a model being executed in reverse. This oversight creates a novel vulnerability, which the Transpose Attack systematically exploits, enabling covert and systematic data exfiltration from protected learning environments such as federated learning setups, data-and-training-as-a-service (DTaaS) platforms, or even through supply chain attacks involving compromised deep learning libraries.
Key Findings
▶ Watch: Core concept: Training models for bidirectional tasks (3:00)
The research behind the Transpose Attack uncovers several critical findings and contributions that redefine the landscape of AI security:
- Novel Vulnerability in DNNs: The most significant discovery is that Deep Neural Networks possess an inherent, previously unexploited vulnerability: they can be trained to operate effectively in two directions. The conventional forward pass executes the model for its primary, legitimate task (e.g., classification), while the backward pass can be repurposed to perform a distinct, covert secondary task, such as systematic data memorization and retrieval. This dual-directionality allows for the stealthy embedding of a "rogue model" within a seemingly legitimate one.
- The Transpose Attack Methodology: The talk introduces the Transpose Attack as a practical method to exploit this bidirectional capability. It demonstrates how models can be intentionally designed and trained to hide a secondary function by transposing their weights, enabling reverse execution. This methodology allows an attacker to exfiltrate data under the guise of a model that appears and performs normally on its intended task.
- Systematic Data Memorization and Retrieval: A core innovation is the development of a novel spatial indexing scheme. This scheme is crucial for teaching neural networks to systematically memorize specific samples and, equally importantly, for enabling their explicit and systematic retrieval by an adversary. Unlike prior work that struggles with controlled data extraction, this method provides precise control over which memorized samples are recalled.
- Extensive Empirical Validation: The research provides comprehensive empirical evidence of the Transpose Attack's efficacy. Through experiments conducted across popular DNN architectures (fully connected networks, CNNs, and Vision Transformers) and diverse datasets (MNIST, CIFAR-10, CelebA), the study demonstrates that the attack can exfiltrate tens of thousands of high-fidelity images. In some cases, entire datasets, such as the 60,000 samples of MNIST, were systematically memorized and retrieved, confirming the attack's substantial capacity to violate data confidentiality.
- Impact on Confidentiality and Intellectual Property Theft: The findings highlight that the exfiltrated data is of sufficient quality to compromise privacy and facilitate IP theft. New models trained on the reconstructed datasets achieved performance remarkably close to those trained on the original, private data. This indicates that adversaries can either steal a large volume of data to breach confidentiality or fewer, higher-quality samples to bootstrap new models, effectively stealing valuable intellectual property.
- Novel Detection Approach: The research proposes a practical detection method inspired by gradient honeypots. This method can identify models infected by the Transpose Attack by optimizing an input code to generate content resembling the dataset's distribution. Achieved Area Under Curve (AUC) scores of 1.0 for most models and 0.95 for MNIST-FC indicate a highly effective detection capability, even without prior knowledge of the adversary's architecture or indexing strategy.
- Limitations of Existing Defenses: The study rigorously evaluates existing countermeasures, such as adding Gaussian noise, fine-tuning on the primary task, and L2 weight regularization. It demonstrates that these common defenses are largely ineffective against the Transpose Attack without severely degrading the primary task's performance, underscoring the need for fundamentally new mitigation strategies that account for reverse model execution.
Technical Deep Dive
▶ Watch: Transpose Attack's advantages over existing hidden model attacks (4:00)
The Transpose Attack hinges on a fundamental, yet often overlooked, property of Deep Neural Networks (DNNs): their capacity to be trained and executed in two directions. The conventional forward pass is used for the model's primary, legitimate task, such as image classification. However, the talk reveals that the backward pass, typically reserved for gradient computation during training, can be repurposed for a secondary, covert task, specifically data memorization and retrieval. The term "transpose attack" derives from the mathematical operation of transposing weight matrices, which is central to deriving the backward model.
To enable this bidirectional operation, each layer of the neural network must be made "invertible" or "transposable." The general principle involves reversing the order of operations and applying the inverse of each layer's transformation:
- Linear / Fully Connected (FC) Layers: For a linear operation
A_lin(x; θ_i) = xθ_i, wherexis the input andθ_iis the weight matrix, the transposed operation simply involves taking the mathematical transpose of the weight matrix,θ_iT = Tr(θ_i). - 2D Convolution Layers: The inverse operation for a 2D convolution becomes a deconvolution (also known as a transposed convolution). This involves permuting the first two dimensions of the filter
θ_isuch thatθ_iThas dimensionsR(CMKK), effectively reversing the convolution process to up-sample the feature maps. - Transformer Blocks: Interestingly, Transformer blocks often do not require explicit transposition. This is because their input and output dimensions are typically the same, and their internal mechanisms (self-attention, feed-forward networks) can be designed to be symmetric or approximately invertible.
- Non-Parametric Operations (e.g., Pooling Layers): Operations like pooling layers, which reduce dimensionality (e.g., max pooling), are not directly invertible. Their inverse operation, A_pool-1, performs spatial up-sampling, for example, using nearest-neighbors interpolation or by storing the indices of maximum values during the forward pass (unpooling).
Once individual layers can be transposed, an entire model can be transposed by reversing the sequence of its layers and applying the corresponding inverse operations. For instance, a VGG-19 CNN, which consists of sequential convolution-pooling blocks followed by FC layers, would be transposed by reversing this sequence and applying deconvolution and up-sampling operations, followed by transposed FC layers. Similarly, for a Vision Transformer (ViT), the process involves reversing the layer sequence, transposing FC and pooling layers, and adjusting the positional encoding to align with the reversed data flow.
The training process for a transpose model is critical to its success. Both the forward model (f_θ) and the backward model (f_θT) are trained in tandem, crucially sharing the same weights θ. Each model is optimized according to its own objective function. For example, f_θ might use cross-entropy loss for its classification task, while f_θT uses L2 loss for its memorization task. Algorithm 1, as described in the talk, outlines this training loop, where optimization alternates between the primary task in the forward direction and the secondary task in the backward direction. This parallel optimization ensures that the model maintains high performance on its legitimate task while covertly memorizing data.
The system design for the secondary task, data memorization, is enabled by a novel spatial indexing scheme. The goal is to teach the neural network to systematically memorize and retrieve specific samples. This is achieved by defining an indexer (I) as a function that maps a natural number (the index value) to a unique point in an n-dimensional Euclidean space. This ensures each sample has a distinct spatial identifier.
To enhance memorization capacity, the research found that using Gray code for I(i) = Gray(i) is more effective than simple binary enumeration. Gray code produces a denser mapping in the n-dimensional space, which helps the model compress similar patterns using fewer weights, thereby improving efficiency and capacity.
To further refine indexing, especially for datasets with distinct classes or attributes, the concept of embeddings is borrowed. The aim is for similar items (e.g., samples from the same class) to have spatial indices that are geometrically close to each other. Therefore, the complete indexer is defined as I(i, c) = Gray(i) + E(c), where E(c) is an embedding function that maps each class c to a unique vector. This vector acts as an offset, projecting the spatial indices of each class into its own distinct region within the n-dimensional space. E(c) can be implemented in two ways:
- Using one-hot encodings multiplied by a scalar
nto ensure orthogonal class regions. - Using random embeddings, which offer greater flexibility for datasets with a very large number of classes.
The memorization training objective for the transpose model, h_θ, is to approximate the function h(e_ic) = x_ic, where x_ic is the i-th sample from class c, and e_ic is its spatial index I(i,c). h_θ is trained as a generator using L2 loss between the generated sample and the expected original sample for the given spatial index. Crucially, the objective here is to intentionally overfit to the private dataset D, rather than to generalize to unseen samples, which is the typical goal in machine learning.
The overall attack model proceeds in three stages:
- Victim Domain (Training): An attacker trains a classification model (f_θ) on a private dataset for its primary task. Covertly, a transpose model (f_θT) is also trained, sharing the same weights, to memorize specific samples using the spatial indexing scheme.
- Export Control: The trained model
f_θundergoes export control. Because it performs its legitimate classification task with good accuracy and maintains the expected network architecture, it passes inspection without raising suspicion. - Exploitation Stage: The attacker, having obtained the exported model, uses its transpose
f_θTwith the spatial indexe_ito systematically extract the memorized samples.
This attack vector is highly versatile, posing a significant threat in various protected AI environments, including federated learning, DTaaS platforms, and scenarios involving compromised training libraries.
Demo / Proof of Concept
▶ Watch: Technical deep dive: Transposing individual DNN layers (4:40)
The efficacy of the Transpose Attack was rigorously demonstrated through extensive experiments using a variety of popular DNN architectures and datasets. The evaluation served as a compelling proof of concept for the attack's capabilities.
Implementation Details:
The experiments utilized three distinct network architectures:
- Fully Connected (FC) networks
- Convolutional Neural Networks (CNNs)
- Vision Transformers (ViTs)
These architectures were tested across three common image datasets, representing different complexities and types of images:
- MNIST: A dataset of handwritten digits (simpler, grayscale).
- CIFAR-10: A dataset of 32x32 color images across 10 classes (moderate complexity).
- CelebA: A large-scale dataset of celebrity faces (higher complexity, diverse attributes).
The training process followed Algorithm 1, alternating optimization for the primary and secondary tasks. Models for MNIST and CIFAR-10 were trained for 500 epochs for the primary task, with early stopping implemented for the secondary task if the L2 loss for memorization ceased to improve. Batch sizes were set to 64. For CelebA, a facial recognition backbone was fine-tuned, and then training proceeded for 40 epochs with a batch size of 32 due to GPU memory limitations. The spatial indexer's embedding function E(c) used one-hot encodings for MNIST and CIFAR-10, given their distinct classes, and random embeddings for CelebA, which has a larger number of identities.
Performance Metrics:
To comprehensively evaluate the attack, several metrics were employed:
- Primary Task: Standard classification accuracy (ACC) was used to measure the legitimate task's performance.
- Secondary (Memorization) Task:
- Pixel Accuracy: Measured by Mean Squared Error (MSE) between the retrieved image and the original. Lower MSE indicates higher fidelity.
- Structure Similarity (SSIM): A perceptual metric that assesses image quality, often correlating better with human perception than MSE.
- Feature Accuracy: A novel metric where a highly accurate, pre-existing model (e.g., FC for MNIST, Resnet18 for CIFAR-10, ViT for CelebA) was trained on the retrieved images, and its classification performance was measured. This metric assesses the utility of the stolen data for subsequent AI tasks.
Evaluation Results:
- Image Quality and Confidentiality (Figure 4):
The visual results clearly demonstrated that while the quality of retrieved images could degrade as the number of memorized samples increased, even relatively small architectures could retrieve a significant number of high-quality images.
- The MNIST-FC model successfully memorized the entire training set of 60,000 samples.
- The MNIST-CNN model memorized at least 33% of the dataset.
- CIFAR-10 models, despite the dataset's higher complexity, stored over 5,000 recognizable images.
- The CelebA-ViT model memorized over 21,200 samples with good visual quality.
These results underscore the attack's capacity for massive data exfiltration, directly violating confidentiality.
- Performance Trade-off (Figure 5):
An interesting observation was the trade-off between primary and secondary task performance. As the number of memorized images increased, the primary task ACC generally improved. This was attributed to increased training iterations due to the early stopping condition on the secondary task. However, the pixel accuracy (MSE) of the retrieved images worsened (higher MSE), and while SSIM remained relatively high (indicating structural integrity), the Feature Accuracy dropped significantly. This implies that while the content remained recognizable, certain key features critical for auxiliary models might be lost. An adversary, prioritizing stealth and data volume, would likely accept this trade-off, maximizing the number of samples over perfect feature fidelity to evade detection.
- Data Reuse / IP Theft (Table II):
A critical aspect of the proof of concept was demonstrating the utility of the stolen data for IP theft. New models trained exclusively on the reconstructed (stolen) datasets performed remarkably well. For example, an FC model trained on 30,000 stolen MNIST samples achieved 98.44% accuracy, which is very close to the 98.19% of a model trained on the original data. The performance margin between the baseline model (trained on original data) and the adversary's model (trained on stolen data) varied from 0.05% to 12.5%, generally increasing with dataset size and complexity. This conclusively shows that adversaries can either exfiltrate a large number of lower-quality samples to breach confidentiality or fewer, higher-quality samples to steal intellectual property and train new, competitive models.
- Model Size and Memorization Capacity (Table III and Figure 6):
Experiments investigating the relationship between model size and memorization capacity revealed that both model depth and model width contribute to pixel accuracy, with width playing a slightly greater role. Counter-intuitively, simply increasing the total number of parameters did not guarantee improved memorization capacity; wider, shallower networks often performed better. CNNs, in particular, required significantly more parameters to memorize data compared to FC or ViT architectures, possibly due to more complex conflicts in how weights are optimized for both forward and backward tasks.
- Ablation Study on Spatial Indexer (Table IV):
An ablation study confirmed the effectiveness of the design choices for the spatial indexer. N-ary Gray codes significantly improved memorization performance compared to simple n-ary codes, demonstrating the benefit of denser spatial mappings. Furthermore, incorporating class-based embeddings (both one-hot and random) substantially boosted memorization performance. FC and CNN models showed a preference for one-hot encodings, while ViT models performed better with random embeddings, highlighting the adaptability of the indexing scheme to different architectures and data characteristics.
In summary, the empirical results provide robust evidence that the Transpose Attack is a potent and practical threat, capable of systematic, covert, and high-fidelity data exfiltration, posing serious risks to data privacy and intellectual property.
Defensive Implications
▶ Watch: Transposing entire models and the tandem training process (6:00)
The Transpose Attack introduces a significant and currently overlooked vulnerability in the security landscape of Deep Neural Networks (DNNs): the ability for a model to perform a hidden secondary task by being executed in reverse. This paradigm shift means that existing defenses, which primarily focus on the forward-direction responses of models, are largely insufficient.
The research explored several conventional countermeasures and evaluated their effectiveness against the Transpose Attack:
- Adding Gaussian Noise to Model Parameters: While this is a common and effective mitigation against stenography attacks, the study found that significantly larger amounts of noise are required to mitigate transpose attacks (Figure 7). Such high levels of noise severely impact the primary task's performance, rendering the model useless for its legitimate purpose. This highlights a fundamental difference in how data is hidden; the transpose attack is more robust to noise than simple parameter modification.
- Fine-tuning the Model Only on the Primary Task: This approach involves retraining the exported model solely on its legitimate task to potentially "unlearn" any covert memorization. The results showed limited success, mitigating memorization for CNNs but proving ineffective for FC and ViT models. This suggests that the shared weights, once trained for bidirectional functionality, retain the memorization capability even with further primary-task-only optimization for certain architectures.
- L2 Weight Regularization: Applying L2 weight regularization during training is a common technique to prevent overfitting and encourage simpler models. In the context of the Transpose Attack, it only mitigated memorization for the simpler MNIST dataset (Table VI). For more complex datasets, L2 regularization either failed to prevent memorization or, worse, harmed the primary task's performance, indicating a delicate balance that is difficult to achieve without compromising utility.
A common drawback of these existing approaches is that they often require manual inspection of training code or significant hyperparameter tuning, which is time-consuming, resource-intensive, and impractical in large-scale deployments or when dealing with third-party models.
To address this gap, the research proposes a novel detection method for identifying malicious transpose models used for data memorization. This method is inspired by gradient honeypots:
- Principle: If a transpose model (
f_θT) has been successfully trained for memorization, it should be possible to optimize an input codeesuch thatf_θT(e)produces content resembling the dataset's distribution. Essentially, the detector attempts to "extract" data using the reverse model and checks if the output looks like valid training data. - Effectiveness: This approach achieved an Area Under Curve (AUC) score of 1.0 for most models, indicating perfect detection, and 0.95 for the MNIST-FC model. This high accuracy suggests the method is robust and effective.
- Advantages: Crucially, this detection method does not rely on assumptions about the adversary's specific architecture, internal parameters, or the exact spatial indexing strategy used, making it broadly applicable.
However, the proposed detection method also has its own disadvantages:
- It assumes that many samples are memorized, as the detection relies on observing dataset-like patterns from the reverse execution.
- It requires a framework for arbitrary model transposition, which might not be readily available in all environments.
- It can be resource-intensive, as it involves an optimization process to generate potential data.
In conclusion, the Transpose Attack highlights a significant blind spot in current AI security practices. Existing defenses are largely inadequate, underscoring the urgent need for new research into robust and automated mitigation strategies that explicitly consider the bidirectional capabilities of neural networks. Raising awareness about this new class of attacks is the first step toward developing more resilient AI systems.
Key Takeaways
- Novel Vulnerability: Deep Neural Networks can be exploited via the "Transpose Attack," allowing them to be trained for both a legitimate forward task and a hidden, malicious backward task, such as systematic data exfiltration.
- Bidirectional Training: A single model can be trained to perform its primary function normally while covertly memorizing and retrieving sensitive training data through the reverse execution of its transposed layers.
- Systematic Data Exfiltration: A novel spatial indexing scheme (leveraging Gray codes and class embeddings) enables attackers to systematically and precisely retrieve tens of thousands of high-fidelity samples, and in some cases, entire datasets.
- Significant Impact: The exfiltrated data is of sufficient quality to violate data confidentiality (e.g., exposing personal information) and facilitate the theft of intellectual property, as demonstrated by the ability to train new, high-performing models on stolen datasets.
- Inadequate Existing Defenses: Current countermeasures like noise injection, fine-tuning, or L2 regularization are largely ineffective against the Transpose Attack without severely compromising the model's legitimate functionality, as they fail to account for reverse execution.
- Promising but Limited Detection: A gradient honeypot-inspired detection method shows high accuracy (AUC 1.0) in identifying infected models, but it is resource-intensive and assumes significant data memorization, emphasizing the need for more robust, automated, and proactive mitigation strategies.
About the Speaker(s)
The research on the "Transpose Attack: Stealing Datasets with Bidirectional Training" was presented by Guy Amit. As indicated in the transcript, Guy Amit shared this "latest research" at the NDSS Symposium. The presentation is a testament to his work in uncovering novel vulnerabilities in Deep Neural Networks and exploring their implications for AI security and data privacy.
All talks from Network and Distributed System Security (NDSS) Symposium 2024