HTB Sorcery CTF: Rust Macro Flaw Enables Neo4j Cypher Injection Chain
A Hack The Box challenge called Sorcery demonstrates a multi-stage attack chain exploiting three CVEs across a Rust web app, Neo4j graph database, and Gitea instance. The first vulnerability involves a JWT authentication bypass where the server mistakenly uses its own public RSA key as an HMAC secret, allowing attackers to forge admin session tokens using publicly available key data. A second flaw in the code-search endpoint directly concatenates user input into Cypher queries, enabling injection attacks that can leak password hashes or trigger outbound network calls via Neo4j's APOC procedures. The third and most notable bug originates in a custom Rust derive macro that auto-generates Cypher query fragments from struct fields, where a subtle typo in the macro's AST traversal introduces an unsanitized field identifier into database queries. Together, the chain illustrates how a low-severity macro authoring mistake can escalate into full database compromise without ever directly accessing the Neo4j port.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in