Back to skill

Security audit

掘金量化skill

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marked this skill suspicious because scanners report serious trading-strategy errors and unsafe live-trading guidance; some analysis was incomplete, so the evidence is not comprehensive.

Use caution before installing. The reported live-trading guidance and strategy defects could affect real funds, and persistence tests may delete existing data. Scanner coverage was partial, so this review cannot establish that unreported areas are safe.

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

Warning
Location
scripts/test_persist_apis.py
Finding

Persistence tests can erase pre-existing strategy state without confirmation

Content
View full analysis

Impact

Pre-existing keys in gmquant_test_bucket can be erased, and an existing deletable another_bucket_xyz can be removed entirely. The persistence documentation states that backtest and live modes share a bucket's data, so running tests in a backtest workflow does not itself protect retained strategy state.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (19)

The execution workflow permits live trading without warning about real-account effects.

High
Category
Output Handling
Confidence
94% confidence
Finding

The workflow directs the agent to execute generated strategies and supports live mode without an explicit real-account warning or confirmation gate. Although backtesting is the default, live mode can submit actual market orders through the connected account, making confusion between simulation and real trading financially consequential.

Content

No source excerpt is available for this finding.

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 240)May include surrounding context.

md
| `02-core-functions.md` | `run`、`set_token`、`stop`、`schedule`、`timer` |

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 241)May include surrounding context.

md
| `03-subscribe-events.md` | `subscribe`、`unsubscribe`、`on_tick`、`on_bar`、`on_l2*` |

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 253)May include surrounding context.

md
| `16-premium-data-apis.md` | 付费增值数据 API(期货/基金/可转债) |

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 1092)May include surrounding context.

md
22. **付费增值数据 API**:期货(fut_get_*)、基金(fnd_get_*)、可转债(bnd_get_*) 的增值数据需要开通相应权限。详见 `references/16-premium-data-apis.md`

L218–L220 direct rejection testing to live mode, including real trading, without warning about financial consequences.

High
Category
Output Handling
Confidence
90% confidence
Finding

The reference recommends live mode, explicitly including real trading, to test rejection behavior without restricting testing to a simulated account. A supposedly invalid test order may instead be accepted and filled under real-account conditions, causing unintended positions, fees, or losses.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/run_strategy.py (reported line 81)May include surrounding context.

python
cmd = [sys.executable, strategy_path]

    # 通过环境变量传递参数给策略文件的 __main__
    env = os.environ.copy()
    env['GM_RUN_MODE'] = args.mode
    env['GM_TOKEN'] = args.token
    if args.strategy_id:

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Automatic activation includes generic words without requiring a 掘金 SDK context.

Medium
Category
Trigger Abuse
Confidence
99% confidence
Finding

L0005 activates the skill whenever the user mentions terms including 'history', 'subscribe', 'gm', 下单, or 财务数据. These can occur in unrelated programming, everyday conversation, or general financial questions, and the trigger does not require an accompanying 掘金 platform reference or provide exclusions.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/run_strategy.py (reported line 99)May include surrounding context.

python
# ---- 执行策略 ----
    try:
        proc = subprocess.run(
            cmd,
            cwd=cwd,
            env=env,

Documented momentum-proportional holdings are calculated from available cash rather than portfolio value.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

The strategy derives absolute target holdings from available cash, excluding the value of retained positions, and then submits those quantities to order_target_volume. This can unintentionally liquidate retained holdings or produce incorrect allocations on subsequent rebalances; asynchronous sales further undermine the cash assumption, and the optional live mode makes this a real financial-integrity risk rather than merely an inaccurate backtest.

Content

No source excerpt is available for this finding.

The claimed equal-weight rebalance uses available cash as the value of the entire target portfolio.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

The equal-weight rebalance divides a pre-sale available-cash snapshot among targets and treats those amounts as absolute position targets, ignoring existing invested capital and subsequent sale proceeds. This can cause unintended position reductions, excessive idle cash, and repeated turnover; although backtesting is the default, the supported live mode exposes actual funds to the defect.

Content

No source excerpt is available for this finding.

The documented MA5/MA20 crossover strategy uses the current MA20 as the previous MA20, producing different trading signals.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

With COUNT set to 20, the previous-MA20 calculation always falls back to the current 20 closing prices rather than the preceding window. This violates the documented crossover logic and can generate unintended trades; the financial-integrity defect is more consequential because the script supports live execution with a 95% position allocation.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/strategy_etf_momentum.py (reported line 284)May include surrounding context.

python
else:
            for attr in dir(indicator):
                if not attr.startswith('_'):
                    val = getattr(indicator, attr)
                    if not callable(val):
                        print(f'  {attr}: {val}')
    print('=' * 60)

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/strategy_event_callbacks_test.py (reported line 76)May include surrounding context.

python
'created_at', 'rejection_reason', 'reason_msg',
                         'order_type', 'position_effect']:
                try:
                    val = getattr(order, attr, None)
                    if val is not None:
                        info[attr] = val
                except:

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/strategy_event_callbacks_test.py (reported line 129)May include surrounding context.

python
'price', 'exec_type', 'exec_id', 'commission',
                         'created_at']:
                try:
                    val = getattr(execrpt, attr, None)
                    if val is not None:
                        info[attr] = val
                except:

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/strategy_event_callbacks_test.py (reported line 462)May include surrounding context.

python
if indicator:
        for key in ['pnl_ratio', 'pnl_ratio_annual', 'sharp_ratio',
                     'max_drawdown', 'win_ratio', 'open_count', 'close_count']:
            val = indicator.get(key) if isinstance(indicator, dict) else getattr(indicator, key, None)
            if val is not None:
                label = {'pnl_ratio': '累计收益率', 'pnl_ratio_annual': '年化收益率',
                         'sharp_ratio': '夏普比率', 'max_drawdown': '最大回撤',

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/test_account_apis.py (reported line 46)May include surrounding context.

python
for attr in ['account_id', 'available', 'nav', 'pnl', 'fpnl',
                             'margin', 'accumulated_return', 'daily_pnl']:
                    if hasattr(cash, attr):
                        print(f'  {attr} = {getattr(cash, attr)}')
        results.append({'name': 'get_cash - 账户资金 (策略环境)', 'status': 'PASS', 'detail': str(type(cash))})
    except Exception as e:
        print(f'[FAIL] get_cash: {e}')

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/test_account_apis.py (reported line 65)May include surrounding context.

python
for attr in ['symbol', 'side', 'position', 'available', 'vwap',
                             'pnl', 'fpnl', 'price']:
                    if hasattr(p0, attr):
                        print(f'  {attr}={getattr(p0, attr)}')
        else:
            print('  (空仓,无持仓)')
        results.append({'name': 'get_position - 持仓列表 (策略环境)', 'status': 'PASS', 'detail': f'{type(pos).__name__} len={len(pos)}'})