Skip to content

GHSA-2wvh-87g2-89hr CVE-2026-42088 PYSEC-2026-2245

OpenC3 COSMOS: Permissions Bypass Provides User Access to Unassigned Administrative Actions via Script Runner Tool

High PyPIRubyGems
Severity
9.6 / 10
High · CVSS 3.1
Exploit chance (EPSS)
0.34%
Chance of exploitation in the next 30 days. Higher than 27.66% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-250 Execution with Unnecessary Privileges
Fix
Available
2 packages have a fixed version

Description

Vulnerability Type: Execution with Unnecessary Privileges Attack type: Authenticated remote Impact: Data disclosure/manipulation, privilege escalation Affected components: The following docker images: • Openc3inc/openc3-COSMOS-script-runner-api

The Script Runner widget allows users to execute Python and Ruby scripts directly from the openc3-COSMOS-script-runner-api container. Because all the docker containers share a network, users can execute specially crafted scripts to bypass the API permissions check and perform administrative actions, including reading and modifying data inside the Redis database, which can be used to read secrets and change COSMOS settings, as well as read and write to the buckets service, which holds configuration, log, and plugin files. These actions are normally only available from the Admin Console or with administrative privileges. Any user with permission to create and run scripts can connect to any service in the docker network.

<img width="940" height="473" alt="image" src="https://github.com/user-attachments/assets/bf524163-127d-4349-999b-cefc53d4374d" />

Figure 1: Environment variables, including Redis credentials, found in the Script Runner container A Ruby script is used to expose the Redis username, password, hostname, and port. These credentials might also be found from the source code or through a brute-force attack.

<img width="940" height="507" alt="image" src="https://github.com/user-attachments/assets/6d3ccad4-949d-4eeb-a5f8-3aca48bbe815" />

Figure 2: A Python script is used to add data to Redis and retrieve the new data A Python script is then used to create a new entry in the Redis database called openc3__settings_hacked with a key of store_url and a value of http://hacked.com.

<img width="940" height="70" alt="image" src="https://github.com/user-attachments/assets/fcef13be-5416-4627-9c95-617a24674ee0" />

Figure 3: The new data found in the Redis database The new entry was successfully added to the Redis database, as is confirmed by using redis-cli. The following example shows how an attacker might change the plugin store URL file that is stored in the config bucket.

<img width="940" height="640" alt="image" src="https://github.com/user-attachments/assets/681b4dd6-4b6e-4a91-8480-0c9fbff76ede" />

Figure 4: Uploading file to change the plugin store URL setting

<img width="940" height="189" alt="image" src="https://github.com/user-attachments/assets/630db0bb-217e-4205-be1d-e9891516b22f" />

Figure 5: The URL file was successfully changed

Steps To Reproduce

  1. Run the following Ruby code to find the Redis credentials:
puts `env | grep redis`
  1. Add the following Python script with the credentials to create a new entry and read it
import redis
import json
import time

r = redis.Redis(
    host = 'openc3-redis',
    port = 6379,
    username = 'openc3', 
    password = 'openc3password',  
    decode_responses=True
)

# Save a setting
setting_data = {
    'name': 'store_url',
    'data': 'http://hacked.com',
    'updated_at': time.time_ns()
}
r.hset('openc3__settings_hacked','store_url',json.dumps(setting_data))
print(r.hget('openc3__settings_hacked','store_url'))

Recommendations

• Limit the permissions of the script runner API to prevent lower level users from performing administrative actions

Affected versions

PyPI

PackageVulnerableFixed in
openc3
< 7.0.0
7.0.0

RubyGems

PackageVulnerableFixed in
openc3
< 7.0.0-rc3
7.0.0-rc3

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

openc3 PyPI → 7.0.0

pip
pip install --upgrade "openc3>=7.0.0"
poetry
poetry add "openc3>=7.0.0"
uv
uv add "openc3>=7.0.0"

openc3 RubyGems → 7.0.0-rc3

bundler
bundle update openc3 # Gemfile: gem "openc3", ">= 7.0.0-rc3"

Severity breakdown

CVSS 3.1 9.6

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

Weakness

CWE-250: Execution with Unnecessary Privileges

The product performs an operation at a privilege level that is higher than the minimum level required, which creates new weaknesses or amplifies the consequences of other weaknesses.

How to prevent it
  • Architecture and Design, Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
  • Architecture and Design: Identify the functionality that requires additional privileges, such as access to privileged operating system resources. Wrap and centralize this functionality if possible, and isolate the privileged code as much as possible from other code [REF-76]. Raise privileges as late as possible, and drop them as soon as possible to avoid CWE-271. Avoid weaknesses such as CWE-288 and CWE-420 by protecting all possible communication channels that could interact with the privileged code, such as a secondary socket that is only intended to be accessed by administrators.
  • Architecture and Design: Identify the functionality that requires additional privileges, such as access to privileged operating system resources. Wrap and centralize this functionality if possible, and isolate the privileged code as much as possible from other code [REF-76]. Raise privileges as late as possible, and drop them as soon as possible to avoid CWE-271. Avoid weaknesses such as CWE-288 and CWE-420 by protecting all possible communication channels that could interact with the privileged code, such as a secondary socket that is only intended to be accessed by administrators.
  • Implementation: Perform extensive input validation for any privileged code that must be exposed to the user and reject anything that does not fit your strict requirements.
  • Implementation: When dropping privileges, ensure that they have been dropped successfully to avoid CWE-273. As protection mechanisms in the environment get stronger, privilege-dropping calls may fail even if it seems like they would always succeed.
  • Implementation: If circumstances force you to run with extra privileges, then determine the minimum access level necessary. First identify the different permissions that the software and its users will need to perform their actions, such as file read and write permissions, network socket permissions, and so forth. Then explicitly allow those actions while denying all else [REF-76]. Perform extensive input validation and canonicalization to minimize the chances of introducing a separate vulnerability. This mitigation is much more prone to error than dropping the privileges in the first place.
  • Operation, System Configuration: Ensure that the software runs properly under the United States Government Configuration Baseline (USGCB) [REF-199] or an equivalent hardening configuration guide, which many organizations use to limit the attack surface and potential risk of deployed software.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-jjq7-m736-w977
OpenC3 COSMOS: Authenticated remote code execution via the user-writable config overlay (table definitions, cmd/tlm definitions, and script suites)
Critical Also affects openc3
GHSA-vp3w-52v9-q57f
OpenC3 COSMOS: Authenticated OS command injection via the `pypi_url` setting
High Also affects openc3
GHSA-v529-vhwc-wfc5
OpenC3 COSMOS has SQL Injection in QuestDB Time-Series Database
Critical Also affects openc3
GHSA-ffq5-qpvf-xq7x
OpenC3 COSMOS is Vulnerable to Self-XSS Through the Command Sender
Medium Also affects openc3
GHSA-4jvx-93h3-f45h
OpenC3 COSMOS allows arbitrary writes to plugins directory via path-traversed config filenames
Medium Also affects openc3
GHSA-wgx6-g857-jjf7
OpenC3 COSMOS: Hijacked session token can be used to reset password for persistence
High Also affects openc3
GHSA-w757-4qv9-mghp
openc3-api Vulnerable to Unauthenticated Remote Code Execution
Critical Also affects openc3
GHSA-4xqv-47rm-37mm
OpenC3 stores passwords in clear text (`GHSL-2024-129`)
Medium Also affects openc3
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor