{"answers":{"affected":"2 open source packages ship an affected version, including zendframework/zendframework1.","exploited":"There is no known exploitation of GHSA-6fqw-j3vm-7f66 in the wild and no public exploit code.","fix":"Upgrade zendframework/zendframework1 to 1.12.20 or later.","what":"GHSA-6fqw-j3vm-7f66 is a SQL injection vulnerability in zendframework/zendframework1, published on 7 Jun 2024. It can be exploited over the network, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-6fqw-j3vm-7f66 and fix it if it is affected.\n\nWhat it is: GHSA-6fqw-j3vm-7f66 is a SQL injection vulnerability in zendframework/zendframework1, published on 7 Jun 2024. It can be exploited over the network, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-6fqw-j3vm-7f66 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- zendframework/zendframework1 (Packagist): affected all versions; fixed in 1.12.20\n- zendframework/zendframework1 (Packagist): affected all versions; fixed in 1.12.20\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/GHSA-6fqw-j3vm-7f66/ (Markdown: https://insights.sbomify.com/GHSA-6fqw-j3vm-7f66/index.md)","id":"GHSA-6fqw-j3vm-7f66","markdown":"https://insights.sbomify.com/GHSA-6fqw-j3vm-7f66/index.md","name":"GHSA-6fqw-j3vm-7f66","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["data_read","data_modify"],"network_reachable":"yes","non_default_config":false,"product_category":"PHP database library","requires_auth":"unknown","summary":"SQL injection in Zend Framework 1 allows attackers to execute arbitrary SQL commands via ORDER or GROUP BY clauses, potentially leading to data theft or modification.","user_interaction":"not_required","vuln_class":"sql_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"The implementation of ORDER BY and GROUP BY in Zend_Db_Select remained prone to SQL injection when a combination of SQL expressions and comments were used. This security patch provides a comprehensive solution that identifies and removes comments prior to checking validity of the statement to ensure no SQLi vectors occur.\n\nThe implementation of ORDER BY and GROUP BY in Zend_Db_Select of ZF1 is vulnerable by the following SQL injection:\n```\n$db = Zend_Db::factory(/* options here */);\n$select = new Zend_Db_Select($db);\n$select-\u003efrom('p');\n$select-\u003eorder(\"MD5(\\\"a(\\\");DELETE FROM p2; #)\"); // same with group()\n```\nThe above $select will render the following SQL statement:\n```\nSELECT `p`.* FROM `p` ORDER BY MD5(\"a(\");DELETE FROM p2; #) ASC\n```\ninstead of the correct one:\n```\nSELECT \"p\".* FROM \"p\" ORDER BY \"MD5(\"\"a(\"\");DELETE FROM p2; #)\" ASC\n```\nThis security fix can be considered an improvement of the previous ZF2016-02 and ZF2014-04 advisories.\n\nAs a final consideration, we recommend developers either never use user input for these operations, or filter user input thoroughly prior to invoking Zend_Db. You can use the Zend_Db_Select::quoteInto() method to filter the input data, as shown in this example:\n```\n$db    = Zend_Db::factory(...);\n$input = \"MD5(\\\"a(\\\");DELETE FROM p2; #)\"; // user input can be an attack\n$order = $db-\u003equoteInto(\"SQL statement for ORDER\", $input);\n\n$select = new Zend_Db_Select($db);\n$select-\u003efrom('p');\n$select-\u003eorder($order); // same with group()\n```","ecosystems":["Packagist"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Zendframework1 Potential SQL injection in ORDER and GROUP functions","id":"GHSA-6fqw-j3vm-7f66","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Packagist","product":null,"products":[],"type":"sql_injection","year":"2024"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"Packagist","fixed":["1.12.20"],"introduced":["0"],"last_affected":[],"package":"zendframework/zendframework1","purl":null,"source":"GHSA-6fqw-j3vm-7f66"},{"ecosystem":"Packagist","fixed":["1.12.20"],"introduced":["0"],"last_affected":[],"package":"zendframework/zendframework1","purl":"pkg:composer/zendframework/zendframework1","source":"GHSA-6fqw-j3vm-7f66"}],"products":null,"published":"2024-06-07","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"SQL injection in Zend Framework 1 allows attackers to execute arbitrary SQL commands via ORDER or GROUP BY clauses, potentially leading to data theft or modification.","url":"https://insights.sbomify.com/GHSA-6fqw-j3vm-7f66/"}