Back to skill

Security audit

WhatsApp cloud api reference

Security checks for vulnerabilities and agentic risk

Overview

This WhatsApp API reference is mostly purpose-aligned, but it includes copy-paste guidance that can create overpowered long-lived credentials and accidentally message or expose real users.

Install only if you treat it as a rough reference, not production-ready security guidance. Before using it, replace the recipient-validation helper with a non-messaging validation path, avoid logging message bodies or phone numbers, do not put tokens in URLs or shell history, use scoped non-admin credentials where possible, rotate and store secrets properly, and require recipient opt-in before sending.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (6)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:818
Finding

Recipient Validation Sends an Unsolicited WhatsApp Message and Fails Open

Content
View full analysis
bool: """ Check if number is a registered WhatsApp user. Returns False only on definitive error 131026 (not on WhatsApp). Returns True if successful, uncertain (auth error, etc.), or timeout. """ headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json" } data = { "messaging_product": "whatsapp", "to": phone_digits, "type": "text", "text": {"body": "_"} # minimal text to check } try: r = requests.post( f"https://graph.facebook.com/v21.0/{phone_id}/messages", headers=headers, json=data, timeout=10 ) if r.status_code == 200: return True # number is valid error_code = r.json().get("error", {}).get("code") if error_code == 131026: return False # NOT on WhatsApp return True # other errors — don't block except: return True # network error — don't block ``` ### Technical Analysis The function is represented as a recipient-validation helper, but it calls the `/messages` endpoint and attempts to deliver an actual `_` message. This is a state-changing messaging operation rather than a read-only validation request. It therefore discloses the supplied telephone number to Meta and can contact a recipient who has not consented to receiving the message. The function also catches every exception and returns `True`. Authentication failures, timeouts, malformed responses, rate limits, and programming errors are consequently treated as successful validation. Downstream code may then send further content to a recipient ...[truncated 906 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:33
Finding

Permanent Administrative System-User Tokens Exceed Least-Privilege Requirements

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:959
Finding

Access Tokens and Application Secrets Are Embedded in Request URLs

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:47
Finding

Third-Party Dependencies Are Installed Without Version or Integrity Controls

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:202
Finding

Webhook Handler Logs Private Message Bodies and Sender Identifiers

Content
View full analysis
entry.changes?.forEach(change => { const value = change.value; // Incoming messages if (value.messages) { value.messages.forEach(msg => { console.log(`Message from ${msg.from}: ${msg.text?.body}`); handleMessage(msg); }); } // Delivery status if (value.statuses) { value.statuses.forEach(status => { console.log(`Message ${status.id} status: ${status.status}`); handleDeliveryStatus(status); }); } }) ); } ``` ### Technical Analysis The webhook example writes the sender's telephone identifier and complete text-message body to standard output. Production platforms commonly forward standard output to persistent centralized logging systems. Message content is not needed to confirm webhook processing and may contain private, regulated, or authentication-related information. The code provides no masking, consent boundary, retention limit, or environment-dependent control. It therefore increases the number of systems and operators that can access WhatsApp conversation data. ### Attack Path 1. A WhatsApp user sends a private message to the business. 2. Meta delivers the message through the configured webhook. 3. The handler writes the sender identifier and full body to standard output. 4. Deployment infrastructure exports and retains the log. 5. An attacker or unauthorized operator with log access reads or exports the conversation data. ### Impact Assessment The issue exposes personal telephone identifiers and potentially sen ...[truncated 281 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:635
Finding

Predictable Two-Step Verification PIN Is Used in Executable Setup Examples

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (11)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The skill is a markdown reference file, so SQP-2 for markdown applies when the description omits warnings about behaviors affecting user data or privacy. Multiple examples transmit phone numbers, message bodies, and related metadata to Meta's Cloud API, but the document does not explicitly disclose that using these patterns shares user communications data with a third-party service.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 74)May include surrounding context.

md
import requests, os

def send_message(phone: str, text: str) -> dict:
    r = requests.post(
        f"https://graph.facebook.com/v21.0/{os.environ['WA_PHONE_NUMBER_ID']}/messages",
        headers={"Authorization": f"Bearer {os.environ['WA_ACCESS_TOKEN']}"},
        json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 89)May include surrounding context.

return r.json()

text

### Quick test via curl

```bash
curl -X POST "https://graph.facebook.com/v21.0/YOUR_PHONE_ID/messages" \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The webhook example logs full incoming message bodies and sender numbers directly to console. In production this can expose sensitive user content and phone numbers into centralized logs, third-party log processors, developer terminals, and long-retention observability systems.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 619)May include surrounding context.

Step 1 — check phone number status:

bash
curl "https://graph.facebook.com/v21.0/PHONE_NUMBER_ID?fields=verified_name,code_verification_status,quality_rating,status" \
  -H "Authorization: Bearer YOUR_TOKEN"

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 762)May include surrounding context.

Run this to check if a number has WhatsApp before sending:

bash
curl "https://graph.facebook.com/v21.0/PHONE_NUMBER_ID/contacts" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -X POST \

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The helper is presented as a WhatsApp-registration check, but it performs a real /messages send with body _. That can contact end users without consent, create unintended outbound traffic/costs, violate the 24-hour/template policy, and produce false assumptions because many non-131026 failures are treated as success.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
98% confidence
Finding

This external transmission occurs inside the misleading registration-check helper and sends a real message as a side effect of validation. Because the code defaults to True on most errors, it can both leak content externally and silently message users when the caller believes it is only checking eligibility.

Content

Scanner excerpt · SKILL.md (reported line 835)May include surrounding context.

md
"text": {"body": "_"}  # minimal text to check
    }
    try:
        r = requests.post(
            f"https://graph.facebook.com/v21.0/{phone_id}/messages",
            headers=headers,
            json=data,

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 878)May include surrounding context.

md
}

    try:
        r = requests.post(url, headers=headers, json=data)
        r.raise_for_status()
        return {"success": True, "message_id": r.json().get("messages")[0].get("id")}
    except requests.HTTPError as e:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 929)May include surrounding context.

md
}

    try:
        r = requests.post(url, headers=headers, json=data)
        r.raise_for_status()
        return {"success": True, "message_id": r.json().get("messages")[0].get("id")}
    except requests.HTTPError as e:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 954)May include surrounding context.

md
}

    try:
        r = requests.post(url, headers=headers, json=data)
        r.raise_for_status()
        return {"success": True, "message_id": r.json().get("messages")[0].get("id")}
    except requests.HTTPError as e: