T09 · Insecure Skill Coding Practices
- Location
scripts/remove_movie.py:18- Finding
Ambiguous title matching can delete unintended movie files
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
MovieFetch mostly does what it says, but its remove action can delete media files by default from an ambiguous title match without a clear confirmation step.
Install only if you are comfortable giving this skill API access to your media stack. Treat remove/cancel/delete prompts as dangerous until the skill is changed to require exact movie identity and explicit confirmation, and use HTTPS or loopback-only service URLs for credentials.
scripts/remove_movie.py:18Ambiguous title matching can delete unintended movie files
scripts/check_download.py:12Service credentials may be transmitted over plaintext HTTP
scripts/check_ott.py:7TMDB API key is exposed in URL query parameters
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
"""Search for a movie or TV series on TMDB."""
url = f"{TMDB_URL}/search/{media_type}"
params = {"api_key": TMDB_API_KEY, "query": query}
resp = requests.get(url, params=params, timeout=10)
resp.raise_for_status()
results = resp.json().get("results", [])
return results[0] if results else None
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
"""Search for a movie or TV series on TMDB."""
url = f"{TMDB_URL}/search/{media_type}"
params = {"api_key": TMDB_API_KEY, "query": query}
resp = requests.get(url, params=params, timeout=10)
resp.raise_for_status()
results = resp.json().get("results", [])
return results[0] if results else None
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
"""Returns the section key for the configured movie library."""
url = f"{PLEX_URL}/library/sections"
headers = {"X-Plex-Token": PLEX_TOKEN, "Accept": "application/json"}
resp = requests.get(url, headers=headers, timeout=5)
resp.raise_for_status()
for section in resp.json()["MediaContainer"]["Directory"]:
if section["title"].lower() == PLEX_LIBRARY.lower():
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
url = f"{PLEX_URL}/library/sections/{library_key}/search"
headers = {"X-Plex-Token": PLEX_TOKEN, "Accept": "application/json"}
params = {"query": title, "type": 1} # type 1 = movies
resp = requests.get(url, headers=headers, params=params, timeout=5)
resp.raise_for_status()
results = resp.json()["MediaContainer"].get("Metadata", [])
return results
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def find_movie_in_library(title: str):
"""Search the Radarr library for a movie by title (case-insensitive partial match)."""
resp = requests.get(f"{RADARR_URL}/movie", headers=HEADERS, timeout=10)
resp.raise_for_status()
title_lower = title.lower()
matches = [m for m in resp.json() if title_lower in m["title"].lower()]
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def lookup_movie(title: str):
"""Search TMDB via Radarr — returns top match or None."""
resp = requests.get(
f"{RADARR_URL}/movie/lookup",
headers=HEADERS,
params={"term": title},
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def get_movie_id(tmdb_id: int):
"""Fetch internal Radarr movie ID from TMDB ID."""
resp = requests.get(
f"{RADARR_URL}/movie",
headers=HEADERS,
params={"tmdbId": tmdb_id},
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def search_and_download_release(movie_id: int, extra_words: set):
"""Search releases for a movie and queue the first one that matches all extra keywords."""
resp = requests.get(
f"{RADARR_URL}/release",
headers=HEADERS,
params={"movieId": movie_id},
The destination URL is taken from RADARR_URL without validation, and the request includes an API key in headers. If an attacker can influence environment configuration or deployment settings, they can redirect this POST to an attacker-controlled host and capture the credential while also triggering unintended outbound requests.
"indexerId": best_release["indexerId"],
"movieId": movie_id
}
dl_resp = requests.post(
f"{RADARR_URL}/release",
headers={**HEADERS, "Content-Type": "application/json"},
json=dl_payload,
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
"searchForMovie": not is_specific_version
},
}
resp = requests.post(
f"{RADARR_URL}/movie",
headers={**HEADERS, "Content-Type": "application/json"},
json=payload,
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- Radarr with API access
- qBittorrent Web UI enabled
- Plex server access token
### Environment Variables
This variant of the mismatch again shows narrower implemented behavior than the manifest promises. Repeated discrepancies are a red flag for poor change control and make the skill context more dangerous because users expect coordinated Plex/Radarr/qBittorrent operations when only a subset may execute.
This variant of the mismatch again shows narrower implemented behavior than the manifest promises. Repeated discrepancies are a red flag for poor change control and make the skill context more dangerous because users expect coordinated Plex/Radarr/qBittorrent operations when only a subset may execute.
This variant of the mismatch again shows narrower implemented behavior than the manifest promises. Repeated discrepancies are a red flag for poor change control and make the skill context more dangerous because users expect coordinated Plex/Radarr/qBittorrent operations when only a subset may execute.
This variant of the mismatch again shows narrower implemented behavior than the manifest promises. Repeated discrepancies are a red flag for poor change control and make the skill context more dangerous because users expect coordinated Plex/Radarr/qBittorrent operations when only a subset may execute.
This variant of the mismatch again shows narrower implemented behavior than the manifest promises. Repeated discrepancies are a red flag for poor change control and make the skill context more dangerous because users expect coordinated Plex/Radarr/qBittorrent operations when only a subset may execute.
This variant of the mismatch again shows narrower implemented behavior than the manifest promises. Repeated discrepancies are a red flag for poor change control and make the skill context more dangerous because users expect coordinated Plex/Radarr/qBittorrent operations when only a subset may execute.
This variant of the mismatch again shows narrower implemented behavior than the manifest promises. Repeated discrepancies are a red flag for poor change control and make the skill context more dangerous because users expect coordinated Plex/Radarr/qBittorrent operations when only a subset may execute.
The script defaults delete_files to true, so a removal request will delete the movie record and its downloaded files unless the caller explicitly opts out. In a chat-triggered automation context, ambiguous user phrasing, LLM misunderstanding, or accidental invocation could cause irreversible data loss without confirmation.
The README explicitly advertises a remove capability that can delete files, but it does not clearly warn users about irreversible data loss or emphasize confirmation requirements. In a chat-driven skill, ambiguous natural-language commands increase the chance of accidental destructive actions, making this more dangerous than in a traditional UI with explicit safeguards.
The skill advertises networked automation across Plex, Radarr, and qBittorrent but does not declare any explicit tool scope such as allowed tools or permissions. In a chat-triggered skill that can query services and potentially remove media, missing scope boundaries increases the risk of unintended environment access or overbroad network use if the runtime grants default capabilities.
The skill describes cleanup that removes movies from the Radarr library and may delete files, but it does not include an explicit warning or confirmation requirement. In a chat-controlled skill, destructive actions without prominent caution are dangerous because a vague or mistaken request could trigger irreversible media deletion.
For a skill described as managing movie downloads and status/removal across Plex, Radarr, and qBittorrent, querying a separate TMDB service for OTT provider data is not directly necessary based on the manifest alone. The use of external API access and secret-backed lookups introduces a capability beyond the declared movie-management purpose.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
import requests
TMDB_API_KEY = os.environ.get("TMDB_API_KEY", "")
TMDB_URL = "https://api.themoviedb.org/3"
def search_tmdb(query: str, media_type: str = "movie"):
"""Search for a movie or TV series on TMDB."""
The manifest describes a chat skill for downloading, tracking, and removing movies in Plex, Radarr, and qBittorrent. This script instead searches TMDB and retrieves watch-provider/streaming availability data, which is a distinct end-user capability not mentioned in the skill description and not an obvious implementation detail of download/status/remove operations.