Back to skill

Security audit

Dorar Hadith

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a straightforward Dorar hadith search helper, but its shell script unsafely embeds the search query into Python code, which can let a crafted query run local commands.

Review before installing or running. The skill's purpose is legitimate and the network call is to the documented Dorar endpoint, but do not run it on untrusted or automatically generated search strings until the query encoding is fixed to pass input as data rather than executable Python source.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/dorar_search.sh:12
Finding

Arbitrary Python Code Execution Through Unsafely Embedded Search Query

Content
View full analysis

Vulnerability Details

File Location: scripts/dorar_search.sh, lines 12–13
Vulnerability Type: Python code injection
Risk Level: High

Vulnerable Code

bash
# URL encode the query
ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$QUERY'))")

Technical Analysis

The script interpolates the user-controlled QUERY value directly into source code passed to python3 -c. Although the shell command is enclosed in double quotes, the generated Python program places the query inside a single-quoted Python string.

A query containing a single quote can terminate that Python string. The attacker can then append arbitrary Python statements and comment out the remaining expected syntax. The resulting statements execute locally with the privileges of the user running the Skill.

The intended URL-encoding operation only requires passing the query as data. Converting it into executable source code violates least-privilege design and creates an unnecessary local code-execution channel.

Attack Path

  1. An attacker supplies, or persuades a user or Agent to submit, a malicious hadith search query.
  2. The shell expands the query into the argument passed to python3 -c.
  3. A payload shaped like the following terminates the expected Python string and injects a new statement:
text
'); __import__('os').system('ATTACKER_COMMAND'); #
  1. Python parses the injected content as executable code.
  2. ATTACKER_COMMAND runs before the request to dorar.net is made.

The exact payload may require adjustment to preserve valid Python syntax, but no separate shell metacharacter injection is required because the vulnerable boundary is the dynamically generated Python source.

Impact Assessment

Successful exploitation provides arbitrary local code execution under the account that invoked the Skill. The attacker can consequently:

  • Read files and credentials accessible to that account.
  • Create, modify, or delete user-accessible ...[truncated 861 chars]
Remediation
View remediation

Remediation Suggestions

Pass the query to Python as a data argument rather than interpolating it into executable source code:

bash
ENCODED=$(
  python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' \
    "$QUERY"
)

Additional hardening measures:

  1. Enable strict shell behavior near the beginning of the script:
bash
set -euo pipefail
  1. Check that required executables such as python3 and curl are available before use.
  2. Configure curl to report HTTP and transport failures rather than silently returning unusable content:
bash
curl --fail --silent --show-error --location ...
  1. Consider applying reasonable connection and total-request timeouts.
  2. Add regression tests containing single quotes, double quotes, semicolons, newlines, shell metacharacters, and Python syntax to verify that every query is treated solely as data.
  3. Keep the current model in which the API response is parsed by a fixed, bundled parser; do not pipe remote responses into a shell or interpreter as executable code.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · scripts/dorar_search.sh (reported line 15)May include surrounding context.

sh
# URL encode the query
ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$QUERY'))")

RESULT=$(curl -s -L \
  -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" \
  -H "Accept: application/json, text/javascript, */*" \
  -H "Referer: https://dorar.net/" \

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script emits user-facing strings exclusively in Arabic (نتيجة and الرابط) with no option to select another language and no documented justification for the locale restriction. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

Line L41 states that keywords must be written in Arabic, which imposes a specific language requirement in the skill's natural-language documentation. The file does not offer a language choice or explain a policy-based reason for requiring Arabic input, so this is a language/locale policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The script reads the DORAR_QUERY value from the environment, which is a form of sensitive runtime input access under the rule's code-file criteria. While there is an inline comment describing the source, there is no user-facing notice, confirmation, or broader warning that environment data will be consumed and then reflected into output links.

Content

No source excerpt is available for this finding.