Back to skill

Security audit

Finam

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for Finam trading, but it combines live brokerage authority with weak scoping and an unpinned third-party Git install users should review carefully.

Install only if you intend to let an agent work with a real Finam brokerage account. Use the least-privileged API key available, keep keys and JWTs out of logs and chat transcripts, require explicit confirmation for every order or cancellation, and avoid or pin/review the FinamPy Git dependency before using the gRPC workflow.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:326
Finding

Unpinned dependency installation from a mutable Git repository

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:326-327
Vulnerability Type: Unpinned third-party dependency from a mutable source
Risk Level: Medium

Vulnerable Code

text
For gRPC, use the [FinamPy](https://github.com/cia76/FinamPy) Python library (
`pip install git+https://github.com/cia76/FinamPy.git`).

The same unsafe installation command also appears in references/GRPC.md:7-10:

bash
## Installation

```bash
pip install git+https://github.com/cia76/FinamPy.git
text

### Technical Analysis

The installation command retrieves FinamPy from the repository's mutable default branch. It does not specify an immutable commit, signed release, exact package version, lock file, or integrity hash.

Package installation may execute build backend and installation logic on the user's system. Consequently, later upstream changes can alter the effective code executed by users without requiring any modification to this Skill. Repository compromise, malicious maintainer changes, or an account takeover could turn this documented installation command into a remote code-execution and credential-theft channel.

The exposure is especially significant because `references/GRPC.md:12-24` instructs users to provide `FINAM_API_KEY` to the installed library and states that the credential is stored in the system credential store:

```python
import os
from FinamPy import FinamPy
fp_provider = FinamPy(os.environ["FINAM_API_KEY"])

Subsequent construction without an explicit token indicates that the dependency can retrieve the stored credential:

python
fp_provider = FinamPy()

There is no evidence that the currently referenced repository is malicious. The vulnerability is the lack of immutable dependency pinning and integrity verification.

Attack Path

  1. An attacker compromises the FinamPy repository, a maintainer account, or its mutable default branch.
  2. The attacker adds ma ...[truncated 1487 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace the mutable Git installation with an exact, reviewed release from a trusted package registry where possible.
  2. Pin the dependency to an immutable version and verify package hashes, for example through a lock file and pip --require-hashes.
  3. If Git installation is unavoidable, pin a reviewed full commit hash rather than a branch or tag:
    bash
    pip install "git+https://github.com/cia76/FinamPy.git@FULL_REVIEWED_COMMIT_HASH"
    
  4. Verify release signatures or provenance attestations where supported.
  5. Install the dependency in an isolated virtual environment under a non-privileged account; never run pip as root for this Skill.
  6. Review the pinned dependency's build configuration, initialization behavior, network destinations, and credential-storage implementation.
  7. Use a restricted Finam credential with only the minimum required capabilities where the API supports scoped credentials.
  8. Document how users can revoke the Finam key and remove credentials stored by FinamPy.
  9. Apply the same corrected installation guidance in both SKILL.md and references/GRPC.md to avoid leaving an unsafe alternative.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (64)

Tainted flow: 'req' from os.environ.get (line 31, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/utils.py (reported line 38)May include surrounding context.

python
method="POST",
    )
    try:
        with urllib.request.urlopen(req) as resp:
            data = json.loads(resp.read())
    except Exception as e:
        print(f"Error: failed to authenticate: {e}", file=sys.stderr)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code chunk only implements asset discovery/search against Finam asset endpoints (/assets and /assets/all). It does not place or manage trades, access portfolio data, perform real-time market data retrieval, compute or scan volatility, or provide any question-answering behavior about the API. While 'browse and search market assets' is accurately represented, the declared description significantly overstates the implemented functionality for this code chunk, so the description does not accurately represent actual behavior.

Content

No source excerpt is available for this finding.

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 · SKILL.md (reported line 203)May include surrounding context.

Russian market news

shell
curl -sL "https://www.finam.ru/analysis/conews/rsspoint/" | python3 -c "
import sys, xml.etree.ElementTree as ET
root = ET.parse(sys.stdin).getroot()
for item in reversed(root.findall('.//item')):

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 · SKILL.md (reported line 214)May include surrounding context.

US market news

shell
curl -sL "https://www.finam.ru/international/advanced/rsspoint/" | python3 -c "
import sys, xml.etree.ElementTree as ET
root = ET.parse(sys.stdin).getroot()
for item in reversed(root.findall('.//item')):

YARA rule 'agent_skill_remote_bootstrap_execution': Remote script or code download followed by execution/bootstrap installation [agent_skills]

High
Category
YARA Match
Confidence
96% confidence
Finding

The skill recommends installing and executing a Python package directly from a GitHub repository via pip install git+https://..., which bypasses normal packaged-release trust controls and pins neither commit nor hash. In an agent or automated environment, this creates a supply-chain risk where a compromised repo, dependency, or transient upstream change can introduce arbitrary code execution.

Content

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

md
- Processing live bar data (M1, M5) for signal generation in event-driven strategies
- Monitoring own orders and trades in real time via subscription
- Your strategy requires minimal latency for rapid order placement/cancellation
- Building long-running trading bots that need persistent, auto-reconnecting connections

For gRPC, use the [FinamPy](https://github.com/cia76/FinamPy) Python library (
`pip install git+https://github.com/cia76/FinamPy.git`).
Full usage reference: [gRPC Python Reference](references/GRPC.md)

---

For full REST API details, use the local file: [REST Reference](references/REST.md)
For extra gRPC API details, fetch from: [gRPC Reference](https://tradeapi.finam.ru/docs/grpc/)

YARA rule 'agent_skill_remote_bootstrap_execution': Remote script or code download followed by execution/bootstrap installation [agent_skills]

High
Category
YARA Match
Confidence
88% confidence
Finding

The installation instruction uses pip install git+https://github.com/cia76/FinamPy.git, which fetches and installs code directly from a remote Git repository rather than a pinned, vetted package release. In an agent skill environment, this increases supply-chain risk because repository contents can change over time, and installation may execute unreviewed setup/build code.

Content

Scanner excerpt · references/GRPC.md (reported line 10)May include surrounding context.

Finam Trade API — gRPC (FinamPy)

Библиотека-обёртка FinamPy для работы с Finam Trade API v2.13.0 из Python по протоколу gRPC.


Установка

bash
pip install git+https://github.com/cia76/FinamPy.git

При первом запуске передать токен явно (сохраняется в системное хранилище):

python
import os
from FinamPy import FinamPy
fp_provider = FinamPy(os.environ["FINAM_API_KEY"])

Последующие вызовы — без токена:

python
fp_provider = FinamPy()

Подключение и базовое использование

python
from FinamPy import FinamPy

fp_provider = FinamPy()

# Синхронный вызов метода — во�

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

The documented capability includes order cancellation via accountId and orderId, creating a high-risk tool surface where attacker-controlled or misinterpreted parameters could trigger destructive financial actions. In a trading skill, parameter abuse is especially dangerous because a single incorrect identifier can cancel the wrong order or remove hedges/protective stops.

Content

Scanner excerpt · references/REST.md (reported line 1216)May include surrounding context.

md
- [GET /v1/accounts/{accountId}/orders](#получение-списка-заявок-для-аккаунта)
- [POST /v1/accounts/{accountId}/orders](#выставление-биржевой-заявки)
- [GET /v1/accounts/{accountId}/orders/{orderId}](#получение-информации-о-конкретном-ордере)
- [DELETE /v1/accounts/{accountId}/orders/{orderId}](#отмена-биржевой-заявки)
- [POST /v1/accounts/{accountId}/sltp-orders](#выставление-sltp-заявки)

---

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

The documented capability includes order cancellation via accountId and orderId, creating a high-risk tool surface where attacker-controlled or misinterpreted parameters could trigger destructive financial actions. In a trading skill, parameter abuse is especially dangerous because a single incorrect identifier can cancel the wrong order or remove hedges/protective stops.

Content

Scanner excerpt · references/REST.md (reported line 1216)May include surrounding context.

md
- [GET /v1/accounts/{accountId}/orders](#пoлyчeниe-cпиcкa-зaявoк-для-aккayнтa)
- [POST /v1/accounts/{accountId}/orders](#выcтaвлeниe-6иpжeвoй-зaявки)
- [GET /v1/accounts/{accountId}/orders/{orderId}](#пoлyчeниe-инфopмaции-o-кoнкpeтнoм-opдepe)
- [DELETE /v1/accounts/{accountId}/orders/{orderId}](#oтмeнa-6иpжeвoй-зaявки)
- [POST /v1/accounts/{accountId}/sltp-orders](#выcтaвлeниe-sltp-зaявки)

---

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

This specific DELETE endpoint exposes a destructive broker action entirely through path parameters, making it vulnerable to parameter confusion, prompt injection into identifiers, or accidental cross-account/order targeting if an agent maps user language incorrectly. In the context of live trading, misuse can directly alter market exposure and risk management.

Content

Scanner excerpt · references/REST.md (reported line 1611)May include surrounding context.

md
### Отмена биржевой заявки

`DELETE /v1/accounts/{accountId}/orders/{orderId}`

**Path Parameters**

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill requires environment secrets and extensive network access but does not declare any explicit tool/permission scope. In an agent setting, that weakens policy boundaries and makes it easier for the skill to be invoked with broader capabilities than users may expect, including access to trading credentials and account operations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description is very broad and lacks invocation constraints, while the skill includes high-impact actions such as placing and cancelling orders. In agent ecosystems, vague trigger language increases the chance the skill is auto-selected in contexts where the user only wanted information, leading to unnecessary access to credentials or unintended trading operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The setup section instructs users to handle API keys, account IDs, and session tokens without explicit guidance on secrecy, storage, logging, or shell-history exposure. That creates a realistic risk of credential leakage through terminal history, debug output, transcripts, or accidental sharing.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

This command transmits the Finam API secret to an external service to mint a JWT, which is inherently sensitive even if it is the legitimate API endpoint. In an agent context, secret-bearing network requests are dangerous because they can expose credentials through logs, transcripts, command history, or misuse by an over-privileged skill.

Content

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

Obtain JWT token before using the API:

shell
export FINAM_JWT_TOKEN=$(curl -sL "https://api.finam.ru/v1/sessions" \
--header "Content-Type: application/json" \
--data '{"secret": "'"$FINAM_API_KEY"'"}' | jq -r '.token')

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

This command transmits the Finam API secret to an external service to mint a JWT, which is inherently sensitive even if it is the legitimate API endpoint. In an agent context, secret-bearing network requests are dangerous because they can expose credentials through logs, transcripts, command history, or misuse by an over-privileged skill.

Content

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

Obtain JWT token before using the API:

shell
export FINAM_JWT_TOKEN=$(curl -sL "https://api.finam.ru/v1/sessions" \
--header "Content-Type: application/json" \
--data '{"secret": "'"$FINAM_API_KEY"'"}' | jq -r '.token')

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

This retrieves sensitive portfolio and account data, including positions and balances, from an external service using account credentials. In an agent setting, exposure of such financial data can violate privacy expectations and enable profiling or follow-on fraud if mishandled or surfaced to unintended parties.

Content

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

Retrieve portfolio information including positions, balances, and P&L:

shell
curl -sL "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

This request sends an authenticated order-placement command to an external trading API, making it a state-changing financial action with direct monetary consequences. If invoked accidentally, manipulated by prompt injection, or executed without strict confirmation controls, it could place unauthorized trades on a real account.

Content

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

  • ORDER_TYPE_LIMIT - Limit order (requires limit_price)
shell
curl -sL "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID/orders" \
  --header "Authorization: $FINAM_JWT_TOKEN" \
  --header "Content-Type: application/json" \
  --data "$(jq -n \

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

This request sends an authenticated order-placement command to an external trading API, making it a state-changing financial action with direct monetary consequences. If invoked accidentally, manipulated by prompt injection, or executed without strict confirmation controls, it could place unauthorized trades on a real account.

Content

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

  • ORDER_TYPE_LIMIT - Limit order (requires limit_price)
shell
curl -sL "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID/orders" \
  --header "Authorization: $FINAM_JWT_TOKEN" \
  --header "Content-Type: application/json" \
  --data "$(jq -n \

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

This sends an authenticated DELETE request to cancel orders on a live trading account, which is a high-impact state-changing financial action. Unauthorized or manipulated use could disrupt trading strategies, liquidations, hedges, or other time-sensitive positions and cause direct financial loss.

Content

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

shell
ORDER_ID="12345678"
curl -sL --request DELETE "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID/orders/$ORDER_ID" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation includes ready-to-run examples for placing market, limit, stop, and cancel orders against a live trading API without an explicit warning that these actions can execute real trades and move funds. In an agent skill context, users or downstream agents may copy these examples directly, increasing the risk of unintended financial transactions.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This documentation shows authenticated requests using a secret token and later documents order placement/cancellation endpoints, but it does not include explicit safety guidance such as requiring user confirmation before trades or warning against exposing tokens in logs and prompts. In an agent skill that can execute trades, omission of such guardrails increases the risk of unauthorized transactions or credential misuse.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

This example transmits a secret/API token to an external service to mint a JWT session token. In a trading skill context, external transmission of credentials is expected for functionality, but documenting it without strong handling constraints increases risk of token exfiltration, replay, and accidental disclosure through logs or prompt injection.

Content

Scanner excerpt · references/REST.md (reported line 779)May include surrounding context.

Request Example

curl
curl https://api.finam.ru/v1/sessions \
  --request POST \
  --header 'Content-Type: application/json' \

Static analysis

No suspicious patterns detected.