Missing server-side authorization allows any authenticated user to escalate to platform administrator
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 32/100
- Issue 類型
- 缺陷
- 描述清晰度
- 需要釐清
- 活躍度
- 冷清
- 技術堆疊
- java, kafka
研究方向
從 km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/interceptor/PermissionInterceptor.java:74 開始,追蹤 LoginServiceImpl 和 DefaultLoginExtendImpl.interceptorCheck。檢查 km-persistence/src/main/resources/sql/dml-logi.sql 中的權限資料,以及報告中描述的角色和使用者端點。完成標準是低權限的已驗證使用者不再能夠執行角色指派、使用者建立或其他未經授權的 REST 操作。
由索引模型根據 Issue 內容生成。
描述
v3.4.0
Summary
KnowStreaming ships a role/permission model (roles, permission points, resource scopes) that its own
web UI uses to decide which menus and buttons to show a user. That model is never checked on the
server. The single interceptor that guards every REST endpoint under /api/v3/** and
/logi-security/api/v1/** only verifies that the caller has a valid authenticated session — it does
not look at which permission points, roles, or resources that session is entitled to. Consequently any
authenticated user, regardless of assigned role, can call any endpoint with full effect, including the
identity-management endpoints that create users and assign roles. This lets a user holding the lowest
possible privilege level (e.g. a single view-only permission point) grant themselves the built-in
administrator role, or mint a brand-new administrator account, from the REST API directly, bypassing
the UI entirely.
Details
The only authorization gate for the whole API is PermissionInterceptor.preHandle():
km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/interceptor/PermissionInterceptor.java:74
return loginService.interceptorCheck(request, response, classRequestMappingValue, whiteMappingValues);
loginService is com.didiglobal.logi.security.service.impl.LoginServiceImpl, which forwards to
com.didiglobal.logi.security.extend.impl.DefaultLoginExtendImpl.interceptorCheck() (decompiled from
logi-security-spring-boot-starter-2.10.13.jar, the exact version pinned in KnowStreaming v3.4.0's
pom.xml):
public boolean interceptorCheck(HttpServletRequest request, HttpServletResponse response,
String requestMappingValue, List<String> whiteMappingValues) throws IOException {
if (StringUtils.isEmpty(requestMappingValue)) { ...; return false; }
for (String mapping : whiteMappingValues) {
if (requestMappingValue.contains(mapping)) return true;
}
if (!this.hasLoginValid(request)) {
this.logout(request, response);
return false;
}
String operator = HttpRequestUtil.getOperator(request);
User user = this.userService.getUserByUserName(operator);
if (user == null) throw new LogiSecurityException(ResultCode.USER_NOT_EXISTS);
this.initLoginContext(request, response, operator, user.getId());
return true;
}
hasLoginValid() only checks that the X-SSO-USER session/cookie identifies an existing user row.
Nothing in this method (or anywhere else reachable from PermissionInterceptor) reads the caller's
logi_security_role, logi_security_role_permission, or logi_security_user_resource rows and
compares them against the requested URL or resource id. No controller in the km-rest module carries
any permission-checking annotation either — a full grep of the source tree for
@RequiresPermission|@PreAuthorize|@CheckPermission|@Aspect returns zero matches. The permission-point
tree seeded in km-persistence/src/main/resources/sql/dml-logi.sql (e.g. permission id 1637
"用户管理-新增角色" / "user-mgmt: add role", id 1641 "用户管理-分配用户角色" / "user-mgmt: assign role
to user") exists solely to drive which buttons the Vue frontend renders for a given role.
The identity-management endpoints that make this exploitable are themselves unguarded, and the vendor's
own Swagger annotation on one of them documents the gap directly (decompiled from the same jar,
com.didiglobal.logi.security.controller.v1.UserController):
@PutMapping(value={"/add"})
@ApiOperation(value="用户新增接口,暂时没有考虑权限", notes="") // "user-add endpoint, permission not yet considered"
public Result<Void> add(HttpServletRequest request, @RequestBody UserDTO param) {
return this.userService.addUser(param, HttpRequestUtil.getOperator(request));
}
RoleController.assign() (POST /logi-security/api/v1/role/assign) is equally unguarded and, per
RoleServiceImpl.assignRoles(), replaces a target user's role set wholesale when flag=true and
id is set to that user's own id — allowing self-service role assignment with no ownership or
elevation check.
PoC
(available upon request)
Impact
Any user KnowStreaming grants an account to — even one deliberately restricted to a single read-only
permission point, the minimum the platform allows — can silently become a full platform administrator
in one HTTP request, or create a hidden administrator backdoor account. Because KnowStreaming's
administrator role controls every registered Kafka cluster it manages (topic create/delete/truncate,
consumer group offset reset, ACL management, cluster registration, and all other user/role
administration), this is a complete compromise of the platform and, transitively, of every Kafka
cluster it has been given credentials to manage. The same root cause (the interceptor performs
authentication only, never authorization) applies uniformly to every controller in the km-rest
module — Topic, Cluster, ACL, Connect, and Group management endpoints carry no permission annotations
either — so the identity-escalation path documented here is simply the most direct and severe instance
of a defect affecting the entire API surface.
- 主要語言
- Java
- 星號
- 7.2k
- 分支
- 1.3k
- 平均合併
- 5 分鐘
- 30 天內合併 PR
- 1
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
didi/KnowStreaming 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 50/100
didi/KnowStreaming#1265 ·
-
降本增笑了吗?未關閉
難度 5/5 一週以上 新手友好度 15/100
didi/KnowStreaming#1262 · 3 則留言 ·
-
難度 3/5 1-2 天 新手友好度 35/100
didi/KnowStreaming#1260 · 1 則留言 ·
-
官网 ssl 证书失效了未關閉
難度 3/5 1-2 天 新手友好度 25/100
didi/KnowStreaming#1258 · 1 則留言 · 1 個 reaction ·
-
指标对应有问题未關閉
難度 4/5 3-5 天 新手友好度 25/100
didi/KnowStreaming#1256 ·
查看 didi/KnowStreaming 的全部 Issue
相似的 Issue
-
account assessment course feature lecture
難度 2/5 1-3 小時 新手友好度 66/100
維護者通常 1 天內回覆
-
app:learninggoalhub enhancement good first issue
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 1/5 1-3 小時 新手友好度 86/100
維護者通常 1 天內回覆
-
PropertyResolver fails on JDK classes with a non-public field named like the property可能已有人在做 @vaibhavgupta443 今天認領。 未關閉good first issue
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆