T05 · Unauthorized Access and Privilege Escalation
- Location
references/cookie-guide.md:5- Finding
Collection of Unrelated Douyin Authentication Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly behaves like a Bilibili favorites downloader, but its documentation asks users to collect unrelated Douyin session cookies and the installer uses broad system-level dependency installation.
Review carefully before installing. Do not follow the Douyin cookie instructions for a Bilibili downloader, do not export complete browser cookies, and keep any Bilibili cookie file private with restrictive permissions. Prefer a user-local or virtual-environment install with pinned verified dependencies, and enable cron or Telegram only after deciding that scheduled downloads and third-party notifications fit your risk tolerance.
references/cookie-guide.md:5Collection of Unrelated Douyin Authentication Credentials
scripts/setup.sh:39Unpinned and Unverified Installation of Executable Dependencies
scripts/bilibili_fav_dl.py:107Telegram Bot Token Exposed Through Process Command-Line Arguments
scripts/bilibili_fav_dl.py:28Hard-Coded Global State and Log Paths Bypass User Configuration
The workflow directly instructs users to obtain and supply browser session cookies, which are reusable authentication secrets. Normalizing credential extraction in the skill increases the chance of accidental disclosure, unsafe storage, or misuse by downstream tooling.
The cookie acquisition section provides step-by-step instructions to extract authentication cookies from browser developer tools and export them to a file. This is a credential collection flow, and in this case the domain mismatch further raises the risk of collecting the wrong account secrets.
The file is a Bilibili cookie guide, but it instructs users to visit douyin.com, collect Douyin cookies, and mix Douyin tokens such as sessionid, uid_tt, and ttwid with Bilibili tokens like SESSDATA and bili_jct. This cross-service credential harvesting is inconsistent with the stated skill purpose and could trick users into disclosing unrelated high-value session tokens, enabling account compromise or unauthorized access on another platform.
The guide tells users to copy the full Cookie header or export complete cookie data, which exposes active authentication material well beyond the minimum needed. In a downloader skill context, this is especially dangerous because users are being normalized into exfiltrating reusable session secrets that could be abused for account takeover, private data access, or long-lived unauthorized API use.
The skill clearly instructs use of shell commands, environment variables, cron persistence, and file paths, but it declares no explicit tool scope or permissions boundaries. That omission weakens reviewability and can cause an agent or user to execute broader capabilities than expected without a clear trust contract.
The skill asks users to provide authentication cookies but gives no warning that these are equivalent to session credentials and may grant account access if leaked. Users may store or transmit them insecurely because the workflow normalizes handling them like ordinary input files.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
或手动安装:
# Ubuntu/Debian
sudo apt install ffmpeg
pip3 install yt-dlp
# macOS
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
设置每2小时自动运行(crontab):
# 编辑 crontab
crontab -e
# 添加:
0 */2 * * * /usr/bin/python3 /path/to/bilibili_fav_dl.py --cookie /path/to/cookie.txt --fav-id 你的收藏夹ID --out-dir /path/to/downloads >> /var/log/bilibili_dl.log 2>&1
The cookie instructions tell the user to log into douyin.com even though the skill is for Bilibili favorites. This mismatch is a strong indicator of copied or careless credential-handling guidance and could trick users into exporting unrelated session cookies, exposing accounts unnecessarily.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
f.write(line + "\n")
def curl_api(url, cookie_file):
r = subprocess.run([
"curl", "-s", url,
"-b", cookie_file,
"-H", "User-Agent: Mozilla/5.0",
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
f.write(line + "\n")
def curl_api(url, cookie_file):
r = subprocess.run([
"curl", "-s", url,
"-b", cookie_file,
"-H", "User-Agent: Mozilla/5.0",
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
all_items = []
pn = 1
while True:
url = f"https://api.bilibili.com/x/v3/fav/resource/list?media_id={fav_id}&pn={pn}&ps=20&jsonp=jsonp&type=0"
data = curl_api(url, cookie_file)
if data.get("code") != 0:
log(f"API page{pn} error: {data.get('message')}")
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
return True, "skipped"
# yt-dlp 最高画质:bestvideo+bestaudio 合并
result = subprocess.run([
"yt-dlp",
"--cookies", cookie_file,
"-f", "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio/best",
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
chat_id = os.environ.get("BILIBILI_TG_CHAT_ID")
if not token or not chat_id:
return
url = f"https://api.telegram.org/bot{token}/sendMessage"
subprocess.run([
"curl", "-s", url,
"-d", f"chat_id={chat_id}",
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if not token or not chat_id:
return
url = f"https://api.telegram.org/bot{token}/sendMessage"
subprocess.run([
"curl", "-s", url,
"-d", f"chat_id={chat_id}",
"-d", f"text={msg}",
The Telegram bot token from the environment is interpolated directly into the request URL and then passed as a command-line argument to curl. On many systems, process command lines are observable to other local users or monitoring tools, which can expose the bot token and enable unauthorized use of the Telegram bot.
if not token or not chat_id:
return
url = f"https://api.telegram.org/bot{token}/sendMessage"
subprocess.run([
"curl", "-s", url,
"-d", f"chat_id={chat_id}",
"-d", f"text={msg}",
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
if ! command -v ffmpeg &>/dev/null; then
echo "[*] 安装 ffmpeg..."
if [ "$PKG_MANAGER" = "apt-get" ]; then
sudo apt-get install -y ffmpeg
else
sudo $PKG_MANAGER install -y ffmpeg
fi
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
if ! command -v ffmpeg &>/dev/null; then
echo "[*] 安装 ffmpeg..."
if [ "$PKG_MANAGER" = "apt-get" ]; then
sudo apt-get install -y ffmpeg
else
sudo $PKG_MANAGER install -y ffmpeg
fi
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
if ! command -v ffmpeg &>/dev/null; then
echo "[*] 安装 ffmpeg..."
if [ "$PKG_MANAGER" = "apt-get" ]; then
sudo apt-get install -y ffmpeg
else
sudo $PKG_MANAGER install -y ffmpeg
fi
This shell script uses sudo to install packages and writes an executable into /usr/local/bin, which modifies the host system in a privileged and potentially hard-to-reverse way. Although it prints status messages, it does not warn the user before making these changes or ask for confirmation.
The script downloads an executable from the network with curl and writes it directly to /usr/local/bin using sudo, without checksum or signature verification. If the download source, release channel, TLS trust chain, or network path is compromised, this could install a trojanized binary with broad system impact.
pip install yt-dlp
else
# 下载二进制
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
fi
else
The Telegram notification feature sends download-related metadata to a third-party messaging service, but the skill does not disclose that data leaves the local machine. This can expose titles, identifiers, timing, and usage patterns, especially when monitoring private favorites.
All user-visible comments and echo messages are in Chinese, with no indication that the skill is region-specific or that users may select another language. This can violate language/locale policy when a skill imposes a specific language without user opt-in.