T09 · Insecure Skill Coding Practices
Warning
- Location
- fetch_arxiv.py:28
- Finding
- ArXiv Metadata Retrieved over Unencrypted HTTP## Vulnerability Details **File Location**: `fetch_arxiv.py`, lines 28-32 **Vulnerability Type**: Plaintext network communication **Risk Level**: Medium ### Vulnerable Code ```python def fetch_metadata(arxiv_id: str) -> dict: """Fetch metadata via arxiv API.""" url = f"http://export.arxiv.org/api/query?id_list={arxiv_id}" r = requests.get(url, timeout=30) r.raise_for_status() text = r.text ``` ### Technical Analysis The application retrieves paper metadata from the arXiv API over plaintext HTTP. Although the subsequently downloaded PDF uses HTTPS, the title, authors, abstract, publication date, and other metadata are obtained through an unauthenticated and unencrypted transport. An attacker with a position on the network path, such as a malicious wireless access point, compromised gateway, or upstream network operator, can intercept and modify the HTTP response. The modified response is parsed and presented as trusted arXiv metadata. Because this content is subsequently used for summaries, translations, and research responses, forged metadata can affect the integrity of agent-generated content. ### Attack Path 1. A user asks the skill to retrieve an arXiv paper. 2. `fetch_metadata()` sends a plaintext HTTP request to `export.arxiv.org`. 3. An on-path attacker intercepts the request or response. 4. The attacker replaces XML fields such as the paper title, author names, abstract, or publication date. 5. The script parses the manipulated response without authenticity verification. 6. The forged metadata is returned in JSON and may be incorporated into summaries, translations, or answers presented to the user. ### Impact Assessment The vulnerability compromises the integrity and authenticity of retrieved paper metadata. An attacker can cause the agent to present false academic information or process attacker-controlled text as if it came from arXiv. This issue does not directly provide l ...[truncated 166 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the plaintext endpoint with the HTTPS equivalent: ```python url = f"https://export.arxiv.org/api/query?id_list={arxiv_id}" ``` 2. Keep TLS certificate verification enabled; do not pass `verify=False` to `requests`. 3. Validate that redirects remain on approved HTTPS arXiv domains. 4. Parse the response with a safe XML parser rather than regular expressions. 5. Confirm that the returned entry corresponds to the requested normalized arXiv identifier before trusting its metadata. 6. Treat metadata as untrusted external content when incorporating it into agent prompts or user-facing responses.
