{"id":"CVE-2024-22261","aliases":["GHSA-vw63-824v-qf2j","BIT-harbor-2024-22261","GO-2024-2916"],"title":"SQL Injection in Harbor scan log API","summary":"SQL Injection in Harbor scan log API","severity":"low","cvss":2.7,"cvssVector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N","vendor":"goharbor","product":"github.com/goharbor/harbor","ecosystem":"go","affected":["github.com/goharbor/harbor < 2.8.6","github.com/goharbor/harbor >= 2.9.0, < 2.9.4","github.com/goharbor/harbor >= 2.10.0, < 2.10.2"],"patched":["github.com/goharbor/harbor 2.8.6","github.com/goharbor/harbor 2.9.4","github.com/goharbor/harbor 2.10.2"],"published":"2024-06-02","updated":"2026-07-08","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-vw63-824v-qf2j","references":[{"url":"https://github.com/goharbor/harbor/security/advisories/GHSA-vw63-824v-qf2j"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-22261"},{"url":"https://github.com/goharbor/harbor"},{"url":"https://pkg.go.dev/vuln/GO-2024-2916"}],"tags":["osv","go"],"epss":0.00417,"epssPercentile":0.35586,"ingestedAt":"2026-07-09T18:56:36.947Z","slug":"CVE-2024-22261","body":"## Overview\n\n### Impact\n\nA user with an administrator, project_admin, or project_maintainer role could utilize and exploit SQL Injection to allow the execution of any Postgres function or the extraction of sensitive information from the database through this API:\n```\nGET /api/v2.0/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/{report_id}/log\n```\nThe SQL injection might happen in the code: \n\nhttps://github.com/goharbor/harbor/blob/9b7c1a2274fbc5ea16e19a484532f86c08926577/src/pkg/task/task.go#L241\n\nBecause raw SQL executed in ormer.Raw(Sql).QueryRows() is PrepareStatement. In the driver of Postgres, one PrepareStatement must contain only ONE SQL command, see https://www.postgresql.org/docs/15/libpq-exec.html#LIBPQ-PQPREPARE.  The SQL should start with:\n```\nSELECT * FROM task WHERE extra_attrs::jsonb->'report_uuids' @>\n```\nAdding a delete/update operation by appending malicious content to the current SQL is impossible. Furthermore, the query result of the task is just an intermediate result, the task ID is used to locate the job log file, and the response only contains the content of the job log file. so this vulnerability can be used to execute SQL functions, but it can't leak any useful information to the response.\n\nHarbor >=v2.8.1, >=2.9.0, >=2.10.0 are impacted.\n\n### Patches\nHarbor v2.8.6, v2.9.4, v2.10.2 fixes this issue.\n\n### Workarounds\nThere is no workaround for this issue.\n\n### Credits\n\nThanks Taisei Inoue ([taisei.inoue@gmo-cybersecurity.com](mailto:taisei.inoue@gmo-cybersecurity.com))\n\n## Affected packages\n\n- `github.com/goharbor/harbor < 2.8.6`\n- `github.com/goharbor/harbor >= 2.9.0, < 2.9.4`\n- `github.com/goharbor/harbor >= 2.10.0, < 2.10.2`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `github.com/goharbor/harbor 2.8.6`\n- `github.com/goharbor/harbor 2.9.4`\n- `github.com/goharbor/harbor 2.10.2`","depth":"sunlit","depthScore":15,"depthScoreParts":{"impact":14.9,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}