T09 · Insecure Skill Coding Practices
- Location
references/setup-guide.md:68- Finding
OAuth credentials exposed through URL query parameters
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Facebook management skill is not plainly malicious, but it relies on powerful long-lived Facebook tokens and documents posting, messaging, reading, deletion, and token-refresh workflows with weak safety controls.
Review this skill before installing. Use only the minimum Facebook scopes needed, avoid storing page or user tokens in plaintext config when possible, do not paste tokens into chats or logs, and require manual confirmation before any post, deletion, reply, or Messenger send. The cron refresh example should not be used as written on shared or sensitive systems.
references/setup-guide.md:68OAuth credentials exposed through URL query parameters
scripts/check-connection.sh:13Facebook access-token prefixes disclosed in script output
references/setup-guide.md:37Default setup recommends permissions broader than individual workflows require
references/setup-guide.md:108Persistent token-refresh job uses an unsafe predictable temporary file
The declared description presents a broad Facebook management skill with many operational capabilities for both pages and personal accounts. The supplied code, however, is only a diagnostic script that verifies whether page/user tokens work and whether group permission may be present. It performs simple read-only API checks against /{page_id}, /me, and /me/groups and prints status messages. This is materially narrower than the declared purpose and reflects a different primary purpose: connection testing rather than comprehensive Facebook management.
The skill explicitly advertises access-token acquisition and token-driven operation, which is credential-sensitive functionality. In a skill context, encouraging token handling without strong safety guidance increases the chance of credential theft, oversharing, insecure storage, or misuse of long-lived Facebook access tokens.
Messenger, xem insights. User Token: tìm nhóm, đọc bài trong nhóm, tìm trang khác,
tìm kiếm bài viết công khai. Hướng dẫn lấy token từ A đến Z.
Sử dụng khi người dùng nhắc đến: Facebook, Fanpage, Messenger, nhóm Facebook,
group, đăng bài, auto reply, tìm bài, search Facebook, Page ID, access token,
Graph API, quản lý fanpage, social media.
version: 2.0.0
metadata:
Documenting Page Access Tokens as effectively permanent and central to operations highlights use of powerful long-lived credentials. If mishandled, these tokens can enable unauthorized posting, messaging, comment actions, and insight access on behalf of a page.
| Nhu cầu | Chế độ | Token |
|---------|:------:|-------|
| Quản lý Fanpage (đăng bài, reply, Messenger, insights) | **Page** | Page Access Token (vĩnh viễn) |
| Tìm nhóm, đọc bài nhóm, tìm trang khác, search bài viết | **User** | User Access Token (~60 ngày) |
| Cả hai | **Cả hai** | Cấu hình 2 token riêng |
The skill also relies on user access tokens for reading groups, pages, and public-post search, which are sensitive delegated credentials tied to personal accounts. Misuse or leakage can expose personal and group-derived data and permit actions within the granted scope.
| Nhu cầu | Chế độ | Token |
|---------|:------:|-------|
| Quản lý Fanpage (đăng bài, reply, Messenger, insights) | **Page** | Page Access Token (vĩnh viễn) |
| Tìm nhóm, đọc bài nhóm, tìm trang khác, search bài viết | **User** | User Access Token (~60 ngày) |
| Cả hai | **Cả hai** | Cấu hình 2 token riêng |
**→ Đọc `references/setup-guide.md` để lấy token từng bước.**
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Hướng dẫn lấy Facebook Access Token
Hướng dẫn chi tiết lấy **cả 2 loại token**: Page Token (vĩnh viễn) và User Token (60 ngày).
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Hướng dẫn lấy Facebook Access Token
Hướng dẫn chi tiết lấy **cả 2 loại token**: Page Token (vĩnh viễn) và User Token (60 ngày).
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Hướng dẫn lấy Facebook Access Token
Hướng dẫn chi tiết lấy **cả 2 loại token**: Page Token (vĩnh viễn) và User Token (60 ngày).
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- `user_posts`
- `groups_access_member_info`
- `pages_show_list`
4. Click **Generate Access Token** → đồng ý cấp quyền
5. Copy token từ ô Access Token
**Token này là Short-lived (~1-2 giờ).** Đổi sang Long-lived ở Bước 4.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- `user_posts`
- `groups_access_member_info`
- `pages_show_list`
4. Click **Generate Access Token** → đồng ý cấp quyền
5. Copy token từ ô Access Token
**Token này là Short-lived (~1-2 giờ).** Đổi sang Long-lived ở Bước 4.
This line explicitly instructs users to place a long-lived user token into the Access Token field in order to obtain a permanent page token, normalizing use of effectively non-expiring credentials. In the context of the broader guide, promoting permanent tokens without strong compensating controls increases the blast radius of any token leak and makes abuse persist until manual revocation.
### 4B: Long-lived User Token → Permanent Page Token
1. Đặt Long-lived User Token vào ô Access Token
2. Query: `me/accounts` → Submit
3. Token trả về cho mỗi page là **VĨNH VIỄN**
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
#!/bin/bash
# refresh-fb-token.sh
NEW_TOKEN=$(curl -s "https://graph.facebook.com/v22.0/oauth/access_token?\
grant_type=fb_exchange_token&\
client_id=$APP_ID&\
client_secret=$APP_SECRET&\
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
| Lỗi | Giải pháp |
|-----|-----------|
| `(#200) Requires ... permission` | Thêm quyền → Generate Token lại |
| `Invalid OAuth access token` | Token hết hạn → lấy mới (Bước 3→4) |
| `(#11) Search is not supported` | Dùng cách: tìm nhóm → đọc bài nhóm |
| `App Not Live` | App Dashboard → App Review → chuyển Live |
| Rate limit | Giảm tần suất, batch requests, cache |
The skill documents shell-based actions using curl against external APIs but does not declare an explicit tool scope such as allowed-tools or permissions. In an agent environment, this can cause the skill to be invoked with broader shell/network capability than users expect, increasing the chance of unintended outbound actions.
The skill describes access to group content, personal account data, and page data without a prominent privacy warning or consent boundary. In context, this is sensitive social-media data, and unclear disclosure can cause users to expose or process third-party content without understanding the privacy implications.
The trigger phrases are extremely broad and cover many ordinary Facebook-related conversations, making accidental activation more likely. Because the skill includes credentialed external actions and data access, overbroad routing increases the risk of invoking sensitive functionality without clear user intent.
The manifest requires FACEBOOK_ACCESS_TOKEN while the documented usage relies on FACEBOOK_PAGE_TOKEN and FACEBOOK_USER_TOKEN. This inconsistency can lead operators to place credentials in the wrong variable, break security assumptions, or encourage overbroad reuse of a single token for multiple purposes.
The documentation includes examples for posting, replying, and sending Messenger messages without an explicit warning that these actions are externally visible and may be irreversible. In an agent setting, that omission materially raises the risk of unintended public posts or outbound messages under a valid token.
The skill contains direct examples for transmitting content and authorization-bearing requests to Facebook's external API. External transmission is expected for this domain, but it is still security-relevant because it can send user-provided content and act under privileged tokens against a third-party service.
# Đăng bài text
curl -X POST "https://graph.facebook.com/v22.0/$FACEBOOK_PAGE_ID/feed" \
-H "Authorization: Bearer $FACEBOOK_PAGE_TOKEN" \
-d "message=Nội dung bài đăng"
The reference documents a destructive DELETE /{POST_ID} capability that is broader than the manifest’s stated posting, replying, auto-reply, insights, and search/read functions. This creates a scope mismatch that can enable an agent or user to remove content unexpectedly, increasing the risk of unauthorized or accidental destructive actions.
The destructive post-deletion endpoint is presented as a normal operation with no caution, approval flow, or rollback guidance. In an agent skill context, that omission increases the chance of accidental, coerced, or unauthorized deletion of page content, especially when agents may act on natural-language instructions.
This section documents access to conversations, messages, group feeds, and personal account data without any privacy, consent, or user-impact warnings. Because the skill is designed for broad Facebook management using page and user tokens, the lack of safeguards makes misuse more dangerous by normalizing surveillance, bulk data access, and outbound messaging operations that can affect third parties.
The file includes personal account endpoints such as /me?fields=id,name,email and /me/posts, which expose user profile and personal posting data beyond the manifest’s described fanpage management and search/group features. That undocumented access expands the skill’s effective privilege and can lead to collection or misuse of personal data without clear user expectation.
The guide explicitly instructs users to place long-lived user tokens and permanent page tokens into a local JSON configuration file, but does not pair that with guidance on file permissions, secret management, redaction, backups, or source-control exclusion. These tokens grant durable access to Facebook assets, so exposure through logs, repo commits, shared home directories, or support bundles could enable account/page takeover actions such as posting, reading messages, or harvesting data.
The refresh script handles sensitive credentials in a shell context and writes a fresh token back into a local config file without warning about credential exposure through process listings, shell history, temporary files, terminal output, or unsafe file replacement. While the script talks only to Facebook, the operational pattern increases the chance of accidental secret leakage or config corruption on multi-user or poorly secured systems.
The skill description and examples are entirely in Vietnamese, and the metadata includes a 'vietnamese' tag, but there is no indication that the locale is optional or that the skill is intentionally restricted to Vietnamese-speaking users for a stated reason. This may conflict with language/locale policy expectations requiring opt-in or explicit justification.