Graph Neural Networks (GNNs) are among the most powerful tools in modern AI. They can analyze data structured as nodes and connections – like social networks, financial links, protein structures, or transportation systems.
But success comes with risk: GNNs can be attacked. A new research paper introduces JANUS – a framework that learns to inject fake nodes into graphs in a way that is extremely hard to detect. While framed as an attack, the insights are equally valuable for building defenses.
Short example
Imagine a social network where a GNN decides whether an account is real or a bot. If someone creates a “fake friend” (a node with features similar to other people and with convincing links), the system may accept it as real. This is a node injection attack – it looks innocent, yet it can change classification results for the whole network.
Traditional attacks were often easy to detect: fake nodes had suspicious features or weird connections. JANUS is smarter:
- Locally – the fake node looks like a normal neighbor.
- Globally – the entire graph structure with injected nodes still looks natural.
Think of it like counterfeiting money: it’s not enough for a bill to look good up close. It also has to blend into the entire economy.
Practical examples:
- In finance, malicious nodes can disguise fraudulent transactions.
- In bioinformatics, an injected gene-dependency node could mislead medical analysis.
Mathematical background
We represent a graph as:
$$ G = (V, E, X), $$
where $V$ is the set of nodes, $E$ the edges, and $X \in \mathbb{R}^{|V|\times d}$ the node feature matrix.
A node injection attack adds a new node $v_{\text{inj}}$ and edges to maximize the GNN’s loss under a limited attack budget.
The JANUS objective is to maximize misclassification:
$$ \max \sum_{v \in T} \mathbb{I}(f_\theta(v, G’) \neq y_v), $$
where $T \subset V$ is the set of target nodes, $f_\theta$ the GNN, and $G’$ the attacked graph.
Dual stealth constraints
Local feature authenticity
Using Optimal Transport (OT), JANUS aligns the distribution of injected node features with real neighbors.$$ L_{\text{OT}}(x_{\text{inj}}, X_{\text{orig}}) = W_2^2 \big(P_{\text{inj}}, P_{\text{orig}} \big), $$
where $W_2$ is the Wasserstein distance, solved via Sinkhorn iterations.
Global semantic consistency
Inspired by InfoGAN, latent codes $c$ guide the generator so injected structures follow the graph’s high-level semantics.$$ L_{\text{info}} = - \mathbb{E}_{c,z} \big[ \log Q(c|g) \big], $$
where $Q$ predicts the latent code from the generated subgraph $g$.
Reinforcement learning optimization
JANUS models the attack as a Markov Decision Process (MDP). The generator (actor) outputs node features and edges; the critic evaluates states.
Unified loss:
$$ L_G = L_{\text{policy}} + L_{\text{adv}} + L_{\text{info}} + \lambda L_{\text{OT}}, $$
where $\lambda$ balances attack strength and stealthiness.
Conclusion
The JANUS framework demonstrates that GNN attacks can be highly stealthy when designed carefully. By combining local feature alignment and global semantic consistency, injected nodes become indistinguishable from real ones.
From a security perspective:
Defenses must address both local and global properties.
Applications include finance, social networks, and bioinformatics.
From a research perspective:
JANUS combines GANs, Optimal Transport, InfoGAN, and Reinforcement Learning.
It’s a step toward more sophisticated modeling of both attacks and defenses in GNNs.
📎 Links
- Based on the publication 📄 2509.13266