Skip to content
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

[GHSA-45pg-36p6-83v9] Langchain SQL Injection vulnerability #5025

Conversation

liadlevy
Copy link

Updates

  • CVSS v3
  • CVSS v4
  • Severity

Comments
I am the security researcher that found the vulnerability. NVD CVSS score is of 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
This vulnerability is easy to exploit, exists in the default configuration, and results in full database exposure. The affected database is commonly used in scenarios where this functionality's interface exposes user input to the package. + credit would be nice ;) Thanks.

@github-actions github-actions bot changed the base branch from main to liadlevy/advisory-improvement-5025 November 20, 2024 19:43
@darakian
Copy link
Contributor

darakian commented Nov 20, 2024

Hey there. It looks like the cvss 3.1 score we have comes from the huntr.dev report which I'm inclined to believe over the nvd score. Reading from the huntr thread it seems like langchain does document that access control is the responsibility of the api user. Can you expand on why you disagree?

Ref: https://huntr.com/bounties/8f4ad910-7fdc-4089-8f0a-b5df5f32e7c5

@liadlevy
Copy link
Author

liadlevy commented Nov 20, 2024 via email

@darakian
Copy link
Contributor

LangChain includes a dangerous functionality opt-in called "allow_dangerous_requests", but it is implemented in numerous chains but was not consistently across all text2query chains/tools. After my disclosure, they mitigated these vulnerabilities and added "allow_dangerous_requests" to the affected chains/tools.

That reads like it should be a considered a vuln in the chain that uses the function to me. It seems somewhat analogous to a database exposing full sql capacity. One would not say that mySQL or postgresql or whatever is vulnerable to sql injection, but rather some application using it could be depending on the context of the application.

From a technical perspective, the CVSS score assigned to this vulnerability is incorrect. This is not a local vulnerability but a network vulnerability

Is that the case? Does langchain accept prompts from the network by default?

@liadlevy
Copy link
Author

liadlevy commented Nov 20, 2024 via email

@darakian
Copy link
Contributor

I’m not sure I follow your analogy.

The analogy is that an api from one project is created to be used in an open ended way by another project.

LangChain doesn’t accept prompts directly from the network by default, but it is almost always integrated into APIs or applications that do.

Would that not be a problem with the use of langchain as opposed to langchain itself?

@liadlevy
Copy link
Author

liadlevy commented Nov 21, 2024 via email

@darakian
Copy link
Contributor

I'm not seeing evidence that convinces me to change the cvss so I am not accepting this PR. We believe huntr did an appropriate job scoring this vulnerability and we would advise you to reach out to applications using langchain inappropriately in order to help secure them.

@darakian darakian closed this Nov 21, 2024
@github-actions github-actions bot deleted the liadlevy-GHSA-45pg-36p6-83v9 branch November 21, 2024 18:17
@liadlevy
Copy link
Author

liadlevy commented Nov 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants