<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Script-Runner — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/script-runner/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Fri, 08 Nov 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/script-runner/feed.xml" rel="self" type="application/rss+xml"/><item><title>OpenC3 COSMOS Script Runner Permissions Bypass</title><link>https://feed.craftedsignal.io/briefs/2024-11-openc3-cosmos-bypass/</link><pubDate>Fri, 08 Nov 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-11-openc3-cosmos-bypass/</guid><description>The OpenC3 COSMOS Script Runner widget allows authenticated users to bypass API permissions checks and execute administrative actions by running specially crafted Python and Ruby scripts, leading to data manipulation and privilege escalation.</description><content:encoded><![CDATA[<p>The openc3-COSMOS-script-runner-api container includes a Script Runner widget that enables users to execute Python and Ruby scripts. A vulnerability exists where users with script execution privileges can bypass API permission checks due to shared networking among Docker containers. This bypass allows unauthorized administrative actions such as reading and modifying data within the Redis database, which can lead to the exposure of sensitive credentials and alteration of COSMOS settings. Attackers can also read and write to the buckets service, affecting configuration, logs, and plugins. The vulnerability affects versions prior to 7.0.0-rc3 of the rubygems/openc3 package, posing a significant risk to data integrity and system security. Any authenticated user with script execution capabilities can exploit this flaw to connect to any service within the Docker network, escalating their privileges and gaining control over critical system components.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker logs into the OpenC3 COSMOS platform with a valid, non-administrative user account that has access to the Script Runner widget.</li>
<li>The attacker crafts a Ruby script to extract Redis credentials (username, password, hostname, port) by querying the environment variables within the <code>openc3-COSMOS-script-runner-api</code> container using a command like <code>puts \</code>env | grep redis``.</li>
<li>The attacker executes the Ruby script within the Script Runner widget, successfully retrieving the Redis credentials, which are then displayed in the script&rsquo;s output.</li>
<li>The attacker crafts a Python script using the obtained Redis credentials to connect to the Redis database. The script is designed to create a new entry or modify an existing one. For example, <code>r.hset('openc3__settings_hacked','store_url',json.dumps(setting_data))</code></li>
<li>The attacker executes the Python script within the Script Runner widget, successfully adding or modifying data in the Redis database, bypassing normal permission controls.</li>
<li>The attacker leverages the ability to write to the buckets service to modify critical system configuration files, such as the plugin store URL, by uploading a malicious file via a Python or Ruby script.</li>
<li>The attacker verifies the changes by using <code>redis-cli</code> to confirm the new data was added to the Redis database, or by observing the altered behavior of the system due to the modified configuration files.</li>
<li>The attacker gains complete control over the OpenC3 COSMOS environment by exploiting modified settings, potentially leading to data exfiltration, service disruption, or further lateral movement within the network.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows unauthorized data disclosure and manipulation within the OpenC3 COSMOS environment. An attacker can access sensitive information such as Redis credentials, modify system settings, and alter configuration files, leading to privilege escalation. The number of affected installations is currently unknown, but the vulnerability poses a significant risk to organizations using OpenC3 COSMOS, potentially resulting in complete system compromise and loss of data integrity. The vulnerability allows unauthorized access to data and functionality typically restricted to administrators, bypassing intended security controls.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the <code>rubygems/openc3</code> package to version 7.0.0-rc3 or later to remediate the vulnerability (reference: rubygems/openc3 v7.0.0-rc3).</li>
<li>Implement network segmentation to isolate the <code>openc3-COSMOS-script-runner-api</code> container from other critical services like Redis, limiting the blast radius of potential attacks.</li>
<li>Deploy the Sigma rule to detect the execution of suspicious scripts within the Script Runner widget that attempt to access Redis or modify configuration files.</li>
<li>Monitor process creation events within the <code>openc3-COSMOS-script-runner-api</code> container for commands such as <code>env | grep redis</code> or any calls to <code>redis-cli</code> which is abnormal behavior, and create alerts (reference: process_creation log source).</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>openc3</category><category>cosmos</category><category>script-runner</category><category>permissions-bypass</category><category>privilege-escalation</category></item></channel></rss>