encoded.toml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # We want to be able to find this key regardless if it's b64 encoded or not
  2. [[rules]]
  3. id = 'private-key'
  4. description = 'Private Key'
  5. regex = '''(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\s\S-]*?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----'''
  6. tags = ['key', 'private']
  7. keywords = [
  8. '-----begin',
  9. ]
  10. # This exists to test what would happen if a normal rule matched something that
  11. # also gets decoded. We don't want to break anyone's existing rules that might
  12. # be looking for specific segments of b64 encoded data.
  13. [[rules]]
  14. id = 'b64-encoded-private-key'
  15. description = 'Private Key'
  16. regex = '''(?:LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0t|0tLS0tQkVHSU4gUFJJVkFURSBLRVktLS0tL|tLS0tLUJFR0lOIFBSSVZBVEUgS0VZLS0tLS)[a-zA-Z0-9+\/]+={0,3}'''
  17. tags = ['key', 'private']
  18. keywords = [
  19. 'ls0tls1crudjtibquklwqvrfietfws0tls0t',
  20. '0tls0tqkvhsu4gufjjvkfursblrvktls0tl',
  21. 'tls0tlujfr0loifbssvzbveugs0vzls0tls',
  22. ]
  23. [[rules]]
  24. id = 'aws-iam-unique-identifier'
  25. description = 'AWS IAM Unique Identifier'
  26. # The funky not group at the beginning consists of ascii ranges
  27. regex = '''(?:^|[^!$-&\(-9<>-~])((?:A3T[A-Z0-9]|ACCA|ABIA|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16})\b'''
  28. tags = ['aws', 'identifier']
  29. entropy = 3.2
  30. secretGroup = 1
  31. keywords = [
  32. 'a3t',
  33. 'abia',
  34. 'acca',
  35. 'agpa',
  36. 'aida',
  37. 'aipa',
  38. 'akia',
  39. 'anpa',
  40. 'anva',
  41. 'aroa',
  42. 'asia',
  43. ]
  44. [[rules]]
  45. id = 'aws-secret-access-key'
  46. description = 'AWS Secret Access Key'
  47. regex = '''(?i)aws[\w\-]{0,32}[\'\"]?\s*?[:=\(]\s*?[\'\"]?([a-z0-9\/+]{40})\b'''
  48. tags = ['aws', 'secret']
  49. entropy = 4
  50. secretGroup = 1
  51. keywords = [
  52. 'aws',
  53. ]
  54. [[rules]]
  55. # Use a small one for making sure things shifting around are kept up with
  56. # appropriately
  57. id = 'small-secret'
  58. description = 'Small Secret'
  59. regex = '''\bsmall-secret\b'''
  60. tags = ['small', 'secret']
  61. [[rules]]
  62. # When the example value is decoded this will overlap and this is here to
  63. # test that the location information is reported accurately when the match
  64. # goes outside the bounds of the encoded value
  65. id = 'overlapping'
  66. description = 'Overlapping'
  67. regex = '''secret=(decoded-secret-value\w*)'''
  68. tags = ['overlapping']
  69. secretGroup = 1
  70. # -----BEGIN REGEX TARGET DECODED MATCH PATTERNS-----
  71. [[rules]]
  72. id = 'decoded-password-dont-ignore'
  73. description = 'Make sure this would be detected with no allowlist'
  74. regex = '''password\s*=\s*\"([^\"]+please-ignore-me[^\"]+)\"'''
  75. tags = ['decode-ignore']
  76. secretGroup = 1
  77. [[rules]]
  78. id = 'decoded-password-ignore-secret'
  79. description = 'Test ignore on decoded secrets: regexTarget = "secret"'
  80. regex = '''password\s*=\s*\"([^\"]+please-ignore-me[^\"]+)\"'''
  81. tags = ['decode-ignore']
  82. secretGroup = 1
  83. [[rules.allowlists]]
  84. regexTarget = 'secret'
  85. regexes = [
  86. # The decoded segment that we are testing against
  87. 'please-ignore-me',
  88. ]
  89. [[rules]]
  90. id = 'decoded-password-ignore-match'
  91. description = 'Test ignore on decoded secrets: regexTarget = "match"'
  92. regex = '''password\s*=\s*\"([^\"]+please-ignore-me[^\"]+)\"'''
  93. tags = ['decode-ignore']
  94. secretGroup = 1
  95. [[rules.allowlists]]
  96. regexTarget = 'match'
  97. regexes = [
  98. # The decoded segment that we are testing against
  99. 'please-ignore-me',
  100. ]
  101. [[rules]]
  102. id = 'decoded-password-ignore-line'
  103. description = 'Test ignore on decoded secrets: regexTarget = "line"'
  104. regex = '''password\s*=\s*\"([^\"]+please-ignore-me[^\"]+)\"'''
  105. tags = ['decode-ignore']
  106. secretGroup = 1
  107. [[rules.allowlists]]
  108. regexTarget = 'line'
  109. regexes = [
  110. # The decoded segment that we are testing against
  111. 'please-ignore-me',
  112. ]
  113. # -----END REGEX TARGET DECODED MATCH PATTERNS-----