CVE-2025-68271
Description
OpenC3 COSMOS provides the functionality needed to send commands to and receive data from one or more embedded systems. From 5.0.0 to 6.10.1, OpenC3 COSMOS contains a critical remote code execution vulnerability reachable through the JSON-RPC API. When a JSON-RPC request uses the string form of certain APIs, attacker-controlled parameter text is parsed into values using String#convert_to_value. For array-like inputs, convert_to_value executes eval(). Because the cmd code path parses the command string before calling authorize(), an unauthenticated attacker can trigger Ruby code execution even though the request ultimately fails authorization (401). This vulnerability is fixed in 6.10.2.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
openc3RubyGems | >= 5.0.6, < 6.10.2 | 6.10.2 |
Affected products
1Patches
101e9fbc5e66eUpdate array and object convert to value
3 files changed · +28 −7
openc3/lib/openc3/core_ext/string.rb+11 −3 modified@@ -22,6 +22,7 @@ require 'openc3/packets/binary_accessor' require 'openc3/ext/string' if RUBY_ENGINE == 'ruby' and !ENV['OPENC3_NO_EXT'] +require 'yaml' # OpenC3 specific additions to the Ruby String class class String @@ -40,6 +41,8 @@ class String HEX_CHECK_REGEX = /\A\s*0[xX][\dabcdefABCDEF]+\s*\z/ # Regular expression to identify a String as an Array of numbers ARRAY_CHECK_REGEX = /\A\s*\[.*\]\s*\z/ + # Regular expression to identify a String containing object notation + OBJECT_CHECK_REGEX = /\A\s*\{.*\}\s*\z/ # Displays a String containing binary data in a human readable format by # converting each byte to the hex representation. @@ -209,6 +212,11 @@ def is_array? if ARRAY_CHECK_REGEX.match?(self) then true else false end end + # @return [Boolean] Whether the String represents an Object + def is_object? + if OBJECT_CHECK_REGEX.match?(self) then true else false end + end + # @return [Boolean] Whether the string contains only printable characters def is_printable? if NON_PRINTABLE_REGEX.match?(self) then false else true end @@ -238,9 +246,9 @@ def convert_to_value elsif self.is_hex? # Hex return_value = Integer(self) - elsif self.is_array? - # Array - return_value = eval(self) + elsif self.is_array? or self.is_object? + # Array or Object + return_value = YAML.safe_load(self) end rescue Exception # Something went wrong so just return the string as is
openc3/python/openc3/utilities/extract.py+11 −2 modified@@ -39,6 +39,8 @@ # Regular expression to identify a String as an Array of numbers ARRAY_CHECK_REGEX = re.compile(r"\A\s*\[.*\]\s*\Z") +# Regular expression to identify a String as an Object +OBJECT_CHECK_REGEX = re.compile(r"\A\s*\{.*\}\s*\Z") # Pulls all string keyword arguments into the args array. def extract_string_kwargs_to_args(args: list, kwargs: dict): @@ -83,6 +85,13 @@ def is_array(string): return False +def is_object(string): + """Whether the String represents an Object""" + if OBJECT_CHECK_REGEX.match(string): + return True + return False + + def convert_to_value(string): """Converts the String into either a Float, Integer, or Array depending on what the String represents. It can successfully convert @@ -101,8 +110,8 @@ def convert_to_value(string): elif is_hex(string): # Hex return_value = int(string, 0) - elif is_array(string): - # Array + elif is_array(string) or is_object(string): + # Array or Object return_value = ast.literal_eval(string) except Exception: # Something went wrong so just return the string as is
openc3/spec/core_ext/string_spec.rb+6 −2 modified@@ -206,8 +206,12 @@ expect("[0,1,2,3]".convert_to_value).to eql [0, 1, 2, 3] end - it "just returns the string if something goes wrong" do - expect("[.a,2,3]".convert_to_value).to eql "[.a,2,3]" + it "is very tolerant to array contents" do + expect("[.a,2,3]".convert_to_value).to eql [".a",2,3] + end + + it "it handles objects" do + expect("{'hello':'goodbye'}".convert_to_value).to eql({"hello" => "goodbye"}) end it "doesn't match(multiline strings" do
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-w757-4qv9-mghpghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-68271ghsaADVISORY
- github.com/OpenC3/cosmos/commit/01e9fbc5e66e9a2500b71a75a44775dd1fc2d1deghsaWEB
- github.com/OpenC3/cosmos/security/advisories/GHSA-w757-4qv9-mghpnvdWEB
- github.com/rubysec/ruby-advisory-db/blob/master/gems/openc3/CVE-2025-68271.ymlghsaWEB
News mentions
0No linked articles in our index yet.