OS Command Injection in doc-recog Library
The doc-recog library through version 1.1.6 is vulnerable to OS command injection via crafted document paths passed to the recog() or tag() functions.
CVE search metadata
CVE search record: CVE-2026-110638. Severity: critical. CVSS: 9.8. KEV: no. Product: doc-recog (<= 1.1.6). Brief: OS Command Injection in doc-recog Library. Brief link: https://feed.craftedsignal.io/briefs/2026-10-doc-recog-rce/
The doc-recog library (versions 1.1.6 and earlier) contains an OS command injection vulnerability, identified as CVE-2026-110638. The vulnerability originates in the DocData._readPDF method, which fails to sanitize user-provided document paths before passing them to a shell-based invocation of the pdftotext utility. By supplying a specially crafted document path containing shell metacharacters, such as command substitution sequences ($(cmd)) or backticks, an attacker can cause the underlying Node.js application to execute arbitrary commands with the privileges of the Node.js process. This vulnerability is highly critical due to the ease of exploitation and the potential for full system access depending on the context in which the Node.js application is running.
Attack Chain
- The application exposes an endpoint or interface that accepts document paths from a user.
- The attacker provides a crafted document path input string containing malicious shell metacharacters like $(whoami) or
id. - The application passes the malicious string to the recog() or tag() functions within the doc-recog library.
- The library internally invokes the DocData._readPDF method.
- The DocData._readPDF method fails to sanitize the input path and includes it directly in a shell command string formatted for the pdftotext binary.
- The shell executes the command string, causing the injected malicious commands to trigger immediately.
- The application returns the output of the injected command or proceeds to crash, while the attacker achieves unauthorized command execution on the host system.
Impact
Successful exploitation allows unauthenticated attackers to execute arbitrary system commands on the server hosting the doc-recog library. This can lead to full system compromise, data exfiltration, or lateral movement within the environment. Given the widespread use of Node.js libraries in web applications, the scope of impact includes any service utilizing doc-recog for document processing.
Recommendation
Prioritized, concrete actions for detection engineering teams:
- Upgrade the doc-recog library to a patched version beyond 1.1.6 as soon as it becomes available.
- Audit all applications utilizing doc-recog to identify code paths where user input influences the document path parameter.
- Implement strict input validation on all file paths to ensure they conform to expected formats and contain only alphanumeric characters, preventing shell metacharacter injection.
- If upgrading is not immediately possible, implement a WAF rule to block requests containing shell substitution characters in paths directed toward the application.
Immediate actions
Upgrade doc-recog to a version above 1.1.6
Mitigations
Implement strict input validation for document paths in application code
CVE-2026-110638