Back to skill

Security audit

PeerBerry SDK

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly coherent for a PeerBerry SDK helper, but it steers users toward financial-account automation through an external, unreviewed Python package that can handle credentials and real-money purchases.

Install only if you are comfortable using an unofficial SDK with PeerBerry credentials and possible live investment actions. Prefer a pinned, reviewed package version in an isolated environment, keep DRY_RUN enabled until you explicitly approve purchases, never print or commit passwords, TOTP seeds, or tokens, and treat exported XLSX files as sensitive financial records.

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

Error
Location
pyproject.toml:10
Finding
Unpinned and Unverifiable SDK Dependency Handles Financial Credentials and Real-Money Operations<![CDATA[ ## Vulnerability Details **File Location**: `pyproject.toml:10-13`; related installation and import behavior in `docs/getting-started/installation.md:12-23` and `docs/gen_client_reference.py:15-41` **Vulnerability Type**: Supply-chain dependency risk **Risk Level**: High ### Evidence `pyproject.toml:10-13` declares a dependency using an open-ended lower bound: ```toml [project] name = "peerberry-sdk" version = "2.0.0" authors = [ { name = "FortressQuant" } ] dependencies = [ "cloudscraper>=1.2" ] ``` `docs/getting-started/installation.md:12-23` directs users to install mutable packages from PyPI without an exact version or hash: ```markdown ## Standard Install (PyPI) ```bash pip install peerberry-sdk ``` Use this for normal application usage when you do not need optional two-factor helpers. ## Install With OTP Support ```bash pip install "peerberry-sdk[otp]" ``` ``` `docs/gen_client_reference.py:15-41` expects a local `src` directory but imports `peerberry_sdk` even when that source tree is unavailable: ```python PROJECT_ROOT = Path(__file__).resolve().parents[1] SOURCE_ROOT = PROJECT_ROOT / 'src' OUTPUT_PATH = 'api/client.md' if str(SOURCE_ROOT) not in sys.path: sys.path.insert(0, str(SOURCE_ROOT)) # Allow running this generator even when optional runtime deps are not installed. if 'cloudscraper' not in sys.modules: try: import cloudscraper # noqa: F401 except ModuleNotFoundError: class _NoopSession: headers = {} def request(self, *args, **kwargs): raise RuntimeError('Noop session cannot perform requests.') def get(self, *args, **kwargs): raise RuntimeError('Noop session cannot perform requests.') sys.modules['cloudscraper'] = types.SimpleNamespace( create_scraper=lambda browser: _NoopSession(), ) from peerberry_sdk.client import PeerberryClient from peerberry_sdk.config import AuthConfig, LifecycleConfi ...[truncated 3492 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Include the complete `src/peerberry_sdk` implementation in the reviewed artifact so authentication, transport, redaction, token storage, and purchase behavior can be audited. 2. Pin runtime and documentation dependencies to exact, reviewed versions rather than open ranges. 3. Generate a lock file and install with hash verification, such as `pip install --require-hashes -r requirements.lock`. 4. Publish and verify package provenance, release signatures, source-to-wheel reproducibility, and trusted publisher configuration. 5. Change documentation generators to verify that `PROJECT_ROOT / "src" / "peerberry_sdk"` exists and fail closed if it does not. 6. Avoid falling back to an arbitrary globally installed `peerberry_sdk` package during documentation generation. Load the expected local source from a validated path or run generation in a locked, isolated environment. 7. Build documentation and run the SDK under a least-privileged account without unrelated credentials, write access, or unrestricted network access. 8. Keep real-money operations disabled by default with `DRY_RUN`, hard order and aggregate-spend limits, explicit confirmation, balance checks, and server-side safeguards. 9. Document that credentials and TOTP seeds should come from a protected secret manager or environment injection mechanism rather than source files, shell history, or copied scripts. 10. Add automated release checks that reject missing package source, unpinned dependencies, unexpected package ownership changes, and dependency artifacts whose hashes differ from the reviewed lock file. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (23)

Credential Access

High
Category
Privilege Escalation
Content
Setup and run:

```bash
cp tests/.env.example tests/.env
python3 tests/manual_display_actions.py
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
A second, more specific description-behavior mismatch indicates the skill may primarily serve documentation generation rather than the advertised authentication, portfolio retrieval, and purchase automation use cases. Hidden or undeclared repo introspection and docs-writing capabilities create a trust boundary violation, especially in an environment where a user expects a constrained financial SDK helper rather than a build/documentation tool.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
A second, more specific description-behavior mismatch indicates the skill may primarily serve documentation generation rather than the advertised authentication, portfolio retrieval, and purchase automation use cases. Hidden or undeclared repo introspection and docs-writing capabilities create a trust boundary violation, especially in an environment where a user expects a constrained financial SDK helper rather than a build/documentation tool.

Self-Modification

High
Category
Rogue Agent
Content
## Maintenance Contract

When SDK changes, update this skill in this order:

1. Verify method signatures and accepted values against:
   - `src/peerberry_sdk/client.py`
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Ae1

High
Category
analysis-evasion
Content
4. Keep this root `SKILL.md` concise and routing-focused.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Credential Access

High
Category
Privilege Escalation
Content
| `email` | `Optional[str]` | `None` | Account's email |
| `password` | `Optional[str]` | `None` | Account's password |
| `tfa_secret` | `Optional[str]` | `None` | Base32 secret used for two-factor authentication |
| `access_token` | `Optional[str]` | `None` | Access token used to authenticate to the API (Optional; Only pass the JWT for it to work!) (Only mandatory if account has two-factor authentication enabled) |
| `refresh_token` | `Optional[str]` | `None` | Existing refresh token used for token rotation. |
| `request_opts` | `Optional[dict]` | `None` | Optional[dict] - Additional options for :any:`requests.sessions.Session.request()`. |
| `config` | `Optional[SDKConfig]` | `None` | Optional[SDKConfig] - Transport/auth behavior overrides. |
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
'AuthConfig': {
        'auto_refresh_on_auth_error': 'Refresh token automatically after auth failures.',
        'max_refresh_attempts': 'Refresh attempts for a failing request.',
        'proactive_refresh': 'Refresh access token before expiry when possible.',
        'proactive_refresh_skew_seconds': 'Seconds before expiry to trigger proactive refresh.',
        'token_store': 'Token store implementation used for load/save/clear.',
        'load_tokens_on_init': 'Load token pair from token store during client initialization.',
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Behavior:

- if access token is present, SDK validates it first
- if token is valid, session starts immediately
- if token is stale and credentials are available, SDK falls back to credential login
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Behavior:

- if access token is present, SDK validates it first
- if token is valid, session starts immediately
- if token is stale and credentials are available, SDK falls back to credential login
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Behavior:

- if access token is present, SDK validates it first
- if token is valid, session starts immediately
- if token is stale and credentials are available, SDK falls back to credential login
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The documentation shows use of account credentials and optional TOTP secrets in examples without any explicit guidance on secure handling, storage, or redaction. Because this SDK automates access to a financial account, users may hardcode secrets, commit them to source control, or mishandle 2FA material, increasing risk of account takeover.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README includes a `purchase_loan()` example that can execute a real financial transaction but does not prominently warn readers that it places a live investment order. In an automation SDK for a lending platform, copy-paste use of this example could cause unintended purchases and real monetary loss, especially because it is presented alongside read-only examples with similar structure.

Lp3

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding
The skill describes behaviors that rely on network access and file-writing semantics, but it does not declare any explicit tool scope such as allowed-tools or permissions. Undeclared capabilities make it harder to constrain execution and audit what the skill may do, increasing the risk of unintended outbound requests or filesystem changes if the hosting agent grants broad default privileges.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The documentation describes `purchase_loan(...)`, which triggers a real financial transaction, but it does not include an explicit warning that the call can place actual investment orders with real funds. In an automation-focused SDK, this omission increases the risk of accidental execution by developers, agents, or users who may treat the method like a read-only retrieval call.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The example prints the bearer token directly, which can expose sensitive authentication material to terminals, shell history capture, CI logs, notebooks, or centralized log collectors. Anyone who obtains the bearer token may be able to authenticate as the user until expiry, making this a clear credential-handling weakness in documentation.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The guide encourages implementing custom token persistence and discusses loading/saving access and refresh tokens, but it does not warn readers against insecure storage, accidental logging, or exposing tokens in environment variables and source control. In an authentication guide for an investment automation SDK, this omission can lead users to store long-lived credentials in unsafe locations, enabling account takeover if the storage backend is compromised.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The quick reference documents `purchase_loan(loan_id: int, amount: Decimal)` as a direct investment-execution method but provides no warning that it places a real financial order, no confirmation pattern, and no guidance on safeguards such as dry-run checks, balance validation, or explicit user approval. In the context of an automation SDK for retail investing, this increases the risk that downstream agents or developers invoke a real-money action unintentionally or too eagerly.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The export recipe explicitly instructs saving investments and transaction exports to local files without warning that the data may contain sensitive financial history. In an agent context, this can lead to unintended persistence of private account data on disk, increasing exposure through local compromise, backups, logs, or accidental sharing.

Missing User Warnings

Medium
Confidence
82% confidence
Finding
The authentication diagnostic recipe encourages creating a login troubleshooting script but does not warn about safe handling of credentials, 2FA challenges, or authentication errors. In practice, such scripts often result in secrets being hardcoded, echoed, or logged during debugging, which can expose account access material.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The token refresh health-check recipe directs the user to force token refresh and validate follow-up access without warning that session tokens are sensitive bearer credentials. This creates a realistic risk that refreshed tokens will be printed, stored insecurely, or mishandled in logs, enabling account takeover if exposed.

Missing User Warnings

Low
Confidence
92% confidence
Finding
The quickstart repeatedly shows inline placeholders for email, password, and a 2FA secret without any accompanying warning about secure secret handling. In practice, developers often copy quickstart patterns into real code, which can lead to hardcoded credentials, accidental commits, insecure logging, or unsafe treatment of MFA secrets in an investment/financial automation context.

Unverifiable Dependency: setuptools has 10 known advisory(ies) (CVE-2013-1633 (Setuptools vulnerable to Man-in-the-middle attacks); CVE-2025-47273 (setuptools has a path traversal vulnerability in PackageIndex.download that lead); CVE-2024-6345 (setuptools vulnerable to Command Injection via package URL) +7 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Unverifiable Dependency: wheel has 4 known advisory(ies) (CVE-2026-24049 (Wheel Affected by Arbitrary File Permission Modification via Path Traversal in w); CVE-2022-40898 (pypa/wheel vulnerable to Regular Expression denial of service (ReDoS)); CVE-2022-40898 (An issue discovered in Python Packaging Authority (PyPA) Wheel 0.37.1 and earlie) +1 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Static analysis

No suspicious patterns detected.