/

CVE-2025-71284

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in Synway SMG Gateway RADIUS

CVE-2025-71284

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Synway SMG Gateway Management Software contains an OS command injection flaw in the RADIUS configuration endpoint, where user-controlled parameters are interpolated directly into a sed command without sanitization.

An unauthenticated remote attacker can send crafted POST requests to execute arbitrary shell commands on the underlying system, leading to full remote code execution when RADIUS configuration is saved and enabled.

Affected context

This vulnerability occurs in the web-based management interface of Synway SMG Gateway when handling RADIUS configuration requests at /en/9-2radius.php.

The issue is present where parameters such as radius_address, radius_address2, shared_secret2, source_ip, timeout, and retry are accepted from HTTP POST data and subsequently used to construct shell commands (via sed) without robust sanitization.

The risk is highest in deployments where the management interface is network-accessible from untrusted networks or exposed to the internet, and where the web server process has broad system privileges.

Exploit preconditions

  • Attack surface: HTTP POST endpoint /en/9-2radius.php within the gateway management web application.
  • Required access: None; exploitation is possible by an unauthenticated remote user able to reach the management interface over the network.
  • Trigger point: Submission of a crafted POST request that includes parameters such as radius_address, radius_address2, shared_secret2, source_ip, timeout, or retry along with save=1 and enable_radius=1.
  • Why exploitation is possible: User-supplied values are split and interpolated directly into a sed shell command without proper escaping or validation, allowing shell metacharacters or command separators to alter the intended command and execute arbitrary OS commands under the web server's privileges.

Why this happens

The root cause maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

The application dynamically builds a shell command (using sed) incorporating untrusted input fields from the HTTP POST body.

Because these values are not strictly validated, constrained, or safely escaped, shell metacharacters and additional command fragments can be injected.

This design pattern—constructing command-line strings from user input and passing them to a shell interpreter—creates a direct channel for attackers to execute arbitrary commands rather than just influencing configuration content.

Potential impact

  • Remote execution of arbitrary system commands under the account running the web management service.
  • Installation of backdoors, web shells, or persistence mechanisms on the device.
  • Exfiltration or tampering with configuration data, including RADIUS secrets and other authentication-related settings.
  • Use of the compromised gateway as a pivot point for further attacks within the internal network.
  • Disruption of telephony or network services managed by the gateway, potentially causing denial of service.

General mitigation guidance

Effective mitigation focuses on eliminating direct shell command construction from untrusted input and constraining how configuration changes are applied.

Recommended patterns include:

  • Avoid invoking shell utilities for configuration updates; prefer native language APIs or libraries to manipulate configuration files directly in memory.
  • Where external commands are unavoidable, use parameterized execution interfaces (e.g., exec-family calls with argument arrays) and avoid passing through a shell.
  • Apply strict allowlists and validation on all configuration parameters, limiting them to expected formats (e.g., IP addresses, hostnames, numeric ranges) and rejecting any unexpected characters or patterns.
  • Run the management interface with least privilege, ensuring that even if command execution occurs, the process has minimal access to system resources.
  • Reduce exposure of the management interface by segmenting it onto dedicated management networks, enforcing strong access controls, and disabling remote access from untrusted networks.

How teams detect issues like this

Detection can leverage both code-level and operational monitoring techniques:

  • Static analysis: Configure rules or linters to flag instances where user-supplied variables are concatenated into command strings or passed to shell execution functions. Look for patterns such as system(), exec*(), shell_exec(), or backtick operators that incorporate request parameters.
  • Code review: During security-focused reviews, identify any reliance on shell utilities (sed, awk, sh, etc.) for configuration handling and verify that all inputs are strictly validated and escaped or replaced with safer alternatives.
  • Runtime monitoring: Observe logs for anomalous RADIUS configuration changes, unexpected process invocations, or unusual commands spawned by the web server process.
  • WAF and IDS/IPS policies: Deploy detection signatures looking for shell metacharacters and typical command injection patterns in HTTP POST bodies targeting management endpoints, while tuning to reduce false positives in normal administrative traffic.

Sources

SourceLink
github.comgithub.com/projectdiscovery/nuclei-templates/blob/main/http/vulnerabilities/synway/synwaysmg-radius-rce.yaml
mp.weixin.qq.commp.weixin.qq.com/s/PyepoFSuQ63E3RnpQa9nsA
mrxn.netmrxn.net/jswz/synway-9-2radius-rce.html
synway.netsynway.net/
vulncheck.comvulncheck.com/advisories/synway-smg-gateway-management-software-os-command-injection-via-radius-address

Frequently asked

questions

Exploitation is straightforward if the management interface is reachable from the attacker's network.

The attacker only needs to craft a POST request with malicious values in specific parameters, without prior authentication.

No, the issue as described is exploitable by unauthenticated remote users.

Network reachability to the /en/9-2radius.php endpoint is the primary requirement.

The most robust approach is to remove shell invocation from the configuration path, using internal APIs or libraries to update configuration instead.

If external tools must be used, avoid passing untrusted input through a shell and validate all fields strictly according to their expected data types.

Adopt secure coding guidelines that prohibit constructing shell commands from user input, enforce strong input validation and allowlists on administrative parameters, and integrate security checks (static analysis and code review policies) into the development and deployment pipeline.

Find out what's already
exploitable in your codebase.