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,vuln

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: 4a0a00473045022100e6838629c6d32c8d5bb7ab8d9f6a45b3385400cf0a1fc6cfa52ee7b2c7c081de02203012196082e4cb4838db7f50826fbe52e8b9353264e5e6874fde339ed189e052:922c64590222798bb761d5b6d8e72950