Inspiration

As a 3rd-semester cybersecurity student with a strong passion for red teaming and offensive security, I quickly ran into a practical barrier while practicing automated web reconnaissance. Industry-standard platforms like Burp Suite lock their automated scanners behind costly commercial licenses, while heavyweight open-source alternatives can feel like opaque black boxes.

During offensive security labs, I noticed three recurring bottlenecks in existing lightweight scanners:

  • Modern Attack Surfaces: Traditional HTTP crawlers cannot see client-side routes or background API calls generated by JavaScript in Single-Page Applications (SPAs).
  • Stealth and Scope Discipline: In real bug-bounty and red-team engagements, operators target a strict list of endpoints. Running an aggressive crawler wastes bandwidth and alerts Web Application Firewalls (WAFs).
  • Noisy Alerts: Network latency spikes often trigger false positives during time-based blind SQL injection checks.

I wanted to build a compact, completely inspectable, MIT-licensed offensive tool from scratch that solves these exact problems—giving students and independent testers full visibility into how modern DAST engines work under the hood.


How I Built It

I engineered Web Vulnerability Scanner v3.1V in Python 3.10+ using a decoupled five-tier asynchronous architecture:

  1. Layer 1 — Hybrid Async Orchestrator (scanner.py): Powered by asyncio with bounded worker concurrency (-c 15). Its core feature is the Hybrid Execution Switch, letting the operator toggle between --mode auto (autonomous discovery) and --mode manual (direct endpoint ingestion to bypass the crawler and minimize WAF exposure).
  2. Layer 2A — Session & State Controller (session.py): Built on an httpx.AsyncClient using HTTP/2 multiplexing (20 keep-alive / 50 max connections) to eliminate repeated TCP/TLS handshakes. I wrote custom session-healing middleware that intercepts 401 or logout responses, acquires an asyncio.Lock so only one worker re-authenticates, refreshes session cookies, and replays the interrupted request. A strict same-origin guard keeps all traffic inside the authorized scope.
  3. Layer 2B — Route Mapping & SPA Core (spa_crawler.py, crawler.py): In --mode auto, a pool of reusable headless Playwright browser contexts injects stealth JavaScript listeners to trigger DOM events (onClick, router links) and intercept background XHR/Fetch API calls, falling back to an async BFS crawler for non-SPA sites.
  4. Layer 3 — Context-Aware Auditing & YAML Engine: Passive fingerprinting inspects Server, X-Powered-By, and cookie signatures to prune irrelevant payloads (e.g., skipping relational SQLi on static or NoSQL stacks). Eight audit engines run concurrently—covering Error-Based SQLi, Adaptive Blind SQLi, Reflected/Stored XSS, CSRF, Open Redirects, Security Headers, and a declarative YAML template engine for checks like exposed /.env files.
  5. Layer 4 — Reporting Engine (reporter.py): Serializes every confirmed vulnerability into a strongly typed Finding dataclass mapped to CWE and OWASP Top 10:2021 categories, generating an executive Markdown report with an aggregate exposure score.

Challenges I Faced

  • Filtering Network Jitter in Blind SQLi: A single slow HTTP response can easily be caused by network jitter rather than a database SLEEP() payload. To solve this, I designed a two-phase latency validation model. After measuring a baseline response time \(T_0\), the scanner sends a \(1.5\text{ s}\) probe (\(t_1\)) and only escalates to a \(4.5\text{ s}\) confirmation probe (\(t_2\)) if the first delay clears the threshold:

$$ \Delta_1 = t_1 - T_0 \ge 1.5\text{ s} \quad \text{and} \quad \Delta_2 = t_2 - T_0 \ge 4.5\text{ s} $$

On my simulated banking lab (\(T_0 = 0.11\text{ s}\)), Phase 1 returned in \(1.62\text{ s}\) (\(\Delta_1 = 1.51\text{ s}\)) and Phase 2 scaled cleanly to \(4.68\text{ s}\) (\(\Delta_2 = 4.57\text{ s}\)), confirming a true database delay rather than random lag.

  • Race Conditions on Session Expiry: Under high concurrency (\(15\) parallel workers), an expired session cookie caused all active workers to fail at once and flood the login endpoint. Placing an asyncio.Lock inside the HTTP middleware ensured thread-safe, single-worker re-authentication without dropping in-flight audit tasks.
  • Fixing Vulnerability Taxonomy: My first prototype forced a CVE-YYYY-NNNNN tag onto every finding. I realized this was inaccurate because CVEs identify specific flaws in versioned software products, whereas custom web app bugs are generic weakness classes. Refactoring the schema to enforce a CWE-first policy (such as CWE-89 for SQLi and CWE-79 for XSS) aligned the reports with industry standards.

What I Learned

  • Asynchronous Concurrency & HTTP/2 Mechanics: Moving from sequential scripts to asyncio event loops, semaphores, and HTTP/2 connection pooling showed me how modern offensive tools maximize speed—achieving \(22.4\text{ requests/second}\) and finishing an authenticated scan in \(8.12\text{ seconds}\).
  • Balancing Precision and Recall: Benchmarking across \(25\) planted vulnerabilities yielded \(88.5\%\) precision and \(92.0\%\) recall:

$$ \text{Precision} = \frac{\text{TP}}{\text{TP} + \text{FP}} = 88.5\%, \qquad \text{Recall} = \frac{\text{TP}}{\text{Planted}} = 92.0\% $$

Seeing how strict two-phase gating eliminated false positives while occasionally missing subtle edge cases taught me how to tune offensive detection heuristics.

  • Disciplined Red-Team Engineering: Building features like the same-origin guard and isolated local testbeds ("Altoro Financial Lab") reinforced that strict scope control and ethical boundaries are just as vital in offensive security engineering as payload crafting.

Built With

  • asyncio
  • beautifulsoup4
  • cli
  • csrf
  • cve
  • cwe
  • cybersecurity
  • dast
  • flask
  • http2
  • httpx
  • markdown
  • offensive-security
  • owasp
  • penetration-testing
  • playwright
  • python
  • pyyaml
  • red-teaming
  • sql-injection
  • sqlite
  • web-security
  • xss
  • yaml
Share this project:

Updates

Submission history