-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsemantic_rules.yaml
More file actions
1208 lines (1116 loc) · 37 KB
/
semantic_rules.yaml
File metadata and controls
1208 lines (1116 loc) · 37 KB
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
# AutoPiff semantic rules (v2 comprehensive)
# Rules are designed for high precision and explainability.
# Each rule must map cleanly to report fields: category, why, indicators, diff_hint.
# v2: expanded from 11 rules / 5 categories to 58 rules / 22 categories.
version: 2
categories:
# --- Original categories ---
- id: bounds_check
description: Added or strengthened bounds/size/index validation.
- id: lifetime_fix
description: Added or strengthened pointer lifetime / ownership protection.
- id: user_boundary_check
description: Added or strengthened validation of user-mode supplied data/pointers.
- id: int_overflow
description: Added or strengthened safe integer/size arithmetic checks.
- id: state_hardening
description: Added or strengthened state/refcount/synchronization validation.
# --- New categories (v2) ---
- id: race_condition
description: Added synchronization to fix race conditions or TOCTOU bugs.
- id: type_confusion
description: Added type validation to prevent type confusion or wrong-object access.
- id: authorization
description: Added privilege, access mode, or ACL enforcement.
- id: info_disclosure
description: Added memory initialization or pointer scrubbing to prevent information leaks.
- id: ioctl_hardening
description: Added IOCTL-specific input validation or dispatch hardening.
- id: mdl_handling
description: Added safe MDL mapping, probe, or NULL checks.
- id: object_management
description: Added object reference balancing or handle access enforcement.
- id: string_handling
description: Replaced unsafe string operations with bounded variants.
- id: pool_hardening
description: Migrated to safer pool APIs or added pool allocation checks.
- id: crypto_hardening
description: Added secure memory wiping or constant-time comparisons.
- id: error_path_hardening
description: Added resource cleanup or correct status propagation on error paths.
- id: dos_hardening
description: Added recursion/loop bounds or resource quota checks to prevent DoS.
- id: ndis_hardening
description: Added NDIS OID/NBL validation for network driver security.
- id: filesystem_filter
description: Added minifilter context management or TOCTOU mitigations.
- id: pnp_power
description: Added PnP removal or power state guards.
- id: dma_mmio
description: Added MMIO/DMA bounds validation or mapping checks.
- id: wdf_hardening
description: Added WDF request buffer or completion guards.
# --- Attack surface categories (new feature detection) ---
- id: new_attack_surface
description: New code introduces potential attack surface (sinks without adequate guards).
rules:
# ==========================================================================
# Bounds & size validation (original, high precision)
# ==========================================================================
- rule_id: added_len_check_before_memcpy
category: bounds_check
confidence: 0.92
required_signals:
- sink_group: memory_copy
- change_type: guard_added
- guard_kind: length_check
- proximity: near_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added a length/bounds check before a memory copy operation.
report:
added_checks:
- length_check
sinks:
- memory_copy
- rule_id: added_struct_size_validation
category: bounds_check
confidence: 0.88
required_signals:
- change_type: guard_added
- guard_kind: sizeof_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added validation that an input buffer/structure is large enough.
report:
added_checks:
- sizeof_check
- rule_id: added_index_bounds_check
category: bounds_check
confidence: 0.86
required_signals:
- change_type: guard_added
- guard_kind: index_bounds
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added an index bounds check to prevent out-of-range access.
report:
added_checks:
- index_bounds
# ==========================================================================
# Lifetime fixes (original, high precision)
# ==========================================================================
- rule_id: null_after_free_added
category: lifetime_fix
confidence: 0.88
required_signals:
- sink_group: pool_free
- change_type: post_free_hardening
- hardening_kind: null_assignment
- proximity: immediately_after_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Pointer is now set to NULL immediately after freeing memory.
report:
sinks:
- pool_free
added_checks:
- null_after_free
- rule_id: guard_before_free_added
category: lifetime_fix
confidence: 0.86
required_signals:
- sink_group: pool_free
- change_type: guard_added
- guard_kind: null_check
- proximity: near_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added a NULL check before freeing a pointer (possible double-free/UAF hardening).
report:
sinks:
- pool_free
added_checks:
- null_check
# ==========================================================================
# User/kernel boundary validation (original, high precision)
# ==========================================================================
- rule_id: probe_for_read_or_write_added
category: user_boundary_check
confidence: 0.93
required_signals:
- sink_group: user_probe
- change_type: validation_added
- validation_kind: probe
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added ProbeForRead/ProbeForWrite to validate user-mode pointers.
report:
sinks:
- user_probe
added_checks:
- probe_for_read_write
- rule_id: previous_mode_gating_added
category: user_boundary_check
confidence: 0.90
required_signals:
- sink_group: user_probe
- change_type: validation_added
- validation_kind: previous_mode_gate
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added ExGetPreviousMode gating to treat user callers differently from kernel callers.
report:
sinks:
- user_probe
added_checks:
- previous_mode_gate
- rule_id: seh_guard_added_around_user_deref
category: user_boundary_check
confidence: 0.82
required_signals:
- sink_group: exceptions
- change_type: validation_added
- validation_kind: seh_guard
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added structured exception handling around potentially unsafe pointer access.
report:
sinks:
- exceptions
added_checks:
- seh_guard
# ==========================================================================
# Integer overflow / size arithmetic hardening (original)
# ==========================================================================
- rule_id: safe_size_math_helper_added
category: int_overflow
confidence: 0.88
required_signals:
- sink_group: io_sanitization
- change_type: validation_added
- validation_kind: safe_math_helper
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Replaced raw size arithmetic with safe math helpers (overflow hardening).
report:
sinks:
- io_sanitization
added_checks:
- safe_math
- rule_id: alloc_size_overflow_check_added
category: int_overflow
confidence: 0.90
required_signals:
- sink_group: pool_alloc
- change_type: guard_added
- guard_kind: overflow_check
- proximity: near_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added an overflow/size check before allocating memory.
report:
sinks:
- pool_alloc
added_checks:
- overflow_check
# ==========================================================================
# State hardening (original, kept conservative)
# ==========================================================================
- rule_id: interlocked_refcount_added
category: state_hardening
confidence: 0.78
required_signals:
- sink_group: refcounting
- change_type: hardening_added
- hardening_kind: refcount
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added Interlocked-based refcounting to protect shared object lifetime/state.
report:
sinks:
- refcounting
added_checks:
- refcount_hardening
# ==========================================================================
# NEW: Race condition rules
# ==========================================================================
- rule_id: spinlock_acquisition_added
category: race_condition
confidence: 0.80
required_signals:
- sink_group: synchronization
- change_type: hardening_added
- hardening_kind: spinlock
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added spinlock acquisition to protect shared data from concurrent access.
report:
sinks:
- synchronization
added_checks:
- spinlock
- rule_id: mutex_or_resource_lock_added
category: race_condition
confidence: 0.82
required_signals:
- sink_group: synchronization
- change_type: hardening_added
- hardening_kind: mutex_resource
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added mutex or executive resource lock to protect shared state.
report:
sinks:
- synchronization
added_checks:
- mutex_resource
- rule_id: double_fetch_to_capture_fix
category: race_condition
confidence: 0.85
required_signals:
- change_type: hardening_added
- hardening_kind: buffer_capture
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Fixed double-fetch TOCTOU by capturing user buffer value into local variable.
report:
added_checks:
- buffer_capture
- rule_id: cancel_safe_irp_queue_added
category: race_condition
confidence: 0.78
required_signals:
- sink_group: irp_cancel
- change_type: hardening_added
- hardening_kind: cancel_safe
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Replaced manual IRP cancellation with cancel-safe queue to fix IRP race.
report:
sinks:
- irp_cancel
added_checks:
- cancel_safe
# ==========================================================================
# NEW: Type confusion rules
# ==========================================================================
- rule_id: object_type_validation_added
category: type_confusion
confidence: 0.88
required_signals:
- change_type: guard_added
- guard_kind: object_type_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added object type tag validation before struct access or vtable dispatch.
report:
added_checks:
- object_type_check
- rule_id: handle_object_type_check_added
category: type_confusion
confidence: 0.92
required_signals:
- sink_group: handle_validation
- change_type: guard_added
- guard_kind: handle_type_validation
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added ObjectType parameter to ObReferenceObjectByHandle to prevent handle type confusion.
report:
sinks:
- handle_validation
added_checks:
- handle_type_validation
- rule_id: wow64_thunk_validation_added
category: type_confusion
confidence: 0.85
required_signals:
- change_type: guard_added
- guard_kind: wow64_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added IoIs32bitProcess check to handle WOW64 struct layout differences.
report:
added_checks:
- wow64_check
# ==========================================================================
# NEW: Authorization rules
# ==========================================================================
- rule_id: privilege_check_added
category: authorization
confidence: 0.90
required_signals:
- sink_group: authorization
- change_type: validation_added
- validation_kind: privilege_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added SeSinglePrivilegeCheck or SeAccessCheck to enforce authorization.
report:
sinks:
- authorization
added_checks:
- privilege_check
- rule_id: access_mode_enforcement_added
category: authorization
confidence: 0.93
required_signals:
- change_type: validation_added
- validation_kind: access_mode_fix
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Fixed access mode mismatch by using caller's actual RequestorMode instead of KernelMode.
report:
added_checks:
- access_mode_fix
- rule_id: device_acl_hardening
category: authorization
confidence: 0.90
required_signals:
- sink_group: device_security
- change_type: hardening_added
- hardening_kind: device_acl
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Hardened device object ACL by using IoCreateDeviceSecure or FILE_DEVICE_SECURE_OPEN.
report:
sinks:
- device_security
added_checks:
- device_acl
- rule_id: registry_access_mask_hardened
category: authorization
confidence: 0.82
required_signals:
- sink_group: handle_validation
- change_type: hardening_added
- hardening_kind: access_mask_reduction
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Reduced registry key access mask from KEY_ALL_ACCESS to least-privilege.
report:
sinks:
- handle_validation
added_checks:
- access_mask_reduction
# ==========================================================================
# NEW: Information disclosure rules
# ==========================================================================
- rule_id: buffer_zeroing_before_copy_added
category: info_disclosure
confidence: 0.90
required_signals:
- sink_group: memory_zeroing
- change_type: validation_added
- validation_kind: buffer_zeroing
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added RtlZeroMemory before populating output buffer to prevent kernel memory disclosure.
report:
sinks:
- memory_zeroing
added_checks:
- buffer_zeroing
- rule_id: stack_variable_initialization_added
category: info_disclosure
confidence: 0.85
required_signals:
- change_type: hardening_added
- hardening_kind: buffer_zeroing
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added zero initialization to stack variables to prevent uninitialized memory disclosure.
report:
added_checks:
- buffer_zeroing
- rule_id: output_length_truncation_added
category: info_disclosure
confidence: 0.82
required_signals:
- sink_group: irp_completion
- change_type: guard_added
- guard_kind: length_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Corrected IoStatus.Information to report only initialized bytes, preventing stale data leak.
report:
sinks:
- irp_completion
added_checks:
- length_check
- rule_id: kernel_pointer_scrubbing_added
category: info_disclosure
confidence: 0.88
required_signals:
- change_type: hardening_added
- hardening_kind: pointer_scrub
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Scrubbed or removed kernel pointer from user-accessible output buffer (KASLR bypass fix).
report:
added_checks:
- pointer_scrub
# ==========================================================================
# NEW: IOCTL hardening rules
# ==========================================================================
- rule_id: method_neither_probe_added
category: ioctl_hardening
confidence: 0.93
required_signals:
- sink_group: user_probe
- change_type: validation_added
- validation_kind: probe
- sink_group: exceptions
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added ProbeForRead/ProbeForWrite with SEH for METHOD_NEITHER IOCTL buffer access.
report:
sinks:
- user_probe
- exceptions
added_checks:
- probe_for_read_write
- seh_guard
- rule_id: ioctl_input_size_validation_added
category: ioctl_hardening
confidence: 0.92
required_signals:
- change_type: guard_added
- guard_kind: sizeof_check
- guard_kind: length_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added InputBufferLength/OutputBufferLength size validation in IOCTL handler.
report:
added_checks:
- sizeof_check
- length_check
- rule_id: ioctl_code_default_case_added
category: ioctl_hardening
confidence: 0.70
required_signals:
- change_type: hardening_added
- hardening_kind: default_case
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added default case with error return to IOCTL dispatch switch statement.
report:
added_checks:
- default_case
# ==========================================================================
# NEW: MDL handling rules
# ==========================================================================
- rule_id: mdl_safe_mapping_replacement
category: mdl_handling
confidence: 0.88
required_signals:
- sink_group: mdl_operations
- change_type: hardening_added
- hardening_kind: mdl_safe
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Replaced unsafe MmGetSystemAddressForMdl with MmGetSystemAddressForMdlSafe.
report:
sinks:
- mdl_operations
added_checks:
- mdl_safe
- rule_id: mdl_probe_access_mode_fix
category: mdl_handling
confidence: 0.93
required_signals:
- sink_group: mdl_operations
- change_type: validation_added
- validation_kind: access_mode_fix
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Fixed MmProbeAndLockPages AccessMode from KernelMode to UserMode to enforce address validation.
report:
sinks:
- mdl_operations
added_checks:
- access_mode_fix
- rule_id: mdl_null_check_added
category: mdl_handling
confidence: 0.84
required_signals:
- sink_group: mdl_operations
- change_type: guard_added
- guard_kind: null_check
- proximity: near_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added NULL check on Irp->MdlAddress before MDL mapping operations.
report:
sinks:
- mdl_operations
added_checks:
- null_check
# ==========================================================================
# NEW: Object management rules
# ==========================================================================
- rule_id: ob_reference_balance_fix
category: object_management
confidence: 0.86
required_signals:
- sink_group: object_management
- change_type: hardening_added
- hardening_kind: reference_balance
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added ObDereferenceObject on error path to fix reference count leak.
report:
sinks:
- object_management
added_checks:
- reference_balance
- rule_id: handle_force_access_check_added
category: object_management
confidence: 0.90
required_signals:
- sink_group: handle_validation
- change_type: hardening_added
- hardening_kind: force_access_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added OBJ_FORCE_ACCESS_CHECK flag to enforce access checks on handle operations.
report:
sinks:
- handle_validation
added_checks:
- force_access_check
# ==========================================================================
# NEW: String handling rules
# ==========================================================================
- rule_id: safe_string_function_replacement
category: string_handling
confidence: 0.88
required_signals:
- sink_group: string_copy
- change_type: hardening_added
- hardening_kind: safe_string_replacement
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Replaced unsafe string function (wcscpy/strcpy/strcat) with bounded RtlStringCb*/RtlStringCch* variant.
report:
sinks:
- string_copy
added_checks:
- safe_string_replacement
- rule_id: unicode_string_length_validation_added
category: string_handling
confidence: 0.86
required_signals:
- change_type: guard_added
- guard_kind: length_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added UNICODE_STRING Length vs MaximumLength validation or alignment check.
report:
added_checks:
- length_check
# ==========================================================================
# NEW: Pool hardening rules
# ==========================================================================
- rule_id: pool_type_nx_migration
category: pool_hardening
confidence: 0.85
required_signals:
- sink_group: pool_alloc
- change_type: hardening_added
- hardening_kind: pool_type_hardening
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Migrated pool allocation from executable NonPagedPool to NonPagedPoolNx.
report:
sinks:
- pool_alloc
added_checks:
- pool_type_hardening
- rule_id: deprecated_pool_api_replacement
category: pool_hardening
confidence: 0.80
required_signals:
- sink_group: pool_alloc
- change_type: hardening_added
- hardening_kind: pool_type_hardening
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Replaced deprecated ExAllocatePoolWithTag with ExAllocatePool2 (zeros memory by default).
report:
sinks:
- pool_alloc
added_checks:
- pool_type_hardening
- rule_id: pool_allocation_null_check_added
category: pool_hardening
confidence: 0.78
required_signals:
- sink_group: pool_alloc
- change_type: guard_added
- guard_kind: null_check
- proximity: near_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added NULL check after pool allocation to prevent NULL dereference.
report:
sinks:
- pool_alloc
added_checks:
- null_check
# ==========================================================================
# NEW: Crypto hardening rules
# ==========================================================================
- rule_id: secure_zero_memory_added
category: crypto_hardening
confidence: 0.82
required_signals:
- sink_group: memory_zeroing
- change_type: hardening_added
- hardening_kind: secure_zero
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added RtlSecureZeroMemory to wipe sensitive data before freeing (non-optimizable zeroing).
report:
sinks:
- memory_zeroing
added_checks:
- secure_zero
- rule_id: constant_time_comparison_added
category: crypto_hardening
confidence: 0.80
required_signals:
- change_type: hardening_added
- hardening_kind: constant_time_compare
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Replaced early-exit comparison with constant-time XOR-accumulate pattern.
report:
added_checks:
- constant_time_compare
# ==========================================================================
# NEW: Error path hardening rules
# ==========================================================================
- rule_id: error_path_cleanup_added
category: error_path_hardening
confidence: 0.80
required_signals:
- change_type: hardening_added
- hardening_kind: error_cleanup
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added resource cleanup (free/release/dereference) on error path to prevent leaks.
report:
added_checks:
- error_cleanup
- rule_id: goto_cleanup_pattern_added
category: error_path_hardening
confidence: 0.75
required_signals:
- change_type: hardening_added
- hardening_kind: goto_cleanup
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added centralized goto-cleanup pattern replacing direct error returns.
report:
added_checks:
- goto_cleanup
- rule_id: irp_completion_status_fix
category: error_path_hardening
confidence: 0.76
required_signals:
- sink_group: irp_completion
- change_type: hardening_added
- hardening_kind: completion_status_fix
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Fixed IRP completion to propagate correct status or prevent double completion.
report:
sinks:
- irp_completion
added_checks:
- completion_status_fix
# ==========================================================================
# NEW: DoS hardening rules
# ==========================================================================
- rule_id: recursion_depth_limit_added
category: dos_hardening
confidence: 0.82
required_signals:
- change_type: guard_added
- guard_kind: depth_limit
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added recursion depth limit or IoGetRemainingStackSize check to prevent stack exhaustion.
report:
added_checks:
- depth_limit
- rule_id: loop_iteration_bound_added
category: dos_hardening
confidence: 0.75
required_signals:
- change_type: guard_added
- guard_kind: index_bounds
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added iteration counter and max bound to loop to prevent infinite loop DoS.
report:
added_checks:
- index_bounds
- rule_id: resource_quota_check_added
category: dos_hardening
confidence: 0.80
required_signals:
- sink_group: pool_alloc
- change_type: guard_added
- guard_kind: length_check
- proximity: near_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added upper bound check on user-supplied allocation size to prevent resource exhaustion.
report:
sinks:
- pool_alloc
added_checks:
- length_check
# ==========================================================================
# NEW: NDIS hardening rules
# ==========================================================================
- rule_id: oid_request_validation_added
category: ndis_hardening
confidence: 0.88
required_signals:
- sink_group: ndis_operations
- change_type: guard_added
- guard_kind: oid_validation
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added NULL and length validation for NDIS OID request InformationBuffer.
report:
sinks:
- ndis_operations
added_checks:
- oid_validation
- rule_id: nbl_chain_length_validation_added
category: ndis_hardening
confidence: 0.84
required_signals:
- sink_group: ndis_operations
- change_type: guard_added
- guard_kind: length_check
- proximity: near_sink
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added bounds check comparing NET_BUFFER_DATA_LENGTH against actual MDL byte count.
report:
sinks:
- ndis_operations
added_checks:
- length_check
# ==========================================================================
# NEW: Filesystem filter rules
# ==========================================================================
- rule_id: flt_context_reference_leak_fix
category: filesystem_filter
confidence: 0.84
required_signals:
- sink_group: filesystem_filter
- change_type: hardening_added
- hardening_kind: flt_context_release
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added FltReleaseContext on error/early-return path to fix minifilter context reference leak.
report:
sinks:
- filesystem_filter
added_checks:
- flt_context_release
- rule_id: flt_create_race_mitigation
category: filesystem_filter
confidence: 0.86
required_signals:
- sink_group: filesystem_filter
- change_type: hardening_added
- hardening_kind: buffer_capture
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Fixed TOCTOU in IRP_MJ_CREATE by capturing mapped buffer before validation.
report:
sinks:
- filesystem_filter
added_checks:
- buffer_capture
# ==========================================================================
# NEW: PnP/Power rules
# ==========================================================================
- rule_id: surprise_removal_guard_added
category: pnp_power
confidence: 0.78
required_signals:
- change_type: guard_added
- guard_kind: removal_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added device-removed flag check before I/O dispatch to prevent use-after-remove.
report:
added_checks:
- removal_check
- rule_id: power_state_validation_added
category: pnp_power
confidence: 0.74
required_signals:
- change_type: guard_added
- guard_kind: power_state_check
excluded_patterns:
- logging_only
- refactor_only
plain_english_summary: Added power state validation (PowerDeviceD0 check) before device I/O.
report:
added_checks:
- power_state_check
- rule_id: io_remove_lock_added