fix(security): prevent OS command injection in os-dependentLibraries (VULN-87310)#2066
Merged
Conversation
…(VULN-87310) `install_python_libraries.py` interpolated `os-dependentLibraries[]` fields (`platform`, `python_version`, `name`, `version`, `target`) from `globalConfig.json` directly into a `pip` command string that was then run with `subprocess.run(..., shell=True)`. An attacker who could influence `globalConfig.json` (e.g. via a pull request to an add-on repo whose CI runs `ucc-gen build`, or via a malicious third-party add-on) could execute arbitrary commands on the build host. Refactor every helper that invokes `subprocess.run` to pass an argv `list[str]` without `shell=True`. Values from `globalConfig.json` are now passed as discrete argv tokens, so shell metacharacters in any of them cannot break out of the intended command. A parametrised regression test asserts that no call uses `shell=True` and that injected payloads survive as literal argv tokens for every injectable field and a representative set of shell metacharacters. Co-Authored-By: Claude <noreply@anthropic.com>
kkedziak-splunk
enabled auto-merge (squash)
June 30, 2026 13:32
Co-Authored-By: Claude <noreply@anthropic.com>
Code Coverage 🎉
|
artemrys
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: VULN-87310
PR Type
What kind of change does this PR introduce?
Summary
Changes
Fixes the OS command injection vulnerability reported through the Splunk Bug
Bounty Program (VULN-87310, CVSS 8.8 / SEC_HIGH).
install_python_libraries.install_os_dependent_librariesinterpolated theos-dependentLibraries[]fields (platform,python_version,name,version,target) fromglobalConfig.jsondirectly into a singlepipcommand string, which was then executed via
subprocess.run(..., shell=True).The reporter demonstrated arbitrary command execution on the build host by
injecting
$(id > /tmp/UCC_PWNED)viaglobalConfig.jsononucc-gen6.5.0.This PR removes
shell=Trueeverywhere ininstall_python_libraries.pyandrefactors every caller to pass
subprocess.runan argvlist[str]:_subprocess_runnow requireslist[str]; theshell=Trueargument isgone. Values that originate from
globalConfig.jsonare passed as discreteargv tokens, so shell metacharacters in any of them cannot break out of the
intended command.
_pip_install,_pip_is_lib_installed,install_libraries, andinstall_os_dependent_librariesbuild thepipinvocation as a list. Theuser-supplied
pip_custom_flagis split withshlex.splitso it stillaccepts multi-flag strings from
ucc-gen build.regression test (
test_install_os_dependent_libraries_does_not_invoke_shell)iterates over every injectable field and a representative set of shell
metacharacter payloads — including the reporter's
$(id > /tmp/UCC_PWNED)— and asserts that (1) no call uses
shell=Trueand (2) the injectedpayload survives intact as a single literal argv token, proving the sink
no longer interprets it.
User experience
No user-visible change for valid
globalConfig.jsoninputs. Building anadd-on with values containing shell metacharacters used to execute arbitrary
commands on the build host; pip now simply receives those values as literal
arguments and fails with a normal "no matching distribution" style error.
Checklist
Review
Tests
See the testing doc.
Demo/meeting:
Reviewers are encouraged to request meetings or demos if any part of the change is unclear