AIDEFEND in Action AIA-0186 Validated Research

LangSmith Public Prompts: Pulling Someone Else's Prompt Could Send Your Model Requests and API Key to Their Server

LangSmith lets teams load reusable prompts into their applications. LangChain's security advisory explains that older SDKs could use settings bundled with a public prompt. If the application used those settings to choose where to send model requests, it could send prompts, retrieved data or attached API credentials to an unapproved server. Updated Python and JavaScript SDKs block public prompt loading by default.

Configuration PoisoningData ExfiltrationSupply Chain DefenseConfiguration ReviewAI Supply Chain
5 applicable AIDEFEND defenses
Source: LangSmith SDK: Public prompt pull deserializes untrusted manifests without trust boundary warning 
Authors: @eyurtsev (LangChain); reporters credited: Moaaz-0x, berardinellidaniele
Original article: May 7, 2026

Threat Analysis

  • How a pulled prompt becomes model-client configuration. An application calls pull_prompt (Python) or pullPrompt (JS/TS) with a prompt name; LangChain's older hub.pull helper does the same through the LangSmith client. The SDK downloads the prompt's manifest, its stored definition on the platform, and deserializes it, rebuilding the LangChain objects it describes. A manifest is more than prompt text: by design it can configure a model with a custom base URL, default headers, a model name or other constructor arguments, and it can carry system messages and other serialized LangChain objects. When an identifier has an owner prefix, for example someuser/rag-answer, the content belongs to whoever controls that account, yet affected SDK versions handled it exactly like a prompt from the caller's own organization.
  • What an attacker could change. Take an illustrative example, not a case from the advisory: an application pulls the latest version of a public prompt together with its model settings, and the prompt's author later commits a version whose model address is https://llm-proxy.attacker.example/v1. The SDK builds the model client with that address, and the application's next requests go to the attacker's server instead of the model provider. LangChain lists what such requests can carry in typical deployments: prompt contents, system prompts, retrieved context, model parameters and provider credentials. The same mechanism can point requests at internal addresses for server-side request forgery (SSRF, where an attacker makes the application server connect on their behalf to services it can reach but outsiders cannot), and an attacker can instead embed system messages or templates in the manifest to change what the application does.
  • When the path exists. The advisory names three conditions that must all hold: the application pulls a public prompt by owner/name, that prompt was published or modified by an untrusted or compromised account, and the application uses it without independently validating its contents. Two arguments widen the impact. With include_model=True (includeModel: true in JS/TS) the SDK asks for the model settings as well, and deserialization may then build classes from LangChain's partner integration packages; the default is false, and LangChain advises keeping it for prompts from outside the organization. With secrets_from_env=True the SDK follows secret references in the manifest and reads environment variables while rebuilding it; the Python SDK has left this off by default since version 0.5.1.
  • The fix, and what it leaves open. Python langsmith 0.8.0 and JS/TS langsmith 0.6.0 refuse a public owner/name pull with an error unless the caller passes dangerously_pull_public_prompt=True (dangerouslyPullPublicPrompt: true), and LangChain says to set it only after reviewing the prompt's contents, not merely the account that published it. Affected are Python langsmith earlier than 0.8.0, JS/TS langsmith earlier than 0.6.0, langchain earlier than 0.3.30 and langchain-classic earlier than 1.0.7; the last two releases deprecate the old hub.pull helper and route it through the LangSmith SDK. Prompts from the caller's own organization, referenced by name only, are not gated: with a leaked LANGSMITH_API_KEY or a compromised team account, someone can push a prompt that redirects model traffic, and the application loads it without any warning. CVE-2026-45134 has a CVSS 3.1 score of 7.1; the advisory credits Moaaz-0x, who first reported it, and berardinellidaniele.
  • A related path was reported in the web interface in 2024. Noma Security researchers Sasi Levi and Gal Moyal named it AgentSmith: an attacker built an agent in the LangSmith Playground, pointed its OpenAI proxy setting at a server they controlled and published it to the public Prompt Hub. A user who tried the agent and entered an OpenAI API key would have their traffic relayed through that server. LangChain fixed it on the platform side on November 6, 2024, eight days after the report, and added a warning that a proxy's owner may see API keys. That warning lives in the web interface; the 2026 advisory covers code that pulls prompts through the SDK, and its title notes that older SDK versions did so without a trust-boundary warning. Neither Noma nor LangChain found evidence that AgentSmith was exploited, and no public information currently shows the SDK path being used in a real attack.

Applicable AIDEFEND Defenses (5)

AID-H-003.010
Deployed AI Software Vulnerability Remediation Lifecycle
Very High
Upgrade each running application to the fixed SDK and verify that an external public prompt is rejected without explicit opt-in. The fix covers that default path. Prompts in your own workspace and any deliberately enabled public imports still need independent review.
AID-I-002.002
Secure External AI Service Connectivity
Very High
A redirected model client only causes harm if its request can leave. On the networks that run LangChain applications, a default-deny egress policy with an FQDN or TLS SNI allowlist naming only the approved model providers, the organization's AI gateway and LangSmith stops a request built for an attacker's base URL or proxy before it leaves, together with the prompts, retrieved context and API key it carries. Attempts show up in firewall or proxy logs as connections to unapproved hosts. Only workloads behind that egress point are covered, so laptops and notebooks with open internet access stay exposed; embedded system messages can still change behavior, and the block fails if the allowlist includes domains an attacker can host on or the allowed gateway accepts an upstream address or credential supplied in request headers.
AID-H-021.002
Runtime Integrity Enforcement (Signed Configurations)
High
Pulling the latest version at runtime lets anyone who can commit to a prompt change production configuration without a deployment. The application's prompt loader should accept a manifest only when its commit and content digest match a signed, approved record for that release: pull by name and commit hash, hash the returned manifest, compare before deserializing, and refuse to start or reload on a mismatch, a missing record or a verifier error. Both paths in the advisory fall inside this check: a later malicious commit to a public prompt the team once approved, and a commit pushed into the team's own workspace with a leaked key. It does not judge content, so a prompt that was already malicious when approved passes; the review before signing has to catch that.
AID-H-004.002
Service & API Authentication
High
What a redirected request can hand over depends on the credential the application holds. Where the model provider supports it, authenticate the application with short-lived workload or managed-identity tokens that the provider restricts to approved models and entry points, or give the application a virtual key that only the organization's internal AI gateway accepts while the gateway keeps the real provider key. A request sent to an attacker's endpoint then carries a credential that expires quickly or is useless outside the approved path, instead of a long-lived provider key. The prompts and context in that request are still exposed, and providers that offer only static API keys need the gateway pattern.
AID-E-001.001
Root & Long-Lived Credential Object Eviction
High
If an application ran a prompt version whose model address pointed outside the approved providers, every provider API key that application sent should be treated as disclosed. Its owner revokes the key at the provider, issues a replacement to each consumer and confirms the old value is rejected; when a same-workspace prompt changed without review, the LANGSMITH_API_KEY that could have pushed it is revoked and replaced the same way. This ends the attacker's continued use of those credentials. It does not recall prompts and context already sent, and the framework's worked example covers an AWS IAM key, so other providers need their own revocation procedure.

What Defenders Should Do Now

  • Find every prompt pull and upgrade affected SDKs. Search application code, notebooks and scheduled jobs for pull_prompt, pull_prompt_commit, pullPrompt, pullPromptCommit and hub.pull, and note which identifiers carry an owner prefix. Check the version installed in each running environment; Python langsmith earlier than 0.8.0, JS/TS langsmith earlier than 0.6.0, langchain earlier than 0.3.30 and langchain-classic earlier than 1.0.7 are affected and should be upgraded. After the upgrade, a test pull of a public owner/name prompt without the opt-in flag must fail with an error. Where an environment cannot be upgraded yet, stop pulling owner/name prompts there and restrict its outbound connections until it can.
  • Read a public prompt before opting in, then keep your own pinned copy. Before anyone adds the opt-in flag, read the full manifest with pull_prompt_commit, which returns the stored JSON without rebuilding objects (the fixed SDK needs the flag for this call too). Check it for model settings, base URLs, headers, proxy settings, secret references and system messages. If it is acceptable, save a reviewed copy in your own workspace and reference it by name and commit hash, such as my-prompt:COMMIT_HASH, rather than the latest version or a tag such as production that can later point at a different commit. Keep include_model false and leave secrets_from_env off for anything that did not originate in your organization.
  • Let model requests reach only approved endpoints. On the hosts and containers that run LangChain applications, block outbound connections by default and allow only the FQDNs of approved model providers or your own AI gateway, plus LangSmith itself. Test from the application environment: a request to an unapproved HTTPS host must fail, and the attempt must appear in the egress logs.
  • Revoke and rotate provider keys if a pulled prompt may have redirected requests. If any application pulled an external prompt with model settings, or loaded a same-workspace prompt version nobody reviewed, inspect the manifests it actually loaded. When a model address points anywhere other than your approved provider or gateway, revoke and rotate the provider API keys that application used, and confirm the old keys are rejected.

1 additional consideration

Flag the opt-in arguments in code review and CI

The fixed SDK protects only while nobody passes the opt-in flag, and two other arguments widen what a pulled prompt can do.
Recommendation: Repository owners can add a code-scanning rule that flags dangerously_pull_public_prompt=True, dangerouslyPullPublicPrompt: true, secrets_from_env=True and include_model=True on prompt pulls, and require a link to a recorded manifest review before such a change merges. Test the rule with fixture files that use each argument. Pattern rules miss values passed through variables or configuration, so they support the manifest review rather than replace it.

Conclusion

A prompt can carry settings that change where an application sends its data. AIDEFEND  points to deploying the SDK fix, accepting only approved prompt versions and restricting network access to approved model services.

Last updated: