-
Notifications
You must be signed in to change notification settings - Fork 0
/
taint.config
841 lines (841 loc) · 23.6 KB
/
taint.config
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
{
"comment": "UserControlled, Test, Demo sources are predefined. Same for Demo, Test and RemoteCodeExecution sinks",
"features": [
{
"comment": "via a string created by tainted_str + 's'",
"name": "string_concat_lhs"
},
{
"comment": "via a string created by 's' + tainted_str",
"name": "string_concat_rhs"
},
{
"comment": "via getattr first parameter",
"name": "getattr"
},
{
"comment": "via django request.FILES",
"name": "request_files"
},
{
"comment": "via io.BytesIO object",
"name": "bytesio"
},
{
"comment": "Indicates taint passed through furl.furl as a query param",
"name": "furl_query_params"
},
{
"comment": "Indicates taint passed through furl.furl as a path",
"name": "furl_path"
},
{
"comment": "Indicates taint passed through furl.furl as a fragment",
"name": "furl_fragment"
},
{
"comment": "Indicates taint passed through furl.furl as a scheme",
"name": "furl_scheme"
},
{
"comment": "Indicates taint passed through furl.furl as a host",
"name": "furl_host"
},
{
"comment": "Indicates taint passed through furl.furl as a port",
"name": "furl_port"
},
{
"comment": "Indicates taint passed through furl.furl as a network location",
"name": "furl_netloc"
},
{
"comment": "Indicates taint passed through furl.furl as an origin",
"name": "furl_origin"
},
{
"comment": "Indicates taint passed through furl.furl as a url",
"name": "furl_url"
},
{
"comment": "Indicates a taint passed through the 'urllib.quote_plus' function",
"name": "urllib_quote_plus"
},
{
"comment": "Indicates a taint passed through a function that escapes data for embedding in HTML documents",
"name": "escape_html"
},
{
"comment": "Indicates taint passed through the HMAC algorithm as a key.",
"name": "hmac_key"
},
{
"comment": "Indicates flow passed through conversion to 'bool'.",
"name": "boolean"
},
{
"comment": "Indicates a flow going to requests APIs kwargs (body, query_string), usually is not SSRF. It is a code smell",
"name": "requests_metadata"
},
{
"comment": "Indicates that the flow is usually code smell and does not have a direct security or privacy impact",
"name": "code_smell"
},
{
"comment": "Indicates that this flow passed through some external query (GraphQL, Database, etc.), and thus might not reflect the original tainted data anymore",
"name": "external_query"
},
{
"comment": "Indicates that this flow passed through a query of a Django Model object, and thus might not reflect the original tainted data anymore",
"name": "django_model_query"
},
{
"comment": "Indicates that data was transformed in some way that likely renders it benign (conversion to bool, length take, uncontrollable attributes like __name__ accessed)",
"name": "benign"
},
{
"comment": "Indicates that data in this flow passed through a type constructor",
"name": "type"
},
{
"comment": "Indicates taint passed through the 'len()' built-in function",
"name": "len"
},
{
"comment": "Indicates taint passed through a function producing a shell escaped string example shlex.quote",
"name": "shell_escape"
},
{
"comment": "Indicates taint passed through a function that does URL encoding usually to protect from SSRF",
"name": "urlencode"
},
{
"comment": "Indicates a known false positive for rule 6306",
"name": "known_false_positive_6306"
},
{
"comment": "Indicates that this flow passed through a SQL query, and thus might not reflect the original tainted data anymore",
"name": "sql_query"
},
{
"comment": "Indicates that this flow passed through a Thrift query, and thus might not reflect the original tainted data anymore",
"name": "thrift_query"
},
{
"comment": "Indicates that this flow passed through a Filesystem operation, and thus might not reflect the original tainted data anymore",
"name": "filesystem_operation"
},
{
"comment": "Indicates that this flow passed through a regex validation function",
"name": "validated_regex"
},
{
"comment": "Indicates that this flow passed through str.isidentifer function",
"name": "validated_isidentifer"
}
],
"transforms": [
{
"name": "FileOperation",
"comment": "Contents of a file are read"
}
],
"implicit_sources": {
"literal_strings": [
{
"description": "Indicates a string which may be an Amazon AWS access key.",
"kind": "AWSAccessKey",
"regexp": "AKIA[0-9A-Z]{16}"
},
{
"description": "Indicates a string which may be a Google API key.",
"kind": "GoogleAPIKey",
"regexp": "AIza[0-9A-Za-z\\-_]{35}"
},
{
"description": "Indicates a string which may be an SQL query.",
"kind": "StringMayBeSQL",
"regexp": "^\\s*(UPDATE|DELETE|(?i)INSERT INTO|SELECT)\\s+.*?"
},
{
"description": "Indicates a string which may be HTML.",
"kind": "StringMayBeHTML",
"regexp": "<.*?>"
},
{
"description": "Indicates a string which may be a URL.",
"kind": "StringMayBeURL",
"regexp": "^(?i)https?://\\S+"
}
]
},
"rules": [
{
"code": 5001,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Possible shell injection",
"sinks": [
"RemoteCodeExecution"
],
"sources": [
"UserControlled"
]
},
{
"code": 5002,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Test flow",
"sinks": [
"Test"
],
"sources": [
"Test",
"UserControlled"
]
},
{
"code": 5005,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "SQL injection.",
"sinks": [
"SQL"
],
"sources": [
"UserControlled"
]
},
{
"code": 5007,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "User data to XML Parser.",
"sinks": [
"XMLParser"
],
"sources": [
"UserControlled"
]
},
{
"code": 5008,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "XSS",
"sinks": [
"XSS"
],
"sources": [
"UserControlled"
]
},
{
"code": 5009,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Demo flow",
"sinks": [
"Demo"
],
"sources": [
"Demo"
]
},
{
"code": 5011,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "User data to filesystem operation (read/write)",
"sinks": [
"FileSystem_ReadWrite"
],
"sources": [
"UserControlled"
]
},
{
"code": 5012,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Potential Server-side request forgery (SSRF)",
"sinks": [
"HTTPClientRequest",
"HTTPClientRequest_URI",
"HTTPClientRequest_METADATA",
"HTTPClientRequest_DATA"
],
"sources": [
"UserControlled"
]
},
{
"code": 5018,
"message_format": "Data from [{$sources}] source(s) may be used in an open redirect via [{$sinks}] sink(s)",
"name": "Open redirect",
"sinks": [
"Redirect"
],
"sources": [
"UserControlled"
]
},
{
"code": 5027,
"message_format": "Server secrets such as keys and access tokens are being returned to users",
"name": "Server secrets reach exit",
"sinks": [
"ReturnedToUser",
"ThriftReturn"
],
"sources": [
"ServerSecrets"
]
},
{
"code": 5029,
"message_format": "User controlled data is used to set headers on a response",
"name": "User controlled response headers",
"sinks": [
"ResponseHeaderName",
"ResponseHeaderValue"
],
"sources": [
"UserControlled"
]
},
{
"code": 5034,
"message_format": "User controlled string is being formatted which may leak globally accessible data",
"name": "User controlled string formatting",
"sinks": [
"FormatString"
],
"sources": [
"UserControlled"
]
},
{
"code": 5036,
"message_format": "User controlled data is in emails being sent from server.",
"name": "User controlled data to email send to users",
"sinks": [
"EmailSend"
],
"sources": [
"UserControlled"
]
},
{
"code": 5041,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Possible shell injection via command line arguments",
"sinks": [
"RemoteCodeExecution"
],
"sources": [
"CLIUserControlled"
]
},
{
"code": 5067,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Unsafe UserControlled file handle before content deserialization may result in RCE",
"sinks": [
"FileContentDeserializationSink"
],
"sources": [
"UserControlled"
]
},
{
"code": 6060,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "User-controlled data flows into filesystem API (other)",
"sinks": [
"FileSystem_Other"
],
"sources": [
"UserControlled"
]
},
{
"code": 6064,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Environment variable or import injection may result in RCE",
"sinks": [
"ExecEnvSink",
"ExecImportSink"
],
"sources": [
"UserControlled"
]
},
{
"code": 6065,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Commandline arguments injection may result in RCE",
"sinks": [
"ExecArgSink"
],
"sources": [
"UserControlled"
]
},
{
"code": 6066,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Unsafe deserialization may result in RCE",
"sinks": [
"ExecDeserializationSink"
],
"sources": [
"UserControlled"
]
},
{
"code": 6073,
"message_format": "User controlled data may eventually flow into a Server Side Template Injection sink",
"name": "Potential Server Side Template Injection",
"sinks": [
"ServerSideTemplateInjection"
],
"sources": [
"UserControlled"
]
},
{
"code": 6074,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Hardcoded credentials may be used to authenticate requests",
"sinks": [
"Authentication",
"HTTPClientRequest_DATA",
"HTTPClientRequest_URI"
],
"sources": [
"AWSAccessKey",
"GoogleAPIKey"
]
},
{
"code": 6302,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Exception message is returned to the user",
"sinks": [
"ReturnedToUser"
],
"sources": [
"Exception"
]
},
{
"code": 6303,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Potential LDAP injection",
"sinks": [
"LDAPInjection"
],
"sources": [
"UserControlled"
]
},
{
"code": 6306,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "User-controlled data flows into Thrift configuration",
"sinks": [
"ThriftConfiguration"
],
"sources": [
"UserControlled"
]
},
{
"code": 5301,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Possible shell injection",
"sinks": [
"RemoteCodeExecution"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5305,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "SQL injection.",
"sinks": [
"SQL"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5307,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "User data to XML Parser.",
"sinks": [
"XMLParser"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5308,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "XSS",
"sinks": [
"XSS"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5311,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "User data to filesystem operation (read/write)",
"sinks": [
"FileSystem_ReadWrite"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5360,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "User-controlled data flows into filesystem API (other)",
"sinks": [
"FileSystem_Other"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5364,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Environment variable or import injection may result in RCE",
"sinks": [
"ExecEnvSink",
"ExecImportSink"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5365,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Commandline arguments injection may result in RCE",
"sinks": [
"ExecArgSink"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5366,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "Unsafe deserialization may result in RCE",
"sinks": [
"ExecDeserializationSink"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5367,
"message_format": "Data from [{$sources}] source(s) may reach [{$sinks}] sink(s)",
"name": "External/Internet request response data controls file handle before content deserialization may result in RCE",
"sinks": [
"FileContentDeserializationSink"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 5373,
"message_format": "Data from Internet may eventually flow into a Server Side Template Injection sink",
"name": "Potential Server Side Template Injection",
"sinks": [
"ServerSideTemplateInjection"
],
"sources": [
"DataFromInternet"
]
},
{
"code": 6108,
"message_format": "User Controlled file returned to user",
"name": "User Controlled file returned to user",
"sinks": [
"ReturnedToUser",
"ThriftReturn"
],
"sources": [
"UserControlled"
],
"transforms": [
"FileOperation"
]
},
{
"code": 6809,
"message_format": "Input is from a Database (sql) which flows into a RCE sink",
"name": "SQL query output flows into a RCE sink ",
"sinks": [
"RemoteCodeExecution"
],
"sources": [
"SQLControlled"
]
}
],
"sinks": [
{
"comment": "demo sink",
"name": "Demo"
},
{
"comment": "test sink",
"name": "Test"
},
{
"comment": "use to annotate where data flows into file system APIs that may allow read/write to an arbitrary file",
"name": "FileSystem_ReadWrite"
},
{
"comment": "use to annotate file systems APIs that do not allow direct read/write (e.g removing a file or renaming a file)",
"name": "FileSystem_Other"
},
{
"comment": "used to annotate `getattr` function",
"name": "GetAttr"
},
{
"comment": "use to annotate where data is logged",
"name": "Logging"
},
{
"comment": "use to annotate where data influences a redirect sent to the user",
"name": "Redirect"
},
{
"comment": "use to annotate where inputs can directly lead to code execution",
"name": "RemoteCodeExecution"
},
{
"comment": "use to annotate where inputs flow into the environment variables",
"name": "ExecEnvSink"
},
{
"comment": "use to annotate where inputs flow into the command line arguments",
"name": "ExecArgSink"
},
{
"comment": "use to annotate where inputs flow into unsafe deserialization functions",
"name": "ExecDeserializationSink"
},
{
"comment": "use to annotate where file content flow into unsafe deserialization functions",
"name": "FileContentDeserializationSink"
},
{
"comment": "use to annotate where inputs flow into import functions",
"name": "ExecImportSink"
},
{
"comment": "use to annotate where data influences request sending",
"name": "HTTPClientRequest"
},
{
"comment": "use to annotate the URI of a request being sent",
"name": "HTTPClientRequest_URI"
},
{
"comment": "use to annotate the meta data of a request being sent (e.g method, port, headers, cookies)",
"name": "HTTPClientRequest_METADATA"
},
{
"comment": "use to annotate the locations of data being sent in a request (post body, query params)",
"name": "HTTPClientRequest_DATA"
},
{
"comment": "use to annotate locations where data is returned to users",
"name": "ReturnedToUser"
},
{
"comment": "use to annotate locations where header names are set on responses",
"name": "ResponseHeaderName"
},
{
"comment": "use to annotate locations where header values are set on responses",
"name": "ResponseHeaderValue"
},
{
"comment": "use to annotate places of SQL injection risk",
"name": "SQL"
},
{
"comment": "use to annotate where data is parsed for XML",
"name": "XMLParser"
},
{
"comment": "use to annotate where data can cause XSS",
"name": "XSS"
},
{
"comment": "used to annotate locations of MemCache",
"name": "MemcacheSink"
},
{
"comment": "used to annotate locations where data enters a persistent data store",
"name": "DataStorage"
},
{
"comment": "used to annotate locations where data is included in emails sent",
"name": "EmailSend"
},
{
"comment": "used to annotate where strings get formatted",
"name": "FormatString"
},
{
"comment": "used to annotate locations of Server Side Template Injection risk",
"name": "ServerSideTemplateInjection"
},
{
"comment": "used to annotate locations where we return data from thrift",
"name": "ThriftReturn"
},
{
"comment": "used to annotate where credentials are supplied to a request",
"name": "Authentication"
},
{
"comment": "used to annotate locations of LDAP injection risk",
"name": "LDAPInjection"
},
{
"comment": "used to annotate information used to configure and construct Thrift instances.",
"name": "ThriftConfiguration"
},
{
"comment": "used to annotate where data is used to set a cookie",
"name": "CookieWrite"
}
],
"sources": [
{
"comment": "Input is coming from the return of an SQL query",
"name": "SQLControlled"
},
{
"comment": "used to annotate cookie sources",
"name": "Cookies"
},
{
"comment": "demo source",
"name": "Demo"
},
{
"comment": "use to annotate passwords, tokens, etc.",
"name": "UserSecrets"
},
{
"comment": "use to annotate user data",
"name": "UserData"
},
{
"comment": "use to annotate all data that is controllable by the user making a request",
"name": "UserControlled",
"kind": "parametric"
},
{
"comment": "use to annotate data that is an entire payload from user requests (eg. GET/POST payloads)",
"name": "UserControlled_Payload"
},
{
"comment": "use to annotate data that an individual parametr from user requests (eg. a single URL param)",
"name": "UserControlled_Parameter"
},
{
"comment": "use to annotate metadata that comes with a user's request, but is not explicitly part of the payload (headers, cookies, etc)",
"name": "UserControlled_Meta"
},
{
"comment": "use to annotate the payload that is returned in response to a user's request",
"name": "ResponseData"
},
{
"comment": "test source",
"name": "Test"
},
{
"comment": "use to annotate signing keys, access tokens, and other server secrets",
"name": "ServerSecrets"
},
{
"comment": "use to annotate headers, which may contain data that should be treated carefully",
"name": "HeaderData"
},
{
"comment": "use to annotate whole or partial URLs",
"name": "URL"
},
{
"comment": "used to annotate locations of MemCache",
"name": "MemCache"
},
{
"comment": "Used to annotate data that comes from a GET request.",
"name": "DataFromGET"
},
{
"comment": "Used to annotate data that comes from a POST request.",
"name": "DataFromPOST"
},
{
"comment": "Used to annotate data that may or may not come from a GET request.",
"name": "MaybeDataFromGET"
},
{
"comment": "Used to annotate data that may or may not come from a POST request.",
"name": "MaybeDataFromPOST"
},
{
"comment": "used to annotate raw exception messages, which could contain sensitive application details.",
"name": "Exception"
},
{
"comment": "used to annotate command line arguments, which could be user-controlled.",
"name": "CLIUserControlled"
},
{
"comment": "used to annotate an Amazon AWS access key.",
"name": "AWSAccessKey"
},
{
"comment": "used to annotate a Google API key.",
"name": "GoogleAPIKey"
},
{
"comment": "use to annotate data returned by an HTTP request",
"name": "DataFromInternet"
},
{
"comment": "used to annotate locations where f-string looks like SQL statement",
"name": "StringMayBeSQL"
},
{
"comment": "used to annotate locations where f-string looks like HTML",
"name": "StringMayBeHTML"
},
{
"comment": "used to annotate locations where string looks like a URL.",
"name": "StringMayBeURL"
}
]
}