T09 · Insecure Skill Coding Practices
- Location
scripts/latex_reader.py:64- Finding
Unsafe Extraction of Untrusted arXiv Archives
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches an academic paper workflow, but its scripts handle remote paper archives and paths unsafely enough to risk local file reads or writes outside the intended folders.
Review before installing. Use this only in a contained workspace and avoid running it on untrusted or arbitrary paper sources until archive extraction, LaTeX include resolution, and download destination validation are fixed. Also be aware that search terms go to external providers and the package contains a bundled Semantic Scholar API key.
scripts/latex_reader.py:64Unsafe Extraction of Untrusted arXiv Archives
scripts/latex_reader.py:453Untrusted LaTeX Include Directives Can Read Local Files
scripts/download_paper.py:56Unsanitized Theme Permits Download Destination Escape
scripts/search_papers.py:43Hard-Coded Semantic Scholar API Credential
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
req = urllib.request.Request(url, headers={"x-api-key": api_key, "Accept": "application/json"})
try:
with urllib.request.urlopen(req, timeout=30) as response:
data = json.loads(response.read().decode())
papers = [_format_paper(p) for p in data.get("data", [])]
# Filter papers with PDF URLs (check for non-empty string) and return top results
Referenced artifact was not completely inspected
| `latex_reader.py` | Download LaTeX source (for AI reading) |
The trigger list includes broad phrases such as "download paper," "paper summary," and especially "read paper," which can match many ordinary user requests outside the narrow arXiv/LaTeX workflow. This can cause unintended activation of the skill, leading the agent to invoke external search/download behavior or apply the wrong workflow when the user did not intend it.
The script embeds a hardcoded default Semantic Scholar API key and automatically transmits it on outbound requests. Hardcoded credentials are dangerous because they can be extracted from source control or redistributed artifacts, abused by unauthorized parties, and make key rotation and accountability difficult.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
api_key = os.environ.get("SEMANTIC_SCHOLAR_API_KEY", "g7Rh7ivl2o8mxhyjTvNhUDXyrD6VuUw5PgrjZqD7")
# Request openAccessPdf field to filter papers with PDF
fields = "paperId,title,abstract,year,venue,citationCount,authors,url,openAccessPdf"
url = f"https://api.semanticscholar.org/graph/v1/paper/search?query={urllib.parse.quote(query)}&limit={max_results * 2}&fields={fields}" # Get more to filter
if year_from:
url += f"&year={year_from}-{year_to if year_to else year_from}"
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
]
try:
result = subprocess.run(
cmd, capture_output=True, text=True, timeout=30,
encoding='utf-8', errors='replace',
creationflags=subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0
The code performs networked paper searches using external providers, transmitting the user-supplied query off the local system. While there are informational logs indicating which provider is used, there is no warning that user input will be shared with third-party services.
No suspicious patterns detected.