Repository navigation
Red Teaming LLM deployed as Hugging Face Spaces
Pre-releaseEnhancement:
Added support for scanning Hugging Face Spaces (HF_SPACE) URLs as models in Hacktor.
Description:
Currently, Hacktor doesn't support scanning models hosted on Hugging Face Spaces. This enhancement will enable Hacktor to directly interact with and assess the security of models deployed on HF_SPACE.
Proposed Solution:
Implement functionality to parse HF_SPACE URLs, extract the underlying model, and perform security scans using the specified parameters (e.g., --model_id, --attack_module, etc.).
Usage
Install or upgrade hacktor
git
git pull origin main
poetry install
docker
docker pull docker.io/detoxio/hacktor:latest
Export API Key
export DETOXIO_API_KEY=xxx
Run it
Example Command using installed hacktor:
hacktor llm HF_SPACE https://3b9822dd204a5d2b8e.gradio.live/ --model_id "google/gemma-2-2b-it" --use_ai --max_crawling_steps 1 --attack_module ADVBENCH --no_of_tests 10 -v
Example Command using docker:
docker run --rm -e DETOXIO_API_KEY=$DETOXIO_API_KEY docker.io/detoxio/hacktor:latest llm HF_SPACE https://b9371c32552ab2dda6.gradio.live --model_id "google/gemma-2-2b-it" --use_ai --max_crawling_steps 1 --attack_module ADVBENCH --no_of_tests 10 -v
URL (https://3b9822dd204a5d2b8e.gradio.live/): This points to the specific Hugging Face Space where the model is hosted and running. It's like the web address of the application that uses the model. This is necessary because models on HF Spaces are often integrated into interactive demos or applications.
model_id (google/gemma-2-2b-it): This is the identifier of the underlying language model itself. Think of it like the model's official name. It tells Hacktor which pre-trained model architecture and weights are being used within that Hugging Face Space. This ID is important for categorizing, analyzing the model's properties, and displaying it meaningfully in the portal.