T09 · Insecure Skill Coding Practices
- Location
ib-gateway/SKILL.md:42- Finding
Flex command exposes credentials and permits code injection
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a disclosed read-only Interactive Brokers reporting suite, but it includes unsafe Flex credential handling that needs review before installation.
Review this before installing if you will use Flex history or dividends. Do not run the ib-gateway python -c Flex command as written, do not pass tokens through environment variables or command text, and prefer the stdin-based configurator. Treat .ib-suite/config.yaml, snapshots, reports, and raw Flex output as sensitive financial data, and consider adding dependency locks and host validation for Flex downloads.
ib-gateway/SKILL.md:42Flex command exposes credentials and permits code injection
ib-gateway/scripts/flex_fetch.py:699Flex token can be forwarded to an unvalidated response-supplied URL
scripts/setup_venv.sh:24Bootstrap installs unpinned executable third-party dependencies
Referenced artifact was not completely inspected
- **`SKILL.md` with valid frontmatter.** Required `name` + `description`, and
Referenced artifact was not completely inspected
- **`SKILL.md` with valid frontmatter.** Required `name` + `description`, and
Untrusted data is passed to an insecure deserializer (pickle, marshal, dill, jsonpickle, joblib, yaml.load without a safe Loader, or torch.load without weights_only). These deserializers reconstruct arbitrary objects and invoke callables during loading, so deserializing attacker-controlled bytes is equivalent to arbitrary code execution.
yaml = YAML(typ="safe")
try:
with open(path, "r", encoding="utf-8") as f:
raw = yaml.load(f)
except (YAMLError, TypeError):
raise ValueError("configuration YAML is malformed") from None
if raw is None:
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
- If `flex.dividend_query_ids` is missing, ask which numeric window the user
wants to register, then ask for that saved Activity Flex Query's Query ID.
- For `coverage_required`, use the numeric window named in `missing` and ask for
its Query ID; do not ask the user to choose a different key silently.
- If `flex.token` is missing, ask for the Flex Web Service token after any
needed window and Query ID have been collected. Do not ask for a configured
item again.
The module docstring says the entrypoint is 'Read-only and offline' and the CLI description repeats 'read-only', which implies no filesystem modification. However, the code passes an output directory to report.build_report and the CLI help explicitly says it is an 'output directory for the report + charts', indicating files are produced as a side effect.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
First ensure the ib-suite onboarding flow has created
`.ib-suite/config.yaml`. In a conversation, collect one item at a time: desired
window, matching Query ID, then the token only if it is absent. Do not ask the
user to repeat a token that is already configured.
`ib-trade-history` and `ib-dividend-income` now register independent Query IDs
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
First ensure the ib-suite onboarding flow has created
`.ib-suite/config.yaml`. In a conversation, collect one item at a time: desired
window, matching Query ID, then the token only if it is absent. Do not ask the
user to repeat a token that is already configured.
`ib-trade-history` and `ib-dividend-income` now register independent Query IDs
Untrusted data is passed to an insecure deserializer (pickle, marshal, dill, jsonpickle, joblib, yaml.load without a safe Loader, or torch.load without weights_only). These deserializers reconstruct arbitrary objects and invoke callables during loading, so deserializing attacker-controlled bytes is equivalent to arbitrary code execution.
yaml = YAML(typ="rt")
try:
contents = path.read_text(encoding="utf-8")
doc = yaml.load(contents)
if doc is None:
doc = yaml.load(f"{contents}\n{{}}\n")
except (OSError, YAMLError):
Untrusted data is passed to an insecure deserializer (pickle, marshal, dill, jsonpickle, joblib, yaml.load without a safe Loader, or torch.load without weights_only). These deserializers reconstruct arbitrary objects and invoke callables during loading, so deserializing attacker-controlled bytes is equivalent to arbitrary code execution.
contents = path.read_text(encoding="utf-8")
doc = yaml.load(contents)
if doc is None:
doc = yaml.load(f"{contents}\n{{}}\n")
except (OSError, YAMLError):
raise ValueError(_CONFIG_ERROR) from None
Untrusted data is passed to an insecure deserializer (pickle, marshal, dill, jsonpickle, joblib, yaml.load without a safe Loader, or torch.load without weights_only). These deserializers reconstruct arbitrary objects and invoke callables during loading, so deserializing attacker-controlled bytes is equivalent to arbitrary code execution.
yaml = YAML(typ="rt")
with open(template, "r", encoding="utf-8") as f:
doc = yaml.load(f)
port = _PORT_BY_MODE[mode]
doc.setdefault("connection", {})
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
rows: list[FlexDividendAccrual], field_name: str
) -> float | None:
"""Sum one nullable lifecycle amount while preserving all-null input."""
values = [getattr(row, field_name) for row in rows]
known = [value for value in values if value is not None]
return None if not known else sum(known)
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
def component(name: str) -> float | None:
"""Sum known values for one component while retaining all-null state."""
values = [getattr(line, f"{prefix}{name}") for line in lines]
known = [value for value in values if value is not None]
return None if not known else sum(known)
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
"""Group dividend totals deterministically by one line attribution field."""
grouped: dict[str, list[DividendIncomeLine]] = defaultdict(list)
for line in lines:
grouped[getattr(line, field_name)].append(line)
return {
key: _totals(grouped[key], base=base)
for key in sorted(grouped)
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
The pyarrow dependency is only lower-bounded (pyarrow>=15), and pyarrow has had serious file-parsing issues including arbitrary code execution from malicious data files. In a data/analytics skill handling portfolio or market data, permissive versioning can leave deployments exposed if a vulnerable release in the allowed range is resolved or retained.
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
The dependency is specified with a lower bound only (ib_async>=1.0.1), which allows future unreviewed versions to be installed and makes builds non-reproducible. While not an immediate exploitable flaw by itself, it increases supply-chain risk because a later vulnerable or malicious release could be pulled in without notice.
-e ./ib-common
ib_async>=1.0.1
requests>=2.31
pytest>=8.0
requests>=2.31 is unpinned, so installations may resolve to different versions over time, including versions with known security defects. This weakens reproducibility and makes it difficult to verify whether deployed environments are protected from published advisories.
-e ./ib-common
ib_async>=1.0.1
requests>=2.31
pytest>=8.0
The manifest references requests without pinning a specific version, and requests has multiple known advisories across releases. Because the resolved version is unknown, the environment could install an affected release, making this more than a theoretical reproducibility issue if the package is used for network operations.
pytest>=8.0 is also unpinned, which introduces supply-chain and reproducibility risk even if pytest is primarily a development dependency. In CI or test environments, pulling an unexpected version can introduce vulnerable code paths or malicious package changes.
-e ./ib-common
ib_async>=1.0.1
requests>=2.31
pytest>=8.0
pytest has known advisories in some versions, and the lack of pinning means an affected release could be installed in development or CI contexts. The risk is lower than a runtime production dependency, but compromised test infrastructure can still affect build integrity and developer systems.
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
handler.setFormatter(logging.Formatter("%(levelname)s %(message)s"))
LOGGER.handlers.clear()
LOGGER.addHandler(handler)
LOGGER.setLevel(getattr(logging, level_name))
LOGGER.propagate = False
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
def _scaled_greek(position: OptionPositionView, name: str) -> float | None:
"""Return the signed, contract-multiplier-adjusted Greek when available."""
value = getattr(position, name)
if value is None or position.fx_rate is None:
return None
return value * position.quantity * position.multiplier * position.fx_rate