Skip to content

NetScaler LLM Triage

Full Recipe

Shared by: Nathan St. Amour

This recipe detects an exploit chain against NetScaler appliances with standing queries, and calls language models from the same Cypher queries where the input is free text or the output is for a person. llm.prompt reads helpdesk tickets and a vendor advisory into the graph and writes a brief for each incident. llm.decide scores each sign-in username and chooses whether an incident pages the on-call responder. The graph queries still do the detection.

NetScaler LLM Triage Recipe
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
version: 2
title: NetScaler CVE Detection with LLM-Augmented Streams
contributor: https://github.com/neewamp
summary: Graph-owned exploit-chain detections over NetScaler telemetry, with LLMs extracting unstructured streams at ingest and writing incident briefs at output.
description: >
  Sequel to the thatDot CVE-2026-88779 detection post. The detections are unchanged graph
  predicates: timing (auth within 60 s of a crash), repetition (3 crashes in a trailing 15
  minutes, promotion at 2+ crashes and 2+ requests estate-wide), and shape (egress to a host
  no healthy appliance ever contacted). The LLM procedures sit at the edges only. At ingest,
  llm.decide scores how payload-shaped each auth username is (an evidence flag; it gates
  nothing), and llm.prompt extracts structure from helpdesk tickets. At output, when the
  kill-chain detection assembles an Incident, llm.decide gates severity and llm.prompt writes
  a human-readable brief from the evidence the graph collected. A vendor advisory arrives
  later, appended to data/live.ndjson; llm.prompt extracts its IOCs onto the same IP nodes
  the graph already built.

  Model endpoints come from system config under quine.llm: completion = Claude on Amazon
  Bedrock (anthropic-messages against the Bedrock compatibility endpoint, api-key auth),
  decision = hosted Jev.

ingestStreams:
  # ---- SAML auth log. Builds (IP)-[:SENT]->(AuthEvent)-[:TO]->(Appliance) and asks the
  # decision model for one calibrated judgment per record. The score is evidence for an
  # analyst and for the brief; no detection reads it.
  - name: saml-auth
    source:
      type: File
      path: data/auth.ndjson
      format:
        type: JsonL
    parallelism: 8
    query: |
      MATCH (ip), (auth), (app)
        WHERE id(ip)   = idFrom('ip', $that.src_ip)
          AND id(auth) = idFrom('auth', $that.event_id)
          AND id(app)  = idFrom('appliance', $that.appliance)
      CALL llm.decide(
        {username: $that.username},
        {payload: {type: "yes-no",
                   instructions: "Is this authentication username a machine-generated or injection-style string rather than a name a person would sign in with?"}}
      ) YIELD answers
      SET ip.ip = $that.src_ip, ip: IP,
          auth.username = $that.username,
          auth.endpoint = $that.endpoint,
          auth.ts = $that.ts,
          auth.epoch = $that.epoch,
          auth.suspicionScore = answers.payload.probability,
          auth.payloadShaped = answers.payload.probability >= 0.8,
          auth: AuthEvent,
          app.host = $that.appliance, app: Appliance
      CREATE (ip)-[:SENT]->(auth)-[:TO]->(app)

  # ---- HTTP access log. Structure only; costs no model call.
  - name: http-access
    source:
      type: File
      path: data/http.ndjson
      format:
        type: JsonL
    query: |
      MATCH (ip), (req), (app)
        WHERE id(ip)  = idFrom('ip', $that.src_ip)
          AND id(req) = idFrom('http', $that.request_id)
          AND id(app) = idFrom('appliance', $that.appliance)
      SET ip.ip = $that.src_ip, ip: IP,
          req.method = $that.method, req.uri = $that.uri, req.status = $that.status,
          req.ts = $that.ts, req.epoch = $that.epoch, req: HttpRequest,
          app.host = $that.appliance, app: Appliance
      CREATE (ip)-[:REQUESTED]->(req)-[:TO]->(app)

  # ---- System events: crashes, restarts, file writes. Costs no model call. Throttled so
  # each crash's standing-query attribution completes before the next crash arrives; the
  # promotion recount reads edges the earlier enrichments wrote.
  - name: system-events
    source:
      type: File
      path: data/sysevents.ndjson
      format:
        type: JsonL
    maxPerSecond: 2
    query: |
      MATCH (ev), (app)
        WHERE id(ev)  = idFrom('sysevent', $that.event_id)
          AND id(app) = idFrom('appliance', $that.appliance)
      SET ev.event_type = $that.event_type, ev.process = $that.process,
          ev.path = $that.path, ev.user = $that.user,
          ev.ts = $that.ts, ev.epoch = $that.epoch, ev: SysEvent,
          app.host = $that.appliance, app: Appliance
      CREATE (ev)-[:ON]->(app)

  # ---- Firewall egress. Structure only; costs no model call.
  - name: firewall-egress
    source:
      type: File
      path: data/egress.ndjson
      format:
        type: JsonL
    query: |
      MATCH (app), (out), (dst)
        WHERE id(app) = idFrom('appliance', $that.appliance)
          AND id(out) = idFrom('outbound', $that.egress_id)
          AND id(dst) = idFrom('ip', $that.dest_ip)
      SET app.host = $that.appliance, app: Appliance,
          out.dest_port = $that.dest_port, out.proto = $that.proto,
          out.ts = $that.ts, out.epoch = $that.epoch, out: Outbound,
          dst.ip = $that.dest_ip, dst: IP
      CREATE (app)-[:CONNECTED_TO]->(out)-[:DEST]->(dst)

  # ---- Helpdesk tickets: free text from people. The chat model extracts which service the
  # ticket concerns and whether it reports a remote-access outage; a null response (output
  # failed the schema) leaves the ticket visibly unextracted rather than silently irrelevant.
  - name: helpdesk
    source:
      type: File
      path: data/helpdesk.ndjson
      format:
        type: JsonL
    query: |
      MATCH (t) WHERE id(t) = idFrom('ticket', $that.ticketId)
      CALL llm.prompt(
        'You are reading one helpdesk ticket, provided in the data block. Decide which service it concerns: "vpn" for remote access or VPN connectivity, "sso" for single sign-on or login portals, or "other". Summarize the symptom in at most eight words. Decide whether the ticket plausibly reports an outage or failure of remote access or sign-on (outageReport). Base everything only on the ticket text.',
        {ticket: $that.text},
        {schema: {
           type: 'object', additionalProperties: false,
           required: ['service', 'symptom', 'outageReport'],
           properties: {
             service: {type: 'string', maxLength: 10},
             symptom: {type: 'string', maxLength: 80},
             outageReport: {type: 'boolean'}
           }
        }}
      ) YIELD response
      SET t.ticketId = $that.ticketId, t.user = $that.user,
          t.ts = $that.ts, t.epoch = $that.epoch, t.text = $that.text,
          t.service = response.service, t.symptom = response.symptom,
          t.outageReport = response.outageReport,
          t.extracted = response IS NOT NULL,
          t: Ticket
      WITH t, response
      WHERE response IS NOT NULL AND response.outageReport = true AND response.service IN ['vpn', 'sso']
      MATCH (svc) WHERE id(svc) = idFrom('service', response.service)
      SET svc.name = response.service, svc: Service
      CREATE (t)-[:REPORTS]->(svc)
      // A ticket can arrive after the incident's brief already fired. This side writes the
      // same CORROBORATED_BY edge for that order; Quine edges are a set, so a ticket the
      // brief already linked is not duplicated.
      WITH t, svc
      MATCH (svc)<-[:AFFECTS]-(inc:Incident)
      WHERE abs(t.epoch - inc.epoch) <= 2700000
      CREATE (inc)-[:CORROBORATED_BY]->(t)

  # ---- Late input. Reads data/live.ndjson in NAMED_PIPE mode: Quine reads to the end,
  # then checks the file again every second. The kit ships the file empty. Append
  # data/advisory.ndjson to deliver the advisory after the incidents exist. Each other
  # appended line names its `stream`; a line with an advisoryId is the advisory. One
  # subquery per stream runs the same query as that stream's file ingest. Parallelism 1
  # keeps the lines in file order.
  - name: live
    source:
      type: File
      path: data/live.ndjson
      fileIngestMode: NAMED_PIPE
      format:
        type: JsonL
    parallelism: 1
    query: |
      WITH CASE WHEN $that.advisoryId IS NOT NULL THEN 'advisory' ELSE $that.stream END AS stream
      // auth: the saml-auth query
      CALL {
        WITH stream
        WITH stream WHERE stream = 'auth'
        MATCH (ip), (auth), (app)
          WHERE id(ip)   = idFrom('ip', $that.src_ip)
            AND id(auth) = idFrom('auth', $that.event_id)
            AND id(app)  = idFrom('appliance', $that.appliance)
        CALL llm.decide(
          {username: $that.username},
          {payload: {type: "yes-no",
                     instructions: "Is this authentication username a machine-generated or injection-style string rather than a name a person would sign in with?"}}
        ) YIELD answers
        SET ip.ip = $that.src_ip, ip: IP,
            auth.username = $that.username,
            auth.endpoint = $that.endpoint,
            auth.ts = $that.ts,
            auth.epoch = $that.epoch,
            auth.suspicionScore = answers.payload.probability,
            auth.payloadShaped = answers.payload.probability >= 0.8,
            auth: AuthEvent,
            app.host = $that.appliance, app: Appliance
        CREATE (ip)-[:SENT]->(auth)-[:TO]->(app)
      }
      // sysevent: the system-events query
      CALL {
        WITH stream
        WITH stream WHERE stream = 'sysevent'
        MATCH (ev), (app)
          WHERE id(ev)  = idFrom('sysevent', $that.event_id)
            AND id(app) = idFrom('appliance', $that.appliance)
        SET ev.event_type = $that.event_type, ev.process = $that.process,
            ev.path = $that.path, ev.user = $that.user,
            ev.ts = $that.ts, ev.epoch = $that.epoch, ev: SysEvent,
            app.host = $that.appliance, app: Appliance
        CREATE (ev)-[:ON]->(app)
      }
      // egress: the firewall-egress query
      CALL {
        WITH stream
        WITH stream WHERE stream = 'egress'
        MATCH (app), (out), (dst)
          WHERE id(app) = idFrom('appliance', $that.appliance)
            AND id(out) = idFrom('outbound', $that.egress_id)
            AND id(dst) = idFrom('ip', $that.dest_ip)
        SET app.host = $that.appliance, app: Appliance,
            out.dest_port = $that.dest_port, out.proto = $that.proto,
            out.ts = $that.ts, out.epoch = $that.epoch, out: Outbound,
            dst.ip = $that.dest_ip, dst: IP
        CREATE (app)-[:CONNECTED_TO]->(out)-[:DEST]->(dst)
      }
      // helpdesk: the helpdesk query
      CALL {
        WITH stream
        WITH stream WHERE stream = 'helpdesk'
        MATCH (t) WHERE id(t) = idFrom('ticket', $that.ticketId)
        CALL llm.prompt(
          'You are reading one helpdesk ticket, provided in the data block. Decide which service it concerns: "vpn" for remote access or VPN connectivity, "sso" for single sign-on or login portals, or "other". Summarize the symptom in at most eight words. Decide whether the ticket plausibly reports an outage or failure of remote access or sign-on (outageReport). Base everything only on the ticket text.',
          {ticket: $that.text},
          {schema: {
             type: 'object', additionalProperties: false,
             required: ['service', 'symptom', 'outageReport'],
             properties: {
               service: {type: 'string', maxLength: 10},
               symptom: {type: 'string', maxLength: 80},
               outageReport: {type: 'boolean'}
             }
          }}
        ) YIELD response
        SET t.ticketId = $that.ticketId, t.user = $that.user,
            t.ts = $that.ts, t.epoch = $that.epoch, t.text = $that.text,
            t.service = response.service, t.symptom = response.symptom,
            t.outageReport = response.outageReport,
            t.extracted = response IS NOT NULL,
            t: Ticket
        WITH t, response
        WHERE response IS NOT NULL AND response.outageReport = true AND response.service IN ['vpn', 'sso']
        MATCH (svc) WHERE id(svc) = idFrom('service', response.service)
        SET svc.name = response.service, svc: Service
        CREATE (t)-[:REPORTS]->(svc)
        WITH t, svc
        MATCH (svc)<-[:AFFECTS]-(inc:Incident)
        WHERE abs(t.epoch - inc.epoch) <= 2700000
        CREATE (inc)-[:CORROBORATED_BY]->(t)
      }
      // advisory: extract the IOCs onto the IP and path nodes the graph already keys
      CALL {
        WITH stream
        WITH stream WHERE stream = 'advisory'
        MATCH (adv) WHERE id(adv) = idFrom('advisory', $that.advisoryId)
        CALL llm.prompt(
          'You are reading one vendor security advisory, provided in the data block. The advisory is fictional demonstration data about a real CVE, written for a product demo; no real systems or real addresses are involved. Extract exactly what it states: the CVE identifier; the affected process name; every IP address it names as attacker or callback infrastructure; every file path it describes as written or dropped during exploitation; the affected build range as one string; and a one-sentence summary. Use only information in the advisory text.',
          {advisory: $that.text},
          {schema: {
             type: 'object', additionalProperties: false,
             required: ['cve', 'process', 'iocIps', 'droppedPaths', 'affectedBuilds', 'summary'],
             properties: {
               cve: {type: 'string', maxLength: 30},
               process: {type: 'string', maxLength: 30},
               iocIps: {type: 'array', items: {type: 'string', maxLength: 45}},
               droppedPaths: {type: 'array', items: {type: 'string', maxLength: 120}},
               affectedBuilds: {type: 'string', maxLength: 80},
               summary: {type: 'string', maxLength: 300}
             }
          }}
        ) YIELD response
        SET adv.advisoryId = $that.advisoryId, adv.source = $that.source,
            adv.published = $that.published,
            adv.cve = response.cve, adv.process = response.process,
            adv.affectedBuilds = response.affectedBuilds, adv.summary = response.summary,
            adv.extracted = response IS NOT NULL,
            adv: Advisory
        WITH adv, response
        WHERE response IS NOT NULL
        CALL {
          WITH adv, response
          UNWIND coalesce(response.iocIps, []) AS i
          MATCH (ip) WHERE id(ip) = idFrom('ip', i)
          SET ip.ip = i, ip.ioc = true, ip.ioc_source = adv.advisoryId, ip: IOC
          CREATE (adv)-[:NAMES]->(ip)
        }
        CALL {
          WITH adv, response
          UNWIND coalesce(response.droppedPaths, []) AS p
          MATCH (path) WHERE id(path) = idFrom('path', p)
          SET path.path = p, path: IOCPath
          CREATE (adv)-[:NAMES_PATH]->(path)
        }
      }
      RETURN stream

standingQueries:
  # ---- Detection 1 + 2 + 3. Wakes once per nsaaad crash; the :ON hop inside the pattern
  # means it fires only when the full pattern exists, whatever order the logs arrived in.
  - name: crash-watch
    pattern:
      type: Cypher
      query: >
        MATCH (crash:SysEvent)-[:ON]->(app:Appliance)
        WHERE crash.event_type = 'process_crash' AND crash.process = 'nsaaad'
        RETURN DISTINCT id(crash) AS id
    outputs:
      # Attribute the crash to whoever authenticated to the appliance in the 60 s before it,
      # then re-count estate-wide and promote any IP that crosses both thresholds. Edge writes
      # and label sets are idempotent, so the auth-side mirror below can repeat them safely.
      - name: attribute-and-promote
        resultEnrichment:
          query: |
            MATCH (crash:SysEvent)-[:ON]->(app:Appliance) WHERE id(crash) = $that.data.id
            MATCH (ip:IP)-[:SENT]->(auth:AuthEvent)-[:TO]->(app)
            WHERE auth.epoch <= crash.epoch AND auth.epoch >= crash.epoch - 60000
            CREATE (ip)-[:PRECEDED_CRASH]->(crash)
            WITH DISTINCT ip
            MATCH (ip)-[:PRECEDED_CRASH]->(c:SysEvent)-[:ON]->(app2:Appliance)
            MATCH (ip)-[:SENT]->(a:AuthEvent)-[:TO]->(app2)
            WHERE a.epoch <= c.epoch AND a.epoch >= c.epoch - 60000
            WITH ip, count(DISTINCT c) AS crashesPreceded, count(DISTINCT a) AS requestsBefore
            WHERE crashesPreceded >= 2 AND requestsBefore >= 2
            SET ip.attacker_infra = true, ip: AttackerInfra
            RETURN id(ip) AS promoted
        destinations:
          - type: Drop
      # Detection 3: three nsaaad crashes on one appliance inside a trailing 15 minutes.
      # The equality makes it fire once per episode, on the crash that completes the burst.
      - name: repeated-crash-dos
        resultEnrichment:
          query: |
            MATCH (crash:SysEvent)-[:ON]->(app:Appliance) WHERE id(crash) = $that.data.id
            MATCH (other:SysEvent)-[:ON]->(app)
            WHERE other.event_type = 'process_crash' AND other.process = 'nsaaad'
              AND other.epoch <= crash.epoch AND other.epoch >= crash.epoch - 900000
            WITH app, crash, count(DISTINCT other) AS nsaaadCrashes, min(other.epoch) AS t0
            WHERE nsaaadCrashes = 3
            MATCH (alert) WHERE id(alert) = idFrom('alert', 'repeated-crash-dos', app.host)
            SET alert.kind = 'repeated-crash-dos', alert.appliance = app.host,
                alert.crashes = nsaaadCrashes, alert.windowMs = crash.epoch - t0,
                alert: Alert
            CREATE (alert)-[:ON]->(app)
            RETURN id(alert) AS fired
        destinations:
          - type: Drop

  # ---- The mirror of detection 1: wakes once per auth event and looks for a crash in the
  # 60 s after it. Whichever log arrives last completes the attribution, so neither log lag
  # nor ingest order loses an edge. Runs the same promotion recount.
  - name: auth-mirror
    pattern:
      type: Cypher
      query: >
        MATCH (ip:IP)-[:SENT]->(auth:AuthEvent)-[:TO]->(app:Appliance)
        RETURN DISTINCT id(auth) AS id
    outputs:
      - name: attribute-forward
        resultEnrichment:
          query: |
            MATCH (ip:IP)-[:SENT]->(auth:AuthEvent)-[:TO]->(app:Appliance) WHERE id(auth) = $that.data.id
            MATCH (crash:SysEvent)-[:ON]->(app)
            WHERE crash.event_type = 'process_crash' AND crash.process = 'nsaaad'
              AND crash.epoch >= auth.epoch AND crash.epoch <= auth.epoch + 60000
            CREATE (ip)-[:PRECEDED_CRASH]->(crash)
            WITH DISTINCT ip
            MATCH (ip)-[:PRECEDED_CRASH]->(c:SysEvent)-[:ON]->(app2:Appliance)
            MATCH (ip)-[:SENT]->(a:AuthEvent)-[:TO]->(app2)
            WHERE a.epoch <= c.epoch AND a.epoch >= c.epoch - 60000
            WITH ip, count(DISTINCT c) AS crashesPreceded, count(DISTINCT a) AS requestsBefore
            WHERE crashesPreceded >= 2 AND requestsBefore >= 2
            SET ip.attacker_infra = true, ip: AttackerInfra
            RETURN id(ip) AS promoted
        destinations:
          - type: Drop

  # ---- Detection 2's pivot: fires once per promoted IP and assesses every appliance it
  # touched, crashed or not. The patched decoy is the reason this exists.
  - name: attacker-pivot
    pattern:
      type: Cypher
      query: >
        MATCH (ip:AttackerInfra) RETURN DISTINCT id(ip) AS id
    outputs:
      - name: assess-exposure
        resultEnrichment:
          query: |
            MATCH (ip:AttackerInfra) WHERE id(ip) = $that.data.id
            MATCH (ip)-[:SENT|REQUESTED]->(ev)-[:TO]->(app:Appliance)
            WITH DISTINCT ip, app
            OPTIONAL MATCH (c:SysEvent)-[:ON]->(app)
            WHERE c.event_type = 'process_crash' AND c.process = 'nsaaad'
            WITH ip, app, count(DISTINCT c) AS nsaaadCrashes
            SET app.assessment = CASE WHEN nsaaadCrashes > 0 THEN 'compromised'
                                      ELSE 'probed, no crash: verify build' END
            CREATE (ip)-[:TARGETED]->(app)
            RETURN id(app) AS assessed
        destinations:
          - type: Drop

  # ---- Detection 4: the post-exploitation chain. The pattern is built from derived
  # elements (the AttackerInfra label and PRECEDED_CRASH edge), so it completes only when
  # attribution and promotion have, regardless of what order the raw logs arrived in. The
  # output checks the two conditions the original post requires: the write happened after
  # the first attributed crash, and the appliance then reached a destination that either
  # carries the IOC label or has never been contacted by a healthy appliance.
  - name: kill-chain
    pattern:
      type: Cypher
      query: >
        MATCH (ip:AttackerInfra)-[:PRECEDED_CRASH]->(c:SysEvent)-[:ON]->(app:Appliance)<-[:ON]-(fw:SysEvent)
        WHERE fw.event_type = 'file_write'
        RETURN DISTINCT id(fw) AS id
    outputs:
      - name: assemble-incident
        resultEnrichment:
          query: |
            MATCH (fw:SysEvent)-[:ON]->(app:Appliance) WHERE id(fw) = $that.data.id
            MATCH (ip:AttackerInfra)-[:PRECEDED_CRASH]->(c:SysEvent)-[:ON]->(app)
            WITH fw, app, min(c.epoch) AS firstCrash, collect(DISTINCT id(ip)) AS attackerIds
            WHERE fw.epoch > firstCrash
            MATCH (app)-[:CONNECTED_TO]->(o:Outbound)-[:DEST]->(dst:IP)
            WHERE o.epoch > firstCrash
            WITH fw, app, firstCrash, attackerIds, dst,
                 min(o.epoch) AS myContact, 'IOC' IN labels(dst) AS knownIoc
            MATCH (app2:Appliance)-[:CONNECTED_TO]->(o2:Outbound)-[:DEST]->(dst)
            WHERE o2.epoch <= myContact
            OPTIONAL MATCH (x:AttackerInfra)-[:PRECEDED_CRASH]->(c2:SysEvent)-[:ON]->(app2)
            WHERE c2.epoch < o2.epoch
            WITH fw, app, firstCrash, attackerIds, dst, knownIoc, o2, count(c2) AS crashesBeforeContact
            WITH fw, app, firstCrash, attackerIds, dst, knownIoc,
                 count(o2) AS estateContacts,
                 sum(CASE WHEN crashesBeforeContact = 0 THEN 1 ELSE 0 END) AS healthyContacts
            WHERE knownIoc OR healthyContacts = 0
            MATCH (alert) WHERE id(alert) = idFrom('alert', 'post-exploitation', app.host, fw.path)
            SET alert.kind = 'post-exploitation-chain', alert.appliance = app.host,
                alert.droppedFile = fw.path, alert.writtenBy = fw.user,
                alert.egressTo = dst.ip, alert.estateContacts = estateContacts,
                alert.reason = CASE WHEN knownIoc THEN 'known IOC'
                                    ELSE 'no healthy appliance has ever contacted this host' END,
                alert: Alert
            CREATE (alert)-[:ON]->(app)
            WITH fw, app, attackerIds, dst
            MATCH (inc) WHERE id(inc) = idFrom('incident', app.host)
            SET inc.appliance = app.host,
                inc.epoch = coalesce(inc.epoch, fw.epoch),
                inc.egressTo = dst.ip
            CREATE (inc)-[:ON]->(app)
            CREATE (inc)-[:EGRESS_TO]->(dst)
            WITH DISTINCT inc, attackerIds
            UNWIND attackerIds AS aid
            MATCH (attacker) WHERE id(attacker) = aid
            CREATE (inc)-[:ATTRIBUTED_TO]->(attacker)
            WITH DISTINCT inc
            // Tickets only know their service, so give them an edge path to the incident:
            // the helpdesk query walks service -> AFFECTS -> incident for late arrivals.
            // These edges go in before the label, so the path is complete at the moment
            // the label makes the incident matchable.
            UNWIND ['vpn', 'sso'] AS svcName
            MATCH (svc) WHERE id(svc) = idFrom('service', svcName)
            SET svc.name = svcName, svc: Service
            CREATE (inc)-[:AFFECTS]->(svc)
            WITH DISTINCT inc
            SET inc: Incident
            RETURN id(inc) AS incident
        destinations:
          - type: Drop

  # ---- The sequel's output stage: fires once per Incident (the label is set last, after
  # the incident's edges exist). Collects compact evidence from the subgraph, asks the
  # decision model whether to page, and has the chat model write the brief. Both models
  # only see what the graph assembled; the prompt forbids invention, the schema bounds the
  # shape, and a schema-null brief leaves inc.briefed = false instead of a wrong summary.
  - name: incident-brief
    pattern:
      type: Cypher
      query: >
        MATCH (inc:Incident) RETURN DISTINCT id(inc) AS id
    outputs:
      - name: gate-and-brief
        resultEnrichment:
          query: |
            MATCH (inc:Incident)-[:ON]->(app:Appliance) WHERE id(inc) = $that.data.id
            MATCH (inc)-[:ATTRIBUTED_TO]->(attacker:IP)
            WITH DISTINCT inc, app, collect(DISTINCT attacker.ip) AS attackers
            MATCH (:AttackerInfra)-[:PRECEDED_CRASH]->(c:SysEvent)-[:ON]->(app)
            WITH inc, app, attackers, count(DISTINCT c) AS attributedCrashes,
                 min(c.epoch) AS firstCrash, collect(DISTINCT c.ts) AS crashTimes
            MATCH (fw:SysEvent)-[:ON]->(app)
            WHERE fw.event_type = 'file_write' AND fw.epoch > firstCrash
            WITH inc, app, attackers, attributedCrashes, crashTimes, firstCrash,
                 collect(DISTINCT (fw.path + ' written by ' + fw.user + ' at ' + fw.ts)) AS droppedFiles
            MATCH (app)-[:CONNECTED_TO]->(o:Outbound)-[:DEST]->(dst:IP)
            WHERE o.epoch > firstCrash AND dst.ip = inc.egressTo
            WITH inc, app, attackers, attributedCrashes, crashTimes, firstCrash, droppedFiles,
                 collect(DISTINCT dst.ip)[0] AS egressTo,
                 sum(CASE WHEN 'IOC' IN labels(dst) THEN 1 ELSE 0 END) AS iocContacts
            UNWIND ['vpn', 'sso'] AS svcName
            MATCH (svc) WHERE id(svc) = idFrom('service', svcName)
            OPTIONAL MATCH (svc)<-[:REPORTS]-(t)
            WHERE abs(t.epoch - inc.epoch) <= 2700000
            WITH inc, app, attackers, attributedCrashes, crashTimes, droppedFiles, egressTo,
                 iocContacts, collect(DISTINCT t) AS windowTickets
            // The edges and the count come from this one matched set, before the LLM calls:
            // a ticket arriving during the calls can no longer split them apart.
            FOREACH (tk IN windowTickets | CREATE (inc)-[:CORROBORATED_BY]->(tk))
            WITH inc, app, attackers, attributedCrashes, crashTimes, droppedFiles, egressTo,
                 iocContacts, size(windowTickets) AS userReports
            WITH inc, app,
                 {appliance: app.host, attackers: attackers,
                  attributedCrashes: attributedCrashes, crashTimes: crashTimes,
                  droppedFiles: droppedFiles, egressTo: egressTo,
                  egressIsKnownIoc: iocContacts > 0,
                  userOutageReportsInWindow: userReports} AS evidence
            CALL llm.decide(
              evidence,
              {severity: {type: "choice", options: ["page", "ticket"],
                          instructions: "Given this evidence about one authentication gateway appliance, should the on-call responder be paged immediately (page), or is a tracked ticket during business hours enough (ticket)?"}}
            ) YIELD answers
            CALL llm.prompt(
              'You are writing an incident brief for a security responder. The data block holds evidence a streaming graph assembled about one appliance: the attacker addresses, how many service crashes were attributed to them and when, the files dropped afterward, the outbound callback destination, and how many users reported outages in the window. State only facts present in the evidence; never invent counts, times, addresses, or causes. The timeline entries must be chronological and one sentence each. Give at most eight timeline entries and at most five recommended actions.',
              evidence,
              {schema: {
                 type: 'object', additionalProperties: false,
                 required: ['title', 'summary', 'timeline', 'recommendedActions'],
                 properties: {
                   title: {type: 'string', maxLength: 90},
                   summary: {type: 'string', maxLength: 600},
                   timeline: {type: 'array', maxItems: 8, items: {type: 'string', maxLength: 160}},
                   recommendedActions: {type: 'array', maxItems: 5, items: {type: 'string', maxLength: 120}}
                 }
              }}
            ) YIELD response
            SET inc.severity = answers.severity.choice,
                inc.severityConfidence = answers.severity.confidence,
                inc.title = response.title,
                inc.summary = response.summary,
                inc.timeline = response.timeline,
                inc.recommendedActions = response.recommendedActions,
                inc.briefed = response IS NOT NULL
            RETURN id(inc) AS briefed
        destinations:
          - type: Drop

  # ---- The page: wakes once per incident whose severity is `page`. The brief stage sets the
  # severity and the brief in one SET, so the brief is present when this fires. StandardOut
  # here; Slack, HttpEndpoint, SNS, Kafka, or Kinesis deliver it to a person or a pipeline.
  - name: page-on-call
    pattern:
      type: Cypher
      query: >
        MATCH (inc:Incident) WHERE inc.severity = 'page' RETURN DISTINCT id(inc) AS id
    outputs:
      - name: send-page
        resultEnrichment:
          query: |
            MATCH (inc:Incident) WHERE id(inc) = $that.data.id
            RETURN inc.appliance AS appliance, inc.title AS title, inc.summary AS summary,
                   inc.recommendedActions AS actions
        destinations:
          - type: StandardOut

nodeAppearances:
  # Promoted and IOC-flagged IPs carry several labels, and appearance predicates match the
  # joined label string exactly, so these two match on the marker property instead.
  - predicate:
      propertyKeys: []
      knownValues: { attacker_infra: true }
    icon: ion-flag
    color: '#ff0000'
    label: { type: Property, key: ip, prefix: '' }
  - predicate:
      propertyKeys: []
      knownValues: { ioc: true }
    icon: ion-alert-circled
    color: '#aa00aa'
    label: { type: Property, key: ip, prefix: 'IOC ' }
  - predicate:
      dbLabel: IP
      propertyKeys: []
      knownValues: {}
    icon: ion-ios-world
    label: { type: Property, key: ip, prefix: '' }
  - predicate:
      dbLabel: Appliance
      propertyKeys: []
      knownValues: { assessment: 'compromised' }
    icon: ion-cube
    color: '#ff0000'
    label: { type: Property, key: host, prefix: '' }
  - predicate:
      dbLabel: Appliance
      propertyKeys: []
      knownValues: { assessment: 'probed, no crash: verify build' }
    icon: ion-cube
    color: '#ffa500'
    label: { type: Property, key: host, prefix: '' }
  - predicate:
      dbLabel: Appliance
      propertyKeys: []
      knownValues: {}
    icon: ion-cube
    label: { type: Property, key: host, prefix: '' }
  - predicate:
      dbLabel: Incident
      propertyKeys: []
      knownValues: {}
    icon: ion-fireball
    color: '#ff0000'
    label: { type: Property, key: title, prefix: '' }
  - predicate:
      dbLabel: Alert
      propertyKeys: []
      knownValues: {}
    icon: ion-alert
    color: '#ffa500'
    label: { type: Property, key: kind, prefix: '' }
  - predicate:
      dbLabel: SysEvent
      propertyKeys: []
      knownValues: { event_type: 'process_crash' }
    icon: ion-nuclear
    color: '#cc0000'
    label: { type: Property, key: process, prefix: 'crash ' }
  - predicate:
      dbLabel: SysEvent
      propertyKeys: []
      knownValues: {}
    icon: ion-gear-b
    label: { type: Property, key: event_type, prefix: '' }
  - predicate:
      dbLabel: AuthEvent
      propertyKeys: []
      knownValues: {}
    icon: ion-log-in
    label: { type: Property, key: username, prefix: '' }
  - predicate:
      dbLabel: Ticket
      propertyKeys: []
      knownValues: {}
    icon: ion-chatbubble
    label: { type: Property, key: ticketId, prefix: '' }
  - predicate:
      dbLabel: Service
      propertyKeys: []
      knownValues: {}
    icon: ion-wrench
    label: { type: Property, key: name, prefix: '' }
  - predicate:
      dbLabel: Advisory
      propertyKeys: []
      knownValues: {}
    icon: ion-document-text
    color: '#aa00aa'
    label: { type: Property, key: advisoryId, prefix: '' }
  - predicate:
      dbLabel: IOCPath
      propertyKeys: []
      knownValues: {}
    icon: ion-document
    color: '#aa00aa'
    label: { type: Property, key: path, prefix: '' }
  - predicate:
      dbLabel: HttpRequest
      propertyKeys: []
      knownValues: {}
    icon: ion-link
    label: { type: Property, key: uri, prefix: '' }

quickQueries:
  - predicate: { propertyKeys: [], knownValues: {} }
    quickQuery:
      name: Adjacent Nodes
      querySuffix: MATCH (n)--(m) RETURN DISTINCT m
      sort: NODE
  - predicate: { propertyKeys: [], knownValues: {} }
    quickQuery:
      name: Refresh
      querySuffix: RETURN n
      sort: NODE
  - predicate: { propertyKeys: [], knownValues: {} }
    quickQuery:
      name: Local Properties
      querySuffix: RETURN id(n), properties(n)
      sort: TEXT
  - predicate:
      dbLabel: Appliance
      propertyKeys: []
      knownValues: {}
    quickQuery:
      name: System Events
      querySuffix: MATCH (n)<-[:ON]-(ev:SysEvent) RETURN ev
      sort: NODE
  - predicate:
      dbLabel: Incident
      propertyKeys: []
      knownValues: {}
    quickQuery:
      name: Full Evidence
      querySuffix: MATCH (n)-[]-(m) RETURN DISTINCT m
      sort: NODE

sampleQueries:
  - name: Promoted attacker infrastructure
    query: MATCH (ip:AttackerInfra) RETURN ip
  - name: Incidents and their appliances
    query: MATCH (inc:Incident)-[:ON]->(app) RETURN inc, app
  - name: Every assessed appliance, compromised or probed
    query: MATCH (ip:AttackerInfra)-[:TARGETED]->(app:Appliance) RETURN ip, app
  - name: The callback host and everyone who reached it
    query: MATCH (app:Appliance)-[:CONNECTED_TO]->(o:Outbound)-[:DEST]->(dst:IP) WHERE dst.ip = '203.0.113.66' RETURN app, o, dst
  - name: Attack subgraph around one appliance
    query: MATCH (ip:AttackerInfra)-[:PRECEDED_CRASH]->(c:SysEvent)-[:ON]->(app:Appliance) WHERE app.host = 'ns-gw-01' RETURN ip, c, app

statusQuery:
  cypherQuery: >
    MATCH (alert:Alert)
    WITH count(DISTINCT alert) AS alerts
    OPTIONAL MATCH (ip:AttackerInfra)
    WITH alerts, count(DISTINCT ip) AS attackerIps
    OPTIONAL MATCH (inc:Incident)
    RETURN alerts, attackerIps, count(DISTINCT inc) AS incidents

Download Recipe

The recipe needs Quine 2.2.1 or later, the first release that includes the LLM procedures.

The LLM procedures are a preview feature

The API and behavior of llm.prompt, llm.decide, and the quine.llm configuration may change in future versions.

This recipe makes paid calls to two model services

You need an account and an API key for each service: Amazon Bedrock, for a Claude model, and TypeSafe, for the hosted Jev decision model. A full run in which no call is retried makes 199 llm.decide calls and 13 llm.prompt calls.

Scenario

In the sample data, an attacker sends crafted SAML sign-in requests to NetScaler gateway appliances. On a vulnerable appliance, a request crashes nsaaad, the authentication process, and VPN and single sign-on stop until the process restarts. On two appliances the attacker then writes files, and each of those appliances opens an outbound connection to the attacker's callback host. Users who are locked out file helpdesk tickets. Later in the day, the vendor publishes a security advisory that names the callback host and the dropped files.

This is the recipe behind the thatDot post LLM Procedures in Quine. It follows an earlier thatDot post that detects this attack with graph queries alone. The detections here are the same graph queries. The model calls are at the edges of the graph, where the input is free text or the output is for a person:

Work Done by
Attribute each crash to the addresses that signed in before it, promote repeat offenders to attacker infrastructure, alert on repeated crashes, detect the kill chain, and assemble an incident Standing queries
Score how much each sign-in username looks like an attack payload llm.decide, in an ingest query. The score is evidence for an analyst, and no detection reads it.
Read each helpdesk ticket: the service it concerns, the symptom, and whether it reports an outage llm.prompt, in an ingest query
Read the vendor advisory and extract its indicators of compromise (IOCs) llm.prompt, in an ingest query
Choose whether an incident pages the on-call responder or becomes a ticket llm.decide, in a standing query output
Write a brief for each incident from the evidence the graph collected llm.prompt, in a standing query output

The sample data is synthetic

CVE-2026-88779 is a real vulnerability. The advisory in the sample data is fictional demo data, and so are the users, hosts, and events. Every IP address is in a range reserved for documentation.

Sample Data

The sample data and the model configuration file are in one zip file. Download netscaler-llm-triage.zip and unpack it in the directory where you run Quine:

curl -O https://quine-recipe-public.s3.us-west-2.amazonaws.com/netscaler-llm-triage.zip
unzip netscaler-llm-triage.zip

The zip file unpacks to quine.conf and a data directory. The recipe reads the data files by relative path, so run Quine from the directory that holds data, with the recipe file next to it.

File Records Contents
data/auth.ndjson 197 SAML sign-in log
data/http.ndjson 81 HTTP access log
data/sysevents.ndjson 32 Process crashes, process restarts, and file writes
data/egress.ndjson 52 Firewall log of outbound connections from the appliances
data/helpdesk.ndjson 10 Helpdesk tickets, as free text
data/advisory.ndjson 1 The vendor advisory, as free text
data/live.ndjson 0 Empty. You append the advisory to this file while the recipe runs.

The events cover one day, 2026-10-29, on five appliances. Two attacker addresses compromise ns-gw-01 and ns-gw-03, and one of them also probes ns-aaa-01, which does not crash.

How it Works

Ingest Streams Build the Graph

Six ingest streams read the files. Each stream gives a node its id with idFrom, so an address or an appliance that appears in several logs is one node in the graph.

Ingest stream Reads Writes Model call
saml-auth data/auth.ndjson (IP)-[:SENT]->(AuthEvent)-[:TO]->(Appliance) llm.decide, once per record
http-access data/http.ndjson (IP)-[:REQUESTED]->(HttpRequest)-[:TO]->(Appliance) None
system-events data/sysevents.ndjson (SysEvent)-[:ON]->(Appliance) None
firewall-egress data/egress.ndjson (Appliance)-[:CONNECTED_TO]->(Outbound)-[:DEST]->(IP) None
helpdesk data/helpdesk.ndjson Ticket nodes, and (Ticket)-[:REPORTS]->(Service) for outage reports llm.prompt, once per ticket
live data/live.ndjson The Advisory node, and an IOC label on each address the advisory names llm.prompt, once per advisory

The saml-auth stream asks the decision model one yes-no question about each username:

  - name: saml-auth
    source:
      type: File
      path: data/auth.ndjson
      format:
        type: JsonL
    parallelism: 8
    query: |
      MATCH (ip), (auth), (app)
        WHERE id(ip)   = idFrom('ip', $that.src_ip)
          AND id(auth) = idFrom('auth', $that.event_id)
          AND id(app)  = idFrom('appliance', $that.appliance)
      CALL llm.decide(
        {username: $that.username},
        {payload: {type: "yes-no",
                   instructions: "Is this authentication username a machine-generated or injection-style string rather than a name a person would sign in with?"}}
      ) YIELD answers
      SET ip.ip = $that.src_ip, ip: IP,
          auth.username = $that.username,
          auth.endpoint = $that.endpoint,
          auth.ts = $that.ts,
          auth.epoch = $that.epoch,
          auth.suspicionScore = answers.payload.probability,
          auth.payloadShaped = answers.payload.probability >= 0.8,
          auth: AuthEvent,
          app.host = $that.appliance, app: Appliance
      CREATE (ip)-[:SENT]->(auth)-[:TO]->(app)

The answer to a yes-no question is the probability of yes. The query stores it as suspicionScore and sets payloadShaped when it is at least 0.8. The query sets the threshold, and no standing query reads either property.

The helpdesk stream sends each ticket's text to the completion model with a schema of three fields:

  - name: helpdesk
    source:
      type: File
      path: data/helpdesk.ndjson
      format:
        type: JsonL
    query: |
      MATCH (t) WHERE id(t) = idFrom('ticket', $that.ticketId)
      CALL llm.prompt(
        'You are reading one helpdesk ticket, provided in the data block. Decide which service it concerns: "vpn" for remote access or VPN connectivity, "sso" for single sign-on or login portals, or "other". Summarize the symptom in at most eight words. Decide whether the ticket plausibly reports an outage or failure of remote access or sign-on (outageReport). Base everything only on the ticket text.',
        {ticket: $that.text},
        {schema: {
           type: 'object', additionalProperties: false,
           required: ['service', 'symptom', 'outageReport'],
           properties: {
             service: {type: 'string', maxLength: 10},
             symptom: {type: 'string', maxLength: 80},
             outageReport: {type: 'boolean'}
           }
        }}
      ) YIELD response
      SET t.ticketId = $that.ticketId, t.user = $that.user,
          t.ts = $that.ts, t.epoch = $that.epoch, t.text = $that.text,
          t.service = response.service, t.symptom = response.symptom,
          t.outageReport = response.outageReport,
          t.extracted = response IS NOT NULL,
          t: Ticket
      WITH t, response
      WHERE response IS NOT NULL AND response.outageReport = true AND response.service IN ['vpn', 'sso']
      MATCH (svc) WHERE id(svc) = idFrom('service', response.service)
      SET svc.name = response.service, svc: Service
      CREATE (t)-[:REPORTS]->(svc)
      // A ticket can arrive after the incident's brief already fired. This side writes the
      // same CORROBORATED_BY edge for that order; Quine edges are a set, so a ticket the
      // brief already linked is not duplicated.
      WITH t, svc
      MATCH (svc)<-[:AFFECTS]-(inc:Incident)
      WHERE abs(t.epoch - inc.epoch) <= 2700000
      CREATE (inc)-[:CORROBORATED_BY]->(t)

The model returns JSON that conforms to the schema, and the rest of the query decides what to write:

  • Every ticket: the extracted fields become properties on the Ticket node, next to the raw text. When the answer does not conform to the schema, response is null, and extracted is false on that ticket.
  • An outage report about vpn or sso: the ticket gets a REPORTS edge to that Service node.
  • An outage report that arrives after its incident exists: the last clause links the ticket to an incident whose time is within 45 minutes of it.

The system-events stream sets maxPerSecond: 2, so that the standing queries finish attributing one crash before the next crash arrives.

Standing Queries Detect the Attack

Six standing queries run in a chain. Each one after the first matches on something an earlier one wrote.

Standing query Matches Its output writes
crash-watch Each crash of nsaaad A PRECEDED_CRASH edge from each address that signed in to the appliance in the 60 seconds before the crash. An AttackerInfra label on an address that preceded at least 2 crashes with at least 2 requests. An Alert node on the third crash of one appliance inside 15 minutes.
auth-mirror Each sign-in event The same attribution and promotion, started from the sign-in. Whichever log arrives last completes the edge.
attacker-pivot Each AttackerInfra address An assessment on every appliance the address contacted: compromised, or probed, no crash: verify build.
kill-chain A file write on an appliance that has an attributed crash An Alert node and an Incident node, when the write came after the first attributed crash and the appliance then connected to a destination that has the IOC label or that no healthy appliance has contacted.
incident-brief Each Incident node The severity from llm.decide and the brief from llm.prompt, as properties on the incident.
page-on-call Each incident whose severity is page Nothing. It prints the brief to standard output.

The first five send their results to a Drop destination, because the Cypher query in each output does the work by writing to the graph.

The kill-chain pattern matches on the AttackerInfra label and the PRECEDED_CRASH edge, which the earlier standing queries write:

  - name: kill-chain
    pattern:
      type: Cypher
      query: >
        MATCH (ip:AttackerInfra)-[:PRECEDED_CRASH]->(c:SysEvent)-[:ON]->(app:Appliance)<-[:ON]-(fw:SysEvent)
        WHERE fw.event_type = 'file_write'
        RETURN DISTINCT id(fw) AS id

The pattern therefore completes only after attribution and promotion have, whatever order the raw logs arrive in.

The Models Choose the Severity and Write the Brief

The kill-chain output sets the Incident label last, after the incident's edges exist. The incident-brief output then collects what the graph holds about the incident into one map, evidence. Both model calls receive that map and nothing else. This is the end of that output's query, from the point where it builds the map:

            WITH inc, app,
                 {appliance: app.host, attackers: attackers,
                  attributedCrashes: attributedCrashes, crashTimes: crashTimes,
                  droppedFiles: droppedFiles, egressTo: egressTo,
                  egressIsKnownIoc: iocContacts > 0,
                  userOutageReportsInWindow: userReports} AS evidence
            CALL llm.decide(
              evidence,
              {severity: {type: "choice", options: ["page", "ticket"],
                          instructions: "Given this evidence about one authentication gateway appliance, should the on-call responder be paged immediately (page), or is a tracked ticket during business hours enough (ticket)?"}}
            ) YIELD answers
            CALL llm.prompt(
              'You are writing an incident brief for a security responder. The data block holds evidence a streaming graph assembled about one appliance: the attacker addresses, how many service crashes were attributed to them and when, the files dropped afterward, the outbound callback destination, and how many users reported outages in the window. State only facts present in the evidence; never invent counts, times, addresses, or causes. The timeline entries must be chronological and one sentence each. Give at most eight timeline entries and at most five recommended actions.',
              evidence,
              {schema: {
                 type: 'object', additionalProperties: false,
                 required: ['title', 'summary', 'timeline', 'recommendedActions'],
                 properties: {
                   title: {type: 'string', maxLength: 90},
                   summary: {type: 'string', maxLength: 600},
                   timeline: {type: 'array', maxItems: 8, items: {type: 'string', maxLength: 160}},
                   recommendedActions: {type: 'array', maxItems: 5, items: {type: 'string', maxLength: 120}}
                 }
              }}
            ) YIELD response
            SET inc.severity = answers.severity.choice,
                inc.severityConfidence = answers.severity.confidence,
                inc.title = response.title,
                inc.summary = response.summary,
                inc.timeline = response.timeline,
                inc.recommendedActions = response.recommendedActions,
                inc.briefed = response IS NOT NULL
            RETURN id(inc) AS briefed

llm.decide answers a choice question with page or ticket. llm.prompt writes the brief under a schema that bounds its shape: a title, a summary, at most eight timeline entries, and at most five recommended actions. One SET writes the severity and the brief together. When the brief does not conform to the schema, briefed is false on the incident.

A brief is written when its kill chain completes, from what the graph holds at that moment. Crashes, file writes, and tickets that arrive later are not in it. The helpdesk stream still links a later ticket to the incident with a CORROBORATED_BY edge.

The severity is the one place where a model's answer controls an action. page-on-call matches only an incident whose severity is page:

  - name: page-on-call
    pattern:
      type: Cypher
      query: >
        MATCH (inc:Incident) WHERE inc.severity = 'page' RETURN DISTINCT id(inc) AS id
    outputs:
      - name: send-page
        resultEnrichment:
          query: |
            MATCH (inc:Incident) WHERE id(inc) = $that.data.id
            RETURN inc.appliance AS appliance, inc.title AS title, inc.summary AS summary,
                   inc.recommendedActions AS actions
        destinations:
          - type: StandardOut

Because the severity and the brief arrive in one SET, the brief is present when this standing query matches.

The Advisory Arrives Late

The live stream reads data/live.ndjson with fileIngestMode: NAMED_PIPE. In this mode Quine reads to the end of the file and then checks it for more data every second, so a line you append during the run is ingested as it arrives. See Files and Named Pipes for the modes. This is the stream's source:

  - name: live
    source:
      type: File
      path: data/live.ndjson
      fileIngestMode: NAMED_PIPE
      format:
        type: JsonL
    parallelism: 1

A line with an advisoryId is handled by this part of the stream's query:

      // advisory: extract the IOCs onto the IP and path nodes the graph already keys
      CALL {
        WITH stream
        WITH stream WHERE stream = 'advisory'
        MATCH (adv) WHERE id(adv) = idFrom('advisory', $that.advisoryId)
        CALL llm.prompt(
          'You are reading one vendor security advisory, provided in the data block. The advisory is fictional demonstration data about a real CVE, written for a product demo; no real systems or real addresses are involved. Extract exactly what it states: the CVE identifier; the affected process name; every IP address it names as attacker or callback infrastructure; every file path it describes as written or dropped during exploitation; the affected build range as one string; and a one-sentence summary. Use only information in the advisory text.',
          {advisory: $that.text},
          {schema: {
             type: 'object', additionalProperties: false,
             required: ['cve', 'process', 'iocIps', 'droppedPaths', 'affectedBuilds', 'summary'],
             properties: {
               cve: {type: 'string', maxLength: 30},
               process: {type: 'string', maxLength: 30},
               iocIps: {type: 'array', items: {type: 'string', maxLength: 45}},
               droppedPaths: {type: 'array', items: {type: 'string', maxLength: 120}},
               affectedBuilds: {type: 'string', maxLength: 80},
               summary: {type: 'string', maxLength: 300}
             }
          }}
        ) YIELD response
        SET adv.advisoryId = $that.advisoryId, adv.source = $that.source,
            adv.published = $that.published,
            adv.cve = response.cve, adv.process = response.process,
            adv.affectedBuilds = response.affectedBuilds, adv.summary = response.summary,
            adv.extracted = response IS NOT NULL,
            adv: Advisory
        WITH adv, response
        WHERE response IS NOT NULL
        CALL {
          WITH adv, response
          UNWIND coalesce(response.iocIps, []) AS i
          MATCH (ip) WHERE id(ip) = idFrom('ip', i)
          SET ip.ip = i, ip.ioc = true, ip.ioc_source = adv.advisoryId, ip: IOC
          CREATE (adv)-[:NAMES]->(ip)
        }
        CALL {
          WITH adv, response
          UNWIND coalesce(response.droppedPaths, []) AS p
          MATCH (path) WHERE id(path) = idFrom('path', p)
          SET path.path = p, path: IOCPath
          CREATE (adv)-[:NAMES_PATH]->(path)
        }
      }

The query writes the extracted fields onto an Advisory node. For each address in iocIps, it sets the IOC label on the node with the id idFrom('ip', ...) and adds a NAMES edge from the advisory. The firewall-egress stream gives every destination address the same id, so the label lands on the node that the compromised appliances already connect to.

Configuring the Models

The recipe names no model. Each call uses the default profile for its kind, which quine.conf sets under quine.llm: bedrock-claude for llm.prompt and hosted-jev for llm.decide. This is quine.conf:

quine.llm {
  # Which profile each procedure uses when a call does not name one.
  default-profiles {
    completion = "bedrock-claude"
    decision = "hosted-jev"
  }
  profiles {
    # Claude on Amazon Bedrock through the Anthropic-compatible endpoint. No Bedrock-specific
    # code is involved: the endpoint speaks the anthropic-messages wire format, so a base-url
    # and an API key are the whole integration. The model id must be the cross-region
    # inference profile id (the `us.` prefix); the bare id is rejected by Bedrock.
    bedrock-claude {
      api { type = anthropic-messages }
      base-url = "https://bedrock-runtime.us-west-2.amazonaws.com/anthropic"
      model = "us.anthropic.claude-sonnet-5"
      api-key = ${?QUINE_LLM_BEDROCK_KEY}
      max-tokens = 4096
      max-concurrent-requests = 8
      request-timeout = 60s
    }
    # The hosted Jev decision model. Bedrock serves no decision model, so llm.decide stays
    # on TypeSafe's hosted endpoint. The key comes from the environment, never this file.
    hosted-jev {
      api { type = jev-systemone }
      base-url = "https://api.typesafe.ai"
      model = "jev-latest"
      api-key = ${?QUINE_LLM_JEV_KEY}
      max-concurrent-requests = 8
      request-timeout = 30s
    }
  }
}

The zip file holds this file. You can also download it on its own:

Download quine.conf

To set up the two model services:

  1. In Amazon Bedrock, get access to a Claude model and create an Amazon Bedrock API key.
  2. Check base-url and model in quine.conf. As shipped, they name the us-west-2 region and the inference profile id us.anthropic.claude-sonnet-5. To use another region or model, change them. model must be an inference profile id, which has a prefix such as us., because Bedrock rejects the bare model id. This command lists the ids your account can use:

    aws bedrock list-inference-profiles --region us-west-2
    
  3. Get an API key from TypeSafe for the hosted Jev model.

  4. Set both keys in the environment of the shell that starts Quine:

    export QUINE_LLM_BEDROCK_KEY=<your Bedrock API key>
    export QUINE_LLM_JEV_KEY=<your TypeSafe API key>
    

quine.conf reads the keys from the environment, so no key is stored in the file. Configuring Profiles describes every profile setting.

A rejected key stops the stream that made the call

When a model endpoint rejects a key or a model id, the ingest stream or standing query output that made the call stops. In Ingests and Standing Queries describes how each kind of error is handled.

Running the Recipe

Start Quine with the configuration file and the recipe:

java -Dconfig.file=quine.conf -jar quine-2.2.2.jar -r netscaler-llm-triage.yaml

Quine starts the standing queries and the ingest streams:

Graph is ready
Using 16 node appearances
Using 5 quick queries
Using 5 sample queries
Running Standing Query crash-watch
Running Standing Query auth-mirror
Running Standing Query attacker-pivot
Running Standing Query kill-chain
2026-11-25 13:14:02,785 WARN [NotFromActor] [graph-service-pekko.actor.default-dispatcher-14] com.thatdot.quine.app.model.outputs2.query.CypherQuery - Could not verify that the provided Cypher query is idempotent. If timeouts or external system errors occur, query execution may be retried and duplicate data may be created. To avoid this set shouldRetry = false in the Standing Query output
Running Standing Query incident-brief
Running Standing Query page-on-call
2026-11-25 13:14:03,031 WARN [NotFromActor] [graph-service-pekko.quine.graph-shard-dispatcher-16] com.thatdot.quine.app.model.ingest2.source.QuineValueIngestQuery$ - Could not verify that the provided ingest query is idempotent. If timeouts occur, query execution may be retried and duplicate data may be created.
Ingest Stream saml-auth: Could not verify that the provided ingest query is idempotent. If timeouts occur, query execution may be retried and duplicate data may be created.
Running Ingest Stream saml-auth
Running Ingest Stream http-access
Running Ingest Stream system-events
Running Ingest Stream firewall-egress
2026-11-25 13:14:03,190 WARN [NotFromActor] [graph-service-pekko.quine.graph-shard-dispatcher-16] com.thatdot.quine.app.model.ingest2.source.QuineValueIngestQuery$ - Could not verify that the provided ingest query is idempotent. If timeouts occur, query execution may be retried and duplicate data may be created.
Ingest Stream helpdesk: Could not verify that the provided ingest query is idempotent. If timeouts occur, query execution may be retried and duplicate data may be created.
Running Ingest Stream helpdesk
2026-11-25 13:14:03,295 WARN [NotFromActor] [graph-service-pekko.quine.graph-shard-dispatcher-17] com.thatdot.quine.app.model.ingest2.source.QuineValueIngestQuery$ - Could not verify that the provided ingest query is idempotent. If timeouts occur, query execution may be retried and duplicate data may be created.
Ingest Stream live: Could not verify that the provided ingest query is idempotent. If timeouts occur, query execution may be retried and duplicate data may be created.
Running Ingest Stream live

The timestamps and thread names in the warning lines differ on your machine. The warnings are expected. llm.prompt and llm.decide are not idempotent, so Quine cannot verify that a query that calls them is safe to run again.

The console prints the result of the recipe's status query during the run. When the four log files and the tickets are ingested, it shows 6 alerts, 2 attacker addresses, and 2 incidents:

---[ Status Query result 1 ]------------
alerts      | 6
attackerIps | 2
incidents   | 2
------------+---------------------------

These counts do not depend on the models' answers. The detections that produce them read the logs, and none of them reads the username score, the ticket fields, the severity, or the brief. kill-chain also accepts the IOC label that the advisory adds, which does not change these counts. The counts are 6, 2, and 2 when every model call succeeds. The 6 alerts are two repeated-crash alerts, one for each compromised appliance, and four kill-chain alerts, one for each of the two files dropped on each of those appliances.

When the decision model chooses page for an incident, page-on-call prints that incident's brief as one line of JSON. This is the line for ns-gw-01:

{"appliance":"ns-gw-01","title":"Suspected Compromise of ns-gw-01 Linked to 198.51.100.77","summary":"Streaming graph evidence shows attacker IP 198.51.100.77 attributed to 2 service crashes on appliance ns-gw-01, followed by a dropped file and outbound traffic to 203.0.113.66 (not a known IOC). 2 user outage reports were recorded in the window.","actions":["Isolate ns-gw-01 from the network pending further investigation.","Block inbound/outbound traffic to and from 198.51.100.77 at the perimeter.","Forensically examine the file /var/tmp/v for malicious content or persistence mechanisms.","Monitor and consider blocking outbound connections to 203.0.113.66 pending reputation review.","Correlate the 2 user outage reports with the crash times to confirm impact scope."]}

This is the line for ns-gw-03:

{"appliance":"ns-gw-03","title":"Two Crashes Attributed to 198.51.100.143 on ns-gw-03 Followed by File Drop and Egress","summary":"The streaming graph attributes two service crashes on appliance ns-gw-03 to attacker address 198.51.100.143. Shortly after the second crash, a file was dropped at /var/tmp/v by user nobody. Outbound traffic was observed to 203.0.113.66, which is not flagged as a known IOC. Three users reported outages during the observed window.","actions":["Isolate ns-gw-03 from the network pending further investigation.","Block or monitor traffic to and from 198.51.100.143.","Inspect and preserve the file /var/tmp/v for forensic analysis.","Review outbound connections to 203.0.113.66 for further context, noting it is not currently a known IOC.","Correlate the three user-reported outages with the crash and file-drop timestamps."]}

The model writes the title, the summary, and the actions, so their wording differs between runs. The number of outage reports a brief states can also differ, because it counts the tickets that were in the graph when the brief was written. When the decision model chooses ticket for an incident, no line is printed for it, and the incident and its brief are still in the graph.

Deliver the Advisory

After the status query result shows 2 incidents, append the advisory to the live file from a second terminal, in the same directory:

cat data/advisory.ndjson >> data/live.ndjson

The live stream reads the new line and calls llm.prompt to extract the advisory's IOCs. Nothing is printed to the console. To see the result, open http://localhost:8080, click Exploration UI in the left navigation, and run this query:

MATCH (inc:Incident)-[:EGRESS_TO]->(dst)<-[:NAMES]-(adv) RETURN inc, dst, adv

The screenshots on this page come from a different run than the console output above, so the incident titles and the recommended actions in them differ from the JSON lines. Both incidents and the advisory point at the same node, the callback host 203.0.113.66:

The Exploration UI showing two Incident nodes, each with an EGRESS_TO edge to the node IOC 203.0.113.66, and the Advisory node ADV-DEMO-2026-88779 with a NAMES edge to the same node

The incidents existed before the advisory arrived. The kill-chain detection had already flagged the callback host, because no healthy appliance had contacted it. The advisory adds the IOC label and its source to that node afterward.

Empty data/live.ndjson before you run the recipe again

The advisory stays in data/live.ndjson after the run. If the file still holds it at the next start, the live stream reads the advisory at once, before the incidents exist.

Summary

The standing queries detect the attack and assemble each incident, and the models work only on what the graph hands them: ten tickets, one advisory, two sets of incident evidence, and one username at a time.

After the advisory is delivered, this query returns the ns-gw-01 incident with its appliance, the attacker address, the attributed crashes, the corroborating tickets, the callback host, and the advisory:

MATCH (inc:Incident)-[:ON]->(app:Appliance) WHERE app.host = 'ns-gw-01' MATCH (inc)-[:ATTRIBUTED_TO]->(attacker)-[:PRECEDED_CRASH]->(crash:SysEvent)-[:ON]->(app) MATCH (inc)-[:CORROBORATED_BY]->(ticket:Ticket) MATCH (inc)-[:EGRESS_TO]->(ioc)<-[:NAMES]-(adv:Advisory) RETURN DISTINCT inc, app, attacker, crash, ticket, ioc, adv

The Exploration UI showing the ns-gw-01 Incident node with CORROBORATED_BY edges to three tickets, an EGRESS_TO edge to IOC 203.0.113.66, which the advisory ADV-DEMO-2026-88779 names, an ON edge to the appliance ns-gw-01, and an ATTRIBUTED_TO edge to the attacker address 198.51.100.77, which has PRECEDED_CRASH edges to five nsaaad crash nodes

In the screenshot, the nodes are arranged by hand. The lower half is the detection, with the attacker address, five crashes of nsaaad, and the compromised appliance. The upper half comes from the model calls, with the tickets the model read as outage reports and the advisory whose IOC the model extracted. The incident's label in the graph is the title the model wrote for it, so yours will differ.

The model's output is stored as properties on the Incident node. To see them, right-click the node and select View properties. In the screenshot, the panel is open on the ns-gw-01 incident in the result of a shorter query, which returns the incident, its appliance, and the attacker address:

The Exploration UI showing the properties panel of the ns-gw-01 Incident node, with briefed true, egressTo 203.0.113.66, the recommendedActions list, and severity page

The recipe includes sample queries as starting points. Click in the empty query bar to list them:

Sample query Returns
Promoted attacker infrastructure The addresses with the AttackerInfra label
Incidents and their appliances Each incident and the appliance it is on
Every assessed appliance, compromised or probed Each attacker address and the appliances it targeted
The callback host and everyone who reached it The appliances that connected to 203.0.113.66
Attack subgraph around one appliance The attacker address, the crashes, and the appliance for ns-gw-01

Right-click a node to run one of the recipe's quick queries:

Quick Query Node Type Description
Adjacent Nodes All Display the nodes that are adjacent to this node
Refresh All Refresh the content stored in a node
Local Properties All Display the properties stored by the node
System Events Appliance Load the system events recorded on this appliance
Full Evidence Incident Load every node joined to this incident

The recipe prints each page to standard output. To send it to a person or a pipeline, change the destination of page-on-call to one of the other output destinations, such as Slack, an HTTP endpoint, SNS, Kafka, or Kinesis.