Summary
Metacat contains an unauthenticated SQL injection vulnerability in the /cn/v1/object and /cn/v2/object REST API endpoints. An attacker may manipulate the nodeId parameter to read, insert, modify, or delete data in the PostgreSQL database, with SQL errors potentially disclosing query results.
Affected context
The vulnerability affects Metacat deployments that expose the /cn REST endpoints and construct backend SQL queries using unsanitized nodeId input. Risk is increased when these endpoints are reachable by untrusted users and when database error details are returned to API callers. Deployments that do not require the Coordinating Node endpoints may have an option to disable them.
Exploit preconditions
- Attack surface: The
/cn/v1/objector/cn/v2/objectREST API endpoints - Required access: Network access to the affected endpoints; authentication is not required
- Trigger point: Processing of attacker-controlled data in the
nodeIdparameter - Why exploitation is possible: User input is appended to SQL statements without parameterization, while database errors are reflected in XML responses
Why this happens
The underlying bug is a failure to separate data from executable SQL syntax. Metacat incorporates the user-controlled nodeId value directly into backend queries rather than using parameterized statements or an equivalent safe query abstraction. Detailed SQL errors further create an information-disclosure channel by returning database-generated output to the caller. This behavior maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection); the lack of authentication is also related to CWE-287: Improper Authentication.
Potential impact
- An unauthenticated attacker may extract protected database information.
- An attacker could disclose catalog metadata, access logs, identity information, or access-control data.
- An attacker could insert, alter, or delete records in the Metacat database.
- Database integrity and the availability of repository services could be affected.
- Sensitive information may be exposed across connected DataONE infrastructure.
General mitigation guidance
Mitigation should focus on eliminating SQL construction from raw user input and reducing exposure of unnecessary API functionality.
Common defensive patterns include:
- Use parameterized queries, prepared statements, or a trusted query-builder abstraction for every user-controlled value.
- Validate
nodeIdagainst a strict allowlist or expected data type before it reaches database logic. - Return generic client-facing errors while recording detailed database diagnostics only in protected server logs.
- Disable unused
/cnREST endpoints at the web-application or servlet-routing layer. - Apply least-privilege permissions to the Metacat database account, separating read and write capabilities where practical.
- Restrict endpoint access through authentication, authorization, network segmentation, and gateway policy.
How teams detect issues like this
Organizations can look for SQL injection exposure through:
- Static analysis rules identifying string concatenation or interpolation of request parameters in SQL statements.
- Code review signals such as database calls built from raw REST parameters and exception details returned in XML or JSON responses.
- Dynamic testing that uses safe, controlled SQL injection test cases against non-production environments.
- Web application firewall or API gateway policies monitoring suspicious database operators, malformed parameters, and repeated database-error responses.
- Log review for unusual
/cnendpoint activity, database syntax errors, unexpected query failures, and unauthenticated access patterns. - Automated security review tools that flag unsafe query construction and verbose error handling.

