TL;DR
- A vulnerability scanner's check code already knows, byte for byte, what an exploitation attempt looks like on the wire. In most tools that information sits unused inside the scanner's own source.
- detection-gen reads that metadata directly from icsScanner and generates Sigma, Splunk ESCU, Suricata, and Zeek templates from it: a narrow variant matching the exact probe, and a broad variant matching the underlying vulnerability class.
- Every renderer I worked on looked correct and was wrong in a way only the real tooling caught. Valid YAML is not a working detection.
- What comes out is a validated starting point, not a finished detection, and the post is explicit about where that boundary sits.
What is detection-gen?
detection-gen is a generator that converts an ICS vulnerability scanner's check metadata into deployable network and log detection content. It reads a detection_hints field stored inside icsScanner's own check files (transport, application protocol, MITRE ATT&CK technique, a Splunk analytic story, and two pattern sets) and emits Sigma rules, Zeek rules, Splunk Enterprise Security Content Update detections, and Suricata rules from the same source. Its output is validated against pySigma, idstools, contentctl, and a real Zeek instance rather than against a schema document.
How I Got Involved
I work in security operations, so I usually meet a security problem when an alert appears. I look at the logs or network traffic available to me, try to work out what happened, and decide what needs investigating.
The icsScanner project let me approach that process from the other side. We had information about the checks we were performing and the traffic they produced. I wanted to know what a defender would see if similar activity happened on their network.
My colleague Shad Malloy started and owned the scanner as an independent side project before I became involved. He developed it as a safety-first tool for ICS and operational technology, with safety tiers that accounted for the risks of testing equipment involved in physical processes. I joined the research later, when we began exploring how the scanner's findings might also support defensive monitoring.
I collaborated with Shad on the companion detection-gen project, which used information from scanner checks to support Sigma, Suricata, and Splunk ESCU templates. My contributions were on the detection-engineering side, and in research review. The question I brought to that work was practical: would the information in a finding help someone recognize and investigate the associated activity?
What We Could Carry from the Scanner into a Detection
The scanner checks included a field called detection_hints. It held details such as transport and application protocols, MITRE ATT&CK mappings, and two kinds of patterns: narrow and broad. The field was descriptive metadata for the separate generation project; it did not change how the scanner ran.
A narrow pattern could identify the specific traffic produced by one of our checks. A broad pattern aimed to describe a wider class of behavior. I understood why we needed both, but I also saw the trade-off. Recognizing our exact check is not the same as recognizing every way someone might attempt the same activity. On the other hand, widening a pattern could also cause it to match legitimate traffic.
Narrow pattern | Broad pattern | |
Matches | This scanner's literal probe bytes | The underlying vulnerability class |
Good for | Knowing when this exact tool or a known proof-of-concept is run against you | Catching a variation that does not match our bytes |
Fails by | Missing any variation | Matching legitimate activity |
When it is absent | The trigger is rate-based or structural, not a byte string | No honest broader signature exists, so the list is left empty |
That mattered to me because I knew what happened after a noisy alert reached a SOC. Someone had to spend time deciding whether it meant anything. We needed to be clear about what a rule matched, rather than treating every match as evidence of an attack.
Keeping both patterns in the check's own file, rather than in a store detection-gen maintained separately, was deliberate. A detection's accuracy is tied to the check's accuracy. Keeping them in the same version-controlled file means they cannot silently drift apart the way two independently maintained artifacts eventually do.
When Matching Bytes Was Not Enough
The Modbus checks made that limitation easier to see. One check involved a protocol data unit whose declared length did not match the bytes actually sent. The relevant detail was the structure of the message, not a distinctive word or string within it. A fixed byte pattern might recognize one example without covering the underlying structural anomaly. A more general detection would need to account for the protocol's message format.
Connection exhaustion raised a different problem. A single connection might be entirely unremarkable. The number of connections, or the rate at which they occurred, was what mattered. Searching for one packet would not capture that behavior; a rate-based approach would make more sense, with thresholds informed by the environment.
Zeek's behavioral renderer, added after this post's first draft, solves that one more precisely than a rate threshold can. Instead of counting connection attempts in a window, it tracks how many connections are held open to the target at once and raises a notice when that concurrency crosses a tunable threshold. The distinction isn't academic: on the project's own test data, legitimate OT masters reconnect in bursts of 8-9 connections in two seconds, large enough to trip a naive rate-based rule, while the attack case that matters looks more like 7 connections held open at once. Counting what's open, not how fast connections arrive, is what actually tells the two apart.
Some scanner checks therefore have no detection hints at all, because a stable fixed signature was not available. I preferred that to inventing a pattern simply so every check had a corresponding rule. It was better to state what we could observe and where the method fell short.
These cases also explained why Sigma, Suricata, Splunk ESCU, and Zeek could not be treated as interchangeable outputs. Suricata could be used for suitable network patterns. A Sigma detection depended on the right information appearing in logs. A Splunk template had its own format and data requirements. Even where a generator produced a valid file, we still needed to check that the target system had the data needed to make the detection meaningful.
Making the Output Trustworthy
The four format renderers each looked correct in isolation, and each was wrong in a way that only showed up against the real tooling a defender would actually use.
Sigma. An early version built its output by interpolating strings directly into YAML text. One of the pilot checks' byte patterns contained literal carriage-return and line-feed bytes, a completely normal thing for a Telnet-based credential check to need. YAML's own line-folding rules silently turned that embedded CR/LF into a plain space. The file still parsed without a single error. The detection pattern it described would never have matched the real traffic it was supposed to catch: a silently broken rule that looked completely fine sitting in a repository. The fix was not a patch to the string-building logic. It was replacing string-building entirely with a real dictionary handed to a real YAML emitter, so escaping is never something we hand-maintain again.
Suricata. Real Suricata rule files have an unforgiving requirement: exactly one rule per line. A pretty-printed, multi-line version of a generated rule (readable, well-indented, perfectly reasonable to a human) parsed as zero rules through idstools, with no error raised at all. It does not fail loudly; it just silently produces nothing. We only caught it because we had made a habit of validating against the real parser instead of trusting that a clean-looking file was a working one.
Splunk ESCU. This one took longest and taught me the most. The renderer was built against the schema published on the splunk/security_content GitHub main branch, the obvious place to look. Running the actual pip-installable contentctl 5.6.0 against our output revealed that version had drifted from the published schema in several real ways: fields nested differently, a single date field instead of the pair we had assumed, a hard 67-character name limit, and a filename that has to be mechanically derived from the detection's own name rather than freely chosen. Reaching a real contentctl validate exit code of zero took five separate rounds, each surfacing a constraint we had not known existed.
Zeek. Zeek anchors a payload signature at the start of a connection's data by default. Every ICS PDU our patterns needed to match sits after a protocol header, not at byte zero. The generated .sig files loaded into Zeek clean, no errors, and matched nothing — not reduced coverage, zero fires, across a full validation run against 199 real OT captures from a public OT-IDS dataset. The fix was a single leading wildcard. We only found it because we ran the generated signatures against real traffic instead of trusting that a file Zeek would load was a file Zeek would act on.
The best single lesson came in the middle of that. We needed a value for a data_source field and did not have a real one, so we filled in a plausible-sounding placeholder, "Zeek," and moved on. It failed validation immediately, for the same reason an invented story name would have: ESCU's content-pack model treats both as real, cross-referenced objects that must actually exist, not free text. The instructive part was not that it failed. It was that the first instinct was to reach for a better guess, and the actual fix was to stop guessing. We left the field unset and documented why. A made-up value that looks right is a worse failure mode than an honest gap, because nobody goes looking for it.
The renderer problem I found myself was the same bug class arriving from a different direction. A detection description with a line break in it produced malformed YAML, because the renderer built part of its output by joining strings together. It was an ordinary input, which was what concerned me: a detection description often needs more than one line. I proposed building the YAML from structured dictionaries and using a real emitter to write it, following the approach already used in the Sigma renderer. The change passed the existing checks I ran locally, including testing with contentctl. I sent Shad the problem and the proposed fix, and he encouraged me to take it forward.
Second Round, Same Discipline
We found a version of the same mistake again later, at a larger scale, and it belongs here because it is the more honest story than pretending we got everything right the first time.
Every detection the ESCU renderer produced carried the same hardcoded analytic story, "ICS Default Credentials," regardless of what the underlying finding actually was. That was fine while every check in the pilot genuinely was a credential-based finding. It stopped being fine the moment we generated detections for findings that were not credential-based at all: a denial-of-service check, an unauthorized-command-execution finding. They all still carried the same, now inaccurate, label.
The fix had the same reasoning as the data_source lesson. Replace the hardcoded guess with a real per-check field against a small, deliberately curated set of categories, and go back through every check that already existed to classify it honestly rather than leave the old default standing. One finding, out of the entire set, genuinely did not fit any category (a protocol-compliance check, not an attack technique) and we left it unclassified rather than force on a label that would have been just as wrong as the one we had fixed.
What "Done" Actually Meant
None of these fixes counted as done because the code looked right or the tests already written stayed green.
The scanner repository had a validation layer for its detection metadata. smoke_test_indusoft_tcp.py checked that the byte patterns recorded in detection hints appeared in generated probe frames. smoke_test_discovery.py checked narrow and broad expressions against discovery payloads, including real and synthetic examples. I valued that approach because it tied recorded patterns to traffic rather than leaving them as untested descriptions in YAML files.
On the generation side, each fix counted as done only after we regenerated every affected template from scratch and ran it back through the real tool: every Sigma file through pySigma's own collection parser, every Suricata rule line through idstools, and every ESCU file through a freshly built contentctl scaffold (complete with real placeholder story and macro files, not just the detection files themselves) until contentctl validate returned exit code zero with zero issues, every time.
There was still a limit to what these checks established. Matching a generated probe showed that a pattern recognized that tested input. It did not show how often a rule might fire on legitimate activity, whether another implementation would produce different traffic, or whether a deployed sensor would see the relevant packets at all.
Why This Matters
The 2017 Triton intrusion at a Saudi petrochemical plant was found on safety instrumented systems, the controllers whose only job is to bring a process to a safe state. It was discovered because a coding error tripped a plant shutdown, not because a detection fired.
That is the gap this work sits in. Detection content for industrial protocols is scarce, and the analyst who receives an ICS alert usually has less context than they would for an equivalent IT alert: fewer logs, unfamiliar protocols, and an asset inventory that may not be accurate. Generating a validated starting point for every finding a scanner can check for does not close that gap, but it moves the tedious and error-prone part of the work off the analyst's desk.
Working in cybersecurity in Jamaica made the protection of essential services, including electricity and water, especially relevant to me. This project gave me a chance to contribute to research about those systems, and to think about the people who would have to make sense of an alert with the time and information available to them.
What an Analyst Would Need Next
I kept thinking about the moment an alert reached an analyst. Suppose a rule matched traffic associated with one of our checks. The analyst would still need to know which systems were communicating, what the protocol activity looked like, and whether that communication was expected.
An authorized assessment could produce traffic that looked suspicious out of context. So could an unusual but legitimate maintenance task. The source and destination, device role, change records, and available network evidence would all matter when deciding what to investigate next. A match on its own would not establish malicious intent.
What the rule gives you | What it does not give you |
This traffic matched a known ICS probe pattern | Whether the sender was authorized |
The protocol and the ATT&CK technique involved | Whether the target is actually the affected model |
A narrow or broad classification of the match | Whether the activity was scheduled maintenance |
A starting point in your own detection format | A tuned false-positive rate for your environment |
I wanted the detection content to explain its purpose and limitations clearly enough that someone could use it during an investigation. That meant thinking about data sources, likely false positives, and useful next steps, not simply whether we could generate another rule.
A Deliberate Boundary
None of this produces a finished detection, and I do not want anyone to read it as if it does.
The generated implementation notes say exactly what a real analyst still has to do: point the placeholder macro at their own log source, resolve the story cross-reference to something real in their own content pack, and tune for their own environment's false-positive rate before trusting it in production. This generates a validated, correctly formatted starting point (the part that is tedious and error-prone to do by hand for every finding a scanner ships), not a substitute for the judgment a real detection engineer still has to apply.
What We See in Real Engagements
- Defenders inherit alerts without the context to judge them. The same organization that cannot patch a twenty-year-old relay also cannot easily tell an authorized assessment apart from an intrusion.
- A rule that parses is not a rule that works. Every one of the four format bugs produced a file that a parser accepted and a defender could not use.
- The tool you install has drifted from the schema it publishes. Validating against documentation rather than the installed package cost five rounds of rework on one format alone.
- Not every finding has a signature, and saying so is the honest answer. Rate-based and structural triggers do not reduce to a byte pattern, and inventing one to fill the column is worse than leaving it empty.
- Detection content without analyst guidance gets ignored. A rule that does not say what it matched, what it does not prove, and what to check next becomes another noisy alert.
- The same metadata serves both sides. The file that decides whether a device is vulnerable is the file that describes what testing it looks like on the wire.
Closing Thoughts
I came into the project wanting to know whether defenders would recognize activity related to our scanner's findings. I now have a more specific question: what could we show an analyst, with evidence, that would help them decide what they were looking at?
That is the part of the work I want to keep developing.
Get the code
- detection-gen: https://github.com/BishopFox/icsScanner/tree/main/detection-gen
- icsScanner: https://github.com/BishopFox/icsScanner
Detection content generated by this tool is a starting point for authorized defensive use. Validate and tune it in your own environment before relying on it.
Subscribe to our blog
Be first to learn about latest tools, advisories, and findings.
Thank You! You have been subscribed.
Recommended Posts