Summary
An OS command injection vulnerability in the IPoA WAN Connection Setup of Trendnet TEW-635BRM allows attackers to inject arbitrary shell commands via the ipoa_ipaddr parameter.
When this parameter is processed by the ipoa_test function in /sbin/rc, untrusted input is concatenated into system commands, enabling remote attackers to execute code on affected devices.
Affected context
The issue arises in Trendnet TEW-635BRM devices up to firmware 1.00.03, specifically within the IPoA (IP over ATM) WAN Connection Setup feature.
The vulnerable logic resides in the ipoa_test function of /sbin/rc, where user-provided ipoa_ipaddr values are used to build shell commands.
Deployments where the device's management or configuration interface is exposed to untrusted networks, or where attacker-controlled input can reach the IPoA setup, are at elevated risk.
The devices are end-of-life and no longer receive security support, which increases the long-term exposure if they remain in service.
Exploit preconditions
- Attack surface: Network-facing management or configuration endpoints that handle IPoA WAN configuration.
- Required access: Ability to send crafted requests that control the
ipoa_ipaddrargument (often via web UI or configuration APIs, depending on deployment). - Trigger point: Invocation of the
ipoa_testfunction in/sbin/rc, which constructs and executes shell commands using the supplied parameter. - Why exploitation is possible: The application directly interpolates unvalidated
ipoa_ipaddrdata into command-line strings passed to the system shell, without proper sanitization, escaping, or parameterization, allowing injected tokens to be interpreted as additional commands.
Why this happens
This vulnerability stems from constructing shell commands from untrusted input within firmware scripts.
The ipoa_test function appears to take the ipoa_ipaddr value and concatenate it into a command that is then executed by a shell, rather than treating the value as pure data.
This pattern corresponds to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), and is closely related to CWE-74: Improper Neutralization of Data within Output Used by a Downstream Component, because data intended as an IP address is forwarded to the shell without neutralizing metacharacters.
Conceptually, the bug occurs when application logic assumes that configuration parameters like IP addresses are inherently safe, and fails to enforce strict syntax validation or to use safer execution primitives that separate command and arguments.
Potential impact
- Remote attackers may execute arbitrary OS-level commands with the privileges of the
/sbin/rcprocess. - Compromise of the router, including full control of configuration and traffic handling.
- Installation of persistent malware or backdoors on the device.
- Use of the compromised router as a pivot point for attacks against internal network hosts.
- Manipulation, interception, or redirection of user traffic passing through the device.
General mitigation guidance
Mitigation strategies should focus on eliminating direct shell command construction and tightly constraining configuration inputs:
- Replace shell-based command execution with APIs or system calls that pass arguments as structured parameters, avoiding shell parsing entirely.
- Apply strict input validation for fields such as IP addresses, ensuring they conform to expected formats and rejecting any characters not needed (e.g., limiting to digits and dots for IPv4).
- Introduce centralized utilities for safely invoking system-level operations that normalize and validate arguments before execution.
- Run configuration-handling components with the least privileges required and disable unnecessary services to limit blast radius if a command is injected.
- For end-of-life hardware, plan for device replacement with supported models that receive security updates and provide more robust management interfaces.
How teams detect issues like this
Detection can rely on both code-centric and operational approaches:
- Static analysis and firmware review: Scan shell scripts, C code, or embedded web applications for patterns where user input is concatenated into strings passed to
system,popen, backticks,execwith a shell, or direct/bin/shinvocation. - Configuration-specific checks: During code review, flag any IP address, hostname, or user-supplied network parameter that is reused as part of a command, especially in router and appliance firmware.
- Policy enforcement: Establish secure coding policies forbidding unsanitized shell invocation, and require security reviews for modules that interface with the operating system.
- Runtime monitoring: On devices where it is practical, monitor for anomalous process executions or unusual command lines initiated by management processes, which can indicate attempted or successful command injection.

