CVE-2026-25591: New API has an SQL LIKE Wildcard Injection DoS via Token Search

Published Feb 23, 2026
·
Updated

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("userid = ?", 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(sessioncookie): requests.get( 'http://localhost:3000/api/token/search', params={'keyword': '%%%%%%', 'token': ''}, cookies={'session': sessioncookie}, headers={'New-API-User': '1'} )

Launch 50 concurrent malicious requests with ThreadPoolExecutor(maxworkers=50) as executor: for in range(50): executor.submit(attack, '<validsession>')

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("userid = ?", 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(), 5time.Second) defer cancel() err = DB.WithContext(ctx).Where(...).Find(&tokens).Error

Other sources

New API is a large language mode (LLM) gateway and artificial intelligence (AI) asset management system. Prior to version 0.10.8-alpha.10, 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. 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. Version 0.10.8-alpha.10 contains a patch.

MITRE

Affected Software

11 affected componentsFixes available
go/github.com/QuantumNous/new-api<0.10.8-alpha.10
0.10.8-alpha.10
Newapi New Api<0.10.8
Newapi New Api=0.10.8-alpha1
Newapi New Api=0.10.8-alpha2
Newapi New Api=0.10.8-alpha3
Newapi New Api=0.10.8-alpha4
Newapi New Api=0.10.8-alpha5
Newapi New Api=0.10.8-alpha6
Newapi New Api=0.10.8-alpha7
Newapi New Api=0.10.8-alpha8
Newapi New Api=0.10.8-alpha9

Event History

Feb 23, 2026
Advisory Published
via GitHub·09:56 PM
Data Sourced
via GitHub·09:56 PM
DescriptionWeaknessAffected Software
Feb 24, 2026
CVE Published
via MITRE·12:41 AM
Data Sourced
via MITRE·12:41 AM
DescriptionWeakness
Data Sourced
via NVD·01:16 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·01:16 AM
RemedyAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-25591?

CVE-2026-25591 is classified as a Denial of Service vulnerability due to SQL LIKE wildcard injection.

2

How do I fix CVE-2026-25591?

To mitigate CVE-2026-25591, upgrade to version 0.10.8-alpha.10 or later of the new-api software.

3

What systems are affected by CVE-2026-25591?

CVE-2026-25591 affects the new-api package version up to 0.10.8-alpha.10.

4

What type of attack does CVE-2026-25591 facilitate?

CVE-2026-25591 allows authenticated users to perform denial of service attacks through resource exhaustion.

5

Where is the vulnerable endpoint for CVE-2026-25591 located?

The vulnerable endpoint for CVE-2026-25591 is located at /api/token/search.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203