T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/wework_combined_service.py:485
- Finding
- Archived Enterprise Conversations Exposed Through Unauthenticated API<![CDATA[ ## Vulnerability Details **File Location**: `scripts/wework_combined_service.py:485-510`, with external exposure enabled at `scripts/wework_combined_service.py:647` **Vulnerability Type**: Missing authentication and authorization on a sensitive-data API **Risk Level**: High ### Vulnerable Code ```python @app.route('/api/messages', methods=['GET']) def api_get_messages(): """Query message API""" try: # Get query parameters start_time = request.args.get('start_time', type=int) end_time = request.args.get('end_time', type=int) from_user = request.args.get('from_user') room_id = request.args.get('room_id') msg_type = request.args.get('msg_type') limit = request.args.get('limit', 100, type=int) offset = request.args.get('offset', 0, type=int) # Query messages messages = storage_system.query_messages( start_time=start_time, end_time=end_time, from_user=from_user, room_id=room_id, msg_type=msg_type, limit=limit, offset=offset ) return jsonify({ 'success': True, 'count': len(messages), 'messages': messages }) except Exception as e: logger.error(f"Message query API failed: {e}") return jsonify({ 'success': False, 'error': str(e) }), 500 ``` The service is bound to every network interface: ```python app.run(host='0.0.0.0', port=8400, debug=False) ``` ### Technical Analysis The `/api/messages` endpoint returns archived enterprise conversation records without performing any authentication or authorization check. Returned database rows can contain message contents, sender identifiers, recipient lists, room identifiers, timestamps, and the `metadata` field containing the original parsed message. The service listens on `0.0.0.0`, and the project explicitly documents mapping port ...[truncated 1609 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require strong authentication for every archive query and statistics endpoint. 2. Implement role-based authorization so only designated archive administrators can retrieve conversation content. 3. Isolate administrative APIs from public callback routes: - Bind the administrative interface to localhost or a private network. - Use a separate authenticated management service or listener. - Configure Cloudflare ingress so only callback paths are publicly routed. 4. Add strict pagination controls: - Require `1 <= limit <= 100`. - Reject negative offsets. - Apply server-side maximum result and time-range limits. 5. Enforce source-network restrictions where practical, but do not use IP allowlisting as a substitute for authentication. 6. Record authenticated administrative access in tamper-resistant audit logs without logging returned message content. 7. Add automated tests proving anonymous requests receive `401 Unauthorized` or `403 Forbidden`. ]]>
