Downloads · 30 days
14
13% of all-time downloads
edaerer/promptwaf-command-injection
promptwaf-command-injection is a text classification model from edaerer. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned DeBERTa model for detecting command injection attacks in prompts before they reach an LLM.
Downloads · 30 days
14
13% of all-time downloads
All-time downloads
108
Public
Parameters
184M
737 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors737 MB · 99%
From the Hugging Face model README
A fine-tuned DeBERTa model for detecting command injection attacks in prompts before they reach an LLM.
This model is part of PromptWAF — a multi-layered ML-based Web Application Firewall designed to detect and block prompt injection attacks.
The model identifies prompts containing shell command execution patterns (; rm -rf, | cat /etc/passwd, $(whoami), backtick execution, etc.) commonly used in command injection attacks.
0 → Safe/Benign1 → Command Injection Attack# Automatically used in PromptWAF via .env configuration
CMD_INJECTION_MODEL_DIR=edaerer/promptwaf-command-injection
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_id = "edaerer/promptwaf-command-injection"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
text = "List files; rm -rf / --no-preserve-root"
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
probabilities = torch.softmax(outputs.logits, dim=-1)
score = probabilities[0][1].item() # Malicious score
print(f"Command Injection Risk: {score:.2%}")
This model is designed to work seamlessly with:
@software{promptwaf2026,
author = {Erer, Eda and Odabasi, Talha},
title = {PromptWAF: A Multi-Layered ML Defense for LLM Prompt Security},
year = {2026},
url = {https://github.com/edaerer/promptwaf}
}
Apache License 2.0
For more information, visit PromptWAF GitHub Repository