Riyan Firmansyah Research & Publications

_

← Back to Projects

vulnsuite

Reproducible vulnerable and patched targets, built from templates and verified before you scan them

project Go MIT license

vulnsuite builds vulnerable systems on purpose. Point it at a template and it builds a reproducible Docker image of a vulnerable system and of its patched twin, runs it in a known state, and proves that state with an independent verify probe. The scanner is not part of it. You bring your own.

vulnsuite update-templates
vulnsuite run -t apache-httpd-2.4.49-cve-2021-41773 -expose host
#   verify: ok -- confirmed vulnerable
#   Scan these with your probe:
#     apache-httpd-2.4.49-cve-2021-41773 [vulnerable]   http://127.0.0.1:49152

Here is a short demo of it in action:

In the demo I use Nuclei from ProjectDiscovery as the scanner to verify each condition: it should fire on the vulnerable target and stay quiet on the patched one.

The problem

Checking whether a vulnerability is really there means switching conditions one at a time. Find the affected version, stand it up, turn on the setting that makes it exploitable, confirm the flaw, then fix it and confirm the flaw is gone. Doing that by hand for one finding is tedious. Doing it for every detection rule a scanner ships is frustrating, and it does not scale past a handful of CVEs.

So I went looking for a tool that already did this, and did not find one that matched the use case.

Then I remembered two ideas that already solve neighbouring problems.

vulnsuite is what you get when you put the two together: a nuclei-style template that describes how to deploy a vulnerability instead of how to detect it, built the way Nix would build it.

How it works

A target is one folder with a contract.yaml. The base is pinned, and each state is reached from it by a config overlay or a patch.

apiVersion: vulnsuite/v1
kind: Target
metadata:
  id: apache-httpd-2.4.49-cve-2021-41773
  summary: Apache httpd 2.4.49 path traversal via an aliased directory.
  vuln_refs: [CVE-2021-41773]
  severity: high
base:
  kind: image
  image: httpd:2.4.49
  digest: sha256:...          # pinned, so it builds the same anywhere
states:
  vulnerable:
    overlay: [ { src: files/vuln/httpd.conf, dest: /usr/local/apache2/conf/httpd.conf } ]
    verify:  [ { http: { raw_path: "/icons/.%2e/%2e%2e/etc/passwd", status: 200, body_matches: "root:.*:0:0:" } } ]
  patched:
    overlay: [ { src: files/fixed/httpd.conf, dest: /usr/local/apache2/conf/httpd.conf } ]
    verify:  [ { http: { raw_path: "/icons/.%2e/%2e%2e/etc/passwd", status_in: [403, 404] } } ]

What it is for

For every detection rule your scanner ships, bring up the matching target vulnerable and expect a hit, then bring it up patched and expect silence. A rule that fires on patched is a false positive caught before a customer sees it. One that stays silent on vulnerable is a false negative.

vulnsuite run vulnerable -t grafana -detach  # scanner should fire
vulnsuite run patched -t grafana -detach     # scanner should stay quiet
vulnsuite targets                            # both URLs, one per state
vulnsuite stop

Both states run simultaneously, so there is no tearing down and rebuilding between the two checks: the scanner sees the vulnerable and the patched system in the same pass.

What it supports today

As of v0.3.0. Listed by what you might need it for, in case one of these matches your own use case.

If you need tovulnsuite gives you
Reproduce a flaw that is only a version differenceimage targets: the vulnerable and the patched release as two pinned image tags
Reproduce a flaw that is a configuration mistakeoverlay targets: one image, with the vulnerable or the fixed config baked in
Reproduce an unreleased or release-candidate revisionsource targets: a repository at a pinned commit, with an optional patch
Reproduce something with no public image, such as a device or a simulationbuild targets: a Dockerfile and its sources inside the template
Test against a stack, not a single containerSidecars (a database, a cache, a second node) on a private network per target
Scan from a containerinternal mode: targets join a Docker network and nothing is published on the host
Scan from your host or another machinehost mode: ports published on localhost by default, or on an address you choose
Make a target look like a separate device on the LANmacvlan mode: the target gets its own IP address
Stand up a whole set at onceFilters (class, tag, category, CVE, year, CISA KEV, real or simulated), named suites and selector files
Cover several ways to trigger the same flawVariant groups: a primary reproduction plus variants such as a WAF-evasion form
Drive it from CI-json output, a -summary document with stable reason codes, and meaningful exit codes
Build once and reuse everywherebuild -push to any registry; a pushed image runs with plain docker run, no vulnsuite needed
Check a template before sharing itvulnsuite validate, plus a JSON schema for editors and CI
Use it from your own Go codeImportable packages for loading, building, running and probing

It works with any runtime that exposes a Docker-compatible socket, including Docker Engine, Docker Desktop, OrbStack, Colima and Podman.

Install

go install github.com/ruzfi/vulnsuite/cmd/vulnsuite@latest

Release binaries are on GitHub Releases. It needs a reachable Docker daemon.

The full command reference and the contract format are in the README and docs/CONTRACT.md.

How it was built

vulnsuite was designed and written with the help of AI, as a deliberate experiment in collaborative intelligence. It helped me a lot, and I do not think I would have got this far this quickly on my own.

The split was clear from the start:

The same collaboration is meant to work for contributors. Hand an assistant a CVE or a scanner’s detection rule together with the authoring guide, and it can draft a validated target for you to review. I think that is how a catalog of thousands of reproducible targets actually gets built.

Templates

Community templates live in ruzfi/vulnsuite-templates, covering web applications, network services, databases and web servers.

For now I prioritize templates for the vulnerabilities I need to validate in my own work. That includes the recent ones that went viral:

vulnsuite run -t php2shell             # the primary reproduction
vulnsuite run -t sshole -variants      # every affected OpenSSH version

vulnsuite was started before these vulnerabilities appeared, so the timing was luck, but it is exactly the situation the tool was made for: a new flaw lands, and I need a vulnerable and a patched system I can trust, quickly. My hope is that vulnsuite keeps making that easy: building the vulnerable and the patched condition with the help of AI and of proofs of concept curated by security researchers. Thank you to everyone who publishes that work.

The templates also cover the applications and vulnerabilities listed in the CISA Known Exploited Vulnerabilities catalog, and will be kept up to date as the catalog is updated. Right now that work is at the stage of filling in the list, so coverage is still partial. vulnsuite list -kev shows which templates already match a catalog entry.

The repository carries an authoring guide, SKILL.md, the one mentioned above, for writing a new target by hand or with an assistant.

What’s next

So far vulnsuite answers the scanner’s question: is the flaw there or not. The next thing I want to experiment with is the defender’s question: when someone exploits it, does anything notice?

The idea is to put an open source network sensor such as Suricata or Snort in front of the targets and watch the traffic while they are attacked. Because the target is verified, an exploit that lands is a known true attack, so a sensor that stays quiet is a real detection gap and not a guess.

That turns the same templates into a purple team lab:

This is an experiment I want to run with vulnsuite, not something to build into it. vulnsuite stays the part that provides the targets; the sensor and the attack sit around it.

Supporting this work

vulnsuite is free and MIT licensed, and I build it in my own time. If it saves you or your team work, you can support it through GitHub Sponsors. That is open to individuals, organizations and companies, as a monthly or a one-time contribution.

Money is not the only way to help:

Comments