Home/Computer Vision/image-hijacks
image-hijacks logo

image-hijacks

euanong/image-hijacks

Adversarial Images Control Generative Models at Runtime

GraphCanon updated 2w · GitHub synced 2w

57 stars13 forksLast push 2y Python MIT

Decision brief

Image Hijacks is an advanced adversarial AI tool for generating images that can control the output of generative models at runtime.

Good fit when

  • When you need to create specific adversarial scenarios where fine-tuned images manipulate generative model outputs during real-time operation.
  • If your research or development requires testing the robustness of image generation algorithms against adversarial attacks with real-time impact.

Avoid when

  • Avoid using Image Hijacks for standard machine learning tasks that do not involve runtime manipulation of AI-generated images through adversarial means.
  • Do not use this tool if you are working within a constrained or sensitive environment where introducing adversarial elements poses an additional risk to system security.
Requirements:
Min 8 GB RAM; System-specific adjustments might be required, such as setting the `PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring` environment variable.; Large files like cached models or data are stored in the `data/` directory. Ensure this directory is appropriately configured for storage.

Observed Jul 17, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Dormant (1050d since push)
As of 2w
Provenance
Not a fork · Personal account
As of 2w
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

pip install image-hijacks
PyPI

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

The euanong/image-hijacks project comprises official code for creating adversarial images that can hijack or manipulate the output of generative models during runtime, using configurations and training processes tailored to specific adversarial scenarios involving AI image generation.

Capability facts

Languages
python

Source: github.language+pyproject.toml · Aug 5, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

OpenAI APIOpenAI API

Source: README excerpt (regex_v1, Aug 5, 2026)

to run jailbreak experiments (configurations coming soon), you must store your OpenAI API key in the `OPENAI_API_KEY` environment variable.
Source link
Python runtimePython

Source: README excerpt (regex_v1, Aug 5, 2026)

The code can be run under any environment with Python 3.9 and above.
Source link

Tags

README

Image Hijacks: Adversarial Images can Control Generative Models at Runtime

This is the code for Image Hijacks: Adversarial Images can Control Generative Models at Runtime.

Setup

The code can be run under any environment with Python 3.9 and above.

We use poetry for dependency management, which can be installed following the instructions here.

To build a virtual environment with the required packages, simply run

poetry install

Notes

  • On some systems you may need to set the environment variable PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring to avoid keyring-based errors.
  • This codebase stores large files (e.g. cached models, data) in the data/ directory; you may wish to symlink this to an appropriate location for storing such files.

Training

The images used in our demo were trained using the config in experiments/exp_results_tables/config.py (specifically runs #1 llava1_att_leak.pat_full.eps_8.lr_3e-2 and #5 llava1_att_spec.pat_full.eps_8.lr_3e-2).

To train these images, first download the relevant LLaVA checkpoint:

poetry run python download.py models llava-v1.3-13b-336px

To get the list of jobs (with their job IDs) specified by this config file:

poetry run python experiments/exp_demo_imgs/config.py

To run job ID N without wandb logging:

poetry run python run.py train \
--config_path experiments/exp_demo_imgs/config.py \
--log_dir experiments/exp_demo_imgs/logs \
--job_id N \
--playground

To run job ID N with wandb logging to YOUR_WANDB_ENTITY/YOUR_WANDB_PROJECT:

poetry run python run.py train \
--config_path experiments/exp_results_tables/config.py \
--log_dir experiments/exp_results_tables/logs \
--job_id N \
--wandb_entity YOUR_WANDB_ENTITY \
--wandb_project YOUR_WANDB_PROJECT \
--no-playground

Notes:

  • In order to run jailbreak experiments (configurations coming soon), you must store your OpenAI API key in the OPENAI_API_KEY environment variable.

Tests

This codebase advocates for expect tests in machine learning, and as such uses @ezyang's expecttest library for unit and regression tests.

To run tests,

poetry run python download.py models blip2-flan-t5-xl
poetry run pytest .

Citation

To cite our work, you can use the following BibTeX entry:

@misc{bailey2023image,
  title={Image Hijacks: Adversarial Images can Control Generative Models at Runtime}, 
  author={Luke Bailey and Euan Ong and Stuart Russell and Scott Emmons},
  year={2023},
  eprint={2309.00236},
  archivePrefix={arXiv},
  primaryClass={cs.LG}
}

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.