Critical Vulnerability in binary-parser Library Allows Remote Code Execution in Node.js Apps

Critical Vulnerability in binary-parser Library Exposes Node.js Applications to Remote Code Execution

A significant security flaw has been identified in the widely-used JavaScript library, binary-parser, which could allow attackers to execute arbitrary code within Node.js applications. This vulnerability, designated as CVE-2026-1245 with a CVSS score of 6.5, affects all versions of the library prior to 2.3.0. The issue was addressed with the release of version 2.3.0 on November 26, 2025.

Overview of binary-parser

Binary-parser is a popular npm package that enables developers to construct parsers for binary data in JavaScript. It supports various data types, including integers, floating-point numbers, strings, and arrays. The library is widely adopted, with approximately 13,000 weekly downloads, highlighting its significance in the developer community.

Details of the Vulnerability

The vulnerability arises from inadequate sanitization of user-supplied inputs, such as parser field names and encoding parameters. In binary-parser, JavaScript code is dynamically generated at runtime using the Function constructor to create parsing logic. This approach allows for efficient parsing of buffers by compiling the generated code into executable functions.

However, due to insufficient validation, malicious inputs can be incorporated into the generated code. This flaw enables attackers to inject and execute arbitrary JavaScript code within the context of the Node.js process. Applications that utilize static, hard-coded parser definitions are not susceptible to this vulnerability.

Potential Impact

Exploitation of this vulnerability could have severe consequences, including:

– Unauthorized Data Access: Attackers could gain access to sensitive local data stored within the application.

– Application Manipulation: Malicious actors might alter application logic, leading to unintended behaviors or security breaches.

– System Command Execution: Depending on the application’s deployment environment, attackers could execute system commands, potentially compromising the entire system.

The CERT Coordination Center (CERT/CC) emphasized the gravity of the situation, stating that in applications where parser definitions are constructed using untrusted input, attackers may execute arbitrary JavaScript code with the privileges of the Node.js process. This could lead to unauthorized data access, application logic manipulation, or system command execution.

Discovery and Reporting

Security researcher Maor Caplan is credited with discovering and reporting this vulnerability. His findings have been instrumental in prompting the necessary updates to mitigate the risk associated with this flaw.

Recommendations for Developers

To safeguard applications from potential exploitation, developers are strongly advised to:

1. Upgrade to Version 2.3.0 or Later: Ensure that the binary-parser library is updated to version 2.3.0 or newer, where the vulnerability has been patched.

2. Avoid Untrusted Inputs: Refrain from passing user-controlled values into parser field names or encoding parameters to prevent malicious code injection.

3. Implement Input Validation: Incorporate thorough input validation mechanisms to sanitize and verify all user-supplied data before processing.

4. Review Application Code: Conduct a comprehensive review of the application code to identify and rectify any instances where untrusted input may influence parser definitions.

Broader Implications

This vulnerability underscores the critical importance of input validation and the potential risks associated with dynamic code generation. Developers must exercise caution when handling user inputs, especially in scenarios involving runtime code compilation.

The incident also highlights the necessity for regular security assessments and prompt application of patches to maintain the integrity and security of software applications.

Conclusion

The discovery of CVE-2026-1245 in the binary-parser library serves as a stark reminder of the vulnerabilities that can arise from improper input handling and dynamic code execution. By adhering to best practices in input validation, staying vigilant with software updates, and conducting regular security audits, developers can mitigate the risks associated with such vulnerabilities and ensure the robustness of their applications.