CVE-2026-39904: Gophish Zip Bomb Denial of Service via Malicious Email Template
Gophish version 0.12.1 and earlier contains a denial of service vulnerability accessible to authenticated users with the User role. An attacker can upload a specially crafted Office document as an email template attachment that tricks the server into decompressing a massive file in memory, ultimately crashing the service. This works because the application doesn't limit how much an Office document (which is really a ZIP file) can expand when unpacked.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 6.5 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-770
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-22 / 2026-07-14
NVD description (verbatim)
Gophish through 0.12.1 contains a denial of service vulnerability that allows authenticated users with the User role to exhaust server memory by uploading a crafted Office document as an email template attachment. The ApplyTemplate() function in models/attachment.go processes Office documents as ZIP archives and calls ioutil.ReadAll() on each contained file entry without enforcing size restrictions on uncompressed content, allowing a zip bomb payload to expand to several gigabytes in memory and cause the process to be terminated by the operating system.
2 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability exists in the ApplyTemplate() function within models/attachment.go. Gophish treats Office documents as ZIP archives during template processing. When unpacking these files, the code calls ioutil.ReadAll() on each entry without enforcing size caps on uncompressed content. An attacker can construct a zip bomb—a highly compressed Office document that expands to several gigabytes of data—causing uncontrolled memory consumption. The operating system eventually terminates the process due to resource exhaustion. This is classified as an allocation without size limits (CWE-770).
Business impact
Gophish is commonly deployed in authorized security testing and phishing simulations. A denial of service via malicious template upload would disrupt active campaigns, force service restarts, and potentially compromise test data or campaign continuity. Because the attack requires User role privileges, the threat is limited to insider misuse or compromised low-privilege accounts within organizations running Gophish. However, the impact on availability is severe—the process terminates without graceful degradation.
Affected systems
Gophish through version 0.12.1 is affected. The vulnerability requires network access and authentication with at least User role permissions. Organizations running Gophish for security testing, red team operations, or authorized phishing simulations should verify their deployed version against the vendor advisory to determine exact patched versions and upgrade guidance.
Exploitability
Exploitation requires authentication (User role minimum) and network access, which limits exposure to trusted users or accounts compromised within the organization. No special authentication bypass is needed; any authenticated user with permission to upload templates can trigger this. The crafted Office document requires no user interaction on the server—the vulnerability triggers automatically during the upload and template processing phase. The barrier to exploitation is low for anyone with valid credentials.
Remediation
Update Gophish to a patched version that enforces size limits on uncompressed content during ZIP decompression in the ApplyTemplate() function. Consult the official Gophish release notes and security advisories for the specific version that addresses CWE-770. As an interim mitigation, restrict User role permissions for template uploads to trusted staff only and monitor template upload activity for anomalies.
Patch guidance
Verify the latest Gophish release on the official repository or vendor advisories for the patched version that resolves this allocation-without-limits issue. Apply patches promptly in test and staging environments before production deployment. Confirm that the patch includes explicit size validation for uncompressed ZIP entries during Office document processing. After patching, restart affected Gophish instances and test template upload functionality to ensure normal operation.
Detection guidance
Monitor Gophish process memory usage and CPU load during template uploads, particularly for spikes that indicate zip bomb decompression. Log and alert on failed or abnormally large template upload attempts. Use endpoint detection and response (EDR) tools to identify processes with abnormal memory growth patterns. Review authentication logs for User role accounts performing template uploads, especially from unexpected sources or at unusual times. Implement file size limits at the application or web server layer to reject oversized uploads before they reach Gophish.
Why prioritize this
Although the CVSS score is 6.5 (Medium), this vulnerability warrants prompt attention because it directly impacts service availability in a tool designed for critical security testing. For organizations that depend on Gophish for red team campaigns or phishing simulations, an unplanned outage could delay security assessments. Mitigation is straightforward (patching and access controls), making this a high-value fix relative to effort. The requirement for authentication reduces urgent risk, but the ease of exploitation once authenticated justifies near-term remediation.
Risk score, explained
CVSS 6.5 reflects a network-accessible, low-complexity attack (AC:L) requiring low privileges (PR:L, authenticated User role) with no user interaction (UI:N) that impacts availability only (A:H). The attack does not compromise confidentiality or integrity, and the scope is unchanged (S:U). The score is raised from low/medium due to the direct availability impact and minimal friction once authenticated; it remains below high severity because exploitation is restricted to authenticated users and requires deliberate malicious action.
Frequently asked questions
Does this vulnerability allow remote code execution or data theft?
No. This is strictly a denial of service vulnerability. It does not enable unauthorized data access, code execution, or account compromise. An attacker can crash the Gophish process, but cannot read templates, steal credentials, or modify campaign data.
Can an unauthenticated user exploit this?
No. The vulnerability requires at least User role authentication. Unauthenticated attackers cannot upload templates or trigger the zip bomb decompression.
What is a zip bomb and how does it work in this case?
A zip bomb is a compressed archive designed to expand to enormous size when decompressed. The attacker creates an Office document (which is internally a ZIP file) with highly compressed, repetitive data that unpacks to several gigabytes. When Gophish processes this as a template, ioutil.ReadAll() expands the entire file into memory without limits, exhausting RAM and crashing the service.
Are there workarounds if I cannot patch immediately?
Yes. Restrict User role template upload permissions to a small group of trusted administrators, monitor upload activity closely, implement file size limits at the web server level to reject suspiciously large uploads, and monitor process memory and CPU metrics for anomalies that indicate zip bomb attempts.
This analysis is provided for informational and educational purposes. The technical details are derived from the published CVE record and vendor advisories. Organizations should verify patch availability and version numbers against official vendor sources before deployment. Zip bomb exploitation requires valid authentication and authorized access; do not test against systems without explicit written permission. SEC.co makes no warranty regarding the completeness or accuracy of this analysis and recommends direct consultation with Gophish maintainers and your security team for deployment decisions. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2024-54178MEDIUMIBM Db2 Cloud Pak for Data Denial of Service via Resource Allocation Flaw
- CVE-2026-10533MEDIUMOpenShift ResourceQuota Bypass Leads to API Server DoS
- CVE-2026-10740MEDIUMs2n-quic Memory Allocation DoS – QUIC CRYPTO Frame Reassembler
- CVE-2026-1500MEDIUMGitLab Authenticated Denial of Service via Malicious File Upload
- CVE-2026-24720MEDIUMQNAP File Station 6 Resource Exhaustion Vulnerability
- CVE-2026-28237MEDIUMAMD uProf Resource Exhaustion Vulnerability – Patch Guidance
- CVE-2026-36499MEDIUMOpen vSwitch Thread Allocation DoS Vulnerability
- CVE-2026-40898MEDIUMquic-go HTTP/3 Trailer Memory Exhaustion DoS