T05 · Unauthorized Access and Privilege Escalation
- Location
templates/factor_strategy.py:64- Finding
Unscoped Liquidation of All Account Positions
- Content
View full analysis
0: trade.close_long(symbol, volume, price=0, price_type="market") ``` ### Technical Analysis The rebalance procedure retrieves every position visible through the account API and closes every positive long position. It does not verify that a position: - Was opened by this strategy. - Belongs to the strategy's previous target portfolio. - Is part of the configured CSI 300 universe. - Belongs to an isolated strategy account or sub-portfolio. - Has been explicitly authorized for liquidation. This violates least-privilege and asset-ownership boundaries at the trading-account level. The strategy only needs to manage positions it owns, but it exercises its trading authority across the entire set of visible holdings. ### Attack Path 1. A user installs the Skill and copies or generates the bundled factor strategy. 2. The user enables the strategy on a live account that also contains manually managed positions or holdings owned by other strategies. 3. The strategy increments its trading-day counter on each invocation. 4. On the twentieth trading day, the rebalance branch executes. 5. `security.get_positions()` returns all positions visible to the strategy. 6. The loop submits market sell orders for every positive long position. 7. Unrelated holdings are liquidated before the strategy buys its newly selected target stocks. No external attacker is required; deploying the advertised template on a shared account is sufficient to trigger the unsafe behavior. ### Impact Assessment The code can use the strategy's existing trading permission to liquidate all long positions visible in the account. It does not ob ...[truncated 458 chars]- Remediation
View remediation
