Back to skill

Security audit

YouTube Comment Moderator

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent YouTube moderation tool, but its auto mode can delete comments and post replies from LLM output with weak safeguards around OAuth and stored tokens.

Install only if you are comfortable granting YouTube comment write access. Prefer monitor or approval mode, avoid auto deletion and auto replies until safeguards are added, do not paste full OAuth callback URLs into chat, keep token/config/database files private, and restrict or rotate API keys if they may have been exposed.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/moderate.py:218
Finding

Prompt Injection Can Trigger Destructive Automatic Moderation Actions

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/setup.py:104
Finding

OAuth Authorization Flow Does Not Validate State or Use PKCE

Content
View full analysis

✅ Authorization successful!

You can close this tab and return to the terminal.

""") else: OAuthCallbackHandler.error = query.get("error", ["unknown"])[0] self.send_response(400) self.send_header("Content-Type", "text/html") self.end_headers() self.wfile.write(f"

Authorization failed: {OAuthCallbackHandler.error}

".encode()) ``` The authorization request contains neither `state` nor a PKCE challenge: ```python params = { "client_id": CLIENT_ID, "redirect_uri": redirect_uri, "response_type": "code", "scope": " ".join(YOUTUBE_SCOPES), "access_type": "offline", "prompt": "consent" } auth_url = f"{GOOGLE_AUTH_URL}?{urlencode(params)}" ``` The code exchange is not bound to a local verifier: ```python token_data = urlencode({ "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, "code": code, "grant_type": "authorization_code", " ...[truncated 2103 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/setup.py:267
Finding

Sensitive OAuth Tokens and Moderation Data Are Stored Without Explicit File Protections

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/setup.py:401
Finding

YouTube API Key Is Unnecessarily Duplicated into Plaintext Configuration

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
skills/youtube-comment-moderator/SKILL.md:53
Finding

Packaged Skill Instructions Require Users to Paste an OAuth Callback Credential into Chat

Content
View full analysis
" ``` ``` ### Technical Analysis The OAuth callback URL contains the authorization code and may contain additional response parameters such as granted scopes. An authorization code is short-lived and single-use, but it remains a bearer-like credential during its validity window. Requiring the user to paste the complete URL into an AI conversation exposes it to the chat platform, agent framework, transcript storage, observability systems, debugging logs, and anyone with access to the conversation. Passing the URL as a command-line argument can additionally expose it through shell history or process inspection. The root `SKILL.md` contains safer but still imperfect guidance to paste only the code, demonstrating inconsistent security instructions between the two distributed Skill documents. The safest approach is not to route the authorization artifact through chat at all. ### Attack Path 1. The user follows the packaged Skill instructions and completes Google authorization. 2. The browser redirects to a URL containing a valid authorization code. 3. The user pastes the complete callback URL into the agent conversation. 4. The callback URL is retained in chat history, telemetry, logs, or another intermediary system. 5. A party with timely access captures the code and attempts to exchange it before the legitimate setup process. 6. If the ...[truncated 604 chars]
Remediation
View remediation
Vulnerability Patterns
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (80)

Tainted flow: 'req' from os.environ.get (line 69, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/classify_comments.py (reported line 74)May include surrounding context.

python
})
        
        try:
            with urlopen(req, timeout=30) as resp:
                data = json.loads(resp.read())
            
            text = data["candidates"][0]["content"]["parts"][0]["text"]

Tainted flow: 'req' from os.environ.get (line 69, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/classify_comments.py (reported line 74)May include surrounding context.

python
})
        
        try:
            with urlopen(req, timeout=30) as resp:
                data = json.loads(resp.read())
            
            text = data["candidates"][0]["content"]["parts"][0]["text"]

Tainted flow: 'req' from os.environ.get (line 69, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/classify_comments.py (reported line 174)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/videos?part=snippet&id={video_id}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            return data["items"][0]["snippet"]["channelId"]

Tainted flow: 'req' from os.environ.get (line 69, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/classify_comments.py (reported line 174)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/videos?part=snippet&id={video_id}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            return data["items"][0]["snippet"]["channelId"]

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/moderate.py (reported line 61)May include surrounding context.

python
url = f"{BASE_URL}/{endpoint}?{urlencode(params)}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/2.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            return json.loads(resp.read())
    except HTTPError as e:
        print(f"  API error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/moderate.py (reported line 103)May include surrounding context.

python
url = f"{BASE_URL}/{endpoint}?{urlencode(params)}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/2.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            return json.loads(resp.read())
    except HTTPError as e:
        print(f"  API error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/moderate.py (reported line 121)May include surrounding context.

python
url = f"{BASE_URL}/{endpoint}?{urlencode(params)}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/2.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            return json.loads(resp.read())
    except HTTPError as e:
        print(f"  API error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/moderate.py (reported line 61)May include surrounding context.

python
url = f"{BASE_URL}/{endpoint}?{urlencode(params)}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/2.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            return json.loads(resp.read())
    except HTTPError as e:
        print(f"  API error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/moderate.py (reported line 103)May include surrounding context.

python
url = f"{BASE_URL}/{endpoint}?{urlencode(params)}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/2.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            return json.loads(resp.read())
    except HTTPError as e:
        print(f"  API error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/moderate.py (reported line 121)May include surrounding context.

python
url = f"{BASE_URL}/{endpoint}?{urlencode(params)}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/2.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            return json.loads(resp.read())
    except HTTPError as e:
        print(f"  API error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/moderate.py (reported line 85)May include surrounding context.

python
headers={"Authorization": f"Bearer {token}"}
    )
    try:
        with urlopen(req, timeout=10):
            return token
    except HTTPError:
        pass

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/moderate.py (reported line 85)May include surrounding context.

python
headers={"Authorization": f"Bearer {token}"}
    )
    try:
        with urlopen(req, timeout=10):
            return token
    except HTTPError:
        pass

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/moderate.py (reported line 133)May include surrounding context.

python
url = f"{BASE_URL}/comments/setModerationStatus?{urlencode({'id': comment_id, 'moderationStatus': status})}"
    req = Request(url, method="POST", headers={"Authorization": f"Bearer {token}"})
    try:
        with urlopen(req, timeout=15):
            return True
    except HTTPError as e:
        print(f"  Moderation error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/moderate.py (reported line 133)May include surrounding context.

python
url = f"{BASE_URL}/comments/setModerationStatus?{urlencode({'id': comment_id, 'moderationStatus': status})}"
    req = Request(url, method="POST", headers={"Authorization": f"Bearer {token}"})
    try:
        with urlopen(req, timeout=15):
            return True
    except HTTPError as e:
        print(f"  Moderation error {e.code}: {e.read().decode()[:200]}", file=sys.stderr)

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/moderate.py (reported line 249)May include surrounding context.

python
req = Request(url, data=body.encode(), headers={"Content-Type": "application/json"})

        try:
            with urlopen(req, timeout=60) as resp:
                data = json.loads(resp.read())
            text = data["candidates"][0]["content"]["parts"][0]["text"].strip()
            if text.startswith("```"):

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/moderate.py (reported line 249)May include surrounding context.

python
req = Request(url, data=body.encode(), headers={"Content-Type": "application/json"})

        try:
            with urlopen(req, timeout=60) as resp:
                data = json.loads(resp.read())
            text = data["candidates"][0]["content"]["parts"][0]["text"].strip()
            if text.startswith("```"):

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/moderate.py (reported line 317)May include surrounding context.

python
})
    req = Request(url, data=body.encode(), headers={"Content-Type": "application/json"})
    try:
        with urlopen(req, timeout=30) as resp:
            data = json.loads(resp.read())
        return data["candidates"][0]["content"]["parts"][0]["text"].strip().strip('"')
    except Exception as e:

Tainted flow: 'req' from os.environ.get (line 246, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/moderate.py (reported line 317)May include surrounding context.

python
})
    req = Request(url, data=body.encode(), headers={"Content-Type": "application/json"})
    try:
        with urlopen(req, timeout=30) as resp:
            data = json.loads(resp.read())
        return data["candidates"][0]["content"]["parts"][0]["text"].strip().strip('"')
    except Exception as e:

Tainted flow: 'req' from os.environ.get (line 328, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/setup.py (reported line 72)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/channels?part=snippet&forHandle={handle}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            channel_id = data["items"][0]["id"]

Tainted flow: 'req' from os.environ.get (line 328, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/setup.py (reported line 90)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/channels?part=snippet&forHandle={handle}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            channel_id = data["items"][0]["id"]

Tainted flow: 'req' from os.environ.get (line 328, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/setup.py (reported line 260)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/channels?part=snippet&forHandle={handle}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            channel_id = data["items"][0]["id"]

Tainted flow: 'req' from os.environ.get (line 328, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/setup.py (reported line 333)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/channels?part=snippet&forHandle={handle}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            channel_id = data["items"][0]["id"]

Tainted flow: 'req' from os.environ.get (line 328, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/setup.py (reported line 72)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/channels?part=snippet&forHandle={handle}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            channel_id = data["items"][0]["id"]

Tainted flow: 'req' from os.environ.get (line 328, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/setup.py (reported line 90)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/channels?part=snippet&forHandle={handle}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            channel_id = data["items"][0]["id"]

Tainted flow: 'req' from os.environ.get (line 328, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · skills/youtube-comment-moderator/scripts/setup.py (reported line 260)May include surrounding context.

python
url = f"https://www.googleapis.com/youtube/v3/channels?part=snippet&forHandle={handle}&key={api_key}"
    req = Request(url, headers={"User-Agent": "YT-Moderator/1.0"})
    try:
        with urlopen(req, timeout=15) as resp:
            data = json.loads(resp.read())
        if data.get("items"):
            channel_id = data["items"][0]["id"]

Static analysis

No suspicious patterns detected.