{"id":"GHSA-wwv8-cqpr-vx3m","summary":"Modoboa has OS Command Injection","details":"### Summary\n\n`exec_cmd()` in `modoboa/lib/sysutils.py` always runs subprocess calls with `shell=True`. Since domain names flow directly into shell command strings without any sanitization, a Reseller or SuperAdmin can include shell metacharacters in a domain name to run arbitrary OS commands on the server.\n\n### Details\n\nThe root cause is in `modoboa/lib/sysutils.py:31`:\n\n```python\nkwargs[\"shell\"] = True\nprocess = subprocess.Popen(cmd, **kwargs)\n```\n\nWhen a create a domain is created with DKIM enabled, the domain name gets embedded into a shell command like this:\n\n```python\nexec_cmd(f\"openssl genrsa -out {dkim_storage_dir}/{domain.name}.pem {key_size}\")\n```\n\nIf the domain name contains something like `$(id\u003e/tmp/proof).example.com`, the shell executes the injected command before running openssl.\n\nThe same pattern appears in several other places:\n\n- `modoboa/admin/jobs.py:38` — mailbox rename via `mv` using `full_address`\n- `modoboa/amavis/lib.py:202` — `sa-learn` using `domain.name`\n- `modoboa/admin/models/mailbox.py:150` — `doveadm user` using `full_address`\n- `modoboa/maillog/graphics.py:105–107` — `rrdtool` using `domain.name`\n- `modoboa/webmail/models.py:54–57` — `doveadm move/delete` using `account.email`\n\n### PoC\n\n1. Deploy modoboa \u003c= 2.7.0\n2. Log in as a Reseller or SuperAdmin\n3. Create a new domain named `$(id\u003e/tmp/proof).example.com` with DKIM enabled\n4. SSH into the server and read `/tmp/proof`\n\nSomething like this will be displayed:\n\n```\nuid=0(root) gid=0(root) groups=0(root)\n```\n\nConfirmed on commit b521bcb4f (latest main at time of discovery).\n\n### Impact\n\nAn attacker with Reseller-level access (or higher) can execute arbitrary OS commands on the mail server — in a typical Modoboa deployment this means running as root. All six identified sinks are reachable through normal application workflows.","aliases":["CVE-2026-27602","PYSEC-2026-2223"],"modified":"2026-07-13T07:26:17.517550624Z","published":"2026-03-25T17:03:37Z","database_specific":{"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"2026-03-25T17:03:37Z","nvd_published_at":"2026-03-25T19:16:48Z","cwe_ids":["CWE-78"]},"references":[{"type":"WEB","url":"https://github.com/modoboa/modoboa/security/advisories/GHSA-wwv8-cqpr-vx3m"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-27602"},{"type":"WEB","url":"https://github.com/modoboa/modoboa/commit/27a7aa133d3608fe8c25ae39125d1012c333cbfa"},{"type":"PACKAGE","url":"https://github.com/modoboa/modoboa"},{"type":"WEB","url":"https://github.com/modoboa/modoboa/releases/tag/2.7.1"}],"affected":[{"package":{"name":"modoboa","ecosystem":"PyPI","purl":"pkg:pypi/modoboa"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.7.1"}]}],"versions":["0.7.0","1.10.0","1.10.1","1.10.2","1.10.3","1.10.4","1.10.5","1.10.6","1.10.7","1.11.0","1.11.1","1.12.0","1.12.1","1.12.2","1.13.0","1.13.1","1.14.0","1.15.0","1.16.0","1.16.1","1.17.0","1.2.0","1.2.0-rc2","1.2.1","1.2.2","1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.5.0","1.5.1","1.5.2","1.5.3","1.6.0","1.6.1","1.6.2","1.6.3","1.7.0","1.7.1","1.7.2","1.7.3","1.7.4","1.8.0","1.8.1","1.8.2","1.8.3","1.9.0","1.9.1","2.0.0","2.0.0b1","2.0.0b2","2.0.0b3","2.0.1","2.0.2","2.0.3","2.0.4","2.0.5","2.1.0","2.1.1","2.1.2","2.1.2.dev0","2.1.3.dev0","2.2.0","2.2.1","2.2.2","2.2.3","2.2.4","2.3.0","2.3.0b1","2.3.0b2","2.3.0b3","2.3.0b4","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.4.0","2.4.1","2.4.10","2.4.11","2.4.2","2.4.3","2.4.4","2.4.5","2.4.6","2.4.7","2.4.8","2.4.9","2.5.0","2.5.1","2.6.0","2.6.1","2.6.2","2.6.3","2.6.4","2.6.5","2.7.0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-wwv8-cqpr-vx3m/GHSA-wwv8-cqpr-vx3m.json","last_known_affected_version_range":"\u003c= 2.7.0"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"}]}