Files
sif/modules/recon/rails-master-key-exposure.yaml
T
TigahandGitHub a9fde8c695 feat(modules): add rails config secret exposure modules (#199)
modules/recon/rails-database-yml-exposure.yaml flags an exposed
config/database.yml on the adapter key paired with a credential key, then
extracts the database name. requiring a credential key keeps a credential free
sqlite config from being reported as a high severity leak.

modules/recon/rails-secrets-yml-exposure.yaml flags an exposed
config/secrets.yml on the secret_key_base key and extracts the secret, the
value an attacker needs to forge rails sessions.

modules/recon/rails-master-key-exposure.yaml flags an exposed master key, the
32 hex value that decrypts the encrypted credentials store. the matcher anchors
the hex to the whole body so a longer digest such as a sha256 served at the
same path does not match, and the same probe covers config/credentials.

internal/modules/rails_secret_exposure_test.go drives the three modules end to
end through ExecuteHTTPModule and asserts the leak alongside the near misses a
strict review wants pinned: a credential free sqlite config, a longer hex
digest, a hex value away from the body start, an html page naming the markers,
a config without the markers and a 404, none of which may match.

verify: go test ./internal/modules, each matcher, guard, anchor and extractor
proven to bite (break -> red, restore -> green).
2026-06-22 17:19:50 -07:00

36 lines
710 B
YAML

# Rails Master Key Exposure Detection Module
id: rails-master-key-exposure
info:
name: Rails Master Key Exposure
author: sif
severity: high
description: Detects an exposed Rails master key that decrypts the encrypted credentials store
tags: [rails, ruby, master-key, credentials, exposure, recon]
type: http
http:
method: GET
paths:
- "{{BaseURL}}/config/master.key"
- "{{BaseURL}}/config/credentials/production.key"
matchers:
- type: status
status:
- 200
- type: regex
part: body
regex:
- '^[a-f0-9]{32}\s*$'
extractors:
- type: regex
name: master_key
part: body
regex:
- '^([a-f0-9]{32})'
group: 1