Back to skill

Security audit

Hacker新闻数据服务

Security checks for vulnerabilities and agentic risk

Overview

This Hacker News skill asks for a third-party API key, stores it locally, and routes requests through an external MCP service, so users should review it before installing.

Install only if you trust the xiaobenyang service and are comfortable giving it an API key that will be stored in a local plaintext .env file. Prefer a low-privilege or disposable key, review the .env file after use, and avoid this skill if you expected direct public Hacker News access without credential persistence.

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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (21)

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill declares no permissions, yet its documented behavior includes reading environment variables, writing a local .env file, and making network calls. This creates a transparency and consent problem: users may expose credentials or permit local state changes without the skill clearly advertising those capabilities.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The skill claims to provide Hacker News data access, but its documented workflow also requires collecting an API key from the user, reading and writing local configuration, and routing requests through an unrelated external service. This mismatch can mislead users about where their data and credentials go, increasing the risk of credential exposure and unauthorized third-party dependence.

Intent-Code Divergence

Medium
Confidence
72% confidence
Finding
The workflow example instructs the model to call an unrelated or nonexistent function `search_schools`, which indicates copy-paste drift and unsafe documentation quality. In an agent setting, incorrect tool-routing guidance can cause unintended actions, failed calls, or invocation of the wrong capability if similarly named functions exist elsewhere.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The file implements a generic proxy client for a remote MCP API rather than a narrowly scoped Hacker News data client. This mismatch increases risk because the skill can be used to access arbitrary backend functionality through attacker-controlled tool names and parameters, violating the principle of least privilege and the declared user-facing purpose.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The call_tool method forwards arbitrary tool_name, mcp_id, and params directly to an upstream service with authentication headers, effectively exposing a general-purpose remote procedure capability. In the context of a skill advertised as a Hacker News data service, this creates a confused-deputy risk where users or prompt-injected agents may invoke unintended privileged upstream tools beyond the stated scope.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The configuration handles an unrelated external service endpoint and API credential persistence despite the skill being ներկայացced as a Hacker News data service. This mismatch increases the likelihood of hidden data flows, unauthorized outbound access, and user deception about what secrets the skill collects and where they are used.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
A Hacker News reader/search skill normally does not need to persist local secrets, yet this code writes an API key to a .env file and updates process environment state. That creates unnecessary secret retention on disk and broadens exposure through backups, logs, accidental commits, or other local processes.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
The docstring identifies the component as a gaokao-related skill while the package is declared as a Hacker News service, indicating code reuse or repurposing without proper review. Such intent mismatch is dangerous because it can conceal unrelated capabilities like secret handling or network access that users and reviewers would not expect in this skill context.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The code persists the API key to .env silently, with only internal comments/docstrings and no explicit user-facing disclosure about disk storage. Secret persistence without transparent notice can surprise users and leads to credential exposure via local file access, source control mistakes, or system backups.

Credential Access

High
Category
Privilege Escalation
Content
model_config = SettingsConfigDict(
        env_prefix="XBY_GAOKAO_",
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )
Confidence
87% confidence
Finding
Loading configuration from .env for a skill that does not clearly need private credentials introduces secret access capability into an otherwise public-data tool. In this context, the danger is elevated because the skill's declared purpose does not prepare users for local secret ingestion and use.

Credential Access

High
Category
Privilege Escalation
Content
default_year: int = 2025

    def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
Confidence
96% confidence
Finding
The code explicitly and forcibly reads the .env file to extract XBY_APIKEY outside the normal settings flow. This manual secret scraping is more dangerous than standard config loading because it bypasses clearer configuration boundaries and suggests deliberate credential access behavior unrelated to a Hacker News data service.

Credential Access

High
Category
Privilege Escalation
Content
def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
            for line in content.splitlines():
Confidence
96% confidence
Finding
Opening and reading the entire .env file gives the skill access to potentially all local secrets in that file, not just values strictly required for its stated functionality. In the context of a Hacker News service, this disproportionate credential access is particularly suspicious and can enable unauthorized secret exposure.

Credential Access

High
Category
Privilege Escalation
Content
if line.startswith("XBY_APIKEY="):
                    self.api_key = line.split("=", 1)[1].strip()
                    break
        # 如果环境变量有值,覆盖 .env 的值
        env_val = os.getenv("XBY_APIKEY", "")
        if env_val:
            self.api_key = env_val
Confidence
89% confidence
Finding
The code reads XBY_APIKEY from the process environment, continuing the pattern of credential intake unrelated to the declared public-data skill purpose. While environment-based config is common, here it expands secret access in a context where such capability is unexpected and insufficiently justified.

Credential Access

High
Category
Privilege Escalation
Content
def save_api_key_to_env(api_key: str) -> bool:
    """将API key保存到.env文件"""
    try:
        env_path = Path(".env")
        lines = []
        if env_path.exists():
            lines = env_path.read_text(encoding="utf-8").splitlines()
Confidence
97% confidence
Finding
This function is dedicated to persisting an API key into .env, creating durable local storage of a secret for a skill whose advertised purpose does not require it. Persisting secrets to plaintext project files materially increases exposure through file disclosure, accidental commits, backups, and multi-user system access.

Credential Access

High
Category
Privilege Escalation
Content
def set_api_key(api_key: str) -> bool:
    """设置API key并持久化到.env"""
    if not api_key or not api_key.strip():
        return False
    api_key = api_key.strip()
Confidence
95% confidence
Finding
The public setter normalizes and persists an API key, making secret collection a first-class feature of the skill. In a Hacker News data service context, this is more dangerous because users may supply credentials under false assumptions about the skill's purpose and storage behavior.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
95% confidence
Finding
The dependency is specified with a lower-bound only (`requests>=2.31.0`), which permits installation of different future versions and undermines reproducible builds. In a security-sensitive tool that fetches external data, this increases supply-chain and stability risk because an unexpected upstream release could introduce vulnerable or incompatible behavior.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
94% confidence
Finding
`pydantic>=2.7.0` is not pinned, so installations may resolve to different versions over time. This creates non-reproducible environments and can expose the skill to newly introduced defects or supply-chain compromise in future releases.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
94% confidence
Finding
`pydantic-settings>=2.2.0` allows any later version, which weakens dependency integrity and reproducibility. Even if the current package is safe, future versions could introduce breaking changes or security issues that are silently pulled into deployments.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
95% confidence
Finding
`python-dotenv>=1.0.1` is unpinned, so builds may consume arbitrary later versions. For configuration-loading libraries, this can affect how environment files are parsed and may unexpectedly pull in vulnerable code paths.

Known Vulnerable Dependency: requests==2.31.0 — 3 advisory(ies): CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi); CVE-2026-25645 (Requests has Insecure Temp File Reuse in its extract_zipped_paths() utility func)

Low
Category
Supply Chain
Confidence
92% confidence
Finding
The requirement permits `requests` version 2.31.0, which is flagged with multiple advisories, and the lower-bound spec means a vulnerable version could be installed depending on resolver behavior or environment state. Because this skill retrieves external Hacker News data over HTTP(S), use of a vulnerable HTTP client is more relevant than in an offline-only tool, especially for issues involving credential handling or TLS/session verification.

Known Vulnerable Dependency: python-dotenv==1.0.1 — 1 advisory(ies): CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via )

Low
Category
Supply Chain
Confidence
82% confidence
Finding
The requirement allows `python-dotenv` 1.0.1, which is reported as vulnerable to symlink-following in `set_key`. This is only exploitable if the skill actually uses the affected write path against attacker-influenced `.env` targets, which is not evident from this file alone, so the practical risk in this Hacker News data service context appears limited but still real if such functionality exists elsewhere.

Static analysis

No suspicious patterns detected.