pinata-security-cli 0.5.3 → 0.6.1
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 +39 -2
- package/dist/cli/index.js +2423 -1909
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +8 -1
- package/src/categories/definitions/concurrency/idempotency-missing.yml +5 -5
- package/src/categories/definitions/concurrency/race-condition.yml +2 -2
- package/src/categories/definitions/data/data-race.yml +15 -18
- package/src/categories/definitions/data/encoding-mismatch.yml +4 -4
- package/src/categories/definitions/data/null-handling.yml +8 -23
- package/src/categories/definitions/input/boundary-testing.yml +12 -40
- package/src/categories/definitions/input/injection-fuzzing.yml +19 -0
- package/src/categories/definitions/input/null-undefined.yml +11 -39
- package/src/categories/definitions/network/connection-failure.yml +9 -3
- package/src/categories/definitions/resource/memory-leak.yml +15 -17
- package/src/categories/definitions/security/auth-failures.yml +8 -0
- package/src/categories/definitions/security/command-injection.yml +17 -0
- package/src/categories/definitions/security/csrf.yml +19 -0
- package/src/categories/definitions/security/data-exposure.yml +24 -0
- package/src/categories/definitions/security/dependency-risks.yml +6 -6
- package/src/categories/definitions/security/deserialization.yml +44 -0
- package/src/categories/definitions/security/file-upload.yml +39 -0
- package/src/categories/definitions/security/ldap-injection.yml +23 -0
- package/src/categories/definitions/security/path-traversal.yml +13 -0
- package/src/categories/definitions/security/prompt-injection.yml +14 -0
- package/src/categories/definitions/security/sql-injection.yml +30 -0
- package/src/categories/definitions/security/ssrf.yml +60 -0
- package/src/categories/definitions/security/xss.yml +36 -0
- package/src/categories/definitions/security/xxe.yml +32 -0
|
@@ -84,6 +84,18 @@ detectionPatterns:
|
|
|
84
84
|
pattern: "serialize-javascript|js-yaml\\.load\\("
|
|
85
85
|
confidence: medium
|
|
86
86
|
description: Detects serialization libraries that may allow code execution
|
|
87
|
+
sources:
|
|
88
|
+
- "req\\.(body|params|query|headers)"
|
|
89
|
+
- "\\buser[Ii]nput\\b"
|
|
90
|
+
- "searchParams\\.get\\("
|
|
91
|
+
- "\\bprocess\\.argv"
|
|
92
|
+
sanitizers:
|
|
93
|
+
- "JSON\\.parse\\("
|
|
94
|
+
- "\\bz\\.(object|string|number|array)\\("
|
|
95
|
+
- "zod\\."
|
|
96
|
+
- "joi\\.validate\\("
|
|
97
|
+
- "Joi\\.(object|string)\\("
|
|
98
|
+
- "yaml\\.load\\(.*schema:\\s*yaml\\.JSON_SCHEMA"
|
|
87
99
|
|
|
88
100
|
- id: ts-eval-json
|
|
89
101
|
type: regex
|
|
@@ -91,6 +103,16 @@ detectionPatterns:
|
|
|
91
103
|
pattern: "eval\\s*\\(.*JSON|Function\\s*\\([\"']return[\"']\\s*\\+"
|
|
92
104
|
confidence: high
|
|
93
105
|
description: Detects eval-based JSON parsing which allows code execution
|
|
106
|
+
sources:
|
|
107
|
+
- "req\\.(body|params|query|headers)"
|
|
108
|
+
- "\\buser[Ii]nput\\b"
|
|
109
|
+
- "searchParams\\.get\\("
|
|
110
|
+
sanitizers:
|
|
111
|
+
- "JSON\\.parse\\("
|
|
112
|
+
- "\\bz\\.(object|string|number|array)\\("
|
|
113
|
+
- "zod\\."
|
|
114
|
+
- "joi\\.validate\\("
|
|
115
|
+
- "Joi\\.(object|string)\\("
|
|
94
116
|
|
|
95
117
|
- id: ts-node-serialize
|
|
96
118
|
type: regex
|
|
@@ -98,6 +120,16 @@ detectionPatterns:
|
|
|
98
120
|
pattern: "node-serialize|serialize-to-js"
|
|
99
121
|
confidence: high
|
|
100
122
|
description: Detects node-serialize which is vulnerable to RCE
|
|
123
|
+
sources:
|
|
124
|
+
- "req\\.(body|params|query|headers)"
|
|
125
|
+
- "\\buser[Ii]nput\\b"
|
|
126
|
+
- "searchParams\\.get\\("
|
|
127
|
+
sanitizers:
|
|
128
|
+
- "JSON\\.parse\\("
|
|
129
|
+
- "\\bz\\.(object|string|number|array)\\("
|
|
130
|
+
- "zod\\."
|
|
131
|
+
- "joi\\.validate\\("
|
|
132
|
+
- "Joi\\.(object|string)\\("
|
|
101
133
|
|
|
102
134
|
- id: ts-vm-runinnewcontext
|
|
103
135
|
type: regex
|
|
@@ -105,6 +137,18 @@ detectionPatterns:
|
|
|
105
137
|
pattern: "vm\\.runInNewContext\\s*\\(|vm\\.runInThisContext\\s*\\("
|
|
106
138
|
confidence: high
|
|
107
139
|
description: Detects Node.js vm module with potential untrusted code
|
|
140
|
+
sources:
|
|
141
|
+
- "req\\.(body|params|query|headers)"
|
|
142
|
+
- "\\buser[Ii]nput\\b"
|
|
143
|
+
- "searchParams\\.get\\("
|
|
144
|
+
- "\\bprocess\\.argv"
|
|
145
|
+
sanitizers:
|
|
146
|
+
- "JSON\\.parse\\("
|
|
147
|
+
- "\\bz\\.(object|string|number|array)\\("
|
|
148
|
+
- "zod\\."
|
|
149
|
+
- "joi\\.validate\\("
|
|
150
|
+
- "Joi\\.(object|string)\\("
|
|
151
|
+
- "vm2|isolated-vm"
|
|
108
152
|
|
|
109
153
|
- id: ts-unserialize
|
|
110
154
|
type: regex
|
|
@@ -46,6 +46,16 @@ detectionPatterns:
|
|
|
46
46
|
pattern: "multer\\s*\\(\\s*\\{(?!.*fileFilter)"
|
|
47
47
|
confidence: high
|
|
48
48
|
description: Multer configured without fileFilter - accepts any file type
|
|
49
|
+
sources:
|
|
50
|
+
- "req\\.file"
|
|
51
|
+
- "req\\.files"
|
|
52
|
+
- "req\\.(body|params|query)"
|
|
53
|
+
sanitizers:
|
|
54
|
+
- "fileFilter"
|
|
55
|
+
- "mimetype"
|
|
56
|
+
- "file\\.mimetype"
|
|
57
|
+
- "path\\.extname\\("
|
|
58
|
+
- "path\\.basename\\("
|
|
49
59
|
|
|
50
60
|
- id: multer-no-limits
|
|
51
61
|
type: regex
|
|
@@ -122,6 +132,16 @@ detectionPatterns:
|
|
|
122
132
|
description: |
|
|
123
133
|
[REVIEW] File processed without extension validation.
|
|
124
134
|
Verify allowed file types are checked.
|
|
135
|
+
sources:
|
|
136
|
+
- "req\\.file"
|
|
137
|
+
- "req\\.files"
|
|
138
|
+
sanitizers:
|
|
139
|
+
- "path\\.extname\\("
|
|
140
|
+
- "\\.endsWith\\("
|
|
141
|
+
- "\\.match\\("
|
|
142
|
+
- "fileFilter"
|
|
143
|
+
- "allowedExtensions"
|
|
144
|
+
- "path\\.basename\\("
|
|
125
145
|
|
|
126
146
|
- id: no-mimetype-check
|
|
127
147
|
type: regex
|
|
@@ -131,6 +151,16 @@ detectionPatterns:
|
|
|
131
151
|
description: |
|
|
132
152
|
[REVIEW] File processed without MIME type check.
|
|
133
153
|
Content-type can be spoofed, combine with magic number check.
|
|
154
|
+
sources:
|
|
155
|
+
- "req\\.file"
|
|
156
|
+
- "req\\.files"
|
|
157
|
+
sanitizers:
|
|
158
|
+
- "mimetype"
|
|
159
|
+
- "content-type"
|
|
160
|
+
- "file-type"
|
|
161
|
+
- "magic-bytes"
|
|
162
|
+
- "fileFilter"
|
|
163
|
+
- "path\\.basename\\("
|
|
134
164
|
|
|
135
165
|
# Path traversal in filename
|
|
136
166
|
- id: path-traversal-filename
|
|
@@ -141,6 +171,15 @@ detectionPatterns:
|
|
|
141
171
|
description: |
|
|
142
172
|
Filename from request used in path.join without sanitization.
|
|
143
173
|
Path traversal attack possible (../../etc/passwd).
|
|
174
|
+
sources:
|
|
175
|
+
- "req\\.file\\.originalname"
|
|
176
|
+
- "req\\.file\\.filename"
|
|
177
|
+
- "req\\.(body|params|query)"
|
|
178
|
+
sanitizers:
|
|
179
|
+
- "path\\.basename\\("
|
|
180
|
+
- "sanitizeFilename\\("
|
|
181
|
+
- "secure_filename\\("
|
|
182
|
+
- "\\.\\..*reject|\\.\\..*throw"
|
|
144
183
|
|
|
145
184
|
testTemplates:
|
|
146
185
|
- id: pytest-file-upload
|
|
@@ -77,6 +77,14 @@ detectionPatterns:
|
|
|
77
77
|
pattern: "ldap.*client\\.search\\(.*\\+|ldapClient\\.search.*`.*\\$\\{"
|
|
78
78
|
confidence: high
|
|
79
79
|
description: Detects ldapjs search with string interpolation
|
|
80
|
+
sources:
|
|
81
|
+
- "req\\.(body|params|query|headers)"
|
|
82
|
+
- "\\buser[Ii]nput\\b"
|
|
83
|
+
- "searchParams\\.get\\("
|
|
84
|
+
sanitizers:
|
|
85
|
+
- "ldap\\.escape\\("
|
|
86
|
+
- "escapeLdap\\("
|
|
87
|
+
- "sanitizeFilter\\("
|
|
80
88
|
|
|
81
89
|
- id: ts-ldap-filter-template
|
|
82
90
|
type: regex
|
|
@@ -84,6 +92,12 @@ detectionPatterns:
|
|
|
84
92
|
pattern: "ldap.*filter.*=.*`.*\\$\\{|ldapFilter.*\\$\\{"
|
|
85
93
|
confidence: high
|
|
86
94
|
description: Detects LDAP filter with template literal interpolation
|
|
95
|
+
sources:
|
|
96
|
+
- "req\\.(body|params|query|headers)"
|
|
97
|
+
- "\\buser[Ii]nput\\b"
|
|
98
|
+
sanitizers:
|
|
99
|
+
- "ldap\\.escape\\("
|
|
100
|
+
- "escapeLdap\\("
|
|
87
101
|
|
|
88
102
|
- id: ts-activedirectory
|
|
89
103
|
type: regex
|
|
@@ -91,6 +105,12 @@ detectionPatterns:
|
|
|
91
105
|
pattern: "activedirectory.*find.*\\+|ad\\.find.*`.*\\$\\{"
|
|
92
106
|
confidence: medium
|
|
93
107
|
description: Detects ActiveDirectory library with user input
|
|
108
|
+
sources:
|
|
109
|
+
- "req\\.(body|params|query|headers)"
|
|
110
|
+
- "\\buser[Ii]nput\\b"
|
|
111
|
+
sanitizers:
|
|
112
|
+
- "ldap\\.escape\\("
|
|
113
|
+
- "escapeLdap\\("
|
|
94
114
|
|
|
95
115
|
- id: ts-ldap-escape-missing
|
|
96
116
|
type: regex
|
|
@@ -99,6 +119,9 @@ detectionPatterns:
|
|
|
99
119
|
confidence: medium
|
|
100
120
|
description: Detects LDAP search operations
|
|
101
121
|
negativePattern: "ldap\\.escape|escape.*filter|sanitize"
|
|
122
|
+
sources:
|
|
123
|
+
- "req\\.(body|params|query|headers)"
|
|
124
|
+
- "\\buser[Ii]nput\\b"
|
|
102
125
|
|
|
103
126
|
testTemplates:
|
|
104
127
|
- id: pytest-ldap-injection
|
|
@@ -80,12 +80,25 @@ detectionPatterns:
|
|
|
80
80
|
pattern: "fs\\.(readFile|readFileSync|createReadStream)\\s*\\(.*\\+|fs\\.(readFile|readFileSync)\\s*\\(`.*\\$\\{"
|
|
81
81
|
confidence: high
|
|
82
82
|
description: Detects fs.readFile with string concatenation or template literal
|
|
83
|
+
sources:
|
|
84
|
+
- "req\\.(body|params|query|headers)"
|
|
85
|
+
- "\\buser[Ii]nput\\b"
|
|
86
|
+
- "searchParams\\.get\\("
|
|
87
|
+
sanitizers:
|
|
88
|
+
- "path\\.resolve\\(.*path\\.normalize"
|
|
89
|
+
- "\\.startsWith\\("
|
|
90
|
+
- "path\\.relative\\(.*\\.startsWith"
|
|
91
|
+
- "\\brealpath"
|
|
83
92
|
|
|
84
93
|
- id: ts-path-join-req
|
|
85
94
|
type: regex
|
|
86
95
|
language: typescript
|
|
87
96
|
pattern: "path\\.join\\s*\\(.*req\\.(params|query|body)"
|
|
88
97
|
confidence: medium
|
|
98
|
+
sanitizers:
|
|
99
|
+
- "\\.startsWith\\("
|
|
100
|
+
- "path\\.relative\\(.*\\.startsWith"
|
|
101
|
+
- "\\brealpath"
|
|
89
102
|
description: Detects path.join with request parameters
|
|
90
103
|
negativePattern: "path\\.resolve.*includes\\(|\\.\\.\\/'"
|
|
91
104
|
|
|
@@ -44,6 +44,14 @@ detectionPatterns:
|
|
|
44
44
|
description: |
|
|
45
45
|
CRITICAL: User input concatenated into AI prompt.
|
|
46
46
|
Attacker can inject instructions to manipulate AI behavior.
|
|
47
|
+
sources:
|
|
48
|
+
- "req\\.(body|params|query|headers)"
|
|
49
|
+
- "\\buser[Ii]nput\\b"
|
|
50
|
+
- "searchParams\\.get\\("
|
|
51
|
+
sanitizers:
|
|
52
|
+
- "sanitizePrompt\\("
|
|
53
|
+
- "stripInstructions\\("
|
|
54
|
+
- "encodeForPrompt\\("
|
|
47
55
|
|
|
48
56
|
- id: prompt-user-input-template
|
|
49
57
|
type: regex
|
|
@@ -53,6 +61,12 @@ detectionPatterns:
|
|
|
53
61
|
description: |
|
|
54
62
|
CRITICAL: User input interpolated into prompt template.
|
|
55
63
|
Use parameterized prompts or sanitize input.
|
|
64
|
+
sources:
|
|
65
|
+
- "req\\.(body|params|query|headers)"
|
|
66
|
+
- "\\buser[Ii]nput\\b"
|
|
67
|
+
sanitizers:
|
|
68
|
+
- "sanitizePrompt\\("
|
|
69
|
+
- "stripInstructions\\("
|
|
56
70
|
|
|
57
71
|
- id: python-prompt-fstring
|
|
58
72
|
type: regex
|
|
@@ -88,6 +88,16 @@ detectionPatterns:
|
|
|
88
88
|
pattern: "(query|execute|run)\\s*\\(\\s*`.*\\$\\{"
|
|
89
89
|
confidence: high
|
|
90
90
|
description: Detects database query with template literal interpolation
|
|
91
|
+
sources:
|
|
92
|
+
- "req\\.(body|params|query|headers)"
|
|
93
|
+
- "\\buser[Ii]nput\\b"
|
|
94
|
+
- "searchParams\\.get\\("
|
|
95
|
+
- "\\bargs\\b"
|
|
96
|
+
sanitizers:
|
|
97
|
+
- "\\$queryRaw\\s*`"
|
|
98
|
+
- "\\bescapeSql\\("
|
|
99
|
+
- "\\bsqlstring\\.escape\\("
|
|
100
|
+
- "\\bpg\\.escapeLiteral\\("
|
|
91
101
|
|
|
92
102
|
- id: ts-concat-query
|
|
93
103
|
type: regex
|
|
@@ -95,6 +105,16 @@ detectionPatterns:
|
|
|
95
105
|
pattern: "(query|execute|run)\\s*\\(.*\\s*\\+\\s*"
|
|
96
106
|
confidence: medium
|
|
97
107
|
description: Detects database query with string concatenation
|
|
108
|
+
sources:
|
|
109
|
+
- "req\\.(body|params|query|headers)"
|
|
110
|
+
- "\\buser[Ii]nput\\b"
|
|
111
|
+
- "searchParams\\.get\\("
|
|
112
|
+
sanitizers:
|
|
113
|
+
- "\\bescapeSql\\("
|
|
114
|
+
- "\\bsqlstring\\.escape\\("
|
|
115
|
+
- "\\bpg\\.escapeLiteral\\("
|
|
116
|
+
- "parseInt\\("
|
|
117
|
+
- "Number\\("
|
|
98
118
|
|
|
99
119
|
- id: ts-prisma-raw-unsafe
|
|
100
120
|
type: regex
|
|
@@ -102,6 +122,13 @@ detectionPatterns:
|
|
|
102
122
|
pattern: "\\$queryRawUnsafe\\s*\\(|\\$executeRawUnsafe\\s*\\("
|
|
103
123
|
confidence: high
|
|
104
124
|
description: Detects Prisma unsafe raw query methods
|
|
125
|
+
sources:
|
|
126
|
+
- "req\\.(body|params|query|headers)"
|
|
127
|
+
- "\\buser[Ii]nput\\b"
|
|
128
|
+
- "searchParams\\.get\\("
|
|
129
|
+
sanitizers:
|
|
130
|
+
- "\\$queryRaw\\s*`"
|
|
131
|
+
- "\\$executeRaw\\s*`"
|
|
105
132
|
|
|
106
133
|
- id: ts-sequelize-literal
|
|
107
134
|
type: regex
|
|
@@ -109,6 +136,9 @@ detectionPatterns:
|
|
|
109
136
|
pattern: "sequelize\\.literal\\s*\\(\\s*`.*\\$\\{"
|
|
110
137
|
confidence: high
|
|
111
138
|
description: Detects Sequelize literal with interpolation
|
|
139
|
+
sources:
|
|
140
|
+
- "req\\.(body|params|query|headers)"
|
|
141
|
+
- "\\buser[Ii]nput\\b"
|
|
112
142
|
|
|
113
143
|
# Generic template literal SQL patterns
|
|
114
144
|
- id: ts-template-sql-select
|
|
@@ -69,6 +69,18 @@ detectionPatterns:
|
|
|
69
69
|
pattern: "fetch\\s*\\(.*req\\.(body|query|params)"
|
|
70
70
|
confidence: high
|
|
71
71
|
description: Detects fetch with user-controlled URL
|
|
72
|
+
sources:
|
|
73
|
+
- "req\\.(body|params|query|headers)"
|
|
74
|
+
- "\\buser[Ii]nput\\b"
|
|
75
|
+
- "searchParams\\.get\\("
|
|
76
|
+
- "\\bprocess\\.argv"
|
|
77
|
+
sanitizers:
|
|
78
|
+
- "new\\s+URL\\(.*\\)"
|
|
79
|
+
- "url\\.parse\\("
|
|
80
|
+
- "isAllowedUrl\\("
|
|
81
|
+
- "allowlist|whitelist"
|
|
82
|
+
- "isPrivateIP\\(|isInternalIP\\("
|
|
83
|
+
- "ipaddr\\.process\\("
|
|
72
84
|
|
|
73
85
|
- id: ts-axios-user-url
|
|
74
86
|
type: regex
|
|
@@ -76,6 +88,18 @@ detectionPatterns:
|
|
|
76
88
|
pattern: "axios\\.(get|post|put|delete|patch)\\s*\\(.*req\\."
|
|
77
89
|
confidence: high
|
|
78
90
|
description: Detects axios with user-controlled URL
|
|
91
|
+
sources:
|
|
92
|
+
- "req\\.(body|params|query|headers)"
|
|
93
|
+
- "\\buser[Ii]nput\\b"
|
|
94
|
+
- "searchParams\\.get\\("
|
|
95
|
+
- "\\bprocess\\.argv"
|
|
96
|
+
sanitizers:
|
|
97
|
+
- "new\\s+URL\\(.*\\)"
|
|
98
|
+
- "url\\.parse\\("
|
|
99
|
+
- "isAllowedUrl\\("
|
|
100
|
+
- "allowlist|whitelist"
|
|
101
|
+
- "isPrivateIP\\(|isInternalIP\\("
|
|
102
|
+
- "ipaddr\\.process\\("
|
|
79
103
|
|
|
80
104
|
- id: ts-got-user-url
|
|
81
105
|
type: regex
|
|
@@ -83,6 +107,18 @@ detectionPatterns:
|
|
|
83
107
|
pattern: "got\\s*\\(.*req\\.|got\\.(get|post)\\s*\\(.*req\\."
|
|
84
108
|
confidence: high
|
|
85
109
|
description: Detects got library with user-controlled URL
|
|
110
|
+
sources:
|
|
111
|
+
- "req\\.(body|params|query|headers)"
|
|
112
|
+
- "\\buser[Ii]nput\\b"
|
|
113
|
+
- "searchParams\\.get\\("
|
|
114
|
+
- "\\bprocess\\.argv"
|
|
115
|
+
sanitizers:
|
|
116
|
+
- "new\\s+URL\\(.*\\)"
|
|
117
|
+
- "url\\.parse\\("
|
|
118
|
+
- "isAllowedUrl\\("
|
|
119
|
+
- "allowlist|whitelist"
|
|
120
|
+
- "isPrivateIP\\(|isInternalIP\\("
|
|
121
|
+
- "ipaddr\\.process\\("
|
|
86
122
|
|
|
87
123
|
- id: ts-node-fetch-user
|
|
88
124
|
type: regex
|
|
@@ -90,6 +126,18 @@ detectionPatterns:
|
|
|
90
126
|
pattern: "node-fetch.*req\\.(body|query|params)"
|
|
91
127
|
confidence: high
|
|
92
128
|
description: Detects node-fetch with user-controlled URL
|
|
129
|
+
sources:
|
|
130
|
+
- "req\\.(body|params|query|headers)"
|
|
131
|
+
- "\\buser[Ii]nput\\b"
|
|
132
|
+
- "searchParams\\.get\\("
|
|
133
|
+
- "\\bprocess\\.argv"
|
|
134
|
+
sanitizers:
|
|
135
|
+
- "new\\s+URL\\(.*\\)"
|
|
136
|
+
- "url\\.parse\\("
|
|
137
|
+
- "isAllowedUrl\\("
|
|
138
|
+
- "allowlist|whitelist"
|
|
139
|
+
- "isPrivateIP\\(|isInternalIP\\("
|
|
140
|
+
- "ipaddr\\.process\\("
|
|
93
141
|
|
|
94
142
|
- id: ts-http-request-user
|
|
95
143
|
type: regex
|
|
@@ -97,6 +145,18 @@ detectionPatterns:
|
|
|
97
145
|
pattern: "http\\.request\\s*\\(.*req\\.|https\\.request\\s*\\(.*req\\."
|
|
98
146
|
confidence: high
|
|
99
147
|
description: Detects native http/https with user-controlled URL
|
|
148
|
+
sources:
|
|
149
|
+
- "req\\.(body|params|query|headers)"
|
|
150
|
+
- "\\buser[Ii]nput\\b"
|
|
151
|
+
- "searchParams\\.get\\("
|
|
152
|
+
- "\\bprocess\\.argv"
|
|
153
|
+
sanitizers:
|
|
154
|
+
- "new\\s+URL\\(.*\\)"
|
|
155
|
+
- "url\\.parse\\("
|
|
156
|
+
- "isAllowedUrl\\("
|
|
157
|
+
- "allowlist|whitelist"
|
|
158
|
+
- "isPrivateIP\\(|isInternalIP\\("
|
|
159
|
+
- "ipaddr\\.process\\("
|
|
100
160
|
|
|
101
161
|
testTemplates:
|
|
102
162
|
- id: pytest-ssrf
|
|
@@ -63,6 +63,21 @@ detectionPatterns:
|
|
|
63
63
|
pattern: "\\.innerHTML\\s*=|\\.outerHTML\\s*="
|
|
64
64
|
confidence: high
|
|
65
65
|
description: Detects direct innerHTML/outerHTML assignment
|
|
66
|
+
sources:
|
|
67
|
+
- "req\\.(body|params|query|headers)"
|
|
68
|
+
- "\\buser[Ii]nput\\b"
|
|
69
|
+
- "searchParams\\.get\\("
|
|
70
|
+
- "\\blocation\\.(hash|search|href)"
|
|
71
|
+
- "\\bwindow\\.location"
|
|
72
|
+
- "\\bdocument\\.cookie"
|
|
73
|
+
- "\\bURLSearchParams"
|
|
74
|
+
sanitizers:
|
|
75
|
+
- "DOMPurify\\.sanitize\\("
|
|
76
|
+
- "escapeHtml\\("
|
|
77
|
+
- "sanitizeHtml\\("
|
|
78
|
+
- "encodeURIComponent\\("
|
|
79
|
+
- "textContent\\s*="
|
|
80
|
+
- "xss\\("
|
|
66
81
|
|
|
67
82
|
- id: ts-document-write
|
|
68
83
|
type: regex
|
|
@@ -70,6 +85,14 @@ detectionPatterns:
|
|
|
70
85
|
pattern: "document\\.write\\s*\\(|document\\.writeln\\s*\\("
|
|
71
86
|
confidence: high
|
|
72
87
|
description: Detects document.write() which is vulnerable to XSS
|
|
88
|
+
sources:
|
|
89
|
+
- "req\\.(body|params|query|headers)"
|
|
90
|
+
- "\\blocation\\.(hash|search|href)"
|
|
91
|
+
- "\\bURLSearchParams"
|
|
92
|
+
sanitizers:
|
|
93
|
+
- "DOMPurify\\.sanitize\\("
|
|
94
|
+
- "escapeHtml\\("
|
|
95
|
+
- "encodeURIComponent\\("
|
|
73
96
|
|
|
74
97
|
- id: ts-dangerouslysetinnerhtml
|
|
75
98
|
type: regex
|
|
@@ -78,6 +101,15 @@ detectionPatterns:
|
|
|
78
101
|
confidence: medium
|
|
79
102
|
description: Detects React dangerouslySetInnerHTML usage
|
|
80
103
|
negativePattern: "DOMPurify\\.sanitize|sanitizeHtml|xss\\("
|
|
104
|
+
sources:
|
|
105
|
+
- "req\\.(body|params|query|headers)"
|
|
106
|
+
- "\\bprops\\."
|
|
107
|
+
- "\\buseSearchParams"
|
|
108
|
+
- "\\bfetch\\("
|
|
109
|
+
sanitizers:
|
|
110
|
+
- "DOMPurify\\.sanitize\\("
|
|
111
|
+
- "sanitizeHtml\\("
|
|
112
|
+
- "xss\\("
|
|
81
113
|
|
|
82
114
|
- id: ts-eval-user-input
|
|
83
115
|
type: regex
|
|
@@ -85,6 +117,10 @@ detectionPatterns:
|
|
|
85
117
|
pattern: "eval\\s*\\(|new\\s+Function\\s*\\(|setTimeout\\s*\\(\\s*[`\"'].*\\$\\{"
|
|
86
118
|
confidence: high
|
|
87
119
|
description: Detects eval() or Function() with potential user input
|
|
120
|
+
sources:
|
|
121
|
+
- "req\\.(body|params|query|headers)"
|
|
122
|
+
- "\\buser[Ii]nput\\b"
|
|
123
|
+
- "searchParams\\.get\\("
|
|
88
124
|
|
|
89
125
|
- id: ts-jquery-html
|
|
90
126
|
type: regex
|
|
@@ -71,6 +71,15 @@ detectionPatterns:
|
|
|
71
71
|
pattern: "DOMParser\\s*\\(\\)|xmldom|xml2js"
|
|
72
72
|
confidence: medium
|
|
73
73
|
description: Detects XML parsing libraries that may allow XXE
|
|
74
|
+
sources:
|
|
75
|
+
- "req\\.(body|params|query|headers)"
|
|
76
|
+
- "\\buser[Ii]nput\\b"
|
|
77
|
+
- "searchParams\\.get\\("
|
|
78
|
+
sanitizers:
|
|
79
|
+
- "disableExternalEntities"
|
|
80
|
+
- "noent:\\s*false"
|
|
81
|
+
- "explicitCharkey"
|
|
82
|
+
- "xmlParserOptions.*noent"
|
|
74
83
|
|
|
75
84
|
- id: ts-libxmljs
|
|
76
85
|
type: regex
|
|
@@ -79,6 +88,14 @@ detectionPatterns:
|
|
|
79
88
|
confidence: high
|
|
80
89
|
description: Detects libxmljs which allows XXE by default
|
|
81
90
|
negativePattern: "noent:\\s*false|nonet:\\s*true"
|
|
91
|
+
sources:
|
|
92
|
+
- "req\\.(body|params|query|headers)"
|
|
93
|
+
- "\\buser[Ii]nput\\b"
|
|
94
|
+
- "searchParams\\.get\\("
|
|
95
|
+
sanitizers:
|
|
96
|
+
- "noent:\\s*false"
|
|
97
|
+
- "nonet:\\s*true"
|
|
98
|
+
- "disableExternalEntities"
|
|
82
99
|
|
|
83
100
|
- id: ts-fast-xml-parser
|
|
84
101
|
type: regex
|
|
@@ -86,6 +103,14 @@ detectionPatterns:
|
|
|
86
103
|
pattern: "XMLParser\\s*\\(\\)|fast-xml-parser"
|
|
87
104
|
confidence: low
|
|
88
105
|
description: Detects fast-xml-parser usage (check external entity settings)
|
|
106
|
+
sources:
|
|
107
|
+
- "req\\.(body|params|query|headers)"
|
|
108
|
+
- "\\buser[Ii]nput\\b"
|
|
109
|
+
- "searchParams\\.get\\("
|
|
110
|
+
sanitizers:
|
|
111
|
+
- "processEntities:\\s*false"
|
|
112
|
+
- "disableExternalEntities"
|
|
113
|
+
- "noent:\\s*false"
|
|
89
114
|
|
|
90
115
|
- id: ts-express-xml
|
|
91
116
|
type: regex
|
|
@@ -93,6 +118,13 @@ detectionPatterns:
|
|
|
93
118
|
pattern: "express-xml-bodyparser|body-parser-xml"
|
|
94
119
|
confidence: medium
|
|
95
120
|
description: Detects Express XML body parsers that may enable XXE
|
|
121
|
+
sources:
|
|
122
|
+
- "req\\.(body|params|query|headers)"
|
|
123
|
+
- "\\buser[Ii]nput\\b"
|
|
124
|
+
sanitizers:
|
|
125
|
+
- "disableExternalEntities"
|
|
126
|
+
- "noent:\\s*false"
|
|
127
|
+
- "xmlParserOptions.*noent"
|
|
96
128
|
|
|
97
129
|
testTemplates:
|
|
98
130
|
- id: pytest-xxe
|