T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/apply_permissions.py:35
- Finding
- Feishu Application Receives Permissions Beyond the Skill's Operational Requirements<![CDATA[ ## Vulnerability Details **File Location**: `scripts/apply_permissions.py:35-56`; related mandatory instructions in `SKILL.md:60-66` **Vulnerability Type**: Excessive tenant-level permissions and violation of least privilege **Risk Level**: High ### Vulnerable Code ```python # 记账系统需要的所有 base 权限 REQUIRED_SCOPES = [ "base:app:read", "base:app:update", "base:app:create", "base:table:read", "base:table:create", "base:table:update", "base:table:delete", "base:field:read", "base:field:create", "base:field:update", "base:field:delete", "base:record:read", "base:record:create", "base:record:update", "base:record:delete", "base:view:read", "base:view:write_only", "bitable:app:readonly", "bitable:app", ] ``` The Skill instructions explicitly require all of these permissions: ```text base:app:read,base:app:update,base:app:create, base:table:read,base:table:create,base:table:update,base:table:delete, base:field:read,base:field:create,base:field:update,base:field:delete, base:record:read,base:record:create,base:record:update,base:record:delete, base:view:read,base:view:write_only,bitable:app:readonly,bitable:app ``` ### Technical Analysis The setup workflow legitimately needs to create a Base, create a table, create fields, and update select-field options. Normal accounting operations need record creation and, where deletion is enabled, record read and deletion. The audited scripts do not demonstrate a need for several requested capabilities, including: - `base:table:update` - `base:table:delete` - `base:field:delete` - `base:record:update` - `base:view:read` - `base:view:write_only` - Broad and overlapping `bitable:app` access The broad `bitable:app` permission also overlaps with the granular Base permissions, making the effective authorization boundary less restrictive than the individual operations suggest. Requiring all 19 permissions as mandatory gives the application destruc ...[truncated 1500 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Inventory the exact Feishu API methods used by each script and request only the scopes documented as necessary for those methods. 2. Remove unused table, field, record-update, and view permissions. 3. Avoid combining broad `bitable:app` access with granular scopes unless Feishu documentation proves it is strictly required. 4. Separate setup permissions from runtime permissions: - Use temporary setup authorization for Base, table, and field creation. - Use a narrower runtime application or credential for record creation, reading, and explicitly requested deletion. 5. Make destructive permissions optional. Request `base:record:delete` only if the user enables remote deletion. 6. Display a plain-English explanation for every requested scope before authorization. 7. Add automated tests that compare the declared permission list against the API methods actually called, preventing future scope expansion without review. 8. Rotate the App Secret and revoke the old permission grant after reducing the scope set. ]]>
