Vulnerability record · CVE-2021-20038 · published 8 December 2021
CVE-2021-20038: SonicWall SMA 100 appliances stack buffer overflow in mod_cgi
Sonicwall · Sma 200 Firmware
A stack-based buffer overflow in the Apache httpd mod_cgi module of SonicWall SMA 100 series appliances lets a remote unauthenticated attacker overwrite memory via crafted environment variables. The flaw affects SMA 200, 210, 400, 410 and 500v firmware 10.2.0.8-37sv, 10.2.1.1-19sv, 10.2.1.2-24sv and earlier. Because the appliance is an internet-facing remote access gateway, successful exploitation is severe.
Description
A Stack-based buffer overflow vulnerability in SMA100 Apache httpd server's mod_cgi module environment variables allows a remote unauthenticated attacker to potentially execute code as a 'nobody' user in the appliance. This vulnerability affected SMA 200, 210, 400, 410 and 500v appliances firmware 10.2.0.8-37sv, 10.2.1.1-19sv, 10.2.1.2-24sv and earlier versions.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Automated analysis
critical priorityRemote unauthenticated code execution on an internet-facing remote access appliance, listed in CISA KEV with known ransomware use and near-maximum EPSS.
What it is
A stack-based buffer overflow in the Apache httpd mod_cgi module of SonicWall SMA 100 series appliances lets a remote unauthenticated attacker overwrite memory via crafted environment variables. The flaw affects SMA 200, 210, 400, 410 and 500v firmware 10.2.0.8-37sv, 10.2.1.1-19sv, 10.2.1.2-24sv and earlier. Because the appliance is an internet-facing remote access gateway, successful exploitation is severe.
Impact
An attacker can execute code as the 'nobody' user on the appliance, gaining a foothold on a perimeter device that brokers remote access. From there, an attacker could pivot into internal networks or tamper with VPN and authentication services.
Attack surface
Reachable over the network through the appliance's web interface with no authentication and no user interaction, per the CVSS vector AV:N/AC:L/PR:N/UI:N. The vulnerable path is the mod_cgi handling of environment variables in the Apache httpd server.
Exploitation
CISA added this to the Known Exploited Vulnerabilities catalog on 2022-01-28 with a 2022-02-11 remediation due date and flags known ransomware campaign use. EPSS is 0.99912 (99.967th percentile), and public exploit code is referenced (badblood, Rapid7).
What to do
- Apply the SonicWall firmware updates referenced in vendor advisory SNWLID-2021-0026 for all affected SMA 100 series models.
- If patching cannot be done immediately, remove or restrict internet exposure of the SMA management and user interfaces to trusted networks.
- Enable multi-factor authentication and review local accounts on the appliance for unauthorized changes.
- Monitor SonicWall advisories and CISA KEV guidance for follow-up fixes, since this CVE was disclosed alongside related SMA 100 flaws.
- Treat the appliance as untrusted until verified clean, and rebuild or reimage if compromise is suspected.
Detection
- Review appliance and web server logs for malformed or unusually long CGI requests and environment-variable abuse against mod_cgi endpoints.
- Hunt for unexpected processes or outbound connections originating from the SMA appliance, especially under the 'nobody' account.
- Check for unauthorized configuration changes, new accounts, or altered VPN and authentication settings on the device.
- Correlate appliance logs with network telemetry for post-exploitation activity consistent with ransomware staging.
This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.
Exploitation in the wild
CISA added CVE-2021-20038 to the Known Exploited Vulnerabilities catalog on 28 January 2022 as "SonicWall SMA 100 Appliances Stack-Based Buffer Overflow Vulnerability". CISA reports known use in ransomware campaigns. Required action: Apply updates per vendor instructions. Federal deadline 11 February 2022.
Affected products
5 vulnerable configurations from NVD's CPE data, grouped by vendor and product.
References
| Link | Tags |
|---|---|
| https://github.com/jbaines-r7/badblood | ExploitThird Party Advisory |
| https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0026 | Vendor Advisory |
| https://www.rapid7.com/blog/post/2022/01/11/cve-2021-20038-42-sonicwall-sma-100-multiple-vulnerabilities-fixed-2/ | ExploitThird Party Advisory |
| https://github.com/jbaines-r7/badblood | ExploitThird Party Advisory |
| https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0026 | Vendor Advisory |
| https://www.rapid7.com/blog/post/2022/01/11/cve-2021-20038-42-sonicwall-sma-100-multiple-vulnerabilities-fixed-2/ | ExploitThird Party Advisory |
| https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2021-20038 | US Government Resource |
Track CVE-2021-20038 inside VULONE
Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.
Related vulnerabilities
Same products first, then exploited flaws of the same weakness class.
Source: NIST National Vulnerability Database (record CVE-2021-20038), CISA KEV, FIRST EPSS (scores of 2026-09-24). This page is refreshed as NVD updates the record.