The vulnerability lies in the camel-neo4j component's Neo4jProducer class, where Cypher queries were constructed by concatenating user-controlled input directly into query strings. This affects node creation, retrieval, and deletion operations.
The analysis of the provided patches (66715d3, 723e2cd, e46c4c0) reveals that the methods createNode, retrieveNodes, and deleteNode were all vulnerable. In each case, input from either the message body or the MATCH_PROPERTIES message header was formatted directly into the Cypher query string.
For example, in the createNode method, the message body, if it was a string, was directly appended to the CREATE statement. Similarly, retrieveNodes and deleteNode used a matchQuery variable, derived from a message header, to build the MATCH clause of their respective queries.
This vulnerability allows an attacker to perform a Cypher injection attack by crafting a malicious message body or header. The exploit could lead to unauthorized data access, modification, or deletion.
The patches fix this vulnerability by consistently using parameterized queries. Instead of string concatenation, the user input is now parsed (e.g., from a JSON string to a Map) and passed to the Neo4j driver as parameters. This ensures a strict separation between the query's logic and the data being processed, which is the standard defense against injection attacks.