-
Notifications
You must be signed in to change notification settings - Fork 60.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] NextChat cors SSRF 漏洞(CVE-2023-49785) #4283
Comments
Please follow the issue template to update title and description of your issue. |
Title: NextChat cors SSRF vulnerability (CVE-2023-49785) Original text from https://avd.aliyun.com/detail?id=AVD-2023-49785 |
This bug is pretty serious. If it's a private deployment, attackers could exploit it to access server resources without permission, causing security issues. |
it easy to patch by adding validation url |
Regarding this code snippet, it has a potential Server-Side Request Forgery (SSRF) vulnerability because it doesn't have proper validation or restrictions in place. It's crucial to implement input validation and sanitization to prevent SSRF attacks, which can lead to unauthorized access to internal systems or other security risks. |
Here are few options to to alleviate this issue:
|
Here is a proposal to solve this issue:
|
Additionally, it would be better to put the CORS host in an environment variable as well, so users can set their own host for CORS in different scenarios. Example: const ENABLE_CORS = process.env.ENABLE_CORS === 'true';
const CORS_HOST = process.env.CORS_HOST || 'https://yourdomain.com';
// Validate and sanitize the CODE input
const validatedCode = validateAndSanitizeCode(req.body.CODE);
// Apply CORS only if ENABLE_CORS is true
if (ENABLE_CORS) {
res.setHeader('Access-Control-Allow-Origin', CORS_HOST);
// Add other CORS headers if needed
}
// Use the validated code
// ... |
Here's a strategy that is likely to have the least impact: CORS is disabled by default, and for upstash and webdav functions that rely on the CORS interface. We could implement separate interfaces and put in the /api/ path, and only endpoint parameters are accepted to avoid the problem of proxy requests |
What is the worst thing one can do with SSRF? Certainly this can be easily used for spamming or probing. My worst imagination is in certain environments, attacker could grab information about the server or even issue cred as the server |
That's why it's recommended to use containers instead of |
原文来自https://avd.aliyun.com/detail?id=AVD-2023-49785
漏洞描述
NextChat 是一个面向用户的GPT类应用程序,用户可以通过这个程序与GPT进行交互。2024年3月,互联网上披露CVE-2023-49785 NextChat cors SSRF 漏洞,攻击者可在无需登陆的情况下构造恶意请求造成SSRF,造成敏感信息泄漏等。
The text was updated successfully, but these errors were encountered: