CVE-2022-45786
HIGHThere are issues with the AGE drivers for Golang and Python that enable SQL injections to occur. This impacts AGE for PostgreSQL 11 & AGE for PostgreSQL 12, all versions up-to-and-including…
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Description
There are issues with the AGE drivers for Golang and Python that enable SQL injections to occur. This impacts AGE for PostgreSQL 11 & AGE for PostgreSQL 12, all versions up-to-and-including 1.1.0, when using those drivers.
The fix is to update to the latest Golang and Python drivers in addition to the latest version of AGE that is used for PostgreSQL 11 or PostgreSQL 12.
The update of AGE will add a new function to enable parameterization of the cypher() function, which, in conjunction with the driver updates, will resolve this issue.
Background (for those who want more information):
After thoroughly researching this issue, we found that due to the nature of the cypher() function, it was not easy to parameterize the values passed into it. This enabled SQL injections, if the developer of the driver wasn't careful. The developer of the Golang and Pyton drivers didn't fully utilize parameterization, likely because of this, thus enabling SQL injections.
The obvious fix to this issue is to use parameterization in the drivers for all PG SQL queries. However, parameterizing all PG queries is complicated by the fact that the cypher() function call itself cannot be parameterized directly, as it isn't a real function. At least, not the parameters that would take the graph name and cypher query.
The reason the cypher() function cannot have those values parameterized is because the function is a placeholder and never actually runs. The cypher() function node, created by PG in the query tree, is transformed and replaced with a query tree for the actual cypher query during the analyze phase. The problem is that parameters - that would be passed in and that the cypher() function transform needs to be resolved - are only resolved in the execution phase, which is much later. Since the transform of the cypher() function needs to know the graph name and cypher query prior to execution, they can't be passed as parameters.
The fix that we are testing right now, and are proposing to use, is to create a function that will be called prior to the execution of the cypher() function transform. This new function will allow values to be passed as parameters for the graph name and cypher query. As this command will be executed prior to the cypher() function transform, its values will be resolved. These values can then be cached for the immediately following cypher() function transform to use. As added features, the cached values will store the calling session's pid, for validation. And, the cypher() function transform will clear this cached information after function invocation, regardless of whether it was used.
This method will allow the parameterizing of the cypher() function indirectly and provide a way to lock out SQL injection attacks.
Affected Products
ageapacheDetection & mitigation playbook
Vendor / applianceDetect
Inventory every apache age deployment and check each version against the affected-products list above. Because the exploit targets the running system rather than your application code, also watch for exploitation at the network and runtime layer — O3 flags the exploit behaviour from runtime telemetry and egress traffic even before a vulnerable build is confirmed.
Remediation status
No patch has shipped for CVE-2022-45786 yet — track the apache age advisory for a fixed release and apply the workarounds below in the meantime.
Mitigate without a patch
Cut exposure now: restrict the management/admin interface to trusted networks, segment the device, and apply the vendor's recommended configuration mitigations and any WAF/IPS signature. O3's runtime protection blocks the exploit chain at execution, holding the line on unpatched or end-of-life systems until you can patch.
How O3 protects you
O3 detects and blocks CVE-2022-45786 exploitation at runtime: eBPF exploit-chain detection, plus L7 egress monitoring that catches the post-exploitation callback and severs the attacker's outbound channel.
Tailored to CVE-2022-45786. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2022-45786 being exploited in your environment?
O3's eBPF runtime sensors and L7 egress monitoring detect and block the CVE-2022-45786 exploit chain at execution — protecting unpatched and end-of-life systems until the vendor patch is applied.