2021-09-30 14:08:43 +00:00
|
|
|
id: csrf-guard-detect
|
|
|
|
|
|
|
|
info:
|
|
|
|
name: OWASP CSRF Guard detection
|
|
|
|
author: forgedhallpass
|
|
|
|
severity: info
|
|
|
|
description: Detects OWASP CSRF Guard 3.x & 4.x versions and whether token-per-page support is enabled based on default configuration.
|
2021-09-30 15:15:04 +00:00
|
|
|
reference: https://github.com/OWASP/www-project-csrfguard
|
|
|
|
tags: tech,csrfguard
|
2021-09-30 14:08:43 +00:00
|
|
|
|
|
|
|
requests:
|
|
|
|
- raw:
|
|
|
|
- |
|
|
|
|
GET / HTTP/1.1
|
|
|
|
Host: {{Hostname}}
|
|
|
|
|
|
|
|
- |
|
|
|
|
GET /JavaScriptServlet HTTP/1.1
|
|
|
|
Host: {{Hostname}}
|
|
|
|
Referer: {{BaseURL}}
|
|
|
|
|
|
|
|
- |
|
|
|
|
POST /JavaScriptServlet HTTP/1.1
|
|
|
|
Host: {{Hostname}}
|
|
|
|
OWASP-CSRFTOKEN: {{masterToken}}
|
|
|
|
|
|
|
|
matchers-condition: or
|
|
|
|
matchers:
|
|
|
|
- type: word
|
2021-09-30 15:11:48 +00:00
|
|
|
name: "CSRFGuard-v3.x"
|
2021-09-30 14:08:43 +00:00
|
|
|
words:
|
|
|
|
- "FETCH-CSRF-TOKEN"
|
|
|
|
|
|
|
|
- type: word
|
2021-09-30 15:11:48 +00:00
|
|
|
name: "CSRFGuard-v4.x"
|
2021-09-30 14:08:43 +00:00
|
|
|
words:
|
|
|
|
- "masterTokenValue"
|
|
|
|
|
|
|
|
- type: dsl
|
2021-09-30 15:11:48 +00:00
|
|
|
name: "Disabled-token-per-page"
|
2021-09-30 14:08:43 +00:00
|
|
|
condition: and
|
|
|
|
dsl:
|
|
|
|
- 'status_code_3==400'
|
|
|
|
- 'contains(body, "Token-Per-Page functionality is disabled")'
|
|
|
|
|
|
|
|
- type: dsl
|
2021-09-30 15:11:48 +00:00
|
|
|
name: "Enabled-token-per-page"
|
2021-09-30 14:08:43 +00:00
|
|
|
condition: and
|
|
|
|
dsl:
|
|
|
|
- 'status_code_3==200'
|
|
|
|
- 'contains(body, "{\"pageTokens")'
|
|
|
|
|
|
|
|
cookie-reuse: true
|
|
|
|
extractors:
|
|
|
|
- type: regex
|
|
|
|
name: masterToken
|
|
|
|
internal: true
|
|
|
|
group: 1
|
|
|
|
regex:
|
|
|
|
- "(?:masterTokenValue\\s*=\\s*')([^']+)';"
|
|
|
|
|
|
|
|
- type: regex
|
|
|
|
group: 1
|
2021-09-30 15:11:48 +00:00
|
|
|
name: "master-token"
|
2021-09-30 14:08:43 +00:00
|
|
|
regex:
|
|
|
|
- "(?:masterTokenValue\\s*=\\s*')([^']+)';"
|
|
|
|
|
|
|
|
- type: json
|
2021-09-30 15:11:48 +00:00
|
|
|
name: "page-token"
|
2021-09-30 14:08:43 +00:00
|
|
|
json:
|
|
|
|
- '.pageTokens'
|