Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Wazuh Vulnerability Explorer

A focused web UI for triaging the vulnerabilities Wazuh finds across your fleet.

Wazuh's own dashboard lists findings one row per (agent, CVE, package). That is the shape of the index, not the shape of the decision — on a 38-agent fleet it meant 20,392 rows collapsing to 4,691 distinct CVEs, with a single CVE occupying 372 of them. This groups to CVE grain and ranks by fleet reach, so a Medium touching 36 hosts is not buried under 798 Criticals that each touch one.

It reads Wazuh's vulnerability index directly and needs no changes to Wazuh itself.

Vulnerability Explorer

Features

  • Grouped by CVE with fleet-reach bars, or a flat per-finding view
  • First seen / Last seen / Age / Status on every CVE
  • Show solved — remediated CVEs reconstructed from tracker history
  • 30-day trend sparkline of open findings
  • Severity cards double as filters, and follow the selected agent
  • Keyset pagination — walks the full result set, not just OpenSearch's first 10,000
  • Authenticated against the Wazuh API; the app stores no credentials
  • Timezone-aware timestamps
  • Light and dark themes, WCAG AA contrast throughout

How it gets its data

Two sources, and the distinction matters:

Source Provides Notes
Wazuh indexer (wazuh-states-vulnerabilities-*) everything currently open current-state: a remediated finding is deleted, not flagged
vuln_tracker.db (SQLite, optional) history — age, status, trend, solved written by a separate daily cron

Because the indexer is current-state, it alone can never tell you what was fixed, when, or how long anything has been open. That history only exists if you run a poller alongside it.

The tracker is entirely optional. Without it the app runs exactly as it did before — it simply omits the Last seen, Age and Status columns, the trend sparkline, and the "Show solved" toggle, rather than rendering them empty.

Requirements

  • Wazuh 4.8+ (tested on 4.14)
  • Python 3.7+ (tested on 3.7.16 — the version Wazuh ships)
  • Read access to the Wazuh indexer and API
  • Wazuh RBAC enabled, so GET /security/users/me/policies reports each user's effective permissions — the app authorises against it (see Security)

Install

1. Create a scoped indexer user

Do not reuse the cluster admin certificate. Create an internal user bound to a role with read on wazuh-states-vulnerabilities-* and nothing else. Verify it is denied on wazuh-alerts-* and on cluster APIs before going further.

2. Lay down the app

sudo useradd --system --no-create-home --shell /usr/sbin/nologin vuln-explorer
sudo mkdir -p /opt/vuln-explorer
sudo git clone https://github.com/TheInfamousToTo/Wazuh-Vulnerability-Explorer.git /opt/vuln-explorer
cd /opt/vuln-explorer

sudo python3 -m venv venv
sudo ./venv/bin/pip install -r requirements.txt

3. TLS

The service is HTTPS-only and will not start without a certificate.

sudo mkdir -p /etc/vuln-explorer/certs
sudo openssl req -x509 -newkey rsa:4096 -nodes -days 3650 \
  -keyout /etc/vuln-explorer/certs/server-key.pem \
  -out    /etc/vuln-explorer/certs/server.pem \
  -subj "/CN=wazuh-server" \
  -addext "subjectAltName=DNS:wazuh-server,DNS:localhost,IP:127.0.0.1"

Add your server's own IP to subjectAltName if you will reach it that way.

4. Configure

sudo cp vuln-explorer.env.example /etc/vuln-explorer/vuln-explorer.env
sudo chown root:vuln-explorer /etc/vuln-explorer/vuln-explorer.env
sudo chmod 640 /etc/vuln-explorer/vuln-explorer.env
sudo -e /etc/vuln-explorer/vuln-explorer.env

Every CHANGEME must be replaced. Generate the session secret with:

openssl rand -hex 32

Changing VE_SESSION_SECRET invalidates all existing sessions, which is the intended way to force everyone to sign in again.

5. Run it

sudo cp vuln-explorer.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now vuln-explorer
sudo systemctl status vuln-explorer

Then browse to https://<your-wazuh-server>:8091 and sign in with a Wazuh account.

Optional: history, age, status and trend

These come from a SQLite database maintained by a separate daily poller that diffs the indexer against its own last snapshot. This repository does not ship that poller; it reads whatever it finds at VE_TRACKER_DB.

The expected schema is one row per (agent, CVE, package):

CREATE TABLE vuln_state (
    doc_id       TEXT PRIMARY KEY,   -- the indexer's _id
    cve          TEXT,
    agent_id     TEXT,
    agent_name   TEXT,
    package_name TEXT,
    pkg_version  TEXT,
    severity     TEXT,
    cvss         REAL,
    status       TEXT DEFAULT 'Open',  -- 'Open' | 'Solved'
    first_seen   REAL,                 -- epoch, when first observed
    last_seen    REAL,                 -- epoch, refreshed each poll while open
    resolved_at  REAL                  -- epoch, set when it disappears
);

Granting read access

This is the step people get wrong. The database usually lives under /var/ossec/etc/lists/, which is not traversable by an unprivileged account, so file permissions alone are not enough:

sudo setfacl -m u:vuln-explorer:x /var/ossec
sudo setfacl -m u:vuln-explorer:x /var/ossec/etc
sudo setfacl -m u:vuln-explorer:x /var/ossec/etc/lists
sudo setfacl -m u:vuln-explorer:r /var/ossec/etc/lists/vuln_tracker.db

sudo -u vuln-explorer test -r /var/ossec/etc/lists/vuln_tracker.db && echo OK

Use ACLs — not usermod -aG wazuh vuln-explorer. Group membership would grant read across every CDB list in that directory, including your malicious-IOC lists, which this app has no business reading. The x grants above are traverse only: the account can reach the file but cannot enumerate either directory.

The app opens the database read-only (file:...?mode=ro) and never writes to it. If it is missing, unreadable or locked, every tracker-derived feature silently disappears and the rest of the app keeps working.

What the columns mean

Column Meaning
Fleet reach how many agents this CVE lands on, drawn to a common scale
First seen earliest evidence from either source (see below)
Last seen most recent detection of this CVE across its instances
Age days since First seen; for solved rows, how long it stayed open
Status Open, or Solved when every tracked instance is remediated

Every sortable column sorts both ways — the first click uses the reading that answers the question the column exists to answer (worst CVSS first, widest reach first, least-recently-confirmed first), and clicking again reverses it. Rows with no value for the sorted column are always appended last in both directions, so an untracked finding never floats to the top of a descending "Last seen" claiming to be the most recent thing you have.

First seen takes the earliest of two values because each understates it alone: the tracker cannot know about anything predating its first run, and the indexer's detected_at is reset whenever vulnerability state documents are rebuilt (agent re-registration, upgrades) — which can make it read later than the tracker's own record of the same CVE.

Last seen deliberately does not use the tracker's last_seen. The poller rewrites that field to the run time on every still-open row, so all of them carry one identical timestamp — useless as a column and impossible to sort by. The poll time is instead shown once, as confirmed present <time> beside the row count.

Notes and limitations

  • "Reopened" is not reported. A poller that clears resolved_at when a finding reappears makes a reopened row indistinguishable from one that was never solved. Showing it would be a guess.

  • History begins at the tracker's first run, not at first detection.

  • Tracker granularity is one poll. Findings detected since the last run have no history and render an explicit —, never a blank and never today's date.

  • The trend is replayed from first_seen/resolved_at rather than stored snapshots. Days before the tracker's baseline are omitted rather than padded with zeroes, which would falsely read as "nothing was open then".

  • "Rescan agents" restarts the selected agents. In Wazuh 4.8+ vulnerability scanning happens manager-side against already-synced inventory, so a restart re-runs syscollector but surfaces new findings only if packages actually changed. Identical results after a restart are expected, not a failure.

    Measured on a Windows agent: the restart command returned in 0.3 s, and syscollector then rewrote netiface at +45 s, processes at +47 s, os at +11 s, ports at +48 s and 47 packages rows at +56 s, growing that inventory from 250 to 290 rows. The agent's vulnerability findings did not change, because none of the new packages matched the feed.

    Note when checking this yourself: scan.time in GET /syscollector/<id>/... is per row, not per scan. Syscollector syncs deltas, so unchanged rows keep their original timestamp — reading one row (?limit=1) will show a weeks-old date on an inventory that just refreshed. Look at the spread of timestamps across all rows instead.

Security

  • Every /api route except login, logout and healthz requires a session
  • Sessions are HMAC-signed cookies — HttpOnly, Secure, SameSite, server-side TTL
  • Login is validated against the Wazuh API; no credential store is added
  • Authorisation is enforced separately from authentication — see below
  • Failed logins are rate limited per source address
  • All configuration comes from the environment; nothing is hardcoded
  • Sort fields are checked against an allowlist before reaching the query DSL
  • Advisory URLs from the vulnerability feed are scheme-checked before becoming links; everything rendered into the page is HTML-escaped
  • Runs as an unprivileged account under a hardened systemd unit
  • Set VE_ALLOW_RESCAN=false to remove the agent-restart capability entirely

Why authorisation needs its own check

Every upstream call this app makes uses the service account in VE_WAZUH_API_USER, not the person signed in. That account usually holds the administrator role, because the Wazuh dashboard's own wazuh-wui account is the obvious thing to reuse — and that role includes agent:uninstall, agent:delete, manager:restart and security:create_user.

So checking only that the Wazuh API accepts someone's password is not enough. It would make this app a confused deputy: any account the API authenticates, including one deliberately created with no permissions, would inherit the service account's authority and could restart your entire fleet.

At login the app therefore reads the signing-in user's own effective policies (GET /security/users/me/policies, called with that user's token) and binds the result into the session:

Capability Wazuh action required
view findings, agents, trend agent:read
"Rescan agents" agent:restart

An account without agent:read is refused a session outright. An account with agent:read but not agent:restart gets the full UI with the rescan control absent, and POST /api/rescan returns 403 even if the request is made directly. The check fails closed — if the policies endpoint is unreachable or returns anything unexpected, no grants are issued and the login is denied.

Grants are captured at login, so a permission change in Wazuh takes effect for that user on their next sign-in (at most VE_SESSION_TTL later). Revoke the session immediately by rotating VE_SESSION_SECRET, which invalidates all of them.

If you want the tighter posture, create a dedicated service account holding only agent:read and agent:restart rather than reusing wazuh-wui.

Known: the pinned dependencies carry open advisories

requirements.txt pins fastapi==0.103.2, uvicorn==0.22.0 and requests==2.31.0, and Dependabot flags moderate advisories against that set. They are pinned there because Python 3.7 is what the Wazuh server ships, and every patched release has dropped 3.7 support — verified on the host:

$ pip download --no-deps requests==2.32.4
ERROR: No matching distribution found for requests==2.32.4

Same for starlette>=0.40, uvicorn>=0.30, h11>=0.16 and urllib3>=2. The pins are honest about what actually runs; loosening them would only make pip install silently resolve back to these versions, which is what the original file did.

The real fix is a Python ≥3.8 interpreter. This app imports only fastapi, uvicorn, requests and the standard library, so if you can put a newer Python on the host, point the venv at it and unpin — nothing here depends on the old versions. Until then, note that both listeners are reachable only from wherever you expose port 8091, and the app's own attack surface is a handful of read-only routes behind a session.

Never commit /etc/vuln-explorer/vuln-explorer.env. Only vuln-explorer.env.example, which contains no real values, belongs in git.

Configuration reference

See vuln-explorer.env.example. Notable settings:

Variable Default Purpose
VE_PORT 8091 listen port
VE_INDEX wazuh-states-vulnerabilities-wazuh-server index to query
VE_TRACKER_DB /var/ossec/etc/lists/vuln_tracker.db history DB (optional)
VE_TZ_OFFSET / VE_TZ_LABEL 3 / +03 timestamp display zone
VE_SITE_LABEL (empty) label on the sign-in card
VE_ALLOW_RESCAN true expose the agent-restart control
VE_SESSION_TTL 28800 session lifetime, seconds

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages