The vulnerability exists because the node-ts-ocr package constructs shell commands using unsanitized user input. Specifically, the Ocr.invokeImageOcr and Ocr.invokePdfToTiff functions in src/index.ts build command strings for tesseract and convert utilities, respectively. They incorporate the imagePath and filePath parameters directly into these command strings. An attacker can provide a path containing shell metacharacters (e.g., ';', '&&', '||') to inject and execute arbitrary commands on the host system. The Ocr.extractText function is also an important indicator, as it acts as a primary entry point, calling the other vulnerable functions with the user-provided file path. The root cause is the use of child_process.exec on a command string built with concatenation instead of using safer alternatives like child_process.spawn with an argument array, which would prevent the shell from interpreting the input as commands.