Repository navigation
Replies: 1 comment
Quickshell 键盘监听 / 后门 / 数据外传 专项安全审计报告
结论摘要
残余风险均为设计内信任边界问题,非隐藏行为:
1. 键盘监听排查 —— 无1.1 框架自身的键记录行为 —— 无
1.2 全局快捷键协议 —— 只收激活事件
1.3 greeter 密码流 —— 直达后端且日志脱敏(已复核)
密码字节仅存内存,不落盘、不进日志、不外传。 1.4 QML 可捕获键盘的 API —— 不存在框架暴露的输入相关 QML API 仅:全局快捷键激活信号(无键内容)、 2. 后门排查 —— 未发现已排除:隐蔽命令执行、日期/主机名/MAC/用户名触发、base64/hex 混淆载荷(≥60 字符零命中)、XOR/解码循环、QML 2.1 外部命令执行点(全部为设计功能,无注入面)
未发现外部数据(文件名、网络、DBus 消息、窗口标题)流入命令拼接的路径。 环境变量读取全部用途明确(XDG_、HOME、LANG、WAYLAND_DISPLAY、HYPRLAND_INSTANCE_SIGNATURE、GREETD_SOCK、PIPEWIRE_、FONTCONFIG_、QS_/QSG_* 功能开关等),无一用于隐藏行为的门控。 2.2 敏感文件与写盘
2.3 IPC 信任边界 —— 已加固(本次复审确认)
防护两层(
此加固为 2026-11-01 审计的配套修复(当时记录为"无应用层鉴权")。异 UID 不可达;同 UID 属文档化信任边界(同 UID 本就能改写 shell 配置)。命令目标仅限用户配置注册的 IpcHandler,无内建 exec/文件目标。 2.4 DBus 会话总线面 —— 数据型,无命令执行
2.5 QML 加载面QML 只从 XDG 配置目录或 3. 数据上传 / 外发排查 —— 框架自身无全树模式检索(含 .qml/.js):
3.1 唯一理论外发面:QML 远程 URL 放行(设计行为)
3.2 本地 DBus 外发(无一出网)
3.3 构建期下载(1 处,可本地覆盖)
3.4 崩溃报告与日志
4. 与前序审计(2026-11-01)的差异
5. 风险发现与建议5.1 【中】QML 远程 URL 放行 —— 配置信任假设框架不阻断 QML 的远程资源加载。信任模型为"QML 配置 = 用户自有代码"(与 execDetached 同级)。配置来源必须可信(权限、属主、不从网络获取第三方 QML)。若引入第三方配置分发渠道,需加 scheme 白名单或内容审查。 5.2 【低】IPC 同 UID 能力面同 UID 进程可退出 shell、调用配置注册的 IpcHandler。已限定异 UID 不可达、无内建敏感命令目标。威胁模型与"同 UID 进程可改写 shell 配置"一致,无需额外处置;记录备查。 5.3 【低】崩溃子系统构建期依赖拉取cpptrace FetchContent 为构建期行为,有本地覆盖机制,kan 构建不编译该子系统。供应链范畴备查。 5.4 【信息】日志尾部进崩溃报告崩溃报告含 100 行日志尾部,若配置自行打印敏感内容会随之进入本地崩溃目录(不外传)。配置作者责任,提示知悉。 6. 残余风险(本次未覆盖)
7. 复核方法(可复查性)
|
Uh oh!
There was an error while loading. Please reload this page.
Quickshell Security Audit: Keylogging / Backdoors / Data Exfiltration
frameworks/wayland/quickshell(Quickshell, a Qt/QML desktop-shell framework; 451 .cpp/.hpp/.qml files, ~3.6MB of source)strata-quickshell-源码定向安全审计-2026-11-01.md(quickshell was Part 2 of that report). This audit is a dedicated three-track re-verificationExecutive Summary
Residual risks are all in-design trust-boundary issues, not hidden behavior:
Image { source: "https://..." }really hits the network (tracking-pixel vector). The framework itself never constructs a remote URL.ipc.sockexposes 5 command classes to same-UID processes (including quitting the shell and invoking QML-registered handlers). Two-layer protection is in place (socket owner-only + SO_PEERCRED UID check); other UIDs cannot connect.1. Keyboard Monitoring — none
1.1 The framework's own keylogging behavior — none
/dev/input.QKeyEvent/keyPressEvent/QEvent::Keyhandlers in any C++ file; nowl_keyboardlistener code — keyboard input is delivered by Qt Wayland to focused surfaces only.Keys.*handlers in any QML file (the key handler inReloadPopup.qmlnoted in the prior audit is gone; the current code there is a mouse-click handler that copies log text to the clipboard).src/core/qmlglobal.cpp:221-233) only reads/writes the current content plus a change signal: no history, no persistence, no exfiltration.1.2 Global shortcut protocol — activation events only
src/wayland/hyprland/global_shortcuts/(protocolhyprland-global-shortcuts-v1.xml:83-118) carries only pressed/released and timestamps; by protocol design the shortcut is anonymous to the app (the app does not know which key triggers it).shortcut.cpp:17-30emits onlypressed()/released()signals — no key content ever reaches QML.wlr_layershell/shortcuts_inhibit/hyprland/focus_grabonly control focus ownership and shortcut suppression; they never observe key events.1.3 Greeter password flow — straight to the backend with log redaction (re-verified)
secretmessages automatically setechoResponse=false,src/services/greetd/connection.cpp:226-228; on the PAM sidePamIpcRequestFlags.echo,src/services/pam/subprocess.cpp:169)connection.cpp:244-262); PAM: length-prefixed pipe into a forked subprocess (src/services/pam/conversation.cpp:73-75)<CENSORED>redaction verified correct: before the debug log is written, theresponsefield is replaced with<CENSORED>(connection.cpp:251-255); unredacted content is sent only to the greetd socketsubprocess.cpp:194); prompt text is logged at debug level (server messages, not user keystrokes)Password bytes live in memory only: never written to disk, never logged, never sent anywhere.
1.4 QML APIs that could capture keys — do not exist
The input-adjacent QML APIs the framework exposes are only: global shortcut activation signals (no key content),
Quickshell.clipboardText(current clipboard), and standard Qt Quick in-focusTextField/Keys(the config's own UI navigation). There is no global key-observation API.2. Backdoors — none found
Ruled out: covert command execution, date/hostname/MAC/username triggers, base64/hex obfuscated payloads (zero hits ≥60 chars), XOR/decode loops, QML
eval/Qt.unescapeabuse (the soleengine.evaluateparses//@ ifconditional directives in the user's own config,src/core/scan.cpp:203), credential-file access (/etc/shadow,~/.ssh,.gnupg,.netrc, keyring,ptrace,/proc/<pid>/mem— zero hits), dynamic code loading (dlopen / QLibrary / QPluginLoader / QQmlExtensionPlugin — zero hits).2.1 External command execution sites (all by design; no injection surface)
src/io/process.cpp:198,src/core/qmlglobal.cpp:292-320(execDetached)src/core/desktopentry.cpp:280-343Exec=(argv parse;%f/%ufield codes stripped,:311-316)src/launch/command.cpp:519src/crash/handler.cpp:132-155/proc/self/exesrc/services/pam/subprocess.cpp:40-93src/services/greetd/connection.cpp:95-119No path was found where external data (file names, network, DBus messages, window titles) reaches command construction.
All environment variables read have a clear purpose (XDG_, HOME, LANG, WAYLAND_DISPLAY, HYPRLAND_INSTANCE_SIGNATURE, GREETD_SOCK, PIPEWIRE_, FONTCONFIG_, QS_/QSG_* feature flags, etc.); none gates hidden behavior.
2.2 Sensitive files and disk writes
/proc/self/exeis read (to locate the binary for crash self-restart); no credential file access at all.$XDG_RUNTIME_DIR/quickshell/{by-id,by-shell,by-pid,by-path,vfs,ipc.sock},$XDG_STATE_HOME/quickshell/by-shell/<id>, crash reports under the run dircrashes/; the QMLFileViewtype can write config-specified paths (atomic QSaveFile). No QSettings.memfd_create(src/core/logging.cpp:380,387) is used only to stage early boot logs, which are then copied to the log file — not fileless execution.2.3 IPC trust boundary — hardened (confirmed in this review)
$XDG_RUNTIME_DIR/quickshell/by-id/<id>/ipc.sock, command set (src/ipc/ipccommand.hpp):IpcKillCommandStringCallCommandStringPropReadCommand/SignalListenCommand/QueryMetadataCommandTwo protection layers (
src/ipc/ipc.cpp:32-74):QLocalServer::UserAccessOption— the socket is owner-only;SO_PEERCREDreads the peer UID, and connections whose UID != geteuid() are aborted.This hardening was the companion fix to the 2026-11-01 audit (which recorded "no application-layer authentication"). Other UIDs cannot connect; same-UID is a documented trust boundary (a same-UID process can rewrite the shell's config anyway). Command targets are limited to IpcHandlers the user's config registers; there are no built-in exec/file targets.
2.4 DBus session-bus surface — data-shaped, no command execution
org.kde.StatusNotifierWatcher/Hostorg.freedesktop.Notificationssrc/dbus/dbusimage.cpp:13-39); no paths, no command execution2.5 QML loading surface
QML is loaded only from XDG config dirs or the
--configargument (src/launch/command.cpp:42-51); no CWD / system-share / network loading. Imports of theqs:scheme outside the config root are redirected toqrc:/qs-blackhole(src/core/qsintercept.cpp:44-48), restricting the QML module resolution range.3. Data Upload / Exfiltration — none in the framework
Tree-wide pattern search (including .qml/.js) over
AF_INET/6,sockaddr_in,getaddrinfo,gethostbyname,inet_pton,curl,wget,QTcpSocket,QUdpSocket,QSslSocket,QWebSocket,QNetworkAccessManager/Reply/Request,XMLHttpRequest,fetch(,WebSocket,ws://,http(s)://— every hit adjudicated:QNetwork*hits are confined tosrc/core/qsintercept.{cpp,hpp}.http(s)://literals are documentation comments, with only 2 exceptions (below).QUrl(sweep: onlyfromLocalFile/qs:/qrc:); no in-tree QML references remote resources.3.1 The single theoretical egress surface: remote-URL passthrough (by design)
src/core/qsintercept.cpp:96-128:qs:/root:schemes are rewritten to local files; any other scheme (including http/https) is passed through unchanged to the defaultQNetworkAccessManager(:126).Image { source: "https://..." }); external data cannot inject it.3.2 Local DBus egress (none leaves the machine)
src/network/nm/network.cpp:277-279, local D-Bus, NM stores the secretsrc/services/polkit/flow.cpp:72straight to polkitNotifyis inbound); no outbound relay anywhere3.3 Build-time downloads (1 site, locally overridable)
src/crash/CMakeLists.txt:14-21FetchContent pulls cpptrace (v1.0.4; controlled byVENDOR_CPPTRACE, otherwisefind_package); upstream docs note a local-source override. The crash-handling subsystem is not compiled in the kan-linux build, so the risk does not materialize. No other FetchContent / ExternalProject / file(DOWNLOAD in the tree.3.4 Crash reports and logs
~/.cache/quickshell/crashes/<id>/(build/Qt versions, signal, PID, config path, stack trace, 100-line log tail). Never uploaded; theCRASHREPORT_URLshown in the crash UI (CMakeLists.txt:13) is display-only, opened manually viaQDesktopServices::openUrl(src/crash/interface.cpp:121).$XDG_RUNTIME_DIR/quickshell/by-id/<id>/log.log|log.qslogcontain framework category messages and configconsole.log. The framework never logs passwords (greetd is redacted), clipboard contents, or SSIDs; however, the crash log tail can capture whatever a config prints itself — config-author responsibility.4. Deltas vs the Prior Audit (2026-11-01)
Keys.*now zero hits)<CENSORED>connection.cpp:251-255)5. Risk Findings and Recommendations
5.1 [MEDIUM] QML remote-URL passthrough — a config-trust assumption
The framework does not block remote resource loading from QML. The trust model is "QML config = the user's own code" (the same level as execDetached). Config provenance must be trusted (ownership, permissions; never fetch third-party QML from the network). If a third-party config distribution channel is introduced, add a scheme allowlist or content review.
5.2 [LOW] Same-UID IPC capability surface
A same-UID process can quit the shell and invoke config-registered IpcHandlers. Other UIDs are already excluded, and there are no built-in sensitive command targets. The threat model matches "a same-UID process can rewrite the shell config"; no further action needed, recorded for the record.
5.3 [LOW] Build-time dependency fetch in the crash subsystem
The cpptrace FetchContent is a build-time behavior with a documented local override, and the kan build does not compile that subsystem. Supply-chain scope; noted for the record.
5.4 [INFO] Log tail included in crash reports
Crash reports include a 100-line log tail; if a config prints sensitive content itself, it lands in the local crash directory (never sent anywhere). Config-author responsibility; noted for awareness.
6. Residual Risks (not covered by this audit)
omarchy-shell-源码定向安全审计-2026-11-01.md.7. Methodology (reproducibility)
QUrl(construction sweep.All reactions