T09 · Insecure Skill Coding Practices
- Location
scripts/meta_campaign_insights.py:288- Finding
Meta Access Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:49-58;scripts/meta_campaign_insights.py:288-293;scripts/meta_campaign_insights.py:503
Vulnerability Type: Credential exposure through process arguments and shell history
Risk Level: HighVulnerable Code
SKILL.md:49-58:bash When Max provides a token, use `scripts/meta_campaign_insights.py` to pull data. Standard pull sequence: # Install dependency (once per session) pip install -q requests # 1. Campaign overview — last 30 days python scripts/meta_campaign_insights.py \ -t TOKEN \ -a act_2335535636459862 \scripts/meta_campaign_insights.py:288-293:python parser.add_argument( "-t", "--access-token", required=True, help="Meta Marketing API access token (with ads_read permission)", )scripts/meta_campaign_insights.py:503:python data = fetch_insights(args.access_token, args.account_id, params)Technical Analysis
The documented and implemented workflow requires a Meta bearer token to be supplied directly as a command-line argument. Command-line arguments may be recorded in interactive shell history, terminal transcripts, automation logs, process-monitoring telemetry, and job metadata. Depending on operating-system process isolation, they may also be visible to other local users while the process is running.
The token is subsequently sent over HTTPS to Meta's official Graph API. That network transmission is necessary for the declared reporting functionality, and the requested
ads_readpermission is consistent with least privilege. The security defect is the local token-delivery mechanism, not the use of Meta's API.Attack Path
- An authorized operator runs the documented command with a real token in place of
TOKEN. - The shell, terminal recorder, process monitor, CI system, or execution environment retains the complete command line.
- An attacker with ac ...[truncated 895 chars]
- An authorized operator runs the documented command with a real token in place of
- Remediation
View remediation
Remediation Suggestions
- Remove the token-bearing command examples from
SKILL.mdand the script documentation. - Accept the token through a protected environment variable, such as
META_ACCESS_TOKEN, or an interactive hidden prompt implemented withgetpass.getpass(). - Prefer a secrets manager when the script runs through automation.
- If environment variables are used, ensure job configuration and diagnostic tooling do not print the environment.
- Reject tokens supplied through command-line arguments, or retain the option only as an explicitly deprecated compatibility mechanism with a security warning.
- Preserve the least-privilege requirement by continuing to request only
ads_read. - Avoid printing tokens, request URLs containing tokens, request headers, or complete request objects in logs.
- Revoke and regenerate any token that may already have appeared in shell history or execution logs.
- Remove the token-bearing command examples from
