Technical Case Study — Graduation Project 2025

Hybrid Web Application Firewall (Hybrid WAF)

Design and implementation of a multi-layer WAF backed by a large language model arbitration layer.

Executive Summary

Web application attacks (SQL injection, XSS, SSRF) routinely bypass traditional signature-based WAFs, while purely behavioral solutions suffer from high false-positive rates. This project addressed both problems with a hybrid architecture: seven graduated filtering layers that cheaply resolve clear cases, plus an LLM-based arbitration layer that decides only the ambiguous cases.

Project card: Graduation project — B.Sc. Cybersecurity, National University, 2025. Role: architecture, development, testing, documentation. Status: being prepared for public open-source release.

The Problem

  • Static rule-based firewalls fail against obfuscated payloads.
  • Raising rule sensitivity increases false positives.
  • Sending every request to an AI model is prohibitively expensive in latency.

Architecture: Seven Filtering Layers

Layers are ordered by a "cheapest first" principle.

LayerFunctionDecision Mechanism
1 — Protocol validationHTTP structural integrityImmediate rejection of malformed requests
2 — Reputation listsKnown-bad IPs and sourcesPeriodic block/allow lists
3 — Rate limitingFlood and brute-force suppressionRedis with sliding windows
4 — SignaturesSQLi/XSS/SSRF/Path Traversal patternsOptimized regex
5 — Semantic analysisRecursive decoding and normalizationMulti-stage decoding pipeline
6 — Behavioral scoringAggregate risk scoreCumulative points system
7 — AI arbitrationGray-area cases onlyQwen 2.5 / DeepSeek with custom prompt engineering

AI Arbitration Layer

  • Invoked only when the first six layers cannot reach a confident decision.
  • Strict prompt engineering forces structured output (allow/block/confidence/attack classification).
  • Dual-model cross-check on critical cases.
  • Decisions are logged for review and for improving static rules.

Technical Stack

PythonFastAPIRedisSQLiteDockerBash
  • FastAPI: Async processing as a reverse-proxy middleware.
  • Redis: Rate-limit counters and session memory.
  • SQLite: Event and decision log.
  • Docker: Reproducible packaging.
  • Bash: Operations and health-check scripts.

Testing Methodology

  • Tested with payloads across OWASP Top 10 categories (obfuscated SQLi, XSS, SSRF).
  • Measured false positives before and after enabling the arbitration layer.
  • Measured latency impact and the share of requests that reach the AI layer.

Detailed metrics will be published alongside the source code when the project is released publicly.

Lessons Learned

  • "Cheapest first" reconciles accuracy with performance.
  • Forcing models to emit structured output is a prerequisite for security automation.
  • Logging arbitration decisions feeds back into improving static rules.

Related