# CVE-2026-9059: NextGEN Gallery - SQL Injection

> Authenticated attackers with specific capabilities can inject SQL via the orderby parameter in NextGEN Gallery REST API endpoints.

- **Severity:** Critical 9.3 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:N/SC:H/SI:H/SA:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 20 May 2026
- **Updated:** 20 May 2026
- **Also known as:** GHSA-q977-85xc-w698

## What is CVE-2026-9059?

CVE-2026-9059 is a critical SQL injection vulnerability in awesomemotive NextGEN Gallery, published on 20 May 2026. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

NextGEN Gallery version prior to 4.2.1 are vulnerable to authenticated SQL injection via the 'orderby' parameter on the REST API endpoints '/imagely/v1/galleries' and '/imagely/v1/albums'.

The root cause is an insufficient sanitization function ('_clean_column()') in the data mapper layer that uses a character blacklist instead of a whitelist approach. This allows an authenticated attacker with the 'NextGEN Gallery overview' capability (assigned to the Administrator role by default) to inject arbitrary SQL into the 'ORDER BY' clause.

Weakness: CWE-89 (Improper Neutralization of Special Elements used in an SQL Command)

## Which versions are affected by CVE-2026-9059?


## How do I fix CVE-2026-9059?

No fix has been published for CVE-2026-9059 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-9059 being exploited?

There is no known exploitation of CVE-2026-9059 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-9059 and fix it if it is affected.

What it is: CVE-2026-9059 is a critical SQL injection vulnerability in awesomemotive NextGEN Gallery, published on 20 May 2026. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-9059 in the wild and no public exploit code.

Affected product: awesomemotive NextGEN Gallery. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. 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.
2. 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.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-9059/ (Markdown: https://insights.sbomify.com/CVE-2026-9059/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-9059
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-9059
- OSV: https://osv.dev/vulnerability/CVE-2026-9059

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-9059/
Summaries are generated and may contain mistakes; the official description above is the record.
