inStrain Passed BAM File Names Straight to a Shell

inStrain is a bioinformatics tool for strain-level analysis of microbial sequencing data. Before version 1.12.1, several code paths built shell commands with the path to a BAM or SAM file and did not quote the filename. A file named with command substitution or backticks could run an operating-system command with the analyst's privileges.

The issue is CVE-2026-141338. The public description names run_coverm, _sam_to_bam, and subset_bam as paths that passed the mapping-file name through a shell. The vendor fix in 1.12.1 states that mapping-file paths are no longer sent through a shell and that paths with spaces now work in those paths.

A filename is attacker-controlled input

Scientific workflows exchange BAM and SAM files through shared storage, job queues, sample sheets, and email. The person who runs inStrain may not be the person who created the filename. A file can arrive in a tar archive, a mounted dataset, or a batch directory with generated names.

The vulnerable program constructs a command string and passes it to a shell. Shell syntax inside the filename is interpreted before the analysis tool sees the path. A payload such as $(...) can run a command as the analysis user. That user may have access to read-only research data, write to shared project storage, or hold cloud credentials in the environment.

CVSSv3.1 is 7.8 with a local attack vector, no privileges, and required user interaction. The local score reflects the need to influence a filename that a user processes, not a guarantee that only an interactive terminal session can trigger it. A pipeline or shared directory can deliver the malicious name.

The fix is about process invocation

The upstream commit replaces shell-string construction with argument-based execution and adds quoting where needed. That is the right structural response. Adding a denylist for $, backticks, ;, or | would miss shell metacharacters and platform-specific parsing. Programs should pass an argument vector directly and avoid shell=True for file paths.

Upgrade to inStrain 1.12.1 or later. After upgrading, test file paths with spaces, parentheses, Unicode characters, and shell metacharacters. The tool should treat each path as a literal argument. A test should also confirm that a missing file produces a controlled error rather than a shell command.

Review pipeline variables that interpolate sample names into command strings. Even after inStrain is fixed, the scheduler or wrapper may use the same unsafe pattern. Store sample identifiers separately from filesystem paths and validate or encode them before use.

Investigate affected runs

Search job logs for file names that contain shell syntax. Check shared dataset directories, sample sheets, and pipeline output for unusual names. Compare process trees and scheduled-job records with expected commands. If a malicious name was processed, review actions by the analysis account and rotate credentials available to that account.

The host may be a batch worker rather than a desktop. In that case, isolate it from the shared cluster and preserve its job image. The attacker may have targeted cluster credentials or mounted data, not only the local workstation.

inStrain's fix closes the known shell path. Teams still need a trusted naming convention and a wrapper that treats filenames as data. That combination prevents a different command builder from reintroducing the same boundary.

References