Repository navigation
Conversation
修复 CWE-290 认证绕过漏洞:/proc/PID/cmdline 可被同用户进程伪造, 导致任意进程可通过伪装可执行名绕过 SetLocked 鉴权。 - 将鉴权方式从读取 /proc/PID/cmdline + startsWith 前缀匹配 改为 readlink(/proc/PID/exe) + 精确 != 比较 - 新增 #include <climits>(PATH_MAX) - 仅允许 /usr/bin/dde-lock 和 /usr/libexec/deepin/dde-lock 精确匹配 Issue: DDE-518
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's Guide修复 SetLocked 中基于可伪造 /proc/PID/cmdline 前缀匹配的 CWE-290 认证绕过:使用 readlink 获取调用者真实可执行路径,并对两个受信任路径执行精确匹配。 Sequence diagram for secure SetLocked caller validationsequenceDiagram
participant Caller as DdeLockProcess
participant SessionManager
participant ProcFS as ProcFS
Caller->>SessionManager: SetLocked(lock)
SessionManager->>ProcFS: readlink(/proc/PID/exe)
ProcFS-->>SessionManager: caller executable path
alt exact trusted path
SessionManager->>SessionManager: SetLocked(lock)
else readlink fails or path is untrusted
SessionManager-->>Caller: reject request
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复 CWE-290 认证绕过漏洞
问题
SessionManager::SetLocked()使用/proc/PID/cmdline前缀匹配(startsWith)作为调用者鉴权依据。/proc/PID/cmdline可被同用户进程伪造,任意进程只需伪装可执行名即可绕过锁定/解锁鉴权。修复方案
将鉴权方式从读取
/proc/PID/cmdline+startsWith()前缀匹配改为readlink(/proc/PID/exe)+ 精确!=比较:#include <climits>(PATH_MAX)readlink读取/proc/PID/exe符号链接获取调用者真实可执行路径!=替代startsWith()前缀匹配/usr/bin/dde-lock和/usr/libexec/deepin/dde-lock修改文件
src/dde-session/impl/sessionmanager.cpp审核
代码审核已通过(100/100,四维度全部通过,无新增安全问题)。
关联 Issue
DDE-518
Summary by Sourcery
Harden SetLocked caller authentication against CWE-290 by using the process executable path for exact authorization checks.
Bug Fixes:
Enhancements: