Category Discovery as a Leakage Attack on Encrypted Vector Search

Companies increasingly store embeddings, the numerical fingerprints that neural networks compute for images, documents, or patient records, in cloud vector databases. Encrypted versions of these databases let the server answer "which stored items are closest to this query?" without seeing the vectors. To stay fast, the strongest such systems have to reveal something: which item is closer than which, how the search graph is wired, and which items each query returns. This proposal asks what that leakage is worth to an adversary in a database that keeps growing. Can a curious server watching new encrypted vectors arrive work out the client's categories, including new ones the moment they appear, using the same algorithms machine-learning researchers built for discovering new classes in unlabeled data streams?

We claim it can, and that incremental class discovery is the right tool for measuring this. Incremental class discovery means continually detecting which incoming items belong to known categories, clustering the ones that don't into new categories, and keeping old categories stable over time. A server that knows the identity of a few stored items, the standard "auxiliary knowledge" assumption in attacks on searchable encryption, faces exactly that learning problem: a few labeled known classes, a stream of unlabeled encrypted points, and novel classes appearing over time. We propose to build this attack, measure how much category structure leaks at three levels of server visibility, and map the trade-off between search recall and leakage for simple defenses. The result would be a leakage audit expressed in the units ML practitioners already understand: discovery accuracy and how long it takes to detect a new class.

Core Claim

Encrypted nearest-neighbor search is designed to hide coordinates and exact distances. It is not designed to hide cluster structure, and in a dynamic database cluster structure is semantic content. A new disease subtype, a new product line, or a new group of individuals shows up as a new dense region of the index. Our hypothesis is that an attacker who runs incremental generalized category discovery on what an encrypted vector index reveals recovers the client's category partition with accuracy close to plaintext discovery. We further expect a large part of that accuracy to survive even when the server sees only the search graph or the access pattern, and not the comparison-preserving ciphertexts. If this holds, "the vectors are encrypted" gives much weaker protection for streaming data than the static security analyses suggest.

Relation to Prior Work

The method we attack comes from Privacy-Preserving Approximate Nearest Neighbor Search on High-Dimensional Data. It pairs Distance Comparison Encryption (DCE), which reveals only whether one vector is closer to a query than another, with Distance-Comparison-Preserving Encryption (DCPE) over a Hierarchical Navigable Small World (HNSW) graph, a layered nearest-neighbor graph that allows fast approximate search. The paper reports that recall matches plaintext search and that DCE is up to 1,000x faster than prior comparison schemes. It treats the database as static and evaluates leakage per query. We take its index as the target and ask what accumulates across insertions.

Two private retrieval systems motivate the defense side. RemoteRAG adds distance-based differential-privacy noise to embeddings to narrow the search to a coarse candidate pool, then uses homomorphic encryption and oblivious transfer to restore exact recall. Pisces combines hashing-based oblivious filtering with secure multi-party refinement and stays within 1.87% of plaintext RAG accuracy. Both target static retrieval. Neither asks whether their coarse stages leak category emergence over time. The general worry that tree and graph indexes leak search and access patterns is stated in Privacy-preserving Multi-keyword Ranked Search over Encrypted Cloud Data Supporting Dynamic Update, which supports dynamic insertion into an encrypted tree but does not quantify what the evolving structure reveals.

The attacker's toolkit comes from incremental class discovery. Incremental Generalized Category Discovery uses a soft nearest-neighbor classifier with density-peak selection and introduces the iNatIGCD benchmark with real domain shift. PromptCCD keeps a Gaussian mixture of prototypes and estimates the number of new classes with split-and-merge. Class-Incremental Novel Class Discovery (FRoST) replays Gaussian feature statistics instead of raw data. Its motivation is privacy-driven deletion, but its stored statistics are plaintext. Its evaluation finding constrains us: methods with separate old and new heads collapse to 0% on new classes under joint evaluation, so we score the attacker only with a unified partition.

Federated Generalized Category Discovery shares plaintext mixture parameters with a server and never asks what that server can infer. Our work asks that question for a cryptographically protected setting. The closest bridge in the file, Continual Pretraining on Encrypted Synthetic Data, learns over deterministically encrypted text and itself notes frequency-analysis risk. It involves neither vector search nor class discovery.

Threat Model and Observation Levels

The client embeds items with a frozen pretrained backbone, encrypts them, and inserts them into a cloud-hosted encrypted HNSW index in stages, following the stage structure of the continual discovery benchmarks. The server is honest but curious: it runs the protocol correctly but records everything. We grant it auxiliary knowledge of the class identity of a small fraction of items from the initial classes, between 0.5% and 5%. These are the labeled known classes of a generalized category discovery problem.

We study three observation levels, each weaker than the last. At the strongest level the server holds the DCPE ciphertexts, which preserve approximate distances up to a noise parameter $\beta$. At the middle level the server sees only the HNSW graph topology: which items are linked as neighbors after each insertion. At the weakest level it sees only access patterns, meaning the result sets returned for client queries. From these the server builds an evolving neighbor graph over item identifiers.

Research Program

The first component is the attack. At the ciphertext level, the attacker runs the discovery methods directly on DCPE vectors. At the graph and access-pattern levels, it first converts what it observed into an embedding, using spectral embedding of the accumulated neighbor or co-retrieval graph, and then runs the same methods. We adapt the density-peak soft-nearest-neighbor method and PromptCCD's Gaussian mixture with split-and-merge to operate on these inputs. Because the attacker never has the image, PromptCCD's prompt mechanism is replaced by its mixture-of-prototypes clustering alone.

The second component is measurement. The outputs are the attacker's discovery accuracy on all, old, and new classes after each stage, using Hungarian-matched clustering accuracy under a unified partition. We also measure novel-class detection delay, defined as the number of insertions after a class first appears before the attacker forms a cluster with at least 50% purity for it. Finally, we report how accurately the attacker estimates the number of classes.

The third component is defense. We test two families of defenses and trace recall against attacker accuracy for each. The first family adds noise: we raise the DCPE noise $\beta$, or add distance-DP perturbation in the style of RemoteRAG. The second family hides structure: the client buffers and shuffles insertions, injects dummy vectors, and periodically re-randomizes the graph by rebuilding it under fresh keys. Each defense is reported as a curve with recall@10 on the horizontal axis and attacker all-class accuracy on the vertical axis. A good defense pushes its curve toward high recall and low accuracy.

Baselines

The naive reference point is a chance-level attacker that assigns unlabeled points uniformly to the known number of classes, together with a static k-means attacker. The static attacker reclusters all observations from scratch at each stage, given the true number of classes, using the same observations as the main attacker. Beating chance shows that leakage exists. Beating static k-means shows that incremental discovery and the auxiliary labels add attack power beyond simple clustering.

The upper reference is plaintext incremental discovery run by the client on its own unencrypted embeddings. This is the most a leak could ever give an attacker. For it we use the published numbers. On CIFAR-100, PromptCCD reports 64.17% continual accuracy (cACC), compared with 58.25% for the prior best method, PA-CGCD (PromptCCD). FRoST reports 59.2% all-class accuracy (Class-Incremental Novel Class Discovery). On iNatIGCD, density-peak soft nearest-neighbor discovery reports 28.4% final discovery accuracy, compared with 20.1% for Grow-and-Merge and 27.9% for SimGCD plus iCaRL (Incremental Generalized Category Discovery). For ImageNet-100 and CUB we found no reported result on Lacuna, so we rerun both methods ourselves in plaintext.

For fairness, attacker and plaintext runs use the same backbone features, the same stage splits, the same labeled fraction, and the same hyperparameter search budget of 20 configurations, tuned on a held-out stream. The attack counts as strong if the ciphertext-level attacker comes within 10 points of the plaintext rerun. It counts as meaningful at the weaker levels if it beats static k-means by at least 5 points.

The key ablation removes the auxiliary labels. This is fully unsupervised incremental discovery, with the number of classes estimated by split-and-merge. It isolates how much of the leak depends on the server knowing a few plaintexts. For defenses, the comparison point is the undefended DCE/DCPE index, whose recall the source paper reports as matching plaintext but without numerical values on Lacuna. We therefore measure its recall ourselves.

Why not just…?

Why not just note that DCPE preserves approximate distances, so clustering obviously works? That observation covers only the strongest observation level, and even there it is qualitative. The DCPE paper offers no figure for how large $\beta$ must be before fine-grained category structure disappears, or what recall that costs. The open questions are quantitative: where the recall-versus-leakage curve bends, and whether the graph-only and access-pattern-only levels leak comparably. If the graph and access-pattern attackers stay near chance, the finding narrows to "do not expose DCPE ciphertexts", and we will report it that way.

Why not just recluster with k-means at every stage instead of using incremental discovery? This is a real threat to the methodological contribution, so static k-means is a headline baseline rather than a straw man. If it matches the incremental attacker, the leakage result still stands, but we would conclude that the discovery machinery adds nothing. We expect it to add something in two places. Auxiliary labels anchor old classes, which density-anchored methods are built to exploit. And on iNatIGCD the domain shift destabilizes from-scratch clustering, which is consistent with SimGCD's 41.0% forgetting there.

Why not just add differential-privacy noise to the embeddings and be done? It is a defense, and we evaluate it directly. Prior evidence suggests it cannot be the whole answer: RemoteRAG needed homomorphic encryption and oblivious transfer on top of distance DP to recover full recall, and Pisces moved away from DP to stay within 1.87% of plaintext. Our curves will show whether any noise level drops attacker accuracy to near chance while keeping recall@10 useful.

Why not just keep the embeddings on the client? At CIFAR scale that is feasible, and we say so. Outsourcing matters when the corpus or the client population grows, which is the setting that motivates encrypted search (Towards privacy preserving access control in the cloud). Our results tell those deployments what the outsourcing actually costs in privacy.

Proposed Experiments

We use frozen DINO ViT-B features, matching the PromptCCD setup, on CIFAR-100, ImageNet-100, and CUB-200 with the CCD stage splits. We use iNatIGCD for streams with domain shift. Each stream is inserted into a reimplementation of the DCE/DCPE HNSW index. For the access-pattern level, we simulate client queries drawn from held-out items of the currently active classes, at 1, 10, and 100 queries per insertion.

The first decisive check tests the core claim. On CIFAR-100 at the ciphertext level with default $\beta$ and 1% auxiliary labels, does the attacker's all-class accuracy fall within 10 points of our plaintext PromptCCD rerun, which we sanity-check against the reported 64.17%? Novel classes are reported separately to show whether new categories are exposed as they appear.

The second check tests whether hiding the ciphertexts is enough. Does the graph-only attacker exceed static k-means by 5 points on CUB, where fine-grained margins should make leakage hardest? If it does not, hiding ciphertexts is a sufficient practical fix.

The third check tests the defenses. Does any defense configuration hold recall@10 above 0.9 while pushing attacker new-class accuracy to within 5 points of chance? A negative answer would argue that dynamic encrypted vector stores need structural protections, such as periodic re-keyed rebuilds, rather than per-vector noise. We report detection delay alongside, since a defense that delays detection without preventing it is still informative for operators.