guard-core-engine 4.0.4

Detection engine for the Guard ecosystem: pattern compilation, input preprocessing, and semantic analysis.
Documentation
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
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
//! Canonical detection pattern table for guard-core spec 4.0.2.
//!
//! Generated from the reference (`guard_core/handlers/_suspatterns_pattern_table.py`)
//! via the TS port's canonical table. The `source` strings are carried verbatim on
//! threats and compared by the conformance corpus; regenerate from the
//! reference when the spec moves. Entry `id` is the table position and keys
//! the matcher dispatch in `mod.rs`.

use std::sync::LazyLock;

pub const CTX_ALL: &[&str] = &[
    "query_param",
    "header",
    "url_path",
    "request_body",
    "unknown",
];
pub const CTX_CMD_INJECTION: &[&str] = &["query_param", "header", "request_body", "unknown"];
pub const CTX_SENSITIVE_PATH_FAMILY: &[&str] =
    &["query_param", "url_path", "request_body", "unknown"];
pub const CTX_SQLI_NARROW: &[&str] = &["query_param", "request_body", "unknown"];

pub struct TableEntry {
    pub id: usize,
    pub source: &'static str,
    pub contexts: &'static [&'static str],
    pub category: &'static str,
}

pub static PATTERN_DEFINITIONS: LazyLock<Vec<TableEntry>> = LazyLock::new(|| {
    vec![
        TableEntry {
            id: 0,
            source: r"<script[^>]*>[^<]*<\/script\s*>",
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 1,
            source: r"javascript:\s*[^\s]+",
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 2,
            source: r"j[\t\r\n]*a[\t\r\n]*v[\t\r\n]*a[\t\r\n]*s[\t\r\n]*c[\t\r\n]*r[\t\r\n]*i[\t\r\n]*p[\t\r\n]*t[\t\r\n]*:\s*[^\s]+",
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 3,
            source: r#"(?:<[A-Za-z/](?:[^<>]*[^<>\s/])?(?<!=)(?<!=\")(?<!=')[\s/]+(?:onwebkitplaybacktargetavailabilitychanged|oncontentvisibilityautostatechange|onwebkitpresentationmodechanged|onwebkitmouseforcewillbegin|onwebkitanimationiteration|onsecuritypolicyviolation|onwebkitmouseforcechanged|onvalidationstatuschange|onwebkitfullscreenchange|onwebkitwillrevealbottom|onwebkitanimationstart|onwebkitmouseforcedown|onbeforescriptexecute|onmozfullscreenchange|onwebkittransitionend|onafterscriptexecute|onanimationiteration|onlostpointercapture|onscrollsnapchanging|onunhandledrejection|onwebkitanimationend|onwebkitmouseforceup|ondeviceorientation|ongotpointercapture|onbeforedeactivate|onfullscreenchange|onpointerrawupdate|onreadystatechange|onrejectionhandled|onscrollsnapchange|ontransitioncancel|onanimationcancel|onbeforeeditfocus|oncontextrestored|ondatasetcomplete|onselectionchange|ontransitionstart|onanimationstart|onbeforeactivate|oncanplaythrough|ondatasetchanged|ondurationchange|onlanguagechange|onlayoutcomplete|onloadedmetadata|onpropertychange|oncontrolselect|ondataavailable|ongesturechange|onmediacomplete|onpointercancel|onpromptdismiss|ontransitionend|ontransitionrun|onwebkitneedkey|onanimationend|onbeforetoggle|onbeforeunload|onbeforeupdate|ondevicemotion|onfilterchange|ongesturestart|onmessageerror|onpointerenter|onpointerleave|onpromptaction|onsyncrestored|onvolumechange|onafterupdate|onbeforeinput|onbeforematch|onbeforepaste|onbeforeprint|oncontextlost|oncontextmenu|onerrorupdate|onlosecapture|onpointerdown|onpointermove|onpointerover|onresizestart|onrowinserted|onselectstart|ontouchcancel|ontrackchange|onafterprint|onbeforecopy|oncellchange|ondeactivate|ongestureend|onhashchange|onloadeddata|onmediaerror|onmouseenter|onmouseleave|onmousewheel|onpagereveal|onpointerout|onratechange|onslotchange|ontimeupdate|ontouchstart|onbeforecut|oncuechange|ondragenter|ondragleave|ondragstart|onloadstart|onmousedown|onmousemove|onmouseover|onmovestart|onoutofsync|onpointerup|onresizeend|onrowdelete|onrowsenter|onscrollend|ontimeerror|ontouchmove|onactivate|onauxclick|ondblclick|ondragdrop|ondragexit|ondragover|onfocusout|onformdata|onkeypress|onlocation|onmouseout|onpagehide|onpageshow|onpageswap|onpopstate|onprogress|ontouchend|oncanplay|oncommand|ondragend|onemptied|onfocusin|oninvalid|onkeydown|onmessage|onmouseup|onmoveend|onoffline|onplaying|onreverse|onrowexit|onseeking|onstalled|onstorage|onsuspend|onurlflip|onwaiting|onbounce|oncancel|onchange|onfinish|ononline|onrepeat|onresize|onresume|onscroll|onsearch|onseeked|onselect|onsubmit|ontoggle|onunload|onabort|onbegin|onclick|onclose|onended|onerror|onfocus|oninput|onkeyup|onpaste|onpause|onreset|onstart|onwheel|onblur|oncopy|ondrag|ondrop|onhelp|onload|onmove|onplay|onredo|onseek|onstop|onundo|oncut|onend)\s*=\s{0,20}(?:[\"'][^\"']*[\"']|[^\s>]+))"#,
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 4,
            source: r#"(?:<[A-Za-z/](?:[^<>]*[^<>\s])?\s+(?:href|src|data|action)\s*=[\s\"\']*(?:javascript|vbscript|data):)"#,
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 5,
            source: r#"(?:<[A-Za-z/][^<>]*style\s*=\s{0,20}[\"']?[^<>\"']*(?:expression|behavior|url)\s*\([^)]*\))"#,
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 6,
            source: r"(?:<object[^>]*>[\s\S]*<\/object\s*>)",
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 7,
            source: r"(?:<embed[^>]*>[\s\S]*<\/embed\s*>)",
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 8,
            source: r"(?:<applet[^>]*>[\s\S]*<\/applet\s*>)",
            contexts: CTX_ALL,
            category: r"xss",
        },
        TableEntry {
            id: 9,
            source: r"(?i)\bSELECT\b(?:(?!\bSELECT\b)[\w\s,\*().])*?\bFROM\b",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 10,
            source: r"(?i)SELECT\s+\*",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 11,
            source: r#"(?i)\bWHERE\s+[\w."]+\s*(?:=|<|>|<=|>=|LIKE|IN)\b"#,
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 12,
            source: r#"(?i)\b(?:OR|AND)\s*(\d+|'[^']*'|\"[^\"]*\"|[@:$][A-Za-z_]\w*)\s*=\s*\1\b"#,
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 13,
            source: r"(?i)UNION\s+(?:ALL\s+)?SELECT",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 14,
            source: r"(?i)('\s*(?:OR|AND)[\s(]*'?(?:[@:$][A-Za-z_]\w*|[\d\w]+)\s*(?:LIKE|[<>]=?|=)[\s(]*'?(?:[@:$][A-Za-z_]\w*|[\d\w]+))",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 15,
            source: r"(?i)(UNION\s+(?:ALL\s+)?SELECT\s+NULL(?:[,\s]*NULL)*[,\s]*|\(\s*SELECT\s+(?:@@|VERSION))",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 16,
            source: r"(?i)(?:INTO\s+(?:OUTFILE|DUMPFILE)\s+'[^']+')",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 17,
            source: r"(?i)(?:LOAD_FILE\s*\([^)]+\))",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 18,
            source: r"(?i)(?:BENCHMARK\s*\(\s*\d+\s*,)",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 19,
            source: r"(?i)(?:SLEEP\s*\(\s*\d+\s*\))",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 20,
            source: r"(?i)(?:\/\*![0-9]*\s*(?:OR|AND|UNION|SELECT|INSERT|DELETE|DROP|CONCAT|CHAR|UPDATE)\b)",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 21,
            source: r"\w/\*(?!!)[^*]*\*/\w",
            contexts: CTX_SQLI_NARROW,
            category: r"sqli",
        },
        TableEntry {
            id: 22,
            source: r"(?i)(?:OR|AND)\s+(?:'[\w\d]*'='[\w\d]*'?|[@:$][A-Za-z_]\w*\s*=\s*[@:$][A-Za-z_]\w*)",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 23,
            source: r"(?i);\s*(?:DROP|TRUNCATE|ALTER|CREATE)\s+(?:TABLE|DATABASE|SCHEMA)\b",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 24,
            source: r"(?i);\s*(?:INSERT\s+INTO|UPDATE\s+\w+\s+SET|DELETE\s+FROM|SELECT\b[^;]*?\bFROM\b|REPLACE\s+INTO)\b",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 25,
            source: r"(?i)\bEXEC(?:UTE)?\s+(?:xp_\w+|sp_\w+)",
            contexts: CTX_SQLI_NARROW,
            category: r"sqli",
        },
        TableEntry {
            id: 26,
            source: r#"(?i)(?:\A|[;'\"])\s*EXEC(?:UTE)?\s+(?:xp_\w+|sp_\w+)"#,
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 27,
            source: r"(?i)\bORDER\s+BY\s+\d+\s*(?:--|#|;|\)|,|/\*|\Z)|(?<=[=?&])ORDER\s+BY\s+\d+\s*\n",
            contexts: CTX_SQLI_NARROW,
            category: r"sqli",
        },
        TableEntry {
            id: 28,
            source: r#"(?i)(?:['\")\d]|/\*)\s{0,3}\bORDER\s+BY\s+\d+|\bORDER\s+BY\s+\d+\s*(?:--|#|/\*)"#,
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 29,
            source: r"'\s*(?:[\);]+\s*)?--|'[\);]*#(?:\n|\Z)",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 30,
            source: r"(?i)\bWAITFOR\s+(?:DELAY|TIME)\s+'\d{1,2}:\d{1,2}:\d{1,2}(?:\.\d+)?'",
            contexts: CTX_ALL,
            category: r"sqli",
        },
        TableEntry {
            id: 31,
            source: r"(?:\.\.\/|\.\.\\)(?:\.\.\/|\.\.\\)+",
            contexts: CTX_ALL,
            category: r"dir_traversal",
        },
        TableEntry {
            id: 32,
            source: r#"\A(?:(?!\n).)*etc/(?:passwd|shadow|group|hosts|motd|issue|mysql/my\.cnf|ssh/ssh_config)(?:[&#;,\"'<>]|\s*\Z)"#,
            contexts: CTX_ALL,
            category: r"dir_traversal",
        },
        TableEntry {
            id: 33,
            source: r"\A(?=(?:(?!\n).)*\b(?:scan(?:ner|ning|ned|s)?|attack(?:er|ers|ed|s)?|attempt(?:ed|s)?|exploit(?:ation|ed|s|ing|kit)?|prob(?:e|ed|es|ing)|malicious|intrusion(?:s)?|botnet(?:s)?|honeypot(?:s)?|brute[- ]force|credential[- ]stuffing|threat feed|vulnerabilit(?:y|ies)|hostile|recon(?:naissance)?|spoofed referer|bad actor(?:s)?|WAF|IDS|SOC|pentest(?:ing)?|blocked|flagged|triggered|denied|enumerat(?:e|ed|ing)|suspicious)\b)\A(?:(?!\n).)*[/\\](?:etc/(?:passwd|shadow|group|hosts|motd|issue|mysql/my\.cnf|ssh/ssh_config))(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?\b",
            contexts: CTX_ALL,
            category: r"dir_traversal",
        },
        TableEntry {
            id: 34,
            source: r#"\A(?:(?!\n).)*(?:boot\.ini|win\.ini|system\.ini|config\.sys)(?:[&#;,\"'<>]|\s*\Z)"#,
            contexts: CTX_ALL,
            category: r"dir_traversal",
        },
        TableEntry {
            id: 35,
            source: r#"\A(?:(?!\n).)*proc/self/environ(?:[&#;,\"'<>]|\s*\Z)"#,
            contexts: CTX_ALL,
            category: r"dir_traversal",
        },
        TableEntry {
            id: 36,
            source: r#"\A(?:(?!\n).)*var/log/[^\s/]+(?:[&#;,\"'<>]|\s*\Z)"#,
            contexts: CTX_ALL,
            category: r"dir_traversal",
        },
        TableEntry {
            id: 37,
            source: r"\.\.;[^/\\]*[/\\]",
            contexts: CTX_ALL,
            category: r"dir_traversal",
        },
        TableEntry {
            id: 38,
            source: r";\s*(?:ls|cat|rm|chmod|chown|wget|curl|nc|netcat|ping|telnet)\s+-[a-zA-Z]+\s+",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 39,
            source: r"\|\s*(?:wget|curl|fetch|lwp-download|lynx|links|GET)\s+",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 40,
            source: r"(?:[;&|]\s*(?:\$\([^)]+\)|\$\{[^}]+\}))",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 41,
            source: r"\A\s*(?:[;&|]\s*)*`\s*(?:[A-Za-z0-9_./~]|\$[({])(?:[^`\\\n]|\\.)*(?:\n\s*)?`(?:\s*[;&|]\s*`\s*(?:[A-Za-z0-9_./~]|\$[({])(?:[^`\\\n]|\\.)*(?:\n\s*)?`)*\s*(?:[;&|]\s*)*\Z",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 42,
            source: r"(?<!`)`(?:[A-Za-z0-9_./~]|\$[({])(?:[^`\\\n]|\\.)*`",
            contexts: CTX_ALL,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 43,
            source: r"\$\((?:[^()\\\n]|\\.)*\)|\$\{(?:[^{}\\\n]|\\.)*\}",
            contexts: CTX_ALL,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 44,
            source: r"(?i)\$\{(?:jndi:(?:ldap|rmi|dns)://|\$?\{?(?:lower|upper):j\}ndi|::-j\}ndi)",
            contexts: CTX_ALL,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 45,
            source: r#"(?:\A|[;|&])\s*/?(?:[\w.-]+/)*(?:env\s+/?(?:[\w.-]+/)*)?(?:bash|sh|ksh|csh|tsch|zsh|ash)\s+-[a-zA-Z]+(?:\s+(?:'[^']*'|\"[^\"]*\"|[^\s;|&]+))?(?=\s*(?:[;|&]|\Z))"#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 46,
            source: r"(?:\A|[;|&])\s*[^=\s;|&]+=[^\s;|&]+\s+(?:/?(?:[\w.-]+/)*env\s+)?/?(?:[\w.-]+/)*(?:bash|sh|ksh|csh|tsch|zsh|ash)\s+-[a-zA-Z]+",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 47,
            source: r"\n[^\S\r\n]*(?:[^=\s;|&]+=[^\s;|&]+\s+)*(?:/?(?:[\w.-]+/)*env\s+)?/?(?:[\w.-]+/)*(?:bash|sh|ksh|csh|tsch|zsh|ash)\s+-c\b",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 48,
            source: r"\b(?:eval|system|exec|shell_exec|passthru|popen|proc_open|create_function)\s*\(",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 49,
            source: r#"(?:require\(\s*[\"']child_process[\"']\s*\)|child_process)\s*\.\s*(?:execSync|spawnSync|spawn|fork)\s*\("#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 50,
            source: r"\bassert\s*\(\s*\$",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 51,
            source: r"\bos\.exec(?:l|le|lp|lpe|v|ve|vp|vpe)\s*\(",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 52,
            source: r#"\b(?:new\s+)?Function\s*\(\s*[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 53,
            source: r#"\[\s*[\"']eval[\"']\s*\]\s*\(\s*[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 54,
            source: r#"(?:\.\s*constructor|\[\s*[\"']constructor[\"']\s*\])\s*(?:\.\s*constructor|\[\s*[\"']constructor[\"']\s*\])\s*\(\s*[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 55,
            source: r#"\b(?:setTimeout|setInterval)\s*\(\s*[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 56,
            source: r"[;|&]\s*(?:ls|cat|rm|id|whoami|uname|wget|curl|nc|netcat|socat|bash|sh|python|perl)\b",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 57,
            source: r"(?i)\b(?:nc|netcat|ncat)\s+-[a-z]*e\b|/dev/tcp/\d",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 58,
            source: r#"(?:\A|[;&|]\s*|\$\()\{[^{}\s,:'\"][^{},:'\"]*(?:,(?:[^{}\s,:'\"][^{},:'\"]*)?)+\}"#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 59,
            source: r#"\w+(?:['\"]+\w+){1,10}"#,
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 60,
            source: r"[A-Za-z0-9_./*?-]*[?*][A-Za-z0-9_./*?-]*",
            contexts: CTX_CMD_INJECTION,
            category: r"cmd_injection",
        },
        TableEntry {
            id: 61,
            source: r"(?:php|data|zip|rar|file|glob|expect|input|phpinfo|zlib|phar|ssh2|rar|ogg|expect)://[^\s]+",
            contexts: CTX_ALL,
            category: r"file_inclusion",
        },
        TableEntry {
            id: 62,
            source: r"(?:(?<!:)\/\/[0-9a-zA-Z](?:[-\w]*[0-9a-zA-Z])?(?:\.[0-9a-zA-Z](?:[-\w]*[0-9a-zA-Z])?)+(:[0-9]+)?(?:\/?)(?:[a-zA-Z0-9\-\.\?,'/\\\+&amp;%\$#_]*)?)",
            contexts: CTX_ALL,
            category: r"file_inclusion",
        },
        TableEntry {
            id: 63,
            source: r#"=(?:https?|ftp):\/\/[^\s'\"<>]+\/[^\s'\"<>\/]*\.(?:phtml|php[3-5]?|phar|jsp|aspx?|pl|py|txt|inc)(?![a-zA-Z0-9])"#,
            contexts: CTX_ALL,
            category: r"file_inclusion",
        },
        TableEntry {
            id: 64,
            source: r#"[\"'](?:template|include|tpl|module|layout)[\"']\s*:\s*[\"'](?:https?|ftp)://[^\s'\"<>]+/[^\s'\"<>/]*\.(?:phtml|php[3-5]?|phar|jsp|aspx?|cgi|pl|py|sh|txt|inc)(?![a-zA-Z0-9])[\"']"#,
            contexts: CTX_ALL,
            category: r"file_inclusion",
        },
        TableEntry {
            id: 65,
            source: r"\([\s]*[|&][\s]*\([^)(]+=[*]",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 66,
            source: r"\*\s*\)+\s*(?:[|&!]\s*)?\(+\s*(?:[&|!]|(?::)?(?:[a-zA-Z][\w.-]*|\d+(?:\.\d+)*)(?:;[\w.-]+)*(?::[\w.-]+)*\s*:?=)",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 67,
            source: r"\)\s*\(\s*(?:[&|!]|(?::)?(?:[a-zA-Z][\w.-]*|\d+(?:\.\d+)*)(?:;[\w.-]+)*(?::[\w.-]+)*\s*:?[=~<>])",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 68,
            source: r"\(\s*[&|]\s*",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 69,
            source: r"\*\)[|&]?\(+\s*(?::)?(?:[a-zA-Z][\w.-]*|\d+(?:\.\d+)*)(?:;[\w.-]+)*(?::[\w.-]+)*\s*:?=",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 70,
            source: r"[a-zA-Z][\w-]*\s*=[\d\w\s]*\*\)+(?:%00|\\u0000|\\x00|\\0|\x00)",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 71,
            source: r"\*\)\)+(?:%00|\\u0000|\\x00|\\0|\x00)",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 72,
            source: r"[a-zA-Z][\w-]*\s*=[\d\w\s]*\*\)+\x00",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 73,
            source: r"\*\)\)+\x00",
            contexts: CTX_ALL,
            category: r"ldap",
        },
        TableEntry {
            id: 74,
            source: r"<!(?:ENTITY|DOCTYPE)[^>]+SYSTEM[^>]+>",
            contexts: CTX_ALL,
            category: r"xml",
        },
        TableEntry {
            id: 75,
            source: r#"<!DOCTYPE[^>\[]+PUBLIC[^>\[]+[\"']https?://(?!(?:www\.)?w3\.org/)[^\"'>]+[\"'][^>\[]*>"#,
            contexts: CTX_ALL,
            category: r"xml",
        },
        TableEntry {
            id: 76,
            source: r"(?:<!\[CDATA\[.*?\]\]>)",
            contexts: CTX_ALL,
            category: r"xml",
        },
        TableEntry {
            id: 77,
            source: r"<!DOCTYPE[^>\[]*\[[\s\S]*?<!ENTITY",
            contexts: CTX_ALL,
            category: r"xml",
        },
        TableEntry {
            id: 78,
            source: r"(?:^|\s|/)(?:(?<=://)[^\s/@]*@)?(?:localhost\.?|127\.0\.0\.1|0\.0\.0\.0|\[::(?:\d*)\]|\[::ffff:127\.0\.0\.1\]|169\.254(?:\.\d{1,3}){2}|192\.168(?:\.\d{1,3}){2}|10(?:\.\d{1,3}){3}|172\.(?:1[6-9]|2[0-9]|3[01])(?:\.\d{1,3}){2}|metadata\.google\.internal|metadata\.goog|100\.100\.100\.200)(?::\d+)?(?:\s|$|/)",
            contexts: CTX_ALL,
            category: r"ssrf",
        },
        TableEntry {
            id: 79,
            source: r"://(?:[^/@\s]*@)?((?:0[xX][0-9a-fA-F]+|0[0-7]+|[1-9]\d*|0)(?:\.(?:0[xX][0-9a-fA-F]+|0[0-7]+|[1-9]\d*|0)){0,3})(?=[:/\s]|$)",
            contexts: CTX_ALL,
            category: r"ssrf",
        },
        TableEntry {
            id: 80,
            source: r"(?:file|dict|gopher|jar|tftp)://[^\s]+",
            contexts: CTX_ALL,
            category: r"ssrf",
        },
        TableEntry {
            id: 81,
            source: r"://[^/\s@]*@[^/\s@]*@",
            contexts: CTX_ALL,
            category: r"ssrf",
        },
        TableEntry {
            id: 82,
            source: r"://(?:metadata|instance-data)(?::\d+)?(?:/|\s|$)",
            contexts: CTX_ALL,
            category: r"ssrf",
        },
        TableEntry {
            id: 83,
            source: r"\{\s*\$(?:where|gt|lt|ne|eq|regex|in|nin|all|size|exists|type|mod|options):",
            contexts: CTX_ALL,
            category: r"nosql",
        },
        TableEntry {
            id: 84,
            source: r"(?:\{\s*\$[a-zA-Z]+\s*:\s*(?:\{|\[))",
            contexts: CTX_ALL,
            category: r"nosql",
        },
        TableEntry {
            id: 85,
            source: r#""\$(?:where|regex|expr|jsonSchema|function|accumulator|type|exists|size)"\s*:"#,
            contexts: CTX_ALL,
            category: r"nosql",
        },
        TableEntry {
            id: 86,
            source: r#""\$(?:gt|gte|lt|lte|ne|eq|in|nin|all|mod)"\s*:\s*(?:""|null|\{|\[)"#,
            contexts: CTX_ALL,
            category: r"nosql",
        },
        TableEntry {
            id: 87,
            source: r#""[^"]+"\s*:\s*\{\s*"\$(?:ne|eq)"\s*:\s*(?:true|false)"#,
            contexts: CTX_ALL,
            category: r"nosql",
        },
        TableEntry {
            id: 88,
            source: r"\[\$(?:where|gt|gte|lt|lte|ne|eq|regex|in|nin|nor|and|or|not|all|size|exists|type|mod|options|expr|function|elemMatch)\]",
            contexts: CTX_ALL,
            category: r"nosql",
        },
        TableEntry {
            id: 89,
            source: r#"(?:\A|[;,:\n])\s*filename\s*=\s*[\"'][^\"']*\.(?:php\d*|phtml|shtml|asax|ascx|ashx|asmx|aspx|bash|jspx|phar|phps|asa|asp|bat|cer|cfc|cfm|cgi|cmd|com|exe|hta|jsp|msi|pht|vbe|vbs|war|wsf|js|pl|py|rb|sh|ws)[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"file_upload",
        },
        TableEntry {
            id: 90,
            source: r#"(?:\A|[;,:\n])\s*filename\s*=\s*[\"'][^\"']*\.(?:php\d*|phtml|shtml|asax|ascx|ashx|asmx|aspx|bash|jspx|phar|phps|asa|asp|bat|cer|cfc|cfm|cgi|cmd|exe|hta|jsp|msi|pht|vbe|vbs|war|wsf|js|pl|py|rb|sh|ws)(?![A-Za-z0-9])(?:[^ \"'][^\"']*)?\.(?:docx|jpeg|pptx|tiff|webm|webp|xlsx|avi|bmp|doc|gif|ico|jpg|mkv|mov|mp3|mp4|odt|pdf|png|ppt|svg|tif|wav|xls)[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"file_upload",
        },
        TableEntry {
            id: 91,
            source: r#"(?:\A|[;,:\n])\s*filename\s*=\s*[\"'][^\"']*\.(?:php\d*|phtml|shtml|asax|ascx|ashx|asmx|aspx|bash|jspx|phar|phps|asa|asp|bat|cer|cfc|cfm|cgi|cmd|exe|hta|jsp|msi|pht|vbe|vbs|war|wsf|js|pl|py|rb|sh|ws)(?![A-Za-z0-9])(?:(?:%00|\\u0000|\\x00|\\0|\x00|;)[^\"']*|\.)[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"file_upload",
        },
        TableEntry {
            id: 92,
            source: r#"(?:\A|[;,:\n])\s*filename\s*=\s*[\"'][^\"']*\.(?:php\d*|phtml|shtml|asax|ascx|ashx|asmx|aspx|bash|jspx|phar|phps|asa|asp|bat|cer|cfc|cfm|cgi|cmd|exe|hta|jsp|msi|pht|vbe|vbs|war|wsf|js|pl|py|rb|sh|ws)(?![A-Za-z0-9])(?:(?:\x00|;)[^\"']*|\.)[\"']"#,
            contexts: CTX_CMD_INJECTION,
            category: r"file_upload",
        },
        TableEntry {
            id: 93,
            source: r"(?:%2e%2e|%252e%252e|%uff0e%uff0e|%c0%ae%c0%ae|%e0%40%ae|%c0%ae%e0%80%ae|%25c0%25ae)/",
            contexts: CTX_ALL,
            category: r"path_traversal",
        },
        TableEntry {
            id: 94,
            source: r"\{\{\s*[^\}]+(?:system|exec|popen|eval|require|include)\s*\}\}",
            contexts: CTX_ALL,
            category: r"template",
        },
        TableEntry {
            id: 95,
            source: r"\{\%\s*[^\%]+(?:system|exec|popen|eval|require|include)\s*\%\}",
            contexts: CTX_ALL,
            category: r"template",
        },
        TableEntry {
            id: 96,
            source: r"(?i)<%[=#]?[^%]*(?:system|exec|eval|`|Runtime|IO\.|File\.|Dir\.|\d+\s*[-+*/]\s*\d+)[^%]*%>",
            contexts: CTX_ALL,
            category: r"template",
        },
        TableEntry {
            id: 97,
            source: r"\$\{[^}]*(?:@[\w.]+@|\b\w+\s*\(|\d+\s*[*/%+\-]\s*\d+)[^}]*\}",
            contexts: CTX_ALL,
            category: r"template",
        },
        TableEntry {
            id: 98,
            source: r#"\{\{(?![^\}]*\d{4}-\d{1,2}-\d{1,2}(?!\d))(?=[^\}]*(?:@[\w.]+@|\b\w+\(\s*\)|['\"]?\d+['\"]?\s*[*/%+\-]\s*['\"]?\d+['\"]?))[^\}]*\}\}"#,
            contexts: CTX_ALL,
            category: r"template",
        },
        TableEntry {
            id: 99,
            source: r#"#\{(?![^\}]*\d{4}-\d{1,2}-\d{1,2}(?!\d))(?=[^\}]*(?:@[\w.]+@|\b\w+\s*\(|['\"]?\d+['\"]?\s*[*/%+\-]\s*['\"]?\d+['\"]?))[^\}]*\}"#,
            contexts: CTX_ALL,
            category: r"template",
        },
        TableEntry {
            id: 100,
            source: r"[\r\n][^\S\r\n]*(?:HTTP\/[0-9.]+|Location:|Set-Cookie:)",
            contexts: CTX_ALL,
            category: r"http_split",
        },
        TableEntry {
            id: 101,
            source: r"\A[/\\]?(?:(?!\.env(?:\.\w+)?(?:[/\\]|\Z))[\w.\-~%]+[/\\])*\.env(?:\.\w+)?(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 102,
            source: r"\A(?=(?:(?!\n).)*\b(?:scan(?:ner|ning|ned|s)?|attack(?:er|ers|ed|s)?|attempt(?:ed|s)?|exploit(?:ation|ed|s|ing|kit)?|prob(?:e|ed|es|ing)|malicious|intrusion(?:s)?|botnet(?:s)?|honeypot(?:s)?|brute[- ]force|credential[- ]stuffing|threat feed|vulnerabilit(?:y|ies)|hostile|recon(?:naissance)?|spoofed referer|bad actor(?:s)?|WAF|IDS|SOC|pentest(?:ing)?|blocked|flagged|triggered|denied|enumerat(?:e|ed|ing)|suspicious)\b)\A(?:(?!\n).)*[/\\](?:\.env(?:\.\w+)?)(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?\b",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 103,
            source: r"\A[/\\]?(?:(?!(?:(?!config)[\w-])*config[\w-]*\.(?:env|yml|yaml|json|toml|ini|xml|conf)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:(?!config)[\w-])*config[\w-]*\.(?:env|yml|yaml|json|toml|ini|xml|conf)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 104,
            source: r"\A[/\\]?(?:(?![\w.\-~%]*\.map(?:[/\\]|\Z))[\w.\-~%]+[/\\])*[\w.\-~%]*\.map(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 105,
            source: r"\A[/\\]?(?:[\w.\-~%]+[/\\])*[\w.\-~%]*\.(?:ts|tsx|jsx|py|rb|java|go|rs|php|pl|sh|sql)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 106,
            source: r"\A[/\\]?(?:(?!\.(?:git|svn|hg|bzr)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*\.(?:git|svn|hg|bzr)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 107,
            source: r"\A(?=(?:(?!\n).)*\b(?:scan(?:ner|ning|ned|s)?|attack(?:er|ers|ed|s)?|attempt(?:ed|s)?|exploit(?:ation|ed|s|ing|kit)?|prob(?:e|ed|es|ing)|malicious|intrusion(?:s)?|botnet(?:s)?|honeypot(?:s)?|brute[- ]force|credential[- ]stuffing|threat feed|vulnerabilit(?:y|ies)|hostile|recon(?:naissance)?|spoofed referer|bad actor(?:s)?|WAF|IDS|SOC|pentest(?:ing)?|blocked|flagged|triggered|denied|enumerat(?:e|ed|ing)|suspicious)\b)\A(?:(?!\n).)*[/\\](?:\.(?:git|svn|hg|bzr))(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?\b",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 108,
            source: r"\A[/\\]?(?:[\w.\-~%]+[/\\])*[\w.\-~%]*\.\w+~(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"sensitive_file",
        },
        TableEntry {
            id: 109,
            source: r"\A[/\\]?(?:(?!(?:wp-(?:admin|login|content|includes|config)|administrator|xmlrpc)\.?(?:php)?(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:wp-(?:admin|login|content|includes|config)|administrator|xmlrpc)\.?(?:php)?(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"cms_probing",
        },
        TableEntry {
            id: 110,
            source: r"\A(?=(?:(?!\n).)*\b(?:scan(?:ner|ning|ned|s)?|attack(?:er|ers|ed|s)?|attempt(?:ed|s)?|exploit(?:ation|ed|s|ing|kit)?|prob(?:e|ed|es|ing)|malicious|intrusion(?:s)?|botnet(?:s)?|honeypot(?:s)?|brute[- ]force|credential[- ]stuffing|threat feed|vulnerabilit(?:y|ies)|hostile|recon(?:naissance)?|spoofed referer|bad actor(?:s)?|WAF|IDS|SOC|pentest(?:ing)?|blocked|flagged|triggered|denied|enumerat(?:e|ed|ing)|suspicious)\b)\A(?:(?!\n).)*[/\\](?:(?:wp-(?:admin|login|content|includes|config)|administrator|xmlrpc)\.?(?:php)?)(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?\b",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"cms_probing",
        },
        TableEntry {
            id: 111,
            source: r"\A[/\\]?(?:(?!(?:phpinfo|info|test|php_info)\.php(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:phpinfo|info|test|php_info)\.php(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"cms_probing",
        },
        TableEntry {
            id: 112,
            source: r"\A(?=(?:(?!\n).)*\b(?:scan(?:ner|ning|ned|s)?|attack(?:er|ers|ed|s)?|attempt(?:ed|s)?|exploit(?:ation|ed|s|ing|kit)?|prob(?:e|ed|es|ing)|malicious|intrusion(?:s)?|botnet(?:s)?|honeypot(?:s)?|brute[- ]force|credential[- ]stuffing|threat feed|vulnerabilit(?:y|ies)|hostile|recon(?:naissance)?|spoofed referer|bad actor(?:s)?|WAF|IDS|SOC|pentest(?:ing)?|blocked|flagged|triggered|denied|enumerat(?:e|ed|ing)|suspicious)\b)\A(?:(?!\n).)*[/\\](?:(?:phpinfo|info|test|php_info)\.php)(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?\b",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"cms_probing",
        },
        TableEntry {
            id: 113,
            source: r"\A[/\\]?(?:(?![\w.\-~%]*\.(?:bak|backup|old|orig|save|swp|swo|tmp|temp)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*[\w.\-~%]*\.(?:bak|backup|old|orig|save|swp|swo|tmp|temp)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"cms_probing",
        },
        TableEntry {
            id: 114,
            source: r"\A[/\\]?(?:(?!(?:\.htaccess|\.htpasswd|\.DS_Store|Thumbs\.db|\.npmrc|\.dockerenv|web\.config)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:\.htaccess|\.htpasswd|\.DS_Store|Thumbs\.db|\.npmrc|\.dockerenv|web\.config)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"cms_probing",
        },
        TableEntry {
            id: 115,
            source: r"\A(?=(?:(?!\n).)*\b(?:scan(?:ner|ning|ned|s)?|attack(?:er|ers|ed|s)?|attempt(?:ed|s)?|exploit(?:ation|ed|s|ing|kit)?|prob(?:e|ed|es|ing)|malicious|intrusion(?:s)?|botnet(?:s)?|honeypot(?:s)?|brute[- ]force|credential[- ]stuffing|threat feed|vulnerabilit(?:y|ies)|hostile|recon(?:naissance)?|spoofed referer|bad actor(?:s)?|WAF|IDS|SOC|pentest(?:ing)?|blocked|flagged|triggered|denied|enumerat(?:e|ed|ing)|suspicious)\b)\A(?:(?!\n).)*[/\\](?:(?:\.htaccess|\.htpasswd|\.DS_Store|Thumbs\.db|\.npmrc|\.dockerenv|web\.config))(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?(?:[/\\][\w.\-~%]{1,64})?\b",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"cms_probing",
        },
        TableEntry {
            id: 116,
            source: r"\A[/\\]?(?:[\w.\-~%]+[/\\])*[\w.\-~%]*\.(?:asp|aspx|jsp|jsa|jhtml|shtml|cfm|cgi|do|action|lua|inc|woa|nsf|esp)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 117,
            source: r"\A[/\\](?:(?!(?:management|config_dump|credentials|system[/\\]version|version[/\\]system)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:management|config_dump|credentials|system[/\\]version|version[/\\]system)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 118,
            source: r"\A[/\\](?:system|version)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 119,
            source: r"\A[/\\]?(?:(?!(?:actuator|server-status|telescope)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:actuator|server-status|telescope)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 120,
            source: r"(?:CSCOE|dana-(?:na|cached)|sslvpn|RDWeb|/owa/|/ecp/|global-protect|ssl-vpn/|svpn/|sonicui|/remote/login|myvpn|vpntunnel|versa/login)",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 121,
            source: r"\A[/\\]?(?:(?!(?:geoserver|confluence|nifi|ScadaBR|pandora_console|centreon|kylin|decisioncenter|evox|MagicInfo|metasys|officescan|helpdesk|ignite)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:geoserver|confluence|nifi|ScadaBR|pandora_console|centreon|kylin|decisioncenter|evox|MagicInfo|metasys|officescan|helpdesk|ignite)(?:[.\-][\w.\-~%]*)?(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 122,
            source: r"\A[/\\]?(?:(?!cgi-(?:bin|mod)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*cgi-(?:bin|mod)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 123,
            source: r"\A[/\\]?(?:(?!(?:HNAP1|IPCamDesc\.xml|SDK/webLanguage)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:HNAP1|IPCamDesc\.xml|SDK/webLanguage)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 124,
            source: r"\A[/\\]?(?:(?!(?:language|languages)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:language|languages)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 125,
            source: r"\A[/\\]?(?:(?!(?:readme\.txt|README\.md|CHANGELOG|pom\.xml|build\.gradle|appsettings\.json|crossdomain\.xml)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:readme\.txt|README\.md|CHANGELOG|pom\.xml|build\.gradle|appsettings\.json|crossdomain\.xml)(?:\.[\w.\-~%]*)?(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 126,
            source: r"\A[/\\]?(?:(?!(?:sap|ise|nidp|cslu|rustfs|developmentserver|fog/management|lms/db|json/login_session|sms_mp|plugin/webs_model|wsman|am_bin)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:sap|ise|nidp|cslu|rustfs|developmentserver|fog/management|lms/db|json/login_session|sms_mp|plugin/webs_model|wsman|am_bin)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 127,
            source: r"(?:nmaplowercheck|nice\s+ports|Trinity\.txt)",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 128,
            source: r"\A[/\\]?(?:(?!\.(?:openclaw|clawdbot)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*\.(?:openclaw|clawdbot)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 129,
            source: r"\A[/\\]?(?:default|inicio|indice|localstart)(?:\.[\w.\-~%]*)?(?:[/\\])?(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 130,
            source: r"\A[/\\]?(?:(?!inicio\.html?(?:[/\\]|\Z))[\w.\-~%]+[/\\])*inicio\.html?(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 131,
            source: r"\A[/\\]?(?:(?!(?:\.streamlit|\.gpt-pilot|\.aider|\.cursor|\.windsurf|\.copilot|\.devcontainer)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:\.streamlit|\.gpt-pilot|\.aider|\.cursor|\.windsurf|\.copilot|\.devcontainer)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 132,
            source: r"\A[/\\]?(?:(?!(?:docker-compose|Dockerfile|Makefile|Vagrantfile|Jenkinsfile|Procfile)(?:\.ya?ml)?(?:[/\\]|\Z))[\w.\-~%]+[/\\])*(?:docker-compose|Dockerfile|Makefile|Vagrantfile|Jenkinsfile|Procfile)(?:\.ya?ml)?(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 133,
            source: r"\A[/\\]?(?:(?![\w.\-~%]*(?:secrets?|credentials?)\.(?:py|json|yml|yaml|toml|txt|env|xml|conf|cfg)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*[\w.\-~%]*(?:secrets?|credentials?)\.(?:py|json|yml|yaml|toml|txt|env|xml|conf|cfg)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 134,
            source: r"\A[/\\]?(?:(?!autodiscover(?:[/\\]|\Z))[\w.\-~%]+[/\\])*autodiscover(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 135,
            source: r"\A[/\\]?(?:(?!dns-query(?:[/\\]|\Z))[\w.\-~%]+[/\\])*dns-query(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 136,
            source: r"\A[/\\]?(?:(?!\.git/(?:refs|index|HEAD|objects|logs)(?:[/\\]|\Z))[\w.\-~%]+[/\\])*\.git/(?:refs|index|HEAD|objects|logs)(?:[/\\][\w.\-~%]*)*(?:\?\S*)?\s*\Z",
            contexts: CTX_SENSITIVE_PATH_FAMILY,
            category: r"recon",
        },
        TableEntry {
            id: 137,
            source: r#"(?:__proto__|constructor)\s*(?:\[\s*[\"']prototype[\"']\s*\]|\.\s*prototype)|[\"']__proto__[\"']\s*:"#,
            contexts: CTX_ALL,
            category: r"proto_pollution",
        },
        TableEntry {
            id: 138,
            source: r#"__proto__\s*(?:\[|\.)|\[\s*[\"']?__proto__[\"']?\s*\]|constructor\s*\[\s*[\"']?prototype[\"']?\s*\]|\[\s*[\"']?constructor[\"']?\s*\]\s*\[\s*[\"']?prototype[\"']?\s*\]"#,
            contexts: CTX_ALL,
            category: r"proto_pollution",
        },
        TableEntry {
            id: 139,
            source: r"Object\.prototype\.[A-Za-z_$][\w$]*\s*=(?!=)",
            contexts: CTX_ALL,
            category: r"proto_pollution",
        },
        TableEntry {
            id: 140,
            source: r"\b(?:Object|Reflect)\.setPrototypeOf\s*\(",
            contexts: CTX_ALL,
            category: r"proto_pollution",
        },
        TableEntry {
            id: 141,
            source: r"System\.Diagnostics\.Process\.Start\s*\(|System\.Reflection\.|Assembly\.Load\s*\(",
            contexts: CTX_ALL,
            category: r"code_injection",
        },
        TableEntry {
            id: 142,
            source: r#"(?-i:\bgetattr\(\s*(?:__import__\(\s*['\"](?:os|subprocess|builtins|importlib)['\"]\s*\)|\b(?:os|subprocess|builtins|importlib)\b)\s*,\s*['\"](?:system|popen|exec|eval|call|run|Popen|check_output|check_call)['\"]\s*\)\s*\()"#,
            contexts: CTX_ALL,
            category: r"code_injection",
        },
        TableEntry {
            id: 143,
            source: r#"(?-i:\bvars\(\s*(?:__import__\(\s*['\"](?:os|subprocess|builtins|importlib)['\"]\s*\)|\b(?:os|subprocess|builtins|importlib)\b)\s*\)\s*\[\s*['\"](?:system|popen|exec|eval|call|run|Popen|check_output|check_call)['\"]\s*\]\s*\()"#,
            contexts: CTX_ALL,
            category: r"code_injection",
        },
        TableEntry {
            id: 144,
            source: r"(?<![A-Za-z0-9+/])(?-i:rO0AB)",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 145,
            source: r"(?<![A-Za-z0-9+/])(?-i:AAEAAAD)",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 146,
            source: r"(?<![A-Za-z0-9+/])(?-i:gA[SW]V)",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 147,
            source: r"(?<![A-Za-z0-9+/])(?-i:BAh[Jv7bV])",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 148,
            source: r"cos\n",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 149,
            source: r"c__builtin__",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 150,
            source: r"csubprocess",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 151,
            source: r"cposix",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 152,
            source: r"(c[A-Za-z_][A-Za-z0-9_]{0,100}(?:\.[A-Za-z_][A-Za-z0-9_]{0,100}){0,20}\n[A-Za-z_][A-Za-z0-9_]{0,100}\n)[^ \t]{0,100}?[Rb]",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 153,
            source: r#"O:\d+:""#,
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 154,
            source: r#"C:\d+:""#,
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 155,
            source: r#"E:\d+:""#,
            contexts: CTX_ALL,
            category: r"deserialization",
        },
        TableEntry {
            id: 156,
            source: r"<ObjectDataProvider\b",
            contexts: CTX_ALL,
            category: r"deserialization",
        },
    ]
});

/// Patterns whose matches are suppressed inside binary-dense regions.
pub static NOISE_PRONE_PATTERN_SOURCES: LazyLock<std::collections::HashSet<&'static str>> =
    LazyLock::new(|| {
        std::collections::HashSet::from([
            r#"#\{(?![^\}]*\d{4}-\d{1,2}-\d{1,2}(?!\d))(?=[^\}]*(?:@[\w.]+@|\b\w+\s*\(|['\"]?\d+['\"]?\s*[*/%+\-]\s*['\"]?\d+['\"]?))[^\}]*\}"#,
            r"(?:[;&|]\s*(?:\$\([^)]+\)|\$\{[^}]+\}))",
            r"(?<!`)`(?:[A-Za-z0-9_./~]|\$[({])(?:[^`\\\n]|\\.)*`",
            r"[;|&]\s*(?:ls|cat|rm|id|whoami|uname|wget|curl|nc|netcat|socat|bash|sh|python|perl)\b",
            r"[A-Za-z0-9_./*?-]*[?*][A-Za-z0-9_./*?-]*",
            r"\$\((?:[^()\\\n]|\\.)*\)|\$\{(?:[^{}\\\n]|\\.)*\}",
            r"\$\{[^}]*(?:@[\w.]+@|\b\w+\s*\(|\d+\s*[*/%+\-]\s*\d+)[^}]*\}",
            r"\(\s*[&|]\s*",
            r#"\w+(?:['\"]+\w+){1,10}"#,
            // SQLi comment terminators span arbitrary whitespace between the
            // quote and the -- / # terminator, so they routinely fire inside
            // text-decoded binary bodies (e.g. "'\n--" byte runs in compressed
            // payloads). Parity with upstream commit f5d53ca5.
            r"'\s*(?:[\);]+\s*)?--|'[\);]*#(?:\n|\Z)",
        ])
    });

/// Patterns that only run on the raw signal-preserving view.
pub static DETECTION_RAW_VIEW_PATTERN_SOURCES: LazyLock<std::collections::HashSet<&'static str>> =
    LazyLock::new(|| {
        std::collections::HashSet::from([
            r#"#\{(?![^\}]*\d{4}-\d{1,2}-\d{1,2}(?!\d))(?=[^\}]*(?:@[\w.]+@|\b\w+\s*\(|['\"]?\d+['\"]?\s*[*/%+\-]\s*['\"]?\d+['\"]?))[^\}]*\}"#,
            r"'\s*(?:[\);]+\s*)?--|'[\);]*#(?:\n|\Z)",
            r"(?:%2e%2e|%252e%252e|%uff0e%uff0e|%c0%ae%c0%ae|%e0%40%ae|%c0%ae%e0%80%ae|%25c0%25ae)/",
            r#"(?:\A|[;,:\n])\s*filename\s*=\s*[\"'][^\"']*\.(?:php\d*|phtml|shtml|asax|ascx|ashx|asmx|aspx|bash|jspx|phar|phps|asa|asp|bat|cer|cfc|cfm|cgi|cmd|exe|hta|jsp|msi|pht|vbe|vbs|war|wsf|js|pl|py|rb|sh|ws)(?![A-Za-z0-9])(?:(?:%00|\\u0000|\\x00|\\0|\x00|;)[^\"']*|\.)[\"']"#,
            r#"(?:\A|[;,:\n])\s*filename\s*=\s*[\"'][^\"']*\.(?:php\d*|phtml|shtml|asax|ascx|ashx|asmx|aspx|bash|jspx|phar|phps|asa|asp|bat|cer|cfc|cfm|cgi|cmd|exe|hta|jsp|msi|pht|vbe|vbs|war|wsf|js|pl|py|rb|sh|ws)(?![A-Za-z0-9])(?:[^ \"'][^\"']*)?\.(?:docx|jpeg|pptx|tiff|webm|webp|xlsx|avi|bmp|doc|gif|ico|jpg|mkv|mov|mp3|mp4|odt|pdf|png|ppt|svg|tif|wav|xls)[\"']"#,
            r"(?<![A-Za-z0-9+/])(?-i:AAEAAAD)",
            r"(?<![A-Za-z0-9+/])(?-i:BAh[Jv7bV])",
            r"(?<![A-Za-z0-9+/])(?-i:gA[SW]V)",
            r"(?<![A-Za-z0-9+/])(?-i:rO0AB)",
            r"(?i)\bORDER\s+BY\s+\d+\s*(?:--|#|;|\)|,|/\*|\Z)|(?<=[=?&])ORDER\s+BY\s+\d+\s*\n",
            r"(c[A-Za-z_][A-Za-z0-9_]{0,100}(?:\.[A-Za-z_][A-Za-z0-9_]{0,100}){0,20}\n[A-Za-z_][A-Za-z0-9_]{0,100}\n)[^ \t]{0,100}?[Rb]",
            r"[\r\n][^\S\r\n]*(?:HTTP\/[0-9.]+|Location:|Set-Cookie:)",
            r"[a-zA-Z][\w-]*\s*=[\d\w\s]*\*\)+(?:%00|\\u0000|\\x00|\\0|\x00)",
            r"\*\)\)+(?:%00|\\u0000|\\x00|\\0|\x00)",
            r"cos\n",
            r"j[\t\r\n]*a[\t\r\n]*v[\t\r\n]*a[\t\r\n]*s[\t\r\n]*c[\t\r\n]*r[\t\r\n]*i[\t\r\n]*p[\t\r\n]*t[\t\r\n]*:\s*[^\s]+",
        ])
    });

/// Patterns that only run on the URL-decoded view.
pub static DETECTION_URL_DECODED_VIEW_PATTERN_SOURCES: LazyLock<
    std::collections::HashSet<&'static str>,
> = LazyLock::new(|| {
    std::collections::HashSet::from([
        r#"(?:\A|[;,:\n])\s*filename\s*=\s*[\"'][^\"']*\.(?:php\d*|phtml|shtml|asax|ascx|ashx|asmx|aspx|bash|jspx|phar|phps|asa|asp|bat|cer|cfc|cfm|cgi|cmd|exe|hta|jsp|msi|pht|vbe|vbs|war|wsf|js|pl|py|rb|sh|ws)(?![A-Za-z0-9])(?:(?:\x00|;)[^\"']*|\.)[\"']"#,
        r#"(?i)(?:['\")\d]|/\*)\s{0,3}\bORDER\s+BY\s+\d+|\bORDER\s+BY\s+\d+\s*(?:--|#|/\*)"#,
        r"[a-zA-Z][\w-]*\s*=[\d\w\s]*\*\)+\x00",
        r"\*\)\)+\x00",
        r#"\A(?:(?!\n).)*(?:boot\.ini|win\.ini|system\.ini|config\.sys)(?:[&#;,\"'<>]|\s*\Z)"#,
        r#"\A(?:(?!\n).)*etc/(?:passwd|shadow|group|hosts|motd|issue|mysql/my\.cnf|ssh/ssh_config)(?:[&#;,\"'<>]|\s*\Z)"#,
        r#"\A(?:(?!\n).)*proc/self/environ(?:[&#;,\"'<>]|\s*\Z)"#,
        r#"\A(?:(?!\n).)*var/log/[^\s/]+(?:[&#;,\"'<>]|\s*\Z)"#,
        r"\n[^\S\r\n]*(?:[^=\s;|&]+=[^\s;|&]+\s+)*(?:/?(?:[\w.-]+/)*env\s+)?/?(?:[\w.-]+/)*(?:bash|sh|ksh|csh|tsch|zsh|ash)\s+-c\b",
    ])
});

/// Per-pattern weight overrides; every other category weighs 1.0.
pub static DETECTION_PATTERN_WEIGHT_OVERRIDES: LazyLock<
    std::collections::HashMap<&'static str, f64>,
> = LazyLock::new(|| {
    std::collections::HashMap::from([
        (
            r"(?i)\bSELECT\b(?:(?!\bSELECT\b)[\w\s,\*().])*?\bFROM\b",
            0.5_f64,
        ),
        (r"(?i)SELECT\s+\*", 0.5_f64),
        (
            r#"(?i)\bWHERE\s+[\w."]+\s*(?:=|<|>|<=|>=|LIKE|IN)\b"#,
            0.5_f64,
        ),
    ])
});