Inference Attacks Against Graph Neural Networks

Zhikun Zhang, Min Chen, Michael Backes, Yun Shen, Yang Zhang

This paper, presented at the 31st USENIX Security Symposium, systematically explores the privacy risks associated with sharing graph embeddings—compact vector representations of entire graphs produced by Graph Neural Networks (GNNs).

TL;DR

The authors demonstrate that graph embeddings, often shared with third parties under the assumption of being "sanitized," leak significant sensitive information. They introduce three novel inference attacks—property, subgraph, and reconstruction—that can accurately recover a graph's structural characteristics and propose a noise-based defense to mitigate these risks.

What Problem Does This Paper Address?

Graph Neural Networks (GNNs) have become the state-of-the-art for analyzing data structured as graphs, such as social networks, financial transactions, and molecular structures. A common practice is to generate a "graph embedding"—a fixed-length numerical vector that represents the entire graph—and share it with third parties for downstream tasks like visualization or classification.

Because these embeddings compress complex, non-Euclidean structures into a single vector, they are often empirically considered "sanitized" or privacy-preserving. This paper challenges that assumption, investigating whether an adversary can "reverse-engineer" the original graph's sensitive structural properties just by looking at the embedding.

Methods

The authors formalize a threat model where an adversary has black-box access to a target embedding and an auxiliary dataset from a similar distribution. They propose three distinct attacks:

  1. Property Inference Attack ($F_{AP}$): Modeled as a multi-task classification problem. A neural network takes the embedding as input and simultaneously predicts basic graph properties like the number of nodes, number of edges, and graph density.
  2. Subgraph Inference Attack ($F_{AS}$): A binary classification task. Given a target embedding and a "subgraph of interest," the attacker determines if that specific structure exists within the target graph. This is achieved by training a "graph embedding extractor" to map the candidate subgraph into the same vector space as the target embedding for direct comparison.
  3. Graph Reconstruction Attack ($F_{AR}$): The most ambitious attack, which aims to build a new graph ($G_R$) that is structurally similar to the target. The authors use a Graph Auto-Encoder (GAE) paradigm, where the attacker's model acts as a decoder. To handle the challenge of graph isomorphism (where different node orderings represent the same graph), they incorporate a graph matching component into the training process.

To counter these, they propose a Graph Embedding Perturbation defense, which adds well-calibrated Laplace noise to the embeddings before they are shared.

Datasets

The study utilizes five widely used public benchmarks from the TUDataset collection:

  • DD & ENZYMES: Bioinformatics graphs representing protein structures.
  • AIDS, NCI1, & OVCAR-8H: Molecular graphs where nodes are atoms and edges are chemical bonds.
  • PC3 & MOLT-4H: Used specifically to test the "transferability" of attacks (i.e., when the attacker's data comes from a different source than the victim's).

Key Insights and Ideas

  • Embeddings are not "Sanitized": The core "aha moment" is that the very features GNNs use to achieve high accuracy on downstream tasks are the same features that leak structural secrets. Structural "fingerprints" survive the compression into a vector.
  • The Power of Multi-Tasking: For property inference, predicting multiple properties at once (e.g., nodes and edges together) improves performance, suggesting that these properties are deeply intertwined in the embedding space.
  • Isomorphism is the Reconstruction Hurdle: Reconstructing a graph is difficult because a single graph can be represented by many different adjacency matrices. By using a maximum pooling matching method during training, the authors successfully taught their decoder to focus on structure rather than arbitrary node indexing.
  • Transferability: The attacks are remarkably robust. They often succeed even if the attacker doesn't know the exact architecture of the victim's GNN or if their auxiliary data is slightly "off-distribution."

Key Results

  • Property Inference: The models achieved up to 0.89 accuracy in predicting basic graph properties on the DD dataset.
  • Subgraph Inference: This attack was highly effective, reaching an AUC of 0.98 on the DD dataset. The authors found that using the "element-wise difference" between the target and subgraph embeddings was the most informative feature for the attacker.
  • Graph Reconstruction: The reconstructed graphs were strikingly similar to the targets, achieving a 0.99 cosine similarity for local clustering coefficient distributions on the AIDS dataset.
  • Defense Efficacy: Adding Laplace noise with a scale of $\beta=2$ was found to be a "sweet spot." It significantly degraded the performance of all three attacks (e.g., dropping subgraph inference AUC to near-random levels) while causing negligible loss in the accuracy of the original graph classification task.

Limitations and Future Work

  • Scalability: The graph matching algorithm used for reconstruction has a computational complexity of $O(n^4)$. This limits the current reconstruction attack to graphs with dozens of nodes (typical for molecules) but makes it impractical for massive social networks with millions of nodes.
  • Node Features: The current reconstruction attack focuses primarily on graph structure. The authors note that future work should aim to reconstruct node-level attributes (like atom types or user profiles) alongside the structure.
  • Defense Refinement: While Laplace noise is effective, more sophisticated differential privacy mechanisms tailored specifically for graph topology could provide even stronger guarantees.

Summary updated

BibTeX
@inproceedings{zhang2022inference,
  author = {Zhikun Zhang and Min Chen and Michael Backes and Yun Shen and Yang Zhang},
  title = {{Inference Attacks Against Graph Neural Networks}},
  booktitle = {USENIX Security},
  year = {2022},
  url = {https://openreview.net/forum?id=GBmPshm3Ae},
}
Figure