id: db-schema

info:
  name: Discover db schema files
  author: geeknik
  severity: info
  description: This file is auto-generated from the current state of the database.
  metadata:
    max-request: 3
  tags: exposure,backup,files,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/db/schema.rb"
      - "{{BaseURL}}/database/schema.rb"
      - "{{BaseURL}}/schema.rb"

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "This file is auto-generated from the current state of the database."
          - "ActiveRecord::Schema.define"
        condition: and

      - type: status
        status:
          - 200

    extractors:
      - type: regex
        name: version
        part: body
        regex:
          - 'eRecord::Schema\.define\(version: ([0-9_]+)\) do'
# digest: 4a0a00473045022100db8dbe3d39a4ccc3ef752deb237f0e0cb91f2e3b0cd9b07366019fc7871a09e7022011fbd6057684f08ff59a17f657e09aeb46828dff08fdc1739a34ac7c8d5c999e:922c64590222798bb761d5b6d8e72950