T03 · Remote Payload Retrieval and Execution
- Location
mrmrmr/README.md:55- Finding
Remote Installer Downloaded and Executed Without Integrity Verification
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This biomedical analysis skill appears purpose-aligned, but it handles credentials and LLM-derived data in unsafe ways that can expose tokens or execute unintended code.
Install only in an isolated research environment with non-sensitive inputs and disposable API tokens. Avoid the documented curl-to-sh installer, disable synonym expansion unless you provide and protect your own UMLS credential, do not use editable CSVs from untrusted sources, and expect disease/exposure terms and analysis results to be sent to external services.
mrmrmr/README.md:55Remote Installer Downloaded and Executed Without Integrity Verification
mrmrmr/mragent/agent_workflow.py:1037Remote LLM Output and Editable CSV Data Executed Through Python eval
mrmrmr/mragent/agent_tool.py:261Untrusted Identifiers Paths and Credentials Interpolated Into Executable R Source
mrmrmr/mragent/agent_tool.py:376OpenGWAS JWT Persisted in a Predictable Plaintext R Script
mrmrmr/mragent/agent_workflow.py:301Hard-Coded UMLS API Credential Exposed and Transmitted in URL Query Strings
requirements.txt:1Unpinned Dependencies and Automatic Runtime Package Installation
mrmrmr/web_demo.py:211Web Demo Globally Replaces os.system and Routes Commands Through a Shell
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- `MRlap` - sample overlap correction (optional)
- `jsonlite` - JSON processing (required for MRlap)
- `OPENAI_API_KEY` environment variable must be set (OpenAI API key)
- `OPENGWAS_JWT` environment variable (optional, for OpenGWAS access token)
## Usage
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- `MRlap` - sample overlap correction (optional)
- `jsonlite` - JSON processing (required for MRlap)
- `OPENAI_API_KEY` environment variable must be set (OpenAI API key)
- `OPENGWAS_JWT` environment variable (optional, for OpenGWAS access token)
## Usage
The README recommends executing a remote installation script directly via 'curl ... | sh', which bypasses normal review of the downloaded content. If the remote server, CDN, or connection path is compromised, users could execute arbitrary shell commands on their systems with the privileges of the invoking user.
You need to follow the steps to install ollama and follow the ollama python support package:
curl -fsSL https://ollama.com/install.sh | sh
pip install ollama
The use of a shell pipe into 'sh' is a classic command-chaining risk because untrusted network content is immediately interpreted by the shell. In practice, any compromise of the fetched content results in direct code execution, making the README materially more dangerous than a simple link to installation instructions.
You need to follow the steps to install ollama and follow the ollama python support package:
curl -fsSL https://ollama.com/install.sh | sh
pip install ollama
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
# 获取OpenGWAS数据库中的GWAS ID
def get_gwas_id(keyword):
def remove_newlines(lst):
# Remove /n from each string in a list
return [s.replace('\n', '') for s in lst]
data = []
The OpenGWAS JWT token is embedded directly into the generated R source code and written to disk in test.R before execution. This exposes a sensitive credential to local users, logs, backups, crash reports, or later accidental commits, and combines with the code-injection risk from generated-script execution.
This function generates an R script by interpolating untrusted inputs such as Exposure_id, Outcome_id, path, and gwas_token directly into code, writes it to disk, and then executes it via os.system. Even though the shell command itself is constant, the executed script content is attacker-controllable, enabling arbitrary R code execution and potentially arbitrary file writes or command execution from within R.
with open('test.R', 'w', encoding='utf-8') as f:
f.write(r_script_run)
os.system('R --slave --no-save --no-restore --no-site-file --no-environ -f test.R --args')
@timer
The second MR tool repeats the credential-handling issue by embedding the OpenGWAS JWT in a generated R file on disk and then executing it. This creates both credential exposure and an easy path for code injection through interpolated values.
This second workflow has the same core issue: untrusted values are inserted into an R program and then executed through os.system. An attacker controlling identifiers, path, or token values could break out of string context in the generated R code, run arbitrary R statements, overwrite files, or exfiltrate secrets.
with open('test.R', 'w', encoding='utf-8') as f:
f.write(r_script_run)
os.system('R --slave --no-save --no-restore --no-site-file --no-environ -f test.R --args')
@timer
The MRlap workflow also constructs an executable R script from attacker-influenced inputs, including Exposure_id, Outcome_id, path, N_exposure, and N_outcome, then runs it. Because those values are embedded into code and file paths, this can lead to arbitrary code execution in R, path traversal, and uncontrolled downloading/writing of files.
with open('test.R', 'w', encoding='utf-8') as f:
f.write(r_script_run)
os.system('R --slave --no-save --no-restore --no-site-file --no-environ -f test.R --args')
def get_synonyms(term, api_key):
A hard-coded UMLS API token is embedded directly in the source and used for live synonym lookups. Anyone with code access can reuse the credential for unrelated authenticated requests, causing credential leakage, abuse of the external account, and loss of control over billed or rate-limited API activity.
The skill silently uses a hard-coded third-party credential to perform network requests for synonym expansion without user disclosure. In this context, that is more dangerous because the workflow is an automated agent pipeline that may run in trusted environments, so embedded secrets can be unintentionally redistributed and abused at scale.
The code calls eval() on Outcome_id values loaded from CSV data that is derived from earlier LLM output and other external sources. An attacker who can influence the CSV contents or upstream model output can turn this into arbitrary Python code execution when step9 runs, making this a direct code execution sink rather than a mere parsing issue.
Outcome_id = Outcome_id.to_numpy()[0]
Exposure_id = Exposure_id.to_numpy()[0]
print(Outcome_id, Exposure_id)
Outcome_id_list = eval(Outcome_id)
Exposure_id_list = eval(Exposure_id)
print(Outcome_id_list, Exposure_id_list)
This eval() call executes Exposure_id content as Python code after reading it from persisted workflow data. Because that content can be influenced by LLM responses, external services, or edited files, it creates a straightforward arbitrary code execution path in a security-sensitive automation pipeline.
Exposure_id = Exposure_id.to_numpy()[0]
print(Outcome_id, Exposure_id)
Outcome_id_list = eval(Outcome_id)
Exposure_id_list = eval(Exposure_id)
print(Outcome_id_list, Exposure_id_list)
# 创建文件夹
The code sends MR analysis inputs and full result tables to an external LLM via llm_chat() without any consent, warning, redaction, or data-classification check. In a biomedical/research workflow, these inputs may contain unpublished, proprietary, or otherwise sensitive analysis data, creating a real confidentiality and compliance risk once transmitted to third-party model providers.
This duplicate match points to the same underlying weakness: command execution through Popen(..., shell=True). Because the application overrides os.system globally, the dangerous pattern affects a broad execution surface and can turn otherwise indirect inputs into shell metacharacter injection opportunities.
def patched_os_system(command):
if 'R ' in command:
# 使用subprocess代替os.system来捕获输出
process = subprocess.Popen(
command,
shell=True,
stdout=subprocess.PIPE,
This duplicate match points to the same underlying weakness: command execution through Popen(..., shell=True). Because the application overrides os.system globally, the dangerous pattern affects a broad execution surface and can turn otherwise indirect inputs into shell metacharacter injection opportunities.
def patched_os_system(command):
if 'R ' in command:
# 使用subprocess代替os.system来捕获输出
process = subprocess.Popen(
command,
shell=True,
stdout=subprocess.PIPE,
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def get_api_keys() -> Dict[str, Optional[str]]:
"""Get API keys from environment variables"""
return {
"openai_api_key": os.environ.get("OPENAI_API_KEY"),
"opengwas_jwt": os.environ.get("OPENGWAS_JWT"),
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def get_api_keys() -> Dict[str, Optional[str]]:
"""Get API keys from environment variables"""
return {
"openai_api_key": os.environ.get("OPENAI_API_KEY"),
"opengwas_jwt": os.environ.get("OPENGWAS_JWT"),
The skill advertises capabilities that imply filesystem, environment, shell, and network access, but it does not declare any explicit tool scope or permissions boundary. This creates an authorization ambiguity where a host may grant broader-than-expected execution privileges, increasing the blast radius if the skill or its dependencies behave unsafely.
The skill sends user-provided biomedical terms to external services including PubMed, OpenGWAS, and an LLM provider, but the description does not clearly warn users that their inputs will leave the local environment. In biomedical contexts, disease, exposure, or study terms may encode sensitive research interests or potentially sensitive health-related information, so lack of disclosure creates privacy and compliance risk.
The README instructs users to provide an LLM API key and a GWAS token and describes literature scanning and online GWAS usage, but it does not clearly warn that user-supplied disease, exposure, and outcome terms may be transmitted to third-party services. In a biomedical context, those inputs can be sensitive research topics or patient-related terms, so the lack of explicit disclosure can lead to unintended external data sharing.
The skill explicitly depends on the OpenGWAS API, which means user queries and analysis parameters may be sent to an external service. External transmission is not inherently malicious, but in this medical-research workflow it creates confidentiality and compliance risk if users assume processing is local or submit sensitive inputs.
You need to get the **GWAS token** for the OpenGWAS data.
- [OpenGWAS API](https://api.opengwas.io/)
## Usage
This code defines credential variables and passes them into an agent configured with a remote base URL, which implies network transmission to an external service. There is no confirmation prompt, user-facing log, or explanatory comment warning that API keys and request data may be used in outbound requests.
The script explicitly configures a third-party API endpoint and then runs an agent workflow, which may transmit prompts, research inputs, or tokens to an external service. In a skill context, this is security-relevant because users may not realize their data is leaving the local environment, and the custom endpoint increases supply-chain and data-handling risk versus a trusted default.
# openai
agent = MRAgent(outcome='back pain', AI_key=AI_key, model='MR',
num=50, bidirectional=True, introduction=False, LLM_model='gpt-4o',
base_url="https://api.gpt.ge/v1/", gwas_token=mr_key,
mr_quality_evaluation=True, mr_quality_evaluation_key_item=['4b', '4e', '6e', '10d'], mrlap=True)
agent.run(step=[1, 2, 3, 4, 5, 6, 7, 8])
agent.run(step=[9])