website-vulnerability-scanner 0.2.1

Cross-platform defensive website security & configuration scanner with GUI and CLI reports.
Documentation
# Website Vulnerability Scanner (`web-vuln-scanner`)

[![Build Cross-Platform Binaries](https://github.com/websecaudit/website-vulnerability-scanner/actions/workflows/build-binaries.yml/badge.svg)](https://github.com/websecaudit/website-vulnerability-scanner/actions/workflows/build-binaries.yml)
[![Crates.io](https://img.shields.io/crates/v/website-vulnerability-scanner)](https://crates.io/crates/website-vulnerability-scanner)
[![GitHub Release](https://img.shields.io/github/v/release/websecaudit/website-vulnerability-scanner)](https://github.com/websecaudit/website-vulnerability-scanner/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

![Website Vulnerability Scanner Banner](assets/social-preview.png)

**Website Vulnerability Scanner** (`web-vuln-scanner`) is a fast, free, open-source **site vulnerability scanner** and **API security audit** CLI/GUI tool written in Rust. It performs non-destructive external security configuration checks, OpenAPI specification audits, secret leak detection, and server hardening generation mapped to **OWASP ASVS**, **OWASP WSTG**, and the **OWASP Secure Headers Project**.

Built on pure-Rust `rustls` (no OpenSSL dependency), it runs natively on **macOS, Linux, and Windows**, with both a native desktop GUI (`eframe`/`egui`) and a minimal headless binary (`--no-default-features`) for CI/CD pipelines.

[Quick Start](#quick-start) · [Screenshots](#screenshots) · [Checks Covered](#checks-covered) · [CI/CD & SARIF](#cicd-gate--sarif-github-actions) · [Comparison](#comparison-when-to-use-what) · [FAQ](#faq)

> **Authorized Use Only:** Designed for auditing your own websites, APIs, and staging environments (or targets with explicit owner permission). All checks are non-destructive configuration and hygiene audits—no active SQLi/XSS/RCE exploit payloads are sent.

---

## Quick Start

### 1. Package Managers & Container

```bash
# macOS & Linux (Homebrew)
brew install websecaudit/tap/web-vuln-scanner

# Windows (Scoop)
scoop bucket add websecaudit https://github.com/websecaudit/scoop-bucket
scoop install web-vuln-scanner

# Cargo (crates.io — add --no-default-features for headless CI)
cargo install website-vulnerability-scanner

# Docker (GitHub Container Registry)
docker run --rm ghcr.io/websecaudit/website-vulnerability-scanner https://example.com
```

### 2. Prebuilt Binaries (macOS / Linux / Windows)

Download the latest archive from [GitHub Releases](https://github.com/websecaudit/website-vulnerability-scanner/releases):

- **macOS (Apple Silicon + Intel Universal):** `web-vuln-scanner-macos-universal.tar.gz`
- **Linux x64:** `web-vuln-scanner-linux-x64.tar.gz`
- **Windows x64:** `web-vuln-scanner-windows-x64.zip`

```bash
# Scan a website in the terminal
./web-vuln-scanner https://example.com

# Launch the native desktop GUI
./web-vuln-scanner --gui https://example.com
```

### 3. Build from Source (Rust)

```bash
git clone https://github.com/websecaudit/website-vulnerability-scanner.git
cd website-vulnerability-scanner

# Full build (GUI + CLI)
cargo build --release

# Minimal headless CLI/CI build (excludes GUI dependencies)
cargo build --release --no-default-features
```

---

## Common CLI Workflows

```bash
# 1. Full site audit with HTML, Markdown, JSON, and SARIF 2.1.0 reports
web-vuln-scanner https://my-site.example \
  --html report.html --md report.md --json report.json --sarif results.sarif

# 2. Audit an API using its OpenAPI 3.x / Swagger 2.0 spec + bearer token
web-vuln-scanner https://api.my-site.example --profile api \
  --openapi openapi.json -H "Authorization: Bearer $API_TOKEN" \
  --fix-config nginx

# 3. Authenticated scan across same-origin pages (credentials redacted from reports)
web-vuln-scanner https://my-site.example -H "Cookie: session=$SESSION_COOKIE"

# 4. Run custom passive rules & custom client-library advisory packs
web-vuln-scanner https://my-site.example --rules rules.example.json

# 5. Track project history, triage status, and audience-tailored reports
web-vuln-scanner https://my-site.example \
  --project my-site --save-run --view executive --max-requests 120

# 6. Regression gate against a pinned baseline JSON report (exits 2 on new/worsened findings)
web-vuln-scanner https://my-site.example --baseline prev.json --fail-on-regression
```

### Example Terminal Output & Generated Hardening Snippet

```text
Security Audit Report: https://example.com/  [Web Site | Developer]
Score: 68/100 (C)  |  HTTP: 200  |  Pages: 5  |  Coverage: 100%  |  Duration: 412 ms
Auth context: anonymous  |  Run status: completed

[HIGH] Strict-Transport-Security (HSTS) header missing (HDR-HSTS-MISSING)
  Category: Security Headers  |  Confidence: high  |  Reference: OWASP ASVS V9.2.1
  Remediation: Add Strict-Transport-Security: max-age=31536000; includeSubDomains

Generated fix configuration (Nginx):
  add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  add_header Content-Security-Policy "default-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'" always;
  location ~ /\. { deny all; return 404; }
```

---

## Screenshots

### Terminal Audit & Auto-Generated Hardening Snippet
![CLI Security Audit Output](assets/cli-terminal-preview.png)

### Standalone HTML Report (Filterable by Severity)
![Standalone HTML Report](assets/html-report-preview.png)

---

## Checks Covered

| Domain | What Is Audited | Standards / Output |
|---|---|---|
| **TLS & HTTPS** | HTTPS enforcement, `http://` → `https://` redirect, certificate trust chain, SAN match, expiry warnings (`<= 30 / 14 days`), legacy **TLS 1.0 / 1.1** handshake probe | OWASP ASVS V9.1 / V9.2, WSTG-CRYP |
| **Security Headers** | `HSTS`, `CSP` (`unsafe-inline`, `unsafe-eval`, `*`, `http:`, `object-src`, `base-uri`), `X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy`, `Permissions-Policy`, `COOP`, `CORP` | OWASP Secure Headers Project |
| **OpenAPI & API Access** | OpenAPI 3.x / Swagger 2.0 spec audit (`http://` servers, query API keys, unprotected mutating specs), automatic `GET` endpoint probing, anonymous access checks on secured routes (`AUTH-MISSING-ENFORCEMENT`), parity checks | OWASP API2:2023, ASVS V4.1 |
| **Secrets, Stack Traces & JWT** | Redacted detection of leaked AWS/GitHub/Stripe/Slack keys, PEM private keys, DB URIs with passwords, runtime stack traces, internal proxy headers, and JWT (`alg: none`, missing `exp`) | OWASP ASVS V2.10 / V7.4 / V3.5 |
| **JS Bundles & HTML** | Same-origin `<script>` bundle inspection, SPA/API route discovery (`/api/...`), exposed `.js.map` source maps, mixed content, missing SRI, unsafe `target="_blank"`, HTTP password forms, CSRF-field heuristic | OWASP ASVS V14.2, WSTG-CLNT |
| **Outdated JS Advisories** | Built-in + extensible `--advisories` JSON database matching script URLs and bundle banners (`jQuery`, `Lodash`, `Bootstrap`, `AngularJS`, `Vue 2`, `Moment`, `Handlebars`, `DOMPurify`, `Axios`, `Marked`, `Underscore`) | CVE / GHSA / ASVS V14.2.1 |
| **Cookies & CORS** | Missing `Secure`, `HttpOnly`, `SameSite` flags; wildcard+credentials and arbitrary `Origin` reflection checks | OWASP ASVS V3.4 / V14.5 |
| **Exposed Files & Directories** | Signature-verified checks for `/.git/HEAD`, `/.git/config`, `/.svn/*`, `/.hg/*`, `/.env*`, `/.DS_Store`, `docker-compose.yml`, `package.json`, `composer.json`, `phpinfo.php`, `server-status`, `swagger-ui`, directory listings, `security.txt` (filters SPA 200 fallbacks) | OWASP WSTG-CONF-05 / INFO-05 |
| **DNS & Email Hygiene** | `CAA` (RFC 8659), `SPF` (RFC 7208), `DMARC` (`_dmarc.<domain>`, RFC 7489); cleanly marks timeouts as `inconclusive` instead of false passes | RFC 8659 / 7208 / 7489 |
| **HTTP Protocol & Caching** | `OPTIONS` (`Allow`), `HTTP TRACE` (`WSTG-CONF-06`), `Cache-Control: no-store` on login forms, cookies, and APIs | OWASP WSTG-CONF-06 / ATHN-06 |

---

## CI/CD Gate & SARIF (GitHub Actions)

Run headless security configuration audits on staging or production deployments and upload findings directly to the **GitHub Security** tab via **SARIF 2.1.0**:

```yaml
name: Security Hygiene Audit
on:
  schedule:
    - cron: "0 6 * * 1"
  workflow_dispatch:

jobs:
  web-audit:
    runs-on: ubuntu-latest
    permissions:
      security-events: write
      contents: read
    steps:
      - uses: actions/checkout@v4

      - name: Run website & API audit
        uses: websecaudit/website-vulnerability-scanner@v0.2.1
        with:
          target: https://example.com
          openapi: openapi.json
          rules: rules.example.json
          sarif: web-audit.sarif
          fail-on: high

      - name: Upload SARIF to GitHub Code Scanning
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: web-audit.sarif
```

---

## Comparison: When to Use What

| Capability | `web-vuln-scanner` | Active DAST (OWASP ZAP / Nuclei) | SAST (Semgrep / CodeQL) |
|---|---|---|---|
| **HTTP headers, TLS 1.0–1.3, DNS, cookies, CORS** | Built-in + auto-generates Nginx/Caddy/Apache fixes | Partial (no server fix snippets) | No |
| **Safe on production without DB corruption** | Yes (read-only/non-destructive + request budget) | Risky without staging isolation | Yes (code only) |
| **OpenAPI spec + missing auth check** | Yes (`--openapi`) | Yes (with setup) | Limited |
| **JS bundle routes, `.js.map` & redacted secrets** | Yes | Partial | Code-only secrets |
| **Baseline diff distinguishing `unverified` checks** | Yes (`CheckOutcome` coverage tracking) | Limited | PR-level |
| **Active SQLi / XSS / SSRF / RCE payloads** | **No** (intentionally excluded) | **Yes** | Code taint analysis |
| **Deterministic per-finding SARIF fingerprints** | Yes | Varies | Yes |

For full AppSec coverage, pair **`web-vuln-scanner`** (external perimeter, headers, TLS, OpenAPI, secrets) with **SAST** (`Semgrep`/`CodeQL`) in Git and isolated staging **DAST** tests.

---

## FAQ

<details>
<summary><strong>Does it run active XSS, SQLi, or SSRF exploits?</strong></summary>

No. `web-vuln-scanner` is strictly a defensive configuration, metadata, OpenAPI, and leak-detection scanner. It avoids destructive payloads so it can safely audit staging and production sites under strict scope (`scheme + host + port`) and request budgets (`--max-requests`).
</details>

<details>
<summary><strong>Why use a local CLI/GUI tool instead of an online website vulnerability scanner?</strong></summary>

Running locally means you never upload internal cookies, Bearer tokens (`-H "Authorization: ..."`), private OpenAPI specs, or internal staging URLs to a third-party cloud service. `SecretRedactor` also strips tokens from saved JSON, HTML, Markdown, and SARIF exports.
</details>

<details>
<summary><strong>How does it avoid false positives on SPA "200 OK" fallback routes?</strong></summary>

Single-Page Applications often return `HTTP 200` with `index.html` for unknown paths like `/.env` or `/.git/HEAD`. The exposure engine verifies actual file signatures (e.g., `ref: refs/`, `[core]`, key=value lines, JSON package manifests) and rejects HTML/SPA shells before reporting a finding.
</details>

<details>
<summary><strong>Can I scan behind authentication and compare runs over time?</strong></summary>

Yes. Pass `-H "Cookie: ..."` or `-H "Authorization: Bearer ..."` (sent strictly to the target origin, stripped on cross-origin/CORS/exposure checks). Save runs with `--project my-app --save-run` or compare against any prior JSON report with `--baseline prev.json --fail-on-regression`. Incomplete/cancelled checks are tracked via `CheckOutcome` so unrun categories are marked **unverified** rather than falsely marked **resolved**.
</details>

<details>
<summary><strong>Can I load custom rules and advisories without recompiling?</strong></summary>

Yes. Use `--rules rules.example.json` to load custom passive rule packs (validated before any network traffic) and `--advisories advisories.json` to extend the vulnerable client-library database.
</details>

---

## Packaging & Development

- **macOS `.app` bundle:** `./scripts/build_macos_app.sh` creates `dist/WebVulnerabilityScanner.app`.
- **macOS Universal binary (Apple Silicon + Intel):**
  ```bash
  rustup target add aarch64-apple-darwin x86_64-apple-darwin
  cargo build --release --target aarch64-apple-darwin
  cargo build --release --target x86_64-apple-darwin
  mkdir -p dist
  lipo -create -output dist/web-vuln-scanner \
    target/aarch64-apple-darwin/release/web-vuln-scanner \
    target/x86_64-apple-darwin/release/web-vuln-scanner
  ```
- **Run formatting, linter, headless check & full test suite:**
  ```bash
  cargo fmt --check
  cargo clippy --all-targets -- -D warnings
  cargo check --no-default-features --locked
  cargo test --no-default-features
  cargo test --locked
  ```

---

## License

Released under the [MIT License](LICENSE).