Skip to main content

CVE-2025-4043: Milesight UG65 Firmware Privilege Escalation

CVE-2025-4043 is a privilege escalation vulnerability in Milesight UG65-868m-ea Firmware allowing admin users to gain unauthorized write access to critical system files. This post covers technical details, affected versions, impact analysis, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-4043 Overview

CVE-2025-4043 affects the Milesight UG65-868M-EA LoRaWAN gateway firmware. An authenticated administrator can gain unauthorized write access to the /etc/rc.local file on the device. Because this script executes on system boot, an attacker who modifies it can achieve persistent command execution with elevated privileges each time the gateway restarts.

The weakness is tracked under CWE-1274: Improper Access Control for Volatile Memory Containing Boot Code and is documented in CISA ICS Advisory ICSA-25-126-02.

Critical Impact

An admin-level attacker can establish persistent code execution on an industrial IoT gateway by writing arbitrary commands to a boot script.

Affected Products

  • Milesight UG65-868M-EA LoRaWAN gateway (hardware)
  • Milesight UG65-868M-EA firmware (all versions prior to the vendor fix)
  • Related UG65 series builds listed in the vendor firmware download center

Discovery Timeline

  • 2025-05-07 - CVE-2025-4043 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-4043

Vulnerability Analysis

The Milesight UG65-868M-EA is an industrial LoRaWAN gateway deployed in critical infrastructure environments. The device exposes administrative functions that improperly permit writes to /etc/rc.local, a shell script executed by the init system during boot.

In a correctly hardened embedded Linux device, system-level boot scripts should remain outside the write scope of any web or management interface user, including administrators. The admin role should be able to configure the gateway through sanctioned APIs, but not alter the OS boot sequence directly. CVE-2025-4043 breaks that boundary.

An attacker who obtains or compromises administrator credentials can append arbitrary shell commands to /etc/rc.local. Those commands run with root privileges at the next reboot, providing a reliable persistence mechanism that survives firmware updates performed through non-full-image flows and routine power cycles common in field-deployed gateways.

Root Cause

The root cause is improper access control over a sensitive boot-time resource. The management surface treats /etc/rc.local as a user-writable configuration file rather than as privileged boot code. This maps to [CWE-1274], where volatile or boot-time execution content lacks adequate write protection, allowing a privileged user of the application layer to influence code executed by the operating system layer.

Attack Vector

Exploitation requires network reachability to the gateway management interface and valid administrator credentials. No user interaction is required. The attacker uses the admin session to overwrite or append shell content to /etc/rc.local, then triggers or waits for a reboot. On restart, the injected commands execute as root, enabling reverse shells, credential harvesting, lateral movement into the operational technology (OT) network, or tampering with LoRaWAN traffic forwarded by the gateway.

No verified proof-of-concept code is published. Refer to the CISA ICS Advisory ICSA-25-126-02 for the authoritative technical description.

Detection Methods for CVE-2025-4043

Indicators of Compromise

  • Unexpected modifications to /etc/rc.local timestamps, size, or content on UG65 gateways
  • Presence of outbound shell, curl, wget, or nc commands within /etc/rc.local
  • New listening sockets or outbound connections appearing immediately after a gateway reboot
  • Administrative logins from unfamiliar source addresses preceding configuration changes

Detection Strategies

  • Baseline the SHA-256 hash of /etc/rc.local on known-good devices and alert on any deviation
  • Collect gateway management logs centrally and correlate admin sessions with reboot events
  • Monitor north-south traffic from gateway management VLANs for anomalous outbound connections after restarts
  • Review authentication logs for brute-force or credential-stuffing patterns against the admin interface

Monitoring Recommendations

  • Forward syslog from Milesight gateways to a centralized SIEM for persistent retention and correlation
  • Alert on any configuration export, firmware upload, or shell command execution outside maintenance windows
  • Track reboot frequency per device; sudden reboots can indicate post-exploitation activation

How to Mitigate CVE-2025-4043

Immediate Actions Required

  • Apply the latest UG65 firmware from the Milesight Firmware Resource Center
  • Rotate all administrator credentials on affected gateways and remove unused accounts
  • Restrict management interface exposure to a dedicated management VLAN; block internet access to the admin UI
  • Inspect /etc/rc.local on every deployed UG65 device and restore a known-good version if tampering is suspected

Patch Information

Milesight publishes firmware updates for the UG65 series through its official download center. Review the release notes for the version that addresses CVE-2025-4043 and plan a staged rollout across production fleets. CISA tracks the vendor response in ICS Advisory ICSA-25-126-02.

Workarounds

  • Enforce network segmentation so the gateway management plane is unreachable from untrusted networks
  • Place the management interface behind a VPN requiring multi-factor authentication
  • Implement strict firewall ACLs permitting admin connections only from designated engineering workstations
  • Periodically audit /etc/rc.local and other boot scripts against a signed golden image
bash
# Example: verify integrity of /etc/rc.local against a known-good hash
KNOWN_GOOD="<sha256-from-golden-image>"
CURRENT=$(sha256sum /etc/rc.local | awk '{print $1}')
if [ "$CURRENT" != "$KNOWN_GOOD" ]; then
  logger -t ug65-integrity "rc.local hash mismatch: $CURRENT"
fi

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.