T09 · Insecure Skill Coding Practices
- Location
skills/joy-logistics-indicator/SKILL.md:161- Finding
Shell Command Injection Through Unquoted User-Controlled Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This logistics query skill is purpose-aligned, but it needs review because its scripts send tokens and shipment/business data while disabling TLS checks and its instructions build shell commands from user input without safe argument handling.
Review before installing or running. Use only a scoped, revocable JD/Ochama token, avoid storing it in a generic home-directory .env file, and run the skill in a restricted environment. The publisher should remove rejectUnauthorized:false, validate and pass command arguments through a non-shell API, standardize credential setup, and disclose that shipment IDs and business metrics are sent to external JD/Ochama services.
skills/joy-logistics-indicator/SKILL.md:161Shell Command Injection Through Unquoted User-Controlled Arguments
skills/joy-logistics-indicator/scripts/get_isc_data.js:39TLS Certificate Verification Disabled for Authenticated API Requests
README.md:28Unpinned Global Installation of a Third-Party CLI Package
README.md:35Inconsistent Credential Configuration and Insecure Secret-Storage Guidance
The documentation includes credential setup instructions centered on an API key, which is directly related to credential handling and could enable unauthorized API access if the token is exposed. The logistics context increases sensitivity because exposed credentials may allow access to shipment tracking data or operational metrics, potentially exposing business or customer information.
MAC/Linux
cat > ~/.env << 'EOF'
# 京东物流 API 配置
api_key=66Pi3xz*******yzNHvRNJgeJsqtSkn7fcJ4
EOF
The code’s actual behavior is narrowly focused on logistics tracking: it reads tracking/reference numbers, constructs a referenceList, and calls /global/trackingOpenExport/queryTrackingBatch to fetch tracking data. This aligns with the first declared module (international logistics trajectory/tracking), but not with the broader declared description that presents the skill as supporting three major function modules, including extensive supply-chain KPI queries and cross-border small-package experience metrics. Since the supplied code chunk does not implement those additional declared capabilities, the description overstates what this code actually does. There are no obvious undeclared malicious or unrelated behaviors beyond making the tracking API request.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const fs = require('fs');
const path = require('path');
// 自动从 ~/.env 读取 joy_token
// let token = '';
// try {
// const envPath = path.join(process.env.HOME, '.env');
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const fs = require('fs');
const path = require('path');
// 自动从 ~/.env 读取 joy_token
// let token = '';
// try {
// const envPath = path.join(process.env.HOME, '.env');
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
// 自动从 ~/.env 读取 joy_token
// let token = '';
// try {
// const envPath = path.join(process.env.HOME, '.env');
// const envContent = fs.readFileSync(envPath, 'utf8');
// const match = envContent.match(/^joy_token=(.+)$/m);
// if (match) token = match[1].trim();
The HTTPS request explicitly sets rejectUnauthorized: false, which disables TLS certificate validation. This allows a man-in-the-middle attacker to intercept or modify requests and responses, exposing the token header and potentially altering logistics or indicator data returned to the skill.
Disabling certificate verification without any warning means the script silently operates over an unauthenticated TLS channel. Users and operators may believe the connection is secure while credentials and data are vulnerable to interception or tampering.
The code sets rejectUnauthorized: false on an HTTPS request, which disables TLS certificate verification and allows man-in-the-middle interception or impersonation of us-api.jd.com. Because this script sends an authentication token and queries potentially sensitive logistics and operational indicator data, an attacker on the network path could steal credentials, alter responses, or inject false business data.
This finding refers to the same behavior: outbound HTTPS certificate validation is explicitly disabled with no warning, making the connection unauthenticated despite using TLS. In this skill's context, the request includes a token header and accesses logistics/indicator data, so intercepted traffic could expose secrets and permit tampering with operational outputs consumed by users or downstream systems.
The README instructs users to place an API credential in a local ~/.env or user environment variable without any guidance on secret hygiene, least privilege, rotation, or avoiding accidental exposure through shell history, backups, or shared machines. Even though this is documentation rather than executable code, it normalizes insecure secret handling and can lead to credential leakage.
Without declared permissions the skill's intent is opaque and cannot be validated.
The skill is presented entirely in Chinese and its required user prompts and fixed return messages are specified only in Chinese, with no indication that users may choose another language. This creates a natural-language locale constraint that is not presented as optional or justified as a region-specific compliance requirement.
The trigger description says to use the skill whenever a user needs to query warehouse-related indicator data, and also covers broad comparison, ranking, and best/worst requests across multiple dimensions. It does not define exclusion conditions or negative examples, so similar everyday analytic requests could overlap unintentionally with other skills.
The skill requires shell command execution with user-influenced parameters but provides no safety constraints, escaping rules, or trust boundary discussion. In an agent setting, this increases the chance that natural-language input is transformed into unsafe subprocess arguments or that execution occurs without appropriate user awareness and sandboxing.
The instruction to check environment variables before query execution encourages access to sensitive configuration without defining limits or masking requirements. In a query-only skill, this broadens the attack surface and may expose credentials, endpoints, or other secrets if the agent surfaces them or uses them outside intended controls.
The skill explicitly instructs the agent to check environment variables before performing a cross-border metrics query, even though the documented task is data retrieval. Accessing environment variables expands scope into sensitive runtime configuration and can expose secrets or enable unintended disclosure if the agent reflects or mishandles that information.
The cross-border section directs the agent to execute a command-line script using parsed user input, again without safety controls or explicit sandbox assumptions. Even though argument order is constrained, untrusted input flowing into subprocess execution can still be dangerous if the surrounding runner uses shell evaluation or if downstream scripts are not hardened.
One mandatory rule says that when no matching data exists, the response must be exactly '未查询到指标数据,请检查查询条件是否正确'. Later, the dedicated empty-result section instructs returning a different fixed message: '该客户不存在或者没有全程履约率'. These are mutually incompatible directives for the same case.
The manifest describes a business-query skill for logistics tracking and indicator retrieval, but does not justify local environment inspection for credentials as part of its user-facing purpose. Reading a process environment variable to obtain an access token is an additional capability outside the stated functional scope, even though it is used to authenticate later API calls.
The skill explicitly instructs sending shipment and order identifiers to an external JD logistics API, but it does not warn the user that their identifiers will leave the local agent context. These identifiers may be sensitive business or customer data, so the lack of disclosure undermines informed consent and can cause privacy or compliance issues, especially in enterprise settings.
The output section mandates fixed Chinese phrasing such as '物流轨迹详情' and '查询结果:物流单号 {单号} 未查询到物流轨迹', which constrains the response language. There is no indication that the user can opt into another language or that the locale restriction is justified as a region-specific requirement.
The request payload hard-codes the locale to "zh-CN", which imposes a specific language/locale behavior on all users. The file does not provide any user opt-in, configuration path, or comment explaining that this skill is intentionally region-specific.
The script explicitly sets rejectUnauthorized to false, disabling TLS certificate validation for an HTTPS request carrying an authentication token and potentially sensitive logistics data. This enables man-in-the-middle interception or response tampering by any attacker able to influence the network path, which is especially dangerous in a logistics-query skill that depends on trusted upstream data.
The README presents all user-facing instructions in Chinese and does not offer an alternate language or state that the skill is intentionally limited to Chinese-speaking users. This can violate a language/locale policy when a specific language is effectively forced without user choice or documented justification.
The manifest declares the skill as iplat-test-skill focused on 京东国际物流数据查询, but the body documentation describes joy-logistics-skill as a complete collection of multiple logistics skills. This is an active documentation/code-intent mismatch within the same file because the inline documentation identifies a different skill package and scope than the declared manifest.
No suspicious patterns detected.