T09 · Insecure Skill Coding Practices
- Location
discord-admin.sh:257- Finding
Unescaped User Input Permits Discord API JSON Payload Injection
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Discord admin skill is broadly purpose-aligned, but it can make powerful live server changes with weak safeguards and weak credential handling.
Install only if you are comfortable giving a script broad Discord bot authority. Use a least-privilege bot rather than ADMINISTRATOR, keep tokens out of command lines and logs, review every destructive command before running it, and avoid using bulk moderation or webhook-management commands until safeguards and redaction are added.
discord-admin.sh:257Unescaped User Input Permits Discord API JSON Payload Injection
discord-admin.sh:231Discord Bot Token Can Be Exposed Through Process Arguments and Shell History
discord-admin.sh:331Raw Webhook API Responses May Disclose Reusable Webhook Credentials
The code is clearly related to Discord server administration, so the general domain matches the description. However, the declared purpose significantly overstates the implemented functionality. The script only exposes a narrow subset of Discord admin actions: channel, role, and limited member management, message send/delete, server info, and emoji listing. It does not implement several prominently declared areas such as AutoMod, webhooks, templates, audit logs, scheduled events, or threads, and therefore does not constitute 'complete A-Z' or 'full server control.' There are no obvious unrelated or undeclared harmful capabilities beyond the stated Discord administration domain, but the description is materially broader than the actual behavior, so this should be flagged as a mismatch.
Mass-ban, mass-kick, and mass-role operations enable rapid, large-scale changes to membership and permissions, yet they are documented without explicit caution, approval requirements, or verification steps. In the context of full server administration, this materially raises the risk of catastrophic misuse, whether accidental or prompted by malicious input.
The script exposes high-impact destructive actions such as bans, kicks, channel/role deletion, bulk message deletion, guild edits, and leaving a guild with no confirmation, dry-run, or safety interlock. In an agentic or automation context, a mistaken command, prompt injection, or argument mix-up can immediately cause irreversible administrative damage to a Discord server.
The skill advertises extensive shell-driven administrative capabilities but does not declare any tool scope such as allowed tools or permissions. In an agent environment, that omission weakens guardrails and can allow broad shell execution for highly privileged server-management actions without explicit sandboxing or approval boundaries.
The documentation prominently exposes destructive administrative actions such as deletion, bans, transfer, and bulk operations without clear safety warnings, preconditions, or approval prompts. In a skill intended for agent use, this increases the chance of accidental or unauthorized destructive execution against a live Discord server.
The quick-start instructs users to export a Discord bot token without any warning about secrecy, storage hygiene, or avoiding command-history leaks. Because the token grants administrative API access, mishandling it can lead to full bot compromise and broad server abuse.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
# Check deps
check_deps() {
command -v curl &> /dev/null || { log_error "curl required"; }
command -v jq &> /dev/null || { log_error "jq required (sudo apt install jq)"; }
}
validate_token() { [[ -z "$BOT_TOKEN" ]] && log_error "DISCORD_BOT_TOKEN not set"; }
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# API wrapper
api() {
local method=$1 endpoint=$2 data=$3
local response=$(curl -s -w "\n%{http_code}" -X "$method" \
"$API_BASE$endpoint" \
-H "Authorization: Bot $BOT_TOKEN" \
-H "Content-Type: application/json" \
The help text claims stage-create, stage-edit, and stage-close manage Discord stage instances. However, the implementation uses /channels/.../threads for creation and generic channel patch/archive operations, which corresponds to thread/channel manipulation rather than stage-instance lifecycle management.
The help output says template-use <code> <name> should create a server from a template, implying use of a template code. The code instead calls POST /guilds/$1/templates, treating the first argument as a guild ID and interacting with guild template management rather than server creation from a template.
The manifest advertises broad capabilities including AutoMod, webhooks, templates, audit logs, scheduled events, threads, and full server control via CLI. The help text and implemented commands only cover basic channel, role, member, message, server info, and emoji operations, so the described behavior materially overstates what the code actually does.
The wrapper exposes destructive actions such as channel deletion, role deletion, kicks, and bans without any confirmation prompt, dry-run mode, or guardrail. In a server-administration skill, this increases the risk of accidental or scripted misuse that can immediately disrupt community operations and moderation state.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
local endpoint="$2"
local data="$3"
curl -s -X "$method" \
"https://discord.com/api/v10$endpoint" \
-H "Authorization: Bot $BOT_TOKEN" \
-H "Content-Type: application/json" \
The webhook example embed uses the string "内容", which introduces a specific non-English locale in a generic administration skill without any language-choice context. This can conflict with organizational language/locale policies when the skill does not offer user opt-in or explain locale constraints.
No suspicious patterns detected.