Summary
Synway SMG Gateway Management Software contains a path traversal vulnerability in the /down.php file-download handler. An unauthenticated attacker who can reach the endpoint may be able to read files accessible to the software process by supplying a traversal path through the downfile parameter.
Affected context
The issue affects Synway SMG Gateway Management Software builds through 2022-03-15. It occurs in the /down.php download handler, where the downfile parameter is used to select a file. Risk is present when the endpoint is reachable and the supplied path is not safely constrained to an intended download directory.
Exploit preconditions
- Attack surface: Network-accessible HTTP endpoint at
/down.php - Required access: No authentication is required, according to the vulnerability description
- Trigger point: Processing of a multipart POST request that supplies the
downfileparameter - Why exploitation is possible: The requested path may escape the intended download location if traversal sequences are not rejected or safely resolved
Why this happens
The underlying issue is insufficient validation and containment of a user-controlled file path. If the application uses that path to access a file without ensuring the resolved location remains within an approved directory, traversal can lead to unauthorized file access. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Potential impact
- An attacker may read sensitive files that are accessible to the application process.
- Exposed files could disclose system, application, or configuration information.
- Disclosed information could support further attacks against the gateway or its environment.
General mitigation guidance
Defensive patterns focus on ensuring file access is limited to intended resources:
- Prefer server-side identifiers mapped to approved files over accepting arbitrary paths.
- Canonicalize requested paths and verify that resolved paths remain within an explicitly allowed directory.
- Reject traversal and unexpected path forms, while avoiding reliance on character filtering alone.
- Run the service with only the filesystem permissions it needs, reducing the impact of any file access flaw.
- Keep file-download behavior narrowly scoped and validate inputs before filesystem access.
How teams detect issues like this
- Review file-download handlers for user-controlled values that reach filesystem APIs.
- Use static analysis to flag path construction from request parameters and verify canonicalization and directory-boundary checks.
- Inspect web logs and alerts for unusual requests to
/down.php, unexpecteddownfilevalues, or repeated file-download attempts. - Apply policy checks that require file access to use approved directories and least-privilege service permissions.

