id: magento-unprotected-dev-files

info:
  name: Magento Unprotected development files
  author: TechbrunchFR
  severity: high
  description: Magento version 1.9.2.x includes /dev directories or files that might reveal your passwords and other sensitive information. The /dev directories and files are not protected by default. According to Magento, "these tests are not supposed to end up on production servers".
  reference:
    - https://support.hypernode.com/en/support/solutions/articles/48001153348-how-to-secure-your-data-using-encryption-and-hashing
  classification:
    cpe: cpe:2.3:a:magento:magento:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 2
    vendor: magento
    product: magento
    shodan-query: http.component:"Magento"
  tags: magento,vuln

http:
  - method: GET
    path:
      - '{{BaseURL}}/dev/tests/functional/credentials.xml.dist'
      - '{{BaseURL}}/dev/tests/functional/etc/config.xml.dist'

    matchers:
      - type: dsl
        dsl:
          - 'contains(body, "Magento")'
          - 'contains(body, "replace xmlns:xsi=")'
          - 'contains(body, "<field path=")'
          - 'contains(tolower(header), "application/xml") || contains(tolower(header), "application/octet-stream")'
          - 'status_code == 200'
        condition: and

      - type: dsl
        dsl:
          - 'contains(body, "Magento")'
          - 'contains(body, "config xmlns:xsi")'
          - 'contains(body, "<application>")'
          - 'contains(body, "<install>")'
          - 'contains(tolower(header), "application/xml") || contains(tolower(header), "application/octet-stream")'
          - 'status_code == 200'
        condition: and
# digest: 4a0a00473045022100dad129d0e9f4cc13a09976c702b1056c0457de6ae4ab52bad7979fd5d21c54b8022011ed3dc001a021b7a08d84b70557aaefd68a099f2c704959332d3f8bcc112b15:922c64590222798bb761d5b6d8e72950