# GHSA-crhg-xgrg-vvcc: a12nserver vulnerable to potential SQL Injections via Knex dependency

> SQL injection in a12nserver with MySQL allows attackers to steal OAuth2 access tokens for unrelated users.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 Jan 2023

## What is GHSA-crhg-xgrg-vvcc?

GHSA-crhg-xgrg-vvcc is a SQL injection vulnerability in @curveball/a12n-server, published on 13 Jan 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

Users of a12nserver that use MySQL might be vulnerable to SQL injection bugs. 

If you use a12nserver and MySQL, update as soon as possible. This SQL injection bug might let an attacker obtain OAuth2 Access Tokens for users unrelated to those that permitted OAuth2 clients.

### Patches

The knex dependency has been updated to 2.4.0 in a12nserver 0.23.0

### Workarounds

No further workarounds

### References

* https://github.com/knex/knex/issues/1227
* https://nvd.nist.gov/vuln/detail/CVE-2016-20018
* https://www.ghostccamm.com/blog/knex_sqli/

## Which versions are affected by GHSA-crhg-xgrg-vvcc?

2 open source packages ship an affected version, including @curveball/a12n-server.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@curveball/a12n-server` | npm | From 0.20.0 | 0.23.0 |
| `@curveball/a12n-server` | npm | From 0.20.0 | 0.23.0 |

## How do I fix GHSA-crhg-xgrg-vvcc?

Upgrade @curveball/a12n-server to 0.23.0 or later.

## Is GHSA-crhg-xgrg-vvcc being exploited?

There is no known exploitation of GHSA-crhg-xgrg-vvcc in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-crhg-xgrg-vvcc and fix it if it is affected.

What it is: GHSA-crhg-xgrg-vvcc is a SQL injection vulnerability in @curveball/a12n-server, published on 13 Jan 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-crhg-xgrg-vvcc in the wild and no public exploit code.

Affected packages and fixed versions:
- @curveball/a12n-server (npm): affected from 0.20.0; fixed in 0.23.0
- @curveball/a12n-server (npm): affected from 0.20.0; fixed in 0.23.0

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/GHSA-crhg-xgrg-vvcc/ (Markdown: https://insights.sbomify.com/GHSA-crhg-xgrg-vvcc/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-crhg-xgrg-vvcc

---
From sbomify Insights: https://insights.sbomify.com/GHSA-crhg-xgrg-vvcc/
Summaries are generated and may contain mistakes; the official description above is the record.
