Unauthenticated MongoDB URI parameter injection can read host files and cause denial of service
Description
WhoDB Community Edition accepts a user-controlled MongoDB URL Params connection field through the public LoginSource and TestSourceConnection GraphQL mutations. The MongoDB plugin appends this value directly to a connection URI and passes it to the MongoDB Go driver's ApplyURI. File-bearing URI options such as tlsCAFile and tlsCertificateKeyFile therefore cause the WhoDB process to open and read an attacker-selected path on the host.
The returned GraphQL error does not disclose the file contents or distinguish a missing file from an invalid certificate file. A TLS handshake also does not transmit the private key: it transmits the certificate and a signature proving possession of the key. The confirmed security impact is uncontrolled server-side file access and denial of service. In particular, the driver reads the selected path before applying a useful size bound, so a blocking or non-terminating special file can hang a request or exhaust process memory.
Affected component
core/src/plugins/mongodb/db.go reads URL Params, concatenates it into the mongodb:// or mongodb+srv:// URI, and calls clientOptions.ApplyURI. MongoDB Go driver v2.8.0 processes tlsCAFile with addCACertFromFile and tlsCertificateKeyFile with addClientCertFromConcatenatedFile; both call ReadFile on the supplied path.
Community Edition exposes LoginSource and TestSourceConnection without application authentication by design, making the issue remotely reachable when a CE instance is network-accessible. Current Enterprise Edition wraps TestSourceConnection with authentication, project context, and project authorization checks, so the unauthenticated precondition does not apply to that resolver in EE.
The vulnerable URI construction was introduced in 0.32.0 and remains present through 0.131.0 and current main.
Proof of concept
An unauthenticated Community Edition client can submit a connection test such as:
mutation {
TestSourceConnection(credentials: {
SourceType: "MongoDB"
Values: [
{ Key: "Hostname", Value: "127.0.0.1" }
{ Key: "URL Params", Value: "?tls=true&tlsCAFile=/path/on/whodb-host" }
]
}) {
Status
}
}The file is read while the driver constructs the MongoDB client, before it attempts to ping the target server. A path such as tlsCertificateKeyFile=/path/to/client.pem similarly causes the file to be loaded and used as client TLS material if it contains a valid certificate and matching key. This can make WhoDB authenticate to an attacker-selected TLS endpoint, but it does not send the raw private key.
Verification
A local regression using WhoDB's real GraphQL schema, authorization middleware, source adapter, MongoDB plugin, and MongoDB driver confirmed that an unauthenticated TestSourceConnection request reaches the file read. An existing non-certificate file produced the driver's internal the specified CA file does not contain any valid certificates error, while a missing path produced no such file or directory. In both cases the remote GraphQL response was the same generic unable to connect: check your credentials and that the database is running error.
Impact
An unauthenticated remote attacker against a network-accessible Community Edition instance can make the WhoDB process open and read attacker-selected host paths. Regular-file contents are not returned by the tested GraphQL path, so arbitrary file-content disclosure has not been demonstrated. However, targeting a blocking or unbounded special file can consume a request indefinitely or exhaust memory because the local file read is synchronous, is not interrupted by the request context, and occurs before validation completes.
Remediation
Do not append untrusted URL Params directly to the MongoDB connection URI. Parse and allowlist the connection options supported for inline credentials, configure them through structured driver options, and reject all file-path-bearing options for non-profile connections. File-based TLS inputs should only be accepted from trusted server-side profiles and should have explicit size limits where applicable.