Part I — A Cypher Injection Story (CSCvt65026)
The Cisco SD-WAN vManage application contained a Cypher injection in multiple endpoints and an insecure deserialisation of SAML objects stored in the Neo4j database. An attacker could exploit these to read local files, perform SSRF, and achieve remote code execution by replacing the serialised SAML object with a malicious gadget.
medium.com
Published on medium.com
Securing Fortune #1 is exciting, challenging and rewarding — all at the same time. Walmart’s global technology footprint consists of many tech implementations and provides security practitioners with unrivaled challenges and rewards.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application concatenated untrusted input into Neo4j Cypher queries without sanitisation, and deserialised SAML objects from the database without validating their type or origin.
Impact
An attacker could read local files, interact with internal network services (SSRF), alter the graph database, and achieve remote code execution via deserialisation, though some Cypher injection instances lacked CSRF protection and could be exploited unauthenticated.
What the attacker needed
Access to the vManage web interface; valid credentials for some endpoints; SSO configured with an Identity Provider; ability to write to the Neo4j database (for deserialisation)
The fix
The vulnerabilities were reported to Cisco PSIRT and presumably fixed in later versions, though the text does not explicitly state the fix.
How it was found
- Send a request to the device counters endpoint with a single quote in the deviceId parameter and observe a Neo4j error revealing the query structure.
- Craft a Cypher injection using LOAD CSV to read local files such as /etc/passwd.
- Use the file read to retrieve the private key for the vmanage-admin user and download the application WAR package via SCP.
- Decompile the WAR and grep for rawQuery to find additional Cypher injection instances.
- For blind instances, chain two LOAD CSV commands to exfiltrate file content through error messages or out-of-band HTTP requests.
- For the deserialisation flaw, replace the serialised SAMLObject in the Neo4j database with a ysoserial gadget, then trigger deserialisation by authenticating through the Identity Provider.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The application built database queries by pasting user input directly into them, so an attacker could sneak in extra database commands to read files on the server. Separately, the application saved login data in a way that could be swapped for a malicious object, which when loaded later would run the attacker's code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.