A complete hands-on lab for learning SQL injection exploitation, Kubernetes observability, and detection-as-code.
This repository accompanies a three-part blog series that starts with a vulnerable PHP/MySQL lab, moves the attack surface into Kubernetes with OWASP Juice Shop, and finishes with portable Sigma rules that can compile into Loki, Elasticsearch, and Splunk queries.
By the end of this lab, you'll have:
- A vulnerable PHP/MySQL application for testing SQL injection techniques
- OWASP Juice Shop running on Minikube as a realistic target application
- Falco collecting syscall-level container activity
- Zeek parsing HTTP traffic and detecting SQL injection payloads
- Fluent Bit forwarding telemetry into Loki
- Grafana dashboards and queries for investigation
- Sigma detection rules that convert into backend-specific queries
- Regression payloads for validating malicious and benign traffic
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Juice Shop │ │ Zeek │ │ Falco │
│ (Target App) │────│ (Network Mon.) │ │ (Syscall Mon.) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────┐
│ Fluent Bit │
│ (Log Collector) │
└─────────────────┘
│
┌─────────────────┐
│ Loki │
│ (Log Storage) │
└─────────────────┘
│
┌─────────────────┐
│ Grafana │
│ (Visualization) │
└─────────────────┘
- Docker
- Minikube or another Kubernetes cluster
- kubectl
- Helm 3.x
- curl
- Python 3.8+ with pip
Read the full series first if you want the concepts, methodology, and reasoning behind the lab.
-
Time, Errors, and Unions: Practical SQL Injection Exploitation and Detection: Build a controlled PHP/MySQL SQL injection lab and test authentication bypass, UNION-based extraction, error-based leaks, boolean-based inference, and time-based blind enumeration.
-
Building a Detection-Ready SOC Lab on Kubernetes: Deploy OWASP Juice Shop on Minikube and build an observable detection pipeline using Falco, Zeek, Fluent Bit, Loki, and Grafana.
-
SQL Injection Detection with Sigma on Kubernetes: Convert lab-tested detection logic into portable Sigma rules and compile them into Loki, Elasticsearch, and Splunk queries.
- Authentication bypass with
OR 1=1tautologies - UNION-based injection for extracting data across tables
- Error-based injection using MySQL error output
- Boolean blind injection through true/false response behavior
- Time-based blind injection using delayed database responses
- URL-encoded payload variants
- Comment-based obfuscation with
--,#, and inline SQL comments
- Network-level detection with Zeek HTTP parsing
- Runtime detection with Falco syscall monitoring
- Centralized log collection with Fluent Bit
- Log storage and investigation with Loki and Grafana
- Sigma rules for backend-independent detection logic
- Query generation for Loki, Elasticsearch, and Splunk
- Regression testing with known malicious and benign payloads
- MITRE ATT&CK mapping for analyst context
juice-shop.yaml- Kubernetes manifest for OWASP Juice Shopzeek-daemonset.yaml- Zeek deployment for network inspectiondetect-sqli.zeek- Zeek script for SQL injection detectionfalco-values.yaml- Falco Helm values for syscall monitoringfluent-bit.yaml- Fluent Bit configuration for log forwardingparsers-conf- Parser configuration for Zeek log formatssigma-sqli-detection-pipeline.yaml- Sigma rule for SQL injection detectionrequirements.txt- Python dependencies for Sigma toolingtests/- Test assets and validation helperssqli.pcap- Sample packet capture for traffic analysis
Clone the repository:
git clone https://github.com/topcug/kubernetes-sigma-soc-detection-lab.git
cd kubernetes-sigma-soc-detection-labStart Minikube:
minikube startDeploy Juice Shop:
kubectl apply -f juice-shop.yaml
kubectl get pods,svcDeploy Zeek:
kubectl create configmap zeek-scripts --from-file=detect-sqli.zeek
kubectl apply -f zeek-daemonset.yamlInstall Falco:
helm repo add falcosecurity https://falcosecurity.github.io/charts
helm repo update
helm install falco falcosecurity/falco --values falco-values.yamlInstall Fluent Bit and Loki/Grafana following the walkthrough in Part 2.
Send a basic tautology payload to Juice Shop:
curl "http://$(minikube ip):30602/rest/products/search?q=test%27%20OR%201=1--"Query Zeek detections in Grafana through Loki:
{job="default/zeek"} |~ "DETECTED SQLi"
Or use the broader Sigma-generated LogQL pattern from Part 3 to detect raw, encoded, UNION-based, and comment-obfuscated variants.
Install the required Sigma tooling:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtConvert the Sigma rule to Loki:
sigma convert -t loki sigma-sqli-detection-pipeline.yamlConvert to Elasticsearch/Lucene with an ECS Zeek pipeline:
pip install pysigma-backend-elasticsearch
sigma list pipelines lucene
sigma convert -t lucene -p ecs_zeek_beats sigma-sqli-detection-pipeline.yamlThe goal is to keep one detection rule as the source of truth and generate backend-specific queries from it.
Use malicious and benign payload sets to validate the rule before trusting it.
- Malicious payloads should trigger detections.
- Benign search terms should stay silent.
- False positives should be fixed in the Sigma YAML, then recompiled.
- Every rule change should be reviewed, versioned, and tested like code.
This gives you a repeatable detection-as-code workflow instead of one-off dashboard queries.
These posts are not part of the SQL injection series, but they explain Kubernetes networking concepts that help when reasoning about pod traffic and packet visibility.
- Pod Birth: veth Pairs, IPAM, and Container Networking
- Inside Pod-to-Pod Networking: Intra-Node Traffic in Kindnet
- Atomic ConfigMap Updates in Kubernetes
- Canary Deployments Made Easy: A CI/CD Journey with GitHub Actions and Argo CD Rollouts
- Zeek detects SQL injection patterns in HTTP URI and body data.
- Falco captures suspicious runtime activity inside containers.
- Fluent Bit normalizes and forwards logs.
- Loki stores logs for fast investigation.
- Grafana provides analyst-facing queries and dashboards.
- Sigma keeps detection logic portable across platforms.
Found an issue, false positive, broken deployment step, or additional attack vector? Open an issue or submit a pull request.
This lab is designed as a practical training resource for SQL injection detection, Kubernetes telemetry, and detection-as-code workflows.
MIT License. Use this lab for training, research, writing detection rules, or building your own Kubernetes security lab.

