T05 · Unauthorized Access and Privilege Escalation
- Location
README.md:22- Finding
Excessive Administrative and Asset Permissions for Read-Only Analytics
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a legitimate social-media analytics assistant, but it asks for broad long-lived Meta credentials and handles them in ways users should review carefully.
Install only if you are comfortable granting this skill access to your Meta and Threads business analytics. Use the narrowest possible read-only permissions, avoid administrator/full-control tokens where Meta allows it, keep .env out of version control with strict file permissions, rotate tokens regularly, and review the fetch script before running it.
README.md:22Excessive Administrative and Asset Permissions for Read-Only Analytics
SKILL.md:23Unpinned Third-Party Packages Installed into the Runtime Environment
README.md:136OAuth Credentials Exposed Through Shell Command Arguments and URL Query Strings
scripts/fetch_insights.py:36Access Tokens Transmitted as GET Query Parameters Throughout the Fetcher
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'fields': 'access_token',
'access_token': user_token,
}
resp = requests.get(url, params=params).json()
token = resp.get('access_token')
if token:
print('✅ Page Access Token 取得成功')
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'fields': 'access_token',
'access_token': user_token,
}
resp = requests.get(url, params=params).json()
token = resp.get('access_token')
if token:
print('✅ Page Access Token 取得成功')
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'access_token': ACCESS_TOKEN,
'limit': 20,
}
response = requests.get(url, params=params).json()
if 'error' in response:
print(f'⚠️ IG media 抓取失敗:{response["error"].get("message")}')
return []
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'access_token': ACCESS_TOKEN,
'limit': 20,
}
response = requests.get(url, params=params).json()
if 'error' in response:
print(f'⚠️ IG media 抓取失敗:{response["error"].get("message")}')
return []
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'access_token': ACCESS_TOKEN,
'limit': 20,
}
response = requests.get(url, params=params).json()
if 'error' in response:
print(f'⚠️ IG media 抓取失敗:{response["error"].get("message")}')
return []
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'metric': 'reach,plays,ig_reels_avg_watch_time,ig_reels_video_view_total_time,likes,comments,saved,shares',
'access_token': ACCESS_TOKEN,
}
ins = requests.get(ins_url, params=ins_params).json()
data = ins.get('data', [])
reach = extract_metric(data, 'reach')
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'metric': 'reach,plays,ig_reels_avg_watch_time,ig_reels_video_view_total_time,likes,comments,saved,shares',
'access_token': ACCESS_TOKEN,
}
ins = requests.get(ins_url, params=ins_params).json()
data = ins.get('data', [])
reach = extract_metric(data, 'reach')
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
'metric': 'reach,plays,ig_reels_avg_watch_time,ig_reels_video_view_total_time,likes,comments,saved,shares',
'access_token': ACCESS_TOKEN,
}
ins = requests.get(ins_url, params=ins_params).json()
data = ins.get('data', [])
reach = extract_metric(data, 'reach')
The script sends THREADS_CLIENT_SECRET as a URL query parameter in a GET request. Query parameters are more likely to be captured in proxy logs, web server logs, monitoring systems, browser history equivalents, or error traces, which increases exposure of a long-lived secret even though the destination is the legitimate Threads API.
"""把短效 Threads token 換成長效(60天)token"""
if not THREADS_CLIENT_ID or not THREADS_CLIENT_SECRET:
return token
resp = requests.get(f'{THREADS_BASE_URL}/access_token', params={
'grant_type': 'th_exchange_token',
'client_secret': THREADS_CLIENT_SECRET,
'access_token': token,
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def get_threads_user_id(token):
"""取得 Threads 數字 User ID"""
resp = requests.get(f'{THREADS_BASE_URL}/me', params={
'fields': 'id,username',
'access_token': token,
}).json()
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
if not threads_user_id:
return []
response = requests.get(f'{THREADS_BASE_URL}/{threads_user_id}/threads', params={
'fields': 'id,text,timestamp,permalink',
'access_token': token,
'limit': 20,
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
rows = []
for post in response.get('data', []):
ins = requests.get(f'{THREADS_BASE_URL}/{post["id"]}/insights', params={
'metric': 'views,likes,replies,reposts,quotes',
'access_token': token,
}).json()
The README instructs creation of a permanent system-user access token with broad permissions, including page and insights access. Long-lived privileged tokens significantly increase blast radius because compromise enables persistent API access without repeated user interaction.
2. 選擇「**粉絲專頁**」→ 勾選你的 FB 粉專 → 權限選「**完整控制**」
3. 再次「**新增資產**」→ 選「**應用程式**」→ 勾選你在 developers.facebook.com 建立的 App → 權限選「**開發者**」
### 1-3. 產生永久 Access Token
1. 點進系統使用者 → **產生新的 token**
2. 選擇你的 App
The documented permission set includes multiple read scopes and page-list access, which together create meaningful authenticated access to business social-media data. While this is likely needed for analytics, the README does not justify scope minimization or warn about the sensitivity of the resulting tokens.
| `instagram_manage_insights` | 讀取 IG 貼文/Reels insights |
| `pages_read_engagement` | 讀取 FB 粉專貼文 insights |
| `pages_read_user_content` | 讀取粉專貼文內容 |
| `pages_show_list` | 取得 Page Access Token |
| `read_insights` | 讀取 FB 粉專層級 insights |
| `threads_business_basic` | 讀取 Threads 資料 |
The .env section instructs users to store sensitive API credentials, including long-lived access tokens and a client secret, in a local plaintext file. If that file is exposed, an attacker could access social media account insights and possibly manage app-linked resources within the granted scopes.
---
## 四、.env 設定總覽
在 openclaw 專案根目錄的 `.env` 加入以下變數:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
cd /path/to/openclaw
source .env
python3 ~/.openclaw/workspace/skills/tw-fashion-social-manager/scripts/fetch_insights.py
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
```bash
cd /path/to/openclaw
source .env
python3 ~/.openclaw/workspace/skills/tw-fashion-social-manager/scripts/fetch_insights.py
```
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
```bash
cd /path/to/openclaw
source .env
python3 ~/.openclaw/workspace/skills/tw-fashion-social-manager/scripts/fetch_insights.py
```
The manifest presents the skill as a social-media strategy advisor, but the instructions also include operational data collection using local credentials, external API calls, and local file output. That mismatch is dangerous because users may invoke what appears to be a content-planning skill without realizing it can access account data and perform authenticated actions against external services.
The skill is configured to auto-trigger on a very broad range of social-media and advertising topics, which increases the chance it runs in contexts where users did not intend to authorize its stronger capabilities. In combination with hidden credential and network behaviors, broad invocation materially raises the likelihood of unintended secret access or external calls.
The instruction explicitly accesses a local .env file to export META_ variables, which is credential access. In skill context, this is especially risky because the declared purpose is advisory marketing assistance, not secret management, so the credential use is both over-privileged and insufficiently disclosed.
# 只載入 META_ 變數,避免 .env 中含空格的行(如 apt packages)造成錯誤
export $(grep -E '^META_' /Users/shangweilin/projects/openclaw/.env | xargs) && \
cd /tmp && \
PYTHONPATH="/Users/shangweilin/Library/Python/3.9/lib/python/site-packages" \
This command sequence continues the credential-loading flow and immediately uses the exported variables to run an external-data retrieval script. That coupling of secret extraction and execution increases the chance of account misuse, token leakage through process state/logging, and unauthorized access to Meta/Threads analytics.
# 只載入 META_ 變數,避免 .env 中含空格的行(如 apt packages)造成錯誤
export $(grep -E '^META_' /Users/shangweilin/projects/openclaw/.env | xargs) && \
cd /tmp && \
PYTHONPATH="/Users/shangweilin/Library/Python/3.9/lib/python/site-packages" \
python3 ~/.openclaw/workspace/skills/tw-fashion-social-manager/scripts/fetch_insights.py
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
IG_ACCOUNT_ID = None
# --- 3. 取得 Page Access Token ---
# FB Page insights 必須用 Page Access Token,User Token 會回 200 但數據為空或報錯
def get_page_access_token(user_token):
url = f'{BASE_URL}/{PAGE_ID}'
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
IG_ACCOUNT_ID = None
# --- 3. 取得 Page Access Token ---
# FB Page insights 必須用 Page Access Token,User Token 會回 200 但數據為空或報錯
def get_page_access_token(user_token):
url = f'{BASE_URL}/{PAGE_ID}'
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
IG_ACCOUNT_ID = None
# --- 3. 取得 Page Access Token ---
# FB Page insights 必須用 Page Access Token,User Token 會回 200 但數據為空或報錯
def get_page_access_token(user_token):
url = f'{BASE_URL}/{PAGE_ID}'