id: rails-secret-token-disclosure

info:
  name: Ruby on Rails Secret Token Disclosure
  author: dhiyaneshDk
  severity: medium
  description: Ruby on Rals Secret Token file is exposed.
  reference:
    - https://github.com/detectify/ugly-duckling/blob/master/modules/crowdsourced/ruby-on-rails-secret-token-disclosure.json
  metadata:
    max-request: 1
  tags: exposure,files,rails,ruby,token

http:
  - method: GET
    path:
      - "{{BaseURL}}/config/initializers/secret_token.rb"

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "secret_key_base ="
          - "config.secret_token ="
        part: body
        condition: and

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