CVE-2026-40190 Overview
CVE-2026-40190 is a prototype pollution vulnerability affecting the LangSmith JavaScript/TypeScript SDK (langsmith). The vulnerability exists in the SDK's internally vendored lodashset() utility, where an incomplete fix for prototype pollution allows attackers to pollute Object.prototype through the constructor.prototype traversal path. Prior to version 0.5.18, the baseAssignValue() function only guards against the __proto__ key but fails to prevent alternative prototype pollution vectors.
Critical Impact
An attacker who controls keys in data processed by the createAnonymizer() API can pollute Object.prototype, affecting all objects in the Node.js process. This can lead to application-wide security issues including denial of service, authorization bypass, or in some cases remote code execution.
Affected Products
- LangSmith JavaScript/TypeScript SDK (langsmith) versions prior to 0.5.18
- Applications using the createAnonymizer() API with user-controlled input
Discovery Timeline
- April 10, 2026 - CVE-2026-40190 published to NVD
- April 13, 2026 - Last updated in NVD database
Technical Details for CVE-2026-40190
Vulnerability Analysis
This vulnerability is classified as CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes), commonly known as prototype pollution. The root issue stems from an incomplete security fix in the vendored lodash library's set() utility function.
Prototype pollution vulnerabilities occur when attackers can inject properties into JavaScript's base object prototypes. In this case, while the baseAssignValue() function was patched to block direct access via __proto__, it failed to account for the semantically equivalent constructor.prototype path. This oversight allows attackers to bypass the existing protection and still achieve prototype pollution.
The attack surface is specifically through the createAnonymizer() API, which processes data containing keys controlled by external input. When malicious keys containing constructor.prototype paths are processed, the vulnerable set() function allows these properties to be written to Object.prototype.
Root Cause
The root cause is an incomplete security fix in the vendored lodashset() utility. The baseAssignValue() function implements a blocklist approach that only filters the __proto__ key, but JavaScript provides multiple equivalent paths to access an object's prototype. The constructor.prototype path achieves the same result and was not included in the blocklist, creating a bypass for the existing protection.
Attack Vector
The attack requires network access and involves an attacker providing malicious input containing specially crafted keys to an application using the LangSmith SDK's createAnonymizer() API. When this API processes the attacker-controlled data, the vulnerable set() function traverses the key path and writes to Object.prototype.
The attack mechanism involves crafting JSON objects with keys like constructor.prototype.polluted that, when processed by the vulnerable function, add properties to all JavaScript objects in the Node.js process. This can lead to various impacts depending on how the application uses object properties, including authentication bypass, denial of service, or in severe cases, code execution.
For technical details and proof-of-concept information, refer to the GitHub Security Advisory.
Detection Methods for CVE-2026-40190
Indicators of Compromise
- Presence of unexpected properties on Object.prototype in the Node.js runtime
- Application logs showing unusual key names containing constructor.prototype in API requests
- Unexpected behavior in object property checks or iterations across the application
- Error conditions triggered by polluted prototype properties affecting application logic
Detection Strategies
- Review application logs for requests containing constructor, prototype, or __proto__ in JSON keys
- Implement runtime monitoring to detect modifications to built-in prototypes
- Use static analysis tools to identify usage of vulnerable LangSmith SDK versions
- Deploy dependency scanning to flag langsmith packages prior to version 0.5.18
Monitoring Recommendations
- Enable verbose logging for the createAnonymizer() API to track input data patterns
- Implement application-level monitoring for prototype modifications using Object.freeze() on critical prototypes in development
- Monitor for anomalous application behavior that could indicate prototype pollution exploitation
- Set up alerts for dependency vulnerabilities in CI/CD pipelines
How to Mitigate CVE-2026-40190
Immediate Actions Required
- Upgrade the LangSmith JavaScript/TypeScript SDK (langsmith) to version 0.5.18 or later immediately
- Audit application code for usage of createAnonymizer() with user-controlled input
- Implement input validation to reject keys containing constructor, prototype, or __proto__ paths
- Review application logs for evidence of exploitation attempts
Patch Information
The vulnerability is fixed in LangSmith SDK version 0.5.18. The fix addresses the incomplete prototype pollution protection in the vendored lodashset() utility by extending the blocklist to include the constructor.prototype traversal path. Organizations should update their package.json or package-lock.json to require langsmith version >=0.5.18.
For additional details on the fix, refer to the GitHub Security Advisory.
Workarounds
- Implement input sanitization to strip or reject keys containing constructor or prototype before passing data to createAnonymizer()
- Use Object.freeze(Object.prototype) in application startup to prevent prototype modifications (may cause compatibility issues with some libraries)
- Implement a wrapper function around createAnonymizer() that validates and sanitizes input keys
- Consider using --frozen-intrinsics Node.js flag in production environments to prevent prototype modifications
# Update langsmith to patched version
npm update langsmith@0.5.18
# Or specify minimum version in package.json
# "langsmith": ">=0.5.18"
# Verify installed version
npm list langsmith
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


