NeuraCrypt Is Not PrivateNeuraCrypt is not private
The authors break the instance encoding privacy scheme NeuraCrypt: matching original and encoded images with a 100% success rate on its public challenge, and providing a theoretical impossibility result.
The attacker Bob is given both the original image set X and the encoded image set (in shuffled order), and the goal is to match each encoded image back to its original image (NeuraCrypt Challenge 1, known-plaintext setting); the attacker does not know the random transformation T and permutation used for encoding. The authors did not break Challenge 2 (ciphertext-only setting, where only encoded data is available and T must be recovered).
- NeuraCrypt proposes encoding sensitive images with a random neural network before public training, claiming the encoding protects the privacy of the original data. The authors test whether this privacy claim holds.
- The authors design a multi-stage attack: first learn patch-level and image-level similarity to obtain a coarse matching, then exploit the position-encoding leak to recover the per-image permutation and iteratively enhance the matching, and finally use gradient descent to extract the encoding transform T to achieve a perfect matching; they also give a theoretical analysis and impossibility results for keyed instance encoding.
- The attack achieves 100% matching accuracy for all security parameters k on the NeuraCrypt Challenge (CheXpert, 14,643 images) and the self-built ImageNet set (10,000 images), completing within 6 hours on a single machine; theoretically, the authors prove that any weakly-ideal encoding can be used to extract the concept function c.
- The attack requires known-plaintext (obtaining both the original and encoded images) and cannot be used in the ciphertext-only scenario where only encoded images are published (Challenge 2 is unsolved); the NeuraCrypt authors state in their response that Challenge 1 does not represent the real-world scenario and that Challenge 2 remains unbroken.
- Evaluated models
- NeuraCrypt
- Benchmarks
- NeuraCrypt Challenge (CheXpert)ImageNet
- Metrics
- 匹配正确率(Percent Correct)p-sim / i-sim 相似度准确率
The researchers claim to have broken NeuraCrypt's privacy claims and fully solved the public challenge set by the authors. NeuraCrypt was intended to encode sensitive datasets so they could still be used to train models, while preventing an adversary with access only to the encoded dataset from learning the original data; the paper points out that it does not satisfy the formal privacy definition proposed in the original paper. Its attack consists of a series of escalation steps that, combined with several design flaws, amplify a 1% attack advantage into a 100% complete break of the scheme.
Paper analysis
What problem does this paper attempt to solve?
Examines and breaks NeuraCrypt's privacy claims: its public challenge is solved 100%, and it does not satisfy the formal privacy definition of the original paper.
Core question: does NeuraCrypt's instance encoding really protect the privacy of sensitive training data—the authors' answer is no.
- Problem setting: to train models on sensitive data such as medical images and private messages, one class of methods uses an encoding function e : X → Y to map the original dataset X to an encoded dataset Y, requiring both utility (a useful model can be trained on Y) and privacy (sensitive attributes of X cannot be learned from Y). NeuraCrypt (Yala et al. 2021) encodes images patch by patch using a neural network with random weights, and its authors claim it provides both.
- Shortcomings of existing work: the authors point out that NeuraCrypt only gives a "perfect privacy" definition for an idealized version, and does not define what privacy a concrete instantiation should provide; the earlier instance-encoding scheme InstaHide has also been fully broken by reconstruction attacks ([CDG+21]).
- Core observation: if the encoding is to preserve utility it cannot completely destroy information, and the very fact that a model can be trained on the encoding suggests that encoded images are distinguishable from one another; the authors exploit this together with design flaws (position-encoding leak, linear regions of ReLU) to amplify a 1% attack advantage into a complete break.
- Paper contributions: (1) a multi-stage practical attack that fully solves the public NeuraCrypt challenge and recovers the encoding transform T; (2) a formal analysis of keyed instance encoding proving that any weakly-ideal encoding can be used to extract the concept function c (Theorem 1).
- Threat model (NeuraCrypt Challenge 1, per the paper's setting):
- Attacker goal: given the original image set X and the shuffled encoded set, recover the matching σ between them; under a secure scheme Bob expects a score of only 1.
- Attacker knowledge: knows both X and the encoding function family sym(X), i.e., the known-plaintext setting; does not know the transform T and permutation π randomly chosen by Alice.
- Attacker capability: arbitrary offline computation on the encoded and original data; no encoding oracle queries.
- Victim system: a sensitive dataset published after encoding with NeuraCrypt (CheXpert medical images in the challenge).
What related research exists?
Around instance encoding privacy: InstaHide and its being broken, NeuraCrypt and its challenge, and cryptographic-style security definitions for encoding schemes.
Instance encoding schemes
- InstaHide (Huang et al., ICML 2020, [HSLA20]): Proposes an instance-hiding scheme for private distributed learning and is a representative of this "train-after-encoding" line of thought. The paper notes that InstaHide has been fully broken by reconstruction attacks, and that its theoretical argument covers only a subproblem of the scheme.
- NeuraCrypt (Yala et al. 2021, [YEO+21b]): The attack target of this paper; it encodes medical images with a random neural network for public training and proposes "ideal encoding" as the privacy goal; the authors note that its theoretical analysis targets the ideal scheme and does not cover the concrete neural network instantiation.
Attacks on instance encoding and impossibility results
- Carlini et al. 2021 ([CDG+21]): Proves that unkeyed instance encoding has a privacy barrier and breaks prior schemes via full reconstruction attacks. This paper notes that their framework does not allow the encoding to use a private key, whereas this paper studies the keyed setting that allows keys, and states that the distinguishing attack of [CDG+21] also applies to keyed schemes under CIA privacy.
Cryptographic definitions and tools
- Goldwasser & Micali 1984 ([GM84]): Probabilistic encryption and the indistinguishability security definition; the authors state that this paper's NIA/CIA definitions follow this indistinguishability style.
- Knowledge extraction ([GMR89], [BG92]): Knowledge extraction in cryptography; the authors state that the result of extracting the concept function c from the encoder is reminiscent of this concept.
- Biryukov & Kushilevitz 1998 ([BK98]): From differential analysis to ciphertext-only attacks; the authors cite it in support of the argument that "attacks only get stronger" and that a chosen-plaintext break can often be converted into a ciphertext-only break.
Baselines and benchmarks: This is an attack paper with no method baseline comparison; the evaluation benchmarks are the NeuraCrypt Challenge (CheXpert medical images, [IRK+19]) and the authors' self-built ImageNet ([DDS+09]) dataset.
Positioning: The authors state that this is their second full break of an instance encoding scheme; the difference from [CDG+21] is that this paper handles keyed encoding and provides both a practical attack (solving Challenge 1) and an impossibility result on the instantiability of ideal encoding.
How does the paper address this problem?
Multi-stage attack: similarity matching yields a coarse solution → exploit the position-encoding leak to recover the permutation and iteratively enhance → gradient descent extracts the transform T to achieve a perfect matching.
The overall idea is to amplify a weak patch-level discriminative ability, through a series of boosting steps, into a complete break of the entire scheme, and to recover Alice's encoding transform T. The attack is implemented in 700 lines of JAX, which the authors state has been open-sourced.
NeuraCrypt Encoding Pipeline (attack target)
- Patch-by-patch encoding: a w×h×c image is split into a² patches; each patch is flattened and passed alternately through k layers of randomly initialized linear transforms f_i(x)=A_i x+b_i and ReLU, yielding ẑ.
- Image-level processing: each patch has a fixed position encoding δ_i added, then passes through a final linear projection to give ŷ_i, and finally the patch order is shuffled by a random permutation π for output. All images in the same dataset share the same random network and position encodings.
Stage 1: Weak Break—Initial Matching
- p-sim (§2.1.1): sample random encoders to construct a patch dataset, train two embedding networks n_x, n_y, and use k-way contrastive softmax so that the inner product is small for matching pairs and large for non-matching pairs; inputs first compute k-th order moments rather than using pixels directly. Highest accuracy 80% on the balanced dataset (random guessing 50%).
- i-sim (§2.1.2): without knowing the permutation π, build a bipartite graph between original-image patches and encoded patches, with p-sim as edge weights, and find the minimum-cost maximum-weight matching; its cost is i-sim, equivalent to efficiently computing max over ρ of i-sim_ρ; accuracy >95%.
- Initial matching m (§2.1.3): compute i-sim for all N² image pairs and solve the minimum-cost bipartite matching. The authors note that because the base rate is low (only 1 true positive among 10,000), the matching quality is not high, but it only needs to be better than random.
Stage 2: Strong Break—Recovering the Permutation and Iterative Enhancement
- Per-image permutation (§2.2.1): the authors observe that the inner product of two encoded patches is correlated with whether they are at the same position—the position encoding δ_j dominates the mean inner product. Taking one encoded image as a reference and decorrelating the others, they recover the permutation π_j of each image (up to a global permutation).
- Global permutation (§2.2.2): after aligning all encoded images, find a single global permutation ρ via max weight matching; the authors state that although the matching m is poor at this point, the noise is uncorrelated and the signal from correct matches dominates.
- Iterative enhancement (§2.2.3): use the recovered permutation to directly compute i-sim_ρ* and re-match, then in turn improve the permutation estimate, alternating iterations; the authors state that this step alone can already fully solve the NeuraCrypt challenge.
Stage 3: Complete Break—Extracting the Transform T
- Extracting T (§2.3.1): on the approximately aligned "known plaintext", randomly initialize T̃ and use gradient descent to minimize argminT̃ ∑i=1N |T̃(xi) − ym(i)|, i.e., make the self-built transform approximate the true encoding. The system is overdetermined: a single image-encoding pair gives about 500,000-dimensional input-output pairs, T has about 30 million parameters, and 60 pairs suffice to fully determine it; the authors state that the robustness of neural network training to label noise makes this feasible even with noisy matchings.
- Perfect matching (§2.3.2): use the extracted T̃ to generate expected encodings, and solve the bipartite matching once more with ‖ỹ_i − y_j‖ as edge weights; the authors state that all experiments they tried yielded perfect solutions.
Theoretical Analysis (§3)
- Definitions: give NIA (no instance attack) and CIA (chosen instance attack) privacy definitions for keyed instance encoding, following the indistinguishability style; and define a weakly-ideal encoder (inputs with the same label have the same encoding distribution, and the encoding preserves labels).
- Theorem 1: if a learning algorithm L achieves (1/2−ε, δ) balanced-error on weakly-ideal encoded data with m samples, then there exists a polynomial-time predictor that, using only two labeled samples, can predict the concept function c with risk ≤τ. On this basis the authors argue that instantiating NeuraCrypt's ideal encoding is at least as hard as "using two samples to achieve 100% accuracy on all distributions".
What experiments did the paper conduct?
On the NeuraCrypt Challenge (CheXpert) and the self-built ImageNet set, the matching accuracy is 100% under all security parameters k.
Experimental Setup
- Attack target: the NeuraCrypt encoding scheme, with security parameter k (related to the number of encoding network layers) set to 2, 7, 15.
- Datasets: the authors' self-built ImageNet dataset (10,000 images, used throughout attack development); the NeuraCrypt Challenge dataset (CheXpert medical images, 14,643 images, evaluated once after the challenge was released).
- Evaluation protocol: following the privacy game of NeuraCrypt Challenge 1, the attacker is given the original image set and the shuffled encoded set, and outputs a matching σ̃; the metric is the number of correctly matched positions / percentage (Percent Correct in Table 1).
- Implementation and cost: 700 lines of JAX; wall-clock time to solve the challenge on a single machine under 6 hours; the dominant attack cost is the O(N²) all-pairs comparison between original and encoded images.
- Intermediate metrics: accuracy of p-sim on the balanced patch dataset (random baseline 50%); image-level decision accuracy of i-sim.
- Not reported in the paper: the number of repetitions and variance for each setting, and the specific architecture and training hyperparameters of the embedding networks n_x/n_y.
Main Results
According to Table 1 (matching accuracy; the attack fully solves the challenge):
Swipe horizontally to read the table
Security parameter Dataset Number of images Matching accuracy k=2 Ours (ImageNet) 10,000 100% k=7 Ours (ImageNet) 10,000 100% k=15 Ours (ImageNet) 10,000 100% k=2 NeuraCrypt Challenge (CheXpert) 14,643 100% k=7 NeuraCrypt Challenge (CheXpert) 14,643 100% - The authors state that regardless of the size of the security parameter or the number of encoded images, the attack success rate is 100%.
- The authors state that the attack was developed entirely on ImageNet and evaluated directly on CheXpert after the challenge was released, and likewise fully succeeded.
- The authors state that the attack also incidentally recovers Alice's transform T, so that future newly encoded images can also be further attacked.
Intermediate Results of Each Stage of the Attack Chain
- p-sim: highest accuracy 80% on the balanced patch matching dataset (random 50%) (§2.1.1).
- i-sim: image-level similarity decision accuracy >95% (§2.1.2).
- Initial matching m: the authors state that only "more than a few percent" of positions are matched; the attack-chain numbers given in §5 are: patch correlation detection 70% → image similarity 98% → recover 2% matching → 50% → 100%. The two sets of numbers (80% vs. 70%, >95% vs. 98%) come from different passages of the paper, and the paper does not explain their correspondence.
Theoretical Results
- Theorem 1: For any weakly-ideal encoding, if L achieves (1/2−ε, δ) balanced-error on the encoding distribution with m samples, then there exists a predictor with running time poly(m, 1/ε, 1/δ, 1/τ) that, using only two labeled samples (x0,0), (x1,1), can predict c on any distribution D′ with risk ≤τ.
- The authors' interpretation: since NeuraCrypt's ideal encoding is also weakly-ideal, instantiating this ideal encoding is at least as hard as "using two samples to raise accuracy to 100% on all distributions"; the authors state that this responds to the NeuraCrypt authors' demand for a proof of impossibility.
Analysis of Challenge 2
- Constructive counterexample (Appendix A.1): the authors construct the encoding E(x,k)=(x,k(x))—which directly leaks the original data x—and prove that under Challenge 2 the attacker's expected number of matches can be arbitrarily close to 1, i.e., this scheme is "secure" under Challenge 2.
- The authors' interpretation: on this basis the authors argue that Challenge 2 (ciphertext-only) cannot guarantee basic privacy, and that ciphertext-only security was considered unrealistic in cryptography decades ago; the NeuraCrypt authors state in their response that both claims are incorrect (see Question 5).
Other Ablations and Analyses
- The paper does not report a separate ablation table; the per-stage accuracies are the intermediate metrics above.
- The authors state that without the transform extraction of stage 3, the iterative enhancement of stage 2 alone can perfectly solve the challenge (§2.3.2).
What are some points that can be further explored?
The authors state that the attack is limited to the known-plaintext setting; the NeuraCrypt authors respond that Challenge 2, which corresponds to the real-world scenario, remains unbroken.
Limitations and future directions noted by the authors
- The attack requires known-plaintext: The authors explicitly write in §5 that their attack can only break the system when (a small amount of) known plaintext is available, and cannot perform a ciphertext-only attack; therefore "currently NeuraCrypt remains safe to use in scenarios where only encoded images are published."
- Retroactive risk of future attacks: The authors point out in §5 that if encoded images are published with NeuraCrypt today, future work extending the attack to the ciphertext-only setting will retroactively compromise the privacy of those images.
- A call regarding research direction: The authors state in §5 that henceforth any slight weakness should be treated as the scheme being broken (the convention in cryptography), and that future instance encoding schemes should by default be assumed to "have fundamental flaws like InstaHide and NeuraCrypt" unless the authors provide strong evidence.
- Response from the NeuraCrypt authors (§4, quoted verbatim from the paper): They state that Challenge 1 does not represent a real scenario (an attacker who already has all the plaintext has no motive to attack), and that Challenge 2, which corresponds to the real scenario, remains unsolved; they state that the two claims about Challenge 2 in Appendix A of this paper are incorrect; and they state that proving neural network encoding is "fundamentally infeasible" requires an impossibility result for neural network encoders. The authors of this paper rebut this point by point in §4.1, stating that Theorem 1 (referred to as Theorem 3.3 in the response) is exactly such an impossibility result.
Scope of experiments
- The attacked scheme is NeuraCrypt, with security parameter k ∈ {2, 7, 15} (Table 1).
- The evaluation datasets are ImageNet (10,000 images, attack development set) and CheXpert from the NeuraCrypt Challenge (14,643 images), for a total of 5 k×dataset combinations (Table 1).
- The attack is implemented in 700 lines of JAX, with single-machine wall-clock time under 6 hours (§2).
- The paper does not report the number of repetitions or variance for each setting; each row of Table 1 has only one accuracy number.
- The paper does not conduct experiments under the Challenge 2 setting (encoded data only), and the authors explicitly state they will not further study Challenge 2 (§4.1).
Summarize the main content of the paper
The authors completely break NeuraCrypt: solving the public challenge 100%, recovering the encoding transformation, and proving its ideal encoding cannot be securely instantiated.
An attack paper targeting the instance encoding privacy scheme NeuraCrypt, providing both a practical break and a theoretical impossibility result.
- Problem: NeuraCrypt uses a random neural network to encode sensitive images (such as medical images) for public training, claiming the encoding protects the privacy of the original data; the authors test this claim.
- Method: A multi-stage boosting attack—first train contrastive embeddings to obtain patch-level similarity p-sim (up to 80%) and image-level similarity i-sim (>95%), solve bipartite matching to obtain rough matches; then exploit inner-product leakage caused by positional encoding to recover per-image and global permutations, iteratively enhancing the matching; finally, on approximately aligned "known plaintext," use gradient descent to extract the encoding transformation T (about 30 million parameters; the authors state 60 image-encoding pairs suffice to fully determine it), obtaining perfect matching.
- Main results: Matching accuracy is 100% on the NeuraCrypt Challenge (CheXpert, 14,643 images, k=2/7) and the self-built ImageNet set (10,000 images, k=2/7/15) (Table 1); completed within under 6 hours on a single machine, implemented in 700 lines of JAX.
- Theoretical results: The authors define NIA/CIA privacy for keyed instance encoding and weakly-ideal encoding, and prove (Theorem 1) that any weakly-ideal encoding that supports learning can efficiently extract the concept function c using only two labeled samples; based on this, the authors argue that NeuraCrypt's ideal encoding cannot be securely instantiated, and use a constructive counterexample to argue that the Challenge 2 (ciphertext-only) definition cannot guarantee basic privacy.
- Controversy: The NeuraCrypt authors, in a response included in the paper, state that Challenge 1 does not reflect a real scenario and that Challenge 2 remains unsolved; the authors of this paper rebut that breaking Challenge 1 is already stronger than the requirements of standard indistinguishability security.
- The authors' conclusion: Privacy schemes must come with precise privacy definitions, neural networks are not ideal random functions, and iterative boosting will amplify small weaknesses into a complete break; the authors argue that instance encoding schemes should be considered broken once a weakness appears.
Related papers
- Measuring Forgetting of Memorized Training ExamplesAnalysis / interpretabilityarXiv