Downloads · 30 days
0
netgoat-ai/koda-waf
koda-waf is a machine learning model from netgoat-ai. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Koda-WAF is a high-performance machine learning Web Application Firewall (WAF) model. It is designed to classify HTTP requests as Benign (0) or Malicious (1) with a specific focus on reducing false positives in modern…
Downloads · 30 days
0
Access
Public
Updated Apr 7, 2026
Repo size
486 KB
Likes
3
Public
Click a slice to open those files.
.pkl486 KB · 99%
From the Hugging Face model README
Koda-WAF is a high-performance machine learning Web Application Firewall (WAF) model. It is designed to classify HTTP requests as Benign (0) or Malicious (1) with a specific focus on reducing false positives in modern, complex web traffic (JSON, long User Agents, and nested query parameters).
Koda-WAF uses XGBoost (Gradient Boosted Decision Trees) to analyze the "intent" of a request rather than just its "structure." Unlike traditional regex-based WAFs that struggle with complex strings, Koda-WAF uses 18+ engineered features to identify patterns associated with:
0.90 (High confidence required)
0.75 (Early warning)The model was trained on a balanced mixture of:
Koda-WAF requires specific feature extraction before inference. You must use the matching extract_smart_features logic (including math.log1p scaling and length capping) to get accurate predictions.
import joblib
import pandas as pd
# Load model and feature metadata
model = joblib.load("smart_waf_model.pkl")
cols = joblib.load("model_features.pkl")
# Process your request dictionary through the feature extractor
# (Ensure your extractor matches the training logic)
features = extract_smart_features(request_data)
df = pd.DataFrame([features]).reindex(columns=cols, fill_value=0)
# Prediction
probability = model.predict_proba(df)[0][1]
if probability > 0.90:
print("🔥 Attack Detected!")
| Test Case | Threat Probability | Decision |
|---|---|---|
| Standard SQLi | 99.9% | Block |
| Path Traversal | 90.2% | Block |
| Chrome User Agent | 89.6% | Allow |
| Complex Safe URL | 0.08% | Allow |
Koda-WAF is a stateless model. It cannot detect multi-step attacks (brute force) or volumetric DDoS. It should be used as part of a Defense in Depth strategy.