id: rails-database-config

info:
  name: Ruby on Rails Database Configuration File - Detect
  author: pdteam,geeknik
  severity: high
  description: Ruby on Rails database configuration file was detected, which may contain database credentials.
  reference:
    - https://guides.rubyonrails.org/configuring.html#configuring-a-database
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
    cvss-score: 7.5
    cwe-id: CWE-200
  metadata:
    max-request: 1
  tags: config,exposure,rails,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/config/database.yml"

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "adapter:"
          - "database:"
          - "production:"
        condition: and
        part: body

      - type: status
        status:
          - 200
# digest: 4a0a00473045022100fbaa561ab277ef35aa798fb0cdd54744bf1045205ab5a559b8563565065e8a50022070f550eb733603a90fc24b3a0a0659ae2fcfa032c94edea0eb27469ea9a2731a:922c64590222798bb761d5b6d8e72950