T05 · Unauthorized Access and Privilege Escalation
- Location
server.py:30- Finding
Unauthenticated Feishu Message Relay Exposed on All Network Interfaces
- Content
View full analysis
str: global _feishu_token, _feishu_token_time import time if _feishu_token and (time.time() - _feishu_token_time) < FEISHU_TOKEN_TTL: return _feishu_token url = 'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal' payload = json.dumps({ 'app_id': FEISHU_APP_ID, 'app_secret': FEISHU_APP_SECRET }).encode() req = urllib.request.Request( url, data=payload, headers={'Content-Type': 'application/json'} ) try: with urllib.request.urlopen(req, timeout=10) as resp: data = json.loads(resp.read()) _feishu_token = data.get('tenant_access_token', '') _feishu_token_time = time.time() return _feishu_token except Exception as e: print(f'[Feishu] token retrieval failed: {e}') return '' def _send_feishu_message(token: str, text: str) -> bool: if not token: return False url = ( 'https://open.feishu.cn/open-apis/im/v1/messages' '?receive_id_type=chat_id' ) payload = { 'receive_id': FEISHU_CHAT_ID, 'msg_type': 'text', 'content': json.dumps({'text': text}) } data = json.dumps(payload).encode('utf-8') req = urllib.request.Request(url, data=data, headers={ 'Content-Type': 'application/json', 'Authorization': f'Bearer {token}' }) try: with urllib.request.ur ...[truncated 3153 chars]- Remediation
View remediation
