{"answers":{"affected":"6 open source packages ship an affected version, including github.com/apache/age/drivers/golang and apache-age-python. It affects 1 product.","exploited":"There is no known exploitation of CVE-2022-45786 in the wild and no public exploit code.","fix":"Upgrade github.com/apache/age/drivers/golang to 1.1.1 or later.","what":"CVE-2022-45786 is a high-severity SQL injection vulnerability in Apache AGE, published on 4 Feb 2023. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2022-45786 and fix it if it is affected.\n\nWhat it is: CVE-2022-45786 is a high-severity SQL injection vulnerability in Apache AGE, published on 4 Feb 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2022-45786 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- github.com/apache/age/drivers/golang (Go): affected all versions; no fix listed\n- github.com/apache/age/drivers/golang (Go): affected all versions; fixed in 1.1.1\n- github.com/apache/age/drivers/golang (Go): affected all versions; fixed in 1.1.1\n- apache-age-python (PyPI): affected all versions; fixed in 0.0.5\n- apache-age-python (PyPI): affected all versions; fixed in 0.0.5\n- apache-age-python (PyPI): affected all versions; fixed in 0.0.5\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2022-45786/ (Markdown: https://insights.sbomify.com/CVE-2022-45786/index.md)","id":"CVE-2022-45786","markdown":"https://insights.sbomify.com/CVE-2022-45786/index.md","name":"CVE-2022-45786","record":{"aliases":["GHSA-6p5q-h963-pwwf","GO-2024-2587","PYSEC-2026-769"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["data_read","data_modify"],"network_reachable":"yes","non_default_config":false,"product_category":"Apache AGE drivers","requires_auth":"none","summary":"SQL injection in Apache AGE Python and Golang drivers allows attackers to manipulate or expose database data via unparameterized queries.","user_interaction":"not_required","vuln_class":"sql_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"apache","cpe":[{"product":"age","vendor":"apache"}],"cvss":{"score":8.1,"severity":"high","source":"cisa-adp","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-89","name":"Improper Neutralization of Special Elements used in an SQL Command"}],"description":"There are issues with the AGE drivers for Golang and Python that enable SQL injections to occur. This impacts AGE for PostgreSQL 11 \u0026 AGE for PostgreSQL 12, all versions up-to-and-including 1.1.0, when using those drivers.\n\nThe 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.\n\nThe 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.\n\nBackground (for those who want more information):\n\nAfter 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.\n\nThe 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.\n\nThe 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.\n\nThe 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.\n\nThis method will allow the parameterizing of the cypher() function indirectly and provide a way to lock out SQL injection attacks.","ecosystems":["Go","PyPI"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Apache AGE: Python and Golang drivers allow data manipulation and exposure due to SQL injection","id":"CVE-2022-45786","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Go","product":null,"products":[],"type":"sql_injection","year":"2022"},"n_packages":6,"n_references":1,"next":{"headline":"Apache James MIME4J: Temporary File Information Disclosure in MIME4J TempFileStorageProvider","id":"CVE-2022-45787"},"packages":[{"ecosystem":"Go","fixed":[],"introduced":["0"],"last_affected":[],"package":"github.com/apache/age/drivers/golang","purl":"pkg:golang/github.com/apache/age/drivers/golang","source":"GO-2024-2587"},{"ecosystem":"Go","fixed":["1.1.1"],"introduced":["0"],"last_affected":[],"package":"github.com/apache/age/drivers/golang","purl":null,"source":"GHSA-6p5q-h963-pwwf"},{"ecosystem":"Go","fixed":["1.1.1"],"introduced":["0"],"last_affected":[],"package":"github.com/apache/age/drivers/golang","purl":"pkg:golang/github.com/apache/age/drivers/golang","source":"GHSA-6p5q-h963-pwwf"},{"ecosystem":"PyPI","fixed":["0.0.5"],"introduced":["0"],"last_affected":[],"package":"apache-age-python","purl":null,"source":"GHSA-6p5q-h963-pwwf"},{"ecosystem":"PyPI","fixed":["0.0.5"],"introduced":["0"],"last_affected":[],"package":"apache-age-python","purl":"pkg:pypi/apache-age-python","source":"GHSA-6p5q-h963-pwwf"},{"ecosystem":"PyPI","fixed":["0.0.5"],"introduced":["0"],"last_affected":[],"package":"apache-age-python","purl":"pkg:pypi/apache-age-python","source":"PYSEC-2026-769"}],"prev":{"headline":"Path traversal in n/a","id":"CVE-2022-45783"},"products":["Apache AGE"],"published":"2023-02-04","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2025-03-26","vendors":["Apache Software Foundation"]},"summary":"SQL injection in Apache AGE Python and Golang drivers allows attackers to manipulate or expose database data via unparameterized queries.","url":"https://insights.sbomify.com/CVE-2022-45786/"}