Configuration-Dependent Unauthenticated Root RCE through the Setup Wizard
Summary
Milesight UG65/UG67 firmware 60.0.0.50 allows unauthenticated access to
yruo_guide.set, even after setup is complete. An attacker can store shell
syntax in an alarm email-group member and enable the power-on email event.
When SMTP/email is already enabled, the next reboot raises event 4019 and
emaild inserts the stored member into a root shell command:
system("echo -e \"Subject: %s\n\n%s\" | msmtp %s -C /etc/msmtprc 2>%s", ...);
$() and backticks survive the group parser, resulting in command execution
as root.
Classification
| Field | Value |
|---|---|
| Product | Milesight UG65/UG67 |
| Firmware | 60.0.0.50 |
| Authentication | None |
| Impact | Stored root command execution |
| CWE | CWE-306, CWE-78 |
| Prerequisite | SMTP/email is already enabled |
| Trigger | Reboot or equivalent power-on event |
| Tags | unauthenticated, configuration_dependent, stored_payload, root_rce, tested |
The wizard request does not enable SMTP. On a freshly initialized test
overlay, /etc/msmtprc contained #enable no, and the stored payload did not
execute until SMTP was enabled through the legitimate authenticated settings.
Attack chain
POST /cgicallsyruo_guide.setwithout a session or ACL check.contack_infostores the attacker-controlled email-group member and enables email notification for events4019and4020.- The payload persists in
/etc/quagga/email_groups.confand is rebuilt into/etc/emaild_groupsat boot. powerdetectraises event4019when it starts.emaild, running as root, expands the stored$()inside itsmsmtpshell command.
Proof of concept
python3 poc_ms11_wizard_rce.py 127.0.0.1:18443 \
-c 'id > /www/duckie'
Prerequisites and trigger:
SMTP/email already enabled
payload planted without authentication
gateway rebooted, or event 4019 raised
Verified result:
# cat /www/duckie
uid=0(root) gid=0(root)
The same request on a fresh overlay with #enable no planted the payload but
did not execute it. This negative control confirms the SMTP prerequisite.
Remediation
- Require an authenticated, authorized session for
yruo_guide.setafter initial setup. - Validate email-group members as email addresses.
- Replace the
emaildshell command with an argument-vector call tomsmtp. - Do not raise the power-on event unconditionally whenever
powerdetectstarts.
Related finding
The MQTT notification finding reaches the same downstream emaild sink, but
its primary eventcore injection executes immediately and does not require
SMTP. See MQTT notifications.