Hijack-GAN: Unintended-Use of Pretrained, Black-Box GANs

Hui-Po Wang, Ning Yu, Mario Fritz

Abstract

While Generative Adversarial Networks (GANs) show increasing performance and the level of realism is becoming indistinguishable from natural images, this also comes with high demands on data and computation. We show that state-of-the-art GAN models -- such as they are being publicly released by researchers and industry -- can be used for a range of applications beyond unconditional image generation. We achieve this by an iterative scheme that also allows gaining control over the image generation process despite the highly non-linear latent spaces of the latest GAN models. We demonstrate that this opens up the possibility to re-use state-of-the-art, difficult to train, pre-trained GANs with a high level of control even if only black-box access is granted. Our work also raises concerns and awareness that the use cases of a published GAN model may well reach beyond the creators' intention, which needs to be taken into account before a full public release.

Introduction

The development of high-fidelity Generative Adversarial Networks (GANs), such as StyleGAN and PGGAN, has revolutionized image synthesis. However, the immense computational resources required for training—often involving weeks of processing on specialized hardware—have led to a paradigm where pre-trained models are shared within the research community. In many instances, these models are provided as "black boxes" (e.g., via APIs) to protect intellectual property or mitigate potential misuse.

Existing methods for controlling GAN outputs typically rely on "white-box" access to calculate gradients or assume a linear latent space. However, modern GAN latent spaces are characterized by high curvature and entanglement. This paper introduces Hijack-GAN, a framework designed to repurpose black-box GANs for complex, unintended manipulation tasks by navigating these non-linear manifolds without direct access to internal model weights.

Methodology

The Hijack-GAN framework circumvents the lack of direct gradient access through a two-stage process:

  1. Proxy Model Distillation: A small proxy neural network ($P$) is trained to approximate the behavior of the black-box GAN ($G$). By feeding random noise into the GAN and processing the resulting images through a pre-trained task model (e.g., an attribute classifier), the proxy learns to map noise vectors directly to predicted attributes.
  2. Iterative Non-linear Traversal: Rather than assuming a linear path in the latent space, Hijack-GAN performs iterative steps. At each step, the Jacobian matrix of the proxy model is calculated to determine the optimal direction for attribute modification.
  3. Orthogonal Constraints: To ensure disentangled control—modifying one attribute (e.g., age) without affecting others (e.g., gender)—the framework employs linear programming constraints to keep the movement vector orthogonal to non-target attribute directions.
The Hijack-GAN framework (a) utilizes a proxy model to navigate the black-box GAN's latent space via iterative non-linear traversal (b).

Experimental Setup

The researchers evaluated Hijack-GAN using PGGAN and StyleGAN architectures pre-trained on the CelebAHQ dataset. Training data for the proxy models consisted of 100,000 synthetic images generated by the "victim" GANs. Task models included facial attribute classifiers for CelebAHQ, the 300W-LP dataset for head pose estimation, and MTCNN for facial landmark detection.

Key Results

Hijack-GAN demonstrates significant improvements over linear baselines like InterfaceGAN, particularly for rare attributes where linear assumptions fail.

  • Disentangled Control: The use of orthogonal constraints allows for precise edits, such as shifting specific facial landmarks while maintaining the overall identity of the subject.
  • Smoothness and Fidelity: Quantitative evaluation using the Modified Perceptual Path Length (mPPL) metric indicates that the iterative approach produces smoother transitions and fewer visual artifacts compared to one-shot linear methods.
  • Unintended Utility: The framework successfully "hijacks" models for tasks they were not explicitly trained for, such as rotating head poses or modifying specific facial features in a face-generation GAN.
Example of high-fidelity facial attribute manipulation (aging) achieved by hijacking a pre-trained StyleGAN model.

Conclusion and Ethical Implications

Hijack-GAN proves that model weights are not an absolute security barrier. If a model's outputs are observable, its internal logic can be distilled and manipulated. While this enables the creative reuse of computationally expensive models, it also highlights significant security risks. The ability to repurpose "locked" models for unintended tasks necessitates a more cautious approach to public model releases, as the potential for creating sophisticated deepfakes or bypassing safety filters increases.

Summary updated

BibTeX
@inproceedings{wang2021hijack,
  author = {Hui-Po Wang and Ning Yu and Mario Fritz},
  title = {{Hijack-GAN: Unintended-Use of Pretrained, Black-Box GANs}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=rcMwxlR-bc},
}
Figure