agent-security-scanner-mcp 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -15
- package/package.json +4 -2
- package/rules/c.security.yaml +459 -0
- package/rules/php.security.yaml +461 -0
- package/rules/ruby.security.yaml +400 -0
- package/rules/terraform.security.yaml +505 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# TERRAFORM SECURITY RULES - AWS S3
|
|
4
|
+
# =============================================================================
|
|
5
|
+
|
|
6
|
+
- id: terraform.aws.security.s3-public-read
|
|
7
|
+
languages: [hcl, terraform]
|
|
8
|
+
severity: ERROR
|
|
9
|
+
message: "S3 bucket has public read access. Remove public-read ACL and use bucket policies for access control."
|
|
10
|
+
patterns:
|
|
11
|
+
- "acl\\s*=\\s*\"public-read\""
|
|
12
|
+
- "acl\\s*=\\s*\"public-read-write\""
|
|
13
|
+
metadata:
|
|
14
|
+
cwe: "CWE-284"
|
|
15
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
16
|
+
confidence: HIGH
|
|
17
|
+
references:
|
|
18
|
+
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket
|
|
19
|
+
|
|
20
|
+
- id: terraform.aws.security.s3-encryption-disabled
|
|
21
|
+
languages: [hcl, terraform]
|
|
22
|
+
severity: WARNING
|
|
23
|
+
message: "S3 bucket encryption not configured. Enable server-side encryption with SSE-S3 or SSE-KMS."
|
|
24
|
+
patterns:
|
|
25
|
+
- "resource\\s*\"aws_s3_bucket\"(?![^}]*server_side_encryption_configuration)"
|
|
26
|
+
metadata:
|
|
27
|
+
cwe: "CWE-311"
|
|
28
|
+
owasp: "A02:2021 - Cryptographic Failures"
|
|
29
|
+
confidence: MEDIUM
|
|
30
|
+
references:
|
|
31
|
+
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-encryption.html
|
|
32
|
+
|
|
33
|
+
- id: terraform.aws.security.s3-versioning-disabled
|
|
34
|
+
languages: [hcl, terraform]
|
|
35
|
+
severity: INFO
|
|
36
|
+
message: "S3 bucket versioning not enabled. Enable versioning for data protection and recovery."
|
|
37
|
+
patterns:
|
|
38
|
+
- "resource\\s*\"aws_s3_bucket\"(?![^}]*versioning)"
|
|
39
|
+
metadata:
|
|
40
|
+
cwe: "CWE-693"
|
|
41
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
42
|
+
confidence: LOW
|
|
43
|
+
references:
|
|
44
|
+
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html
|
|
45
|
+
|
|
46
|
+
- id: terraform.aws.security.s3-logging-disabled
|
|
47
|
+
languages: [hcl, terraform]
|
|
48
|
+
severity: INFO
|
|
49
|
+
message: "S3 bucket logging not configured. Enable access logging for audit trails."
|
|
50
|
+
patterns:
|
|
51
|
+
- "resource\\s*\"aws_s3_bucket\"(?![^}]*logging)"
|
|
52
|
+
metadata:
|
|
53
|
+
cwe: "CWE-778"
|
|
54
|
+
owasp: "A09:2021 - Security Logging and Monitoring Failures"
|
|
55
|
+
confidence: LOW
|
|
56
|
+
references:
|
|
57
|
+
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html
|
|
58
|
+
|
|
59
|
+
# =============================================================================
|
|
60
|
+
# TERRAFORM SECURITY RULES - AWS Security Groups
|
|
61
|
+
# =============================================================================
|
|
62
|
+
|
|
63
|
+
- id: terraform.aws.security.security-group-open-ingress
|
|
64
|
+
languages: [hcl, terraform]
|
|
65
|
+
severity: ERROR
|
|
66
|
+
message: "Security group allows unrestricted ingress (0.0.0.0/0). Restrict to specific IP ranges."
|
|
67
|
+
patterns:
|
|
68
|
+
- "cidr_blocks\\s*=\\s*\\[\\s*\"0\\.0\\.0\\.0/0\"\\s*\\]"
|
|
69
|
+
- "ipv6_cidr_blocks\\s*=\\s*\\[\\s*\"::/0\"\\s*\\]"
|
|
70
|
+
metadata:
|
|
71
|
+
cwe: "CWE-284"
|
|
72
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
73
|
+
confidence: HIGH
|
|
74
|
+
references:
|
|
75
|
+
- https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html
|
|
76
|
+
|
|
77
|
+
- id: terraform.aws.security.security-group-open-ssh
|
|
78
|
+
languages: [hcl, terraform]
|
|
79
|
+
severity: ERROR
|
|
80
|
+
message: "Security group allows SSH from anywhere. Restrict SSH access to specific IPs or use bastion hosts."
|
|
81
|
+
patterns:
|
|
82
|
+
- "from_port\\s*=\\s*22[^}]*cidr_blocks\\s*=\\s*\\[\\s*\"0\\.0\\.0\\.0/0\""
|
|
83
|
+
- "to_port\\s*=\\s*22[^}]*cidr_blocks\\s*=\\s*\\[\\s*\"0\\.0\\.0\\.0/0\""
|
|
84
|
+
metadata:
|
|
85
|
+
cwe: "CWE-284"
|
|
86
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
87
|
+
confidence: HIGH
|
|
88
|
+
references:
|
|
89
|
+
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-rules-reference.html
|
|
90
|
+
|
|
91
|
+
- id: terraform.aws.security.security-group-open-rdp
|
|
92
|
+
languages: [hcl, terraform]
|
|
93
|
+
severity: ERROR
|
|
94
|
+
message: "Security group allows RDP from anywhere. Restrict RDP access to specific IPs."
|
|
95
|
+
patterns:
|
|
96
|
+
- "from_port\\s*=\\s*3389[^}]*cidr_blocks\\s*=\\s*\\[\\s*\"0\\.0\\.0\\.0/0\""
|
|
97
|
+
- "to_port\\s*=\\s*3389[^}]*cidr_blocks\\s*=\\s*\\[\\s*\"0\\.0\\.0\\.0/0\""
|
|
98
|
+
metadata:
|
|
99
|
+
cwe: "CWE-284"
|
|
100
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
101
|
+
confidence: HIGH
|
|
102
|
+
references:
|
|
103
|
+
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-rules-reference.html
|
|
104
|
+
|
|
105
|
+
# =============================================================================
|
|
106
|
+
# TERRAFORM SECURITY RULES - AWS IAM
|
|
107
|
+
# =============================================================================
|
|
108
|
+
|
|
109
|
+
- id: terraform.aws.security.iam-admin-policy
|
|
110
|
+
languages: [hcl, terraform]
|
|
111
|
+
severity: ERROR
|
|
112
|
+
message: "IAM policy grants admin access with Action:* and Resource:*. Follow least privilege principle."
|
|
113
|
+
patterns:
|
|
114
|
+
- "\"Action\"\\s*:\\s*\"\\*\"[^}]*\"Resource\"\\s*:\\s*\"\\*\""
|
|
115
|
+
- "actions\\s*=\\s*\\[\\s*\"\\*\"\\s*\\][^}]*resources\\s*=\\s*\\[\\s*\"\\*\"\\s*\\]"
|
|
116
|
+
metadata:
|
|
117
|
+
cwe: "CWE-250"
|
|
118
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
119
|
+
confidence: HIGH
|
|
120
|
+
references:
|
|
121
|
+
- https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html
|
|
122
|
+
|
|
123
|
+
- id: terraform.aws.security.iam-user-policy-attachment
|
|
124
|
+
languages: [hcl, terraform]
|
|
125
|
+
severity: WARNING
|
|
126
|
+
message: "IAM policy attached directly to user. Attach policies to groups or roles instead."
|
|
127
|
+
patterns:
|
|
128
|
+
- "resource\\s*\"aws_iam_user_policy_attachment\""
|
|
129
|
+
- "resource\\s*\"aws_iam_user_policy\""
|
|
130
|
+
metadata:
|
|
131
|
+
cwe: "CWE-250"
|
|
132
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
133
|
+
confidence: MEDIUM
|
|
134
|
+
references:
|
|
135
|
+
- https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html
|
|
136
|
+
|
|
137
|
+
# =============================================================================
|
|
138
|
+
# TERRAFORM SECURITY RULES - AWS RDS
|
|
139
|
+
# =============================================================================
|
|
140
|
+
|
|
141
|
+
- id: terraform.aws.security.rds-public-access
|
|
142
|
+
languages: [hcl, terraform]
|
|
143
|
+
severity: ERROR
|
|
144
|
+
message: "RDS instance is publicly accessible. Set publicly_accessible to false."
|
|
145
|
+
patterns:
|
|
146
|
+
- "publicly_accessible\\s*=\\s*true"
|
|
147
|
+
metadata:
|
|
148
|
+
cwe: "CWE-284"
|
|
149
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
150
|
+
confidence: HIGH
|
|
151
|
+
references:
|
|
152
|
+
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Security.html
|
|
153
|
+
|
|
154
|
+
- id: terraform.aws.security.rds-encryption-disabled
|
|
155
|
+
languages: [hcl, terraform]
|
|
156
|
+
severity: ERROR
|
|
157
|
+
message: "RDS storage encryption disabled. Set storage_encrypted to true."
|
|
158
|
+
patterns:
|
|
159
|
+
- "storage_encrypted\\s*=\\s*false"
|
|
160
|
+
- "resource\\s*\"aws_db_instance\"(?![^}]*storage_encrypted\\s*=\\s*true)"
|
|
161
|
+
metadata:
|
|
162
|
+
cwe: "CWE-311"
|
|
163
|
+
owasp: "A02:2021 - Cryptographic Failures"
|
|
164
|
+
confidence: HIGH
|
|
165
|
+
references:
|
|
166
|
+
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Encryption.html
|
|
167
|
+
|
|
168
|
+
- id: terraform.aws.security.rds-deletion-protection
|
|
169
|
+
languages: [hcl, terraform]
|
|
170
|
+
severity: INFO
|
|
171
|
+
message: "RDS deletion protection not enabled. Enable for production databases."
|
|
172
|
+
patterns:
|
|
173
|
+
- "deletion_protection\\s*=\\s*false"
|
|
174
|
+
metadata:
|
|
175
|
+
cwe: "CWE-693"
|
|
176
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
177
|
+
confidence: MEDIUM
|
|
178
|
+
references:
|
|
179
|
+
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DeleteInstance.html
|
|
180
|
+
|
|
181
|
+
# =============================================================================
|
|
182
|
+
# TERRAFORM SECURITY RULES - AWS CloudTrail/Logging
|
|
183
|
+
# =============================================================================
|
|
184
|
+
|
|
185
|
+
- id: terraform.aws.security.cloudtrail-disabled
|
|
186
|
+
languages: [hcl, terraform]
|
|
187
|
+
severity: WARNING
|
|
188
|
+
message: "CloudTrail logging disabled. Enable multi-region CloudTrail for audit logging."
|
|
189
|
+
patterns:
|
|
190
|
+
- "enable_logging\\s*=\\s*false"
|
|
191
|
+
- "is_multi_region_trail\\s*=\\s*false"
|
|
192
|
+
metadata:
|
|
193
|
+
cwe: "CWE-778"
|
|
194
|
+
owasp: "A09:2021 - Security Logging and Monitoring Failures"
|
|
195
|
+
confidence: HIGH
|
|
196
|
+
references:
|
|
197
|
+
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html
|
|
198
|
+
|
|
199
|
+
- id: terraform.aws.security.cloudtrail-encryption
|
|
200
|
+
languages: [hcl, terraform]
|
|
201
|
+
severity: WARNING
|
|
202
|
+
message: "CloudTrail logs not encrypted with KMS. Configure kms_key_id for encryption."
|
|
203
|
+
patterns:
|
|
204
|
+
- "resource\\s*\"aws_cloudtrail\"(?![^}]*kms_key_id)"
|
|
205
|
+
metadata:
|
|
206
|
+
cwe: "CWE-311"
|
|
207
|
+
owasp: "A02:2021 - Cryptographic Failures"
|
|
208
|
+
confidence: MEDIUM
|
|
209
|
+
references:
|
|
210
|
+
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html
|
|
211
|
+
|
|
212
|
+
# =============================================================================
|
|
213
|
+
# TERRAFORM SECURITY RULES - AWS KMS
|
|
214
|
+
# =============================================================================
|
|
215
|
+
|
|
216
|
+
- id: terraform.aws.security.kms-key-rotation
|
|
217
|
+
languages: [hcl, terraform]
|
|
218
|
+
severity: WARNING
|
|
219
|
+
message: "KMS key rotation not enabled. Enable automatic key rotation for security."
|
|
220
|
+
patterns:
|
|
221
|
+
- "enable_key_rotation\\s*=\\s*false"
|
|
222
|
+
- "resource\\s*\"aws_kms_key\"(?![^}]*enable_key_rotation\\s*=\\s*true)"
|
|
223
|
+
metadata:
|
|
224
|
+
cwe: "CWE-320"
|
|
225
|
+
owasp: "A02:2021 - Cryptographic Failures"
|
|
226
|
+
confidence: HIGH
|
|
227
|
+
references:
|
|
228
|
+
- https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html
|
|
229
|
+
|
|
230
|
+
# =============================================================================
|
|
231
|
+
# TERRAFORM SECURITY RULES - AWS EC2/EBS
|
|
232
|
+
# =============================================================================
|
|
233
|
+
|
|
234
|
+
- id: terraform.aws.security.ebs-encryption-disabled
|
|
235
|
+
languages: [hcl, terraform]
|
|
236
|
+
severity: WARNING
|
|
237
|
+
message: "EBS volume encryption disabled. Set encrypted to true."
|
|
238
|
+
patterns:
|
|
239
|
+
- "encrypted\\s*=\\s*false"
|
|
240
|
+
- "resource\\s*\"aws_ebs_volume\"(?![^}]*encrypted\\s*=\\s*true)"
|
|
241
|
+
metadata:
|
|
242
|
+
cwe: "CWE-311"
|
|
243
|
+
owasp: "A02:2021 - Cryptographic Failures"
|
|
244
|
+
confidence: HIGH
|
|
245
|
+
references:
|
|
246
|
+
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html
|
|
247
|
+
|
|
248
|
+
- id: terraform.aws.security.ec2-imdsv1
|
|
249
|
+
languages: [hcl, terraform]
|
|
250
|
+
severity: WARNING
|
|
251
|
+
message: "EC2 instance metadata service v1 enabled. Require IMDSv2 for security."
|
|
252
|
+
patterns:
|
|
253
|
+
- "http_tokens\\s*=\\s*\"optional\""
|
|
254
|
+
metadata:
|
|
255
|
+
cwe: "CWE-284"
|
|
256
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
257
|
+
confidence: HIGH
|
|
258
|
+
references:
|
|
259
|
+
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
|
|
260
|
+
|
|
261
|
+
# =============================================================================
|
|
262
|
+
# TERRAFORM SECURITY RULES - Hardcoded Secrets
|
|
263
|
+
# =============================================================================
|
|
264
|
+
|
|
265
|
+
- id: terraform.generic.security.hardcoded-password
|
|
266
|
+
languages: [hcl, terraform]
|
|
267
|
+
severity: ERROR
|
|
268
|
+
message: "Hardcoded password in Terraform. Use variables with sensitive=true or secrets manager."
|
|
269
|
+
patterns:
|
|
270
|
+
- "password\\s*=\\s*\"[^\"]{4,}\""
|
|
271
|
+
- "master_password\\s*=\\s*\"[^\"]{4,}\""
|
|
272
|
+
- "admin_password\\s*=\\s*\"[^\"]{4,}\""
|
|
273
|
+
metadata:
|
|
274
|
+
cwe: "CWE-798"
|
|
275
|
+
owasp: "A07:2021 - Identification and Authentication Failures"
|
|
276
|
+
confidence: HIGH
|
|
277
|
+
references:
|
|
278
|
+
- https://developer.hashicorp.com/terraform/tutorials/configuration-language/sensitive-variables
|
|
279
|
+
|
|
280
|
+
- id: terraform.generic.security.hardcoded-api-key
|
|
281
|
+
languages: [hcl, terraform]
|
|
282
|
+
severity: ERROR
|
|
283
|
+
message: "Hardcoded API key in Terraform. Use variables or secrets manager."
|
|
284
|
+
patterns:
|
|
285
|
+
- "api_key\\s*=\\s*\"[a-zA-Z0-9_-]{20,}\""
|
|
286
|
+
- "access_key\\s*=\\s*\"AKIA[A-Z0-9]{16}\""
|
|
287
|
+
- "secret_key\\s*=\\s*\"[a-zA-Z0-9/+=]{40}\""
|
|
288
|
+
metadata:
|
|
289
|
+
cwe: "CWE-798"
|
|
290
|
+
owasp: "A07:2021 - Identification and Authentication Failures"
|
|
291
|
+
confidence: HIGH
|
|
292
|
+
references:
|
|
293
|
+
- https://developer.hashicorp.com/terraform/tutorials/configuration-language/sensitive-variables
|
|
294
|
+
|
|
295
|
+
# =============================================================================
|
|
296
|
+
# KUBERNETES SECURITY RULES - Pod Security
|
|
297
|
+
# =============================================================================
|
|
298
|
+
|
|
299
|
+
- id: kubernetes.security.privileged-container
|
|
300
|
+
languages: [yaml]
|
|
301
|
+
severity: ERROR
|
|
302
|
+
message: "Container running as privileged. Remove privileged: true for security."
|
|
303
|
+
patterns:
|
|
304
|
+
- "privileged:\\s*true"
|
|
305
|
+
metadata:
|
|
306
|
+
cwe: "CWE-250"
|
|
307
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
308
|
+
confidence: HIGH
|
|
309
|
+
references:
|
|
310
|
+
- https://kubernetes.io/docs/concepts/security/pod-security-standards/
|
|
311
|
+
|
|
312
|
+
- id: kubernetes.security.run-as-root
|
|
313
|
+
languages: [yaml]
|
|
314
|
+
severity: ERROR
|
|
315
|
+
message: "Container running as root. Set runAsNonRoot: true and specify runAsUser."
|
|
316
|
+
patterns:
|
|
317
|
+
- "runAsUser:\\s*0"
|
|
318
|
+
- "runAsNonRoot:\\s*false"
|
|
319
|
+
metadata:
|
|
320
|
+
cwe: "CWE-250"
|
|
321
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
322
|
+
confidence: HIGH
|
|
323
|
+
references:
|
|
324
|
+
- https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
|
325
|
+
|
|
326
|
+
- id: kubernetes.security.host-network
|
|
327
|
+
languages: [yaml]
|
|
328
|
+
severity: WARNING
|
|
329
|
+
message: "Pod using host network. This bypasses network isolation. Remove hostNetwork: true."
|
|
330
|
+
patterns:
|
|
331
|
+
- "hostNetwork:\\s*true"
|
|
332
|
+
metadata:
|
|
333
|
+
cwe: "CWE-284"
|
|
334
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
335
|
+
confidence: HIGH
|
|
336
|
+
references:
|
|
337
|
+
- https://kubernetes.io/docs/concepts/security/pod-security-standards/
|
|
338
|
+
|
|
339
|
+
- id: kubernetes.security.host-pid
|
|
340
|
+
languages: [yaml]
|
|
341
|
+
severity: WARNING
|
|
342
|
+
message: "Pod using host PID namespace. This can expose sensitive process information."
|
|
343
|
+
patterns:
|
|
344
|
+
- "hostPID:\\s*true"
|
|
345
|
+
metadata:
|
|
346
|
+
cwe: "CWE-284"
|
|
347
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
348
|
+
confidence: HIGH
|
|
349
|
+
references:
|
|
350
|
+
- https://kubernetes.io/docs/concepts/security/pod-security-standards/
|
|
351
|
+
|
|
352
|
+
- id: kubernetes.security.host-path
|
|
353
|
+
languages: [yaml]
|
|
354
|
+
severity: WARNING
|
|
355
|
+
message: "Container mounting host path. This can expose sensitive host files."
|
|
356
|
+
patterns:
|
|
357
|
+
- "hostPath:"
|
|
358
|
+
metadata:
|
|
359
|
+
cwe: "CWE-284"
|
|
360
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
361
|
+
confidence: MEDIUM
|
|
362
|
+
references:
|
|
363
|
+
- https://kubernetes.io/docs/concepts/storage/volumes/#hostpath
|
|
364
|
+
|
|
365
|
+
# =============================================================================
|
|
366
|
+
# KUBERNETES SECURITY RULES - Resource Limits
|
|
367
|
+
# =============================================================================
|
|
368
|
+
|
|
369
|
+
- id: kubernetes.security.no-resource-limits
|
|
370
|
+
languages: [yaml]
|
|
371
|
+
severity: WARNING
|
|
372
|
+
message: "Container without resource limits. Set CPU and memory limits to prevent DoS."
|
|
373
|
+
patterns:
|
|
374
|
+
- "containers:(?![^}]*limits:)"
|
|
375
|
+
metadata:
|
|
376
|
+
cwe: "CWE-770"
|
|
377
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
378
|
+
confidence: MEDIUM
|
|
379
|
+
references:
|
|
380
|
+
- https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
|
|
381
|
+
|
|
382
|
+
# =============================================================================
|
|
383
|
+
# KUBERNETES SECURITY RULES - Secrets
|
|
384
|
+
# =============================================================================
|
|
385
|
+
|
|
386
|
+
- id: kubernetes.security.secrets-in-env
|
|
387
|
+
languages: [yaml]
|
|
388
|
+
severity: WARNING
|
|
389
|
+
message: "Secret exposed in environment variable. Use secretKeyRef or volume mounts instead."
|
|
390
|
+
patterns:
|
|
391
|
+
- "env:[^}]*value:\\s*[\"'][^\"']{20,}[\"']"
|
|
392
|
+
- "PASSWORD[\"']?:\\s*[\"'][^\"']{4,}[\"']"
|
|
393
|
+
metadata:
|
|
394
|
+
cwe: "CWE-798"
|
|
395
|
+
owasp: "A07:2021 - Identification and Authentication Failures"
|
|
396
|
+
confidence: MEDIUM
|
|
397
|
+
references:
|
|
398
|
+
- https://kubernetes.io/docs/concepts/configuration/secret/
|
|
399
|
+
|
|
400
|
+
- id: kubernetes.security.hardcoded-secret
|
|
401
|
+
languages: [yaml]
|
|
402
|
+
severity: ERROR
|
|
403
|
+
message: "Hardcoded secret in Kubernetes manifest. Use Kubernetes Secrets or external secrets manager."
|
|
404
|
+
patterns:
|
|
405
|
+
- "stringData:[^}]*password:"
|
|
406
|
+
- "stringData:[^}]*api_key:"
|
|
407
|
+
- "data:[^}]*password:\\s*[a-zA-Z0-9+/=]{10,}"
|
|
408
|
+
metadata:
|
|
409
|
+
cwe: "CWE-798"
|
|
410
|
+
owasp: "A07:2021 - Identification and Authentication Failures"
|
|
411
|
+
confidence: HIGH
|
|
412
|
+
references:
|
|
413
|
+
- https://kubernetes.io/docs/concepts/configuration/secret/
|
|
414
|
+
|
|
415
|
+
# =============================================================================
|
|
416
|
+
# KUBERNETES SECURITY RULES - RBAC
|
|
417
|
+
# =============================================================================
|
|
418
|
+
|
|
419
|
+
- id: kubernetes.security.cluster-admin-binding
|
|
420
|
+
languages: [yaml]
|
|
421
|
+
severity: ERROR
|
|
422
|
+
message: "ClusterRoleBinding to cluster-admin. This grants full cluster access. Use least privilege."
|
|
423
|
+
patterns:
|
|
424
|
+
- "roleRef:[^}]*name:\\s*cluster-admin"
|
|
425
|
+
metadata:
|
|
426
|
+
cwe: "CWE-250"
|
|
427
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
428
|
+
confidence: HIGH
|
|
429
|
+
references:
|
|
430
|
+
- https://kubernetes.io/docs/reference/access-authn-authz/rbac/
|
|
431
|
+
|
|
432
|
+
- id: kubernetes.security.wildcard-rbac
|
|
433
|
+
languages: [yaml]
|
|
434
|
+
severity: WARNING
|
|
435
|
+
message: "RBAC rule with wildcard permissions. Specify explicit resources and verbs."
|
|
436
|
+
patterns:
|
|
437
|
+
- "resources:\\s*\\[\\s*\"\\*\"\\s*\\]"
|
|
438
|
+
- "verbs:\\s*\\[\\s*\"\\*\"\\s*\\]"
|
|
439
|
+
metadata:
|
|
440
|
+
cwe: "CWE-250"
|
|
441
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
442
|
+
confidence: HIGH
|
|
443
|
+
references:
|
|
444
|
+
- https://kubernetes.io/docs/reference/access-authn-authz/rbac/
|
|
445
|
+
|
|
446
|
+
# =============================================================================
|
|
447
|
+
# KUBERNETES SECURITY RULES - Network Policies
|
|
448
|
+
# =============================================================================
|
|
449
|
+
|
|
450
|
+
- id: kubernetes.security.allow-all-ingress
|
|
451
|
+
languages: [yaml]
|
|
452
|
+
severity: WARNING
|
|
453
|
+
message: "NetworkPolicy allows all ingress traffic. Restrict to specific sources."
|
|
454
|
+
patterns:
|
|
455
|
+
- "ingress:\\s*\\[\\s*\\{\\s*\\}\\s*\\]"
|
|
456
|
+
- "ingress:\\s*-\\s*\\{\\}"
|
|
457
|
+
metadata:
|
|
458
|
+
cwe: "CWE-284"
|
|
459
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
460
|
+
confidence: HIGH
|
|
461
|
+
references:
|
|
462
|
+
- https://kubernetes.io/docs/concepts/services-networking/network-policies/
|
|
463
|
+
|
|
464
|
+
# =============================================================================
|
|
465
|
+
# KUBERNETES SECURITY RULES - Security Context
|
|
466
|
+
# =============================================================================
|
|
467
|
+
|
|
468
|
+
- id: kubernetes.security.capabilities-add
|
|
469
|
+
languages: [yaml]
|
|
470
|
+
severity: WARNING
|
|
471
|
+
message: "Container adding Linux capabilities. Review and minimize added capabilities."
|
|
472
|
+
patterns:
|
|
473
|
+
- "capabilities:[^}]*add:"
|
|
474
|
+
metadata:
|
|
475
|
+
cwe: "CWE-250"
|
|
476
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
477
|
+
confidence: MEDIUM
|
|
478
|
+
references:
|
|
479
|
+
- https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
|
480
|
+
|
|
481
|
+
- id: kubernetes.security.no-readonly-root
|
|
482
|
+
languages: [yaml]
|
|
483
|
+
severity: INFO
|
|
484
|
+
message: "Container filesystem not read-only. Set readOnlyRootFilesystem: true."
|
|
485
|
+
patterns:
|
|
486
|
+
- "readOnlyRootFilesystem:\\s*false"
|
|
487
|
+
metadata:
|
|
488
|
+
cwe: "CWE-732"
|
|
489
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
490
|
+
confidence: MEDIUM
|
|
491
|
+
references:
|
|
492
|
+
- https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
|
493
|
+
|
|
494
|
+
- id: kubernetes.security.allow-privilege-escalation
|
|
495
|
+
languages: [yaml]
|
|
496
|
+
severity: WARNING
|
|
497
|
+
message: "Container allows privilege escalation. Set allowPrivilegeEscalation: false."
|
|
498
|
+
patterns:
|
|
499
|
+
- "allowPrivilegeEscalation:\\s*true"
|
|
500
|
+
metadata:
|
|
501
|
+
cwe: "CWE-250"
|
|
502
|
+
owasp: "A05:2021 - Security Misconfiguration"
|
|
503
|
+
confidence: HIGH
|
|
504
|
+
references:
|
|
505
|
+
- https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|