Summary
PACSgear MediaWriter 5.2.1 exposes an unauthenticated .NET Remoting TCP service on port 9000 that allows remote interaction with MarshalByRefObject instances. By abusing object unmarshalling and built-in .NET WebClient methods, an attacker can read and write arbitrary files on the host filesystem.
When combined with DLL hijacking in a SYSTEM-level MediaWriter service that loads missing DLLs from the application directory, this file write primitive can be chained into unauthenticated remote code execution as NT AUTHORITY\SYSTEM on service restart.
Affected context
This vulnerability occurs in PACSgear MediaWriter deployments that:
- Run the PacsgearMediaServerEngine.dll .NET Remoting TCP service on port 9000
- Use default ObjectURIs (RemoteObj and UIRemoteObj) without customization
- Do not enforce authentication or authorization at the remoting endpoint
- Execute the MediaWriter service with high privileges (e.g., NT AUTHORITY\SYSTEM)
In these environments, remote clients can connect to the remoting service and trigger object unmarshalling logic that exposes filesystem operations and DLL loading behavior.
Exploit preconditions
- Attack surface: TCP port 9000 hosting the .NET Remoting service exposed by PacsgearMediaServerEngine.dll
- Required access: Network-level access to the host running MediaWriter; no prior authentication or local account required
- Trigger point: Invocation of remoted objects (RemoteObj, UIRemoteObj) that derive from MarshalByRefObject, leading to improper object unmarshalling and filesystem interaction
- Why exploitation is possible:
- The remoting service lacks any authentication or authorization checks (CWE-306)
- The design trusts remote clients to interact with deserialized MarshalByRefObject instances (CWE-502)
- Identical ObjectURIs across installations simplify discovery and automated exploitation
- The MediaWriter service runs as SYSTEM and loads missing DLLs from the application directory, making arbitrary file writes exploitable via DLL hijacking on restart
Why this happens
The core issue is the exposure of a privileged .NET Remoting endpoint without authentication or authorization, violating the expectation that sensitive remote services enforce identity and access controls (CWE-306: Missing Authentication for Critical Function).
Additionally, the service relies on MarshalByRefObject-based remoting where remote inputs drive object unmarshalling and method invocation. This design implicitly trusts remote callers and allows them to leverage framework classes such as WebClient to perform filesystem operations, aligning with CWE-502: Deserialization of Untrusted Data.
In abstract terms, the pattern is:
- A network-accessible remoting service that runs with elevated privileges
- No access control on remote object URIs
- Untrusted remote data influencing object lifetime and methods that manipulate the filesystem
- A binary loading mechanism (DLL resolution) that searches writable application directories and treats attacker-controlled files as executable code
Potential impact
- Remote unauthenticated reading of arbitrary files from the host filesystem
- Remote unauthenticated writing or overwriting of arbitrary files on the host
- Planting malicious DLLs in the MediaWriter application directory for hijacking
- Execution of arbitrary code as NT AUTHORITY\SYSTEM after service restart
- Complete takeover of the affected Windows host
- Use of the compromised system as a pivot for further network attacks
General mitigation guidance
Effective mitigation focuses on reducing trust in remote endpoints, constraining deserialization behavior, and minimizing privilege exposure:
- Introduce strong authentication and authorization for all .NET Remoting endpoints, treating them as critical administrative interfaces
- Avoid exposing MarshalByRefObject instances that grant filesystem or network capabilities directly to remote callers; encapsulate such behavior behind vetted, limited APIs
- Replace legacy .NET Remoting with more modern communication mechanisms that support robust identity, access control, and auditing by design
- Restrict the MediaWriter service's privilege level where feasible, applying least privilege so that compromise does not equate to full system control
- Harden DLL loading paths by avoiding writable application directories for binary resolution and preferring system-managed, read-only locations
- Enforce strict filesystem permissions that prevent remote-accessible services from writing to locations used for code loading or configuration
How teams detect issues like this
High-level detection and assurance approaches include:
- Static analysis rules that flag unauthenticated .NET Remoting endpoints, especially those exposing MarshalByRefObject instances with filesystem or network capabilities
- Code reviews focused on:
- Use of legacy remoting technologies
- Absence of authentication/authorization on network-facing service endpoints
- Methods that expose file read/write operations or DLL loading logic to remote callers
- Configuration and deployment checks to ensure:
- Remoting ports are not exposed beyond required network segments
- Service accounts are not over-privileged
- Application directories are not writable by untrusted principals
- Policy enforcement in CI/CD pipelines that:
- Prohibit new uses of .NET Remoting without security controls
- Require threat modeling for any component that deserializes remote objects or loads binaries based on path search behavior
- Optional use of automated security testing tools to scan for authentication gaps, unsafe deserialization patterns, and DLL search order vulnerabilities

