mirror of
https://github.com/lunchcat/sif.git
synced 2026-07-28 14:37:01 -07:00
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).
47 lines
896 B
YAML
47 lines
896 B
YAML
# Rails Secrets Config Exposure Detection Module
|
|
|
|
id: rails-secrets-yml-exposure
|
|
info:
|
|
name: Rails Secrets Config Exposure
|
|
author: sif
|
|
severity: high
|
|
description: Detects an exposed Rails config/secrets.yml that leaks the secret key base
|
|
tags: [rails, ruby, secrets, secret-key-base, exposure, recon]
|
|
|
|
type: http
|
|
|
|
http:
|
|
method: GET
|
|
paths:
|
|
- "{{BaseURL}}/config/secrets.yml"
|
|
|
|
matchers:
|
|
- type: status
|
|
status:
|
|
- 200
|
|
|
|
- type: word
|
|
part: body
|
|
words:
|
|
- "secret_key_base:"
|
|
|
|
- type: word
|
|
part: body
|
|
negative: true
|
|
condition: or
|
|
words:
|
|
- "<!DOCTYPE"
|
|
- "<!doctype"
|
|
- "<html"
|
|
- "<HTML"
|
|
- "<head>"
|
|
- "<title>"
|
|
|
|
extractors:
|
|
- type: regex
|
|
name: secret_key_base
|
|
part: body
|
|
regex:
|
|
- 'secret_key_base:\s*["'']?([a-f0-9]{32,})'
|
|
group: 1
|