Skip to content

Commit cb1d9d2

Browse files
authored
Merge pull request #64 from Vladush/feature/uac-style-prompt
feat: Interactive User Confirmation for Privilege Escalation
2 parents 4b19cfb + b79d5ce commit cb1d9d2

24 files changed

Lines changed: 499 additions & 75 deletions

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [0.9.7.5] - 2026-06-10
9+
10+
### Added
11+
12+
- **Universal Confirmation & Password Fallback**: The PAM module now forces an interactive prompt (`<Enter>`) to neutralize silent privilege escalation for sensitive services (like `sudo`). Users can seamlessly bypass face authentication by typing their password at this prompt instead. Configurable via `require_confirmation` and `confirmation_exempt_services`.
13+
- **Proximity Wake Lock**: Added `always_wake_on_presence_detected` option to force wake on detection. Screen wake now requires presence detection in addition to confidence threshold.
14+
- **Background Worker**: Offloaded proximity sensor initialization to a background worker.
15+
16+
### Fixed
17+
18+
- **Memory Leaks**: Prevented memory leaks in subprocess execution by properly duplicating and freeing argument strings.
19+
- **Process Tracking**: Initialized pid variable to -1 to ensure safe process state tracking.
20+
- **Code Quality**: Applied C++17 best practices and resolved IDE and cppcheck warnings.
21+
- **Testing**: Added coverage for config parsing, camera device failures, and auth engine detection pipelines.
22+
23+
### Docs
24+
25+
- **Security**: Updated THREAT_MODEL_AND_RISK_ASSESSMENT for interactive confirmation, D-Bus screen-state synchronization, and automated wake/unlock vulnerabilities.
926

1027
## [0.9.7.4] - 2026-06-02
1128

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.14)
2-
project(LinuxCamPAM VERSION 0.9.7.4 LANGUAGES C CXX)
2+
project(LinuxCamPAM VERSION 0.9.7.5 LANGUAGES C CXX)
33

44
# --- Automatic Git Hook Installation ---
55
# Installs/Updates the pre-push hook to prevent accidental pushes to master
@@ -129,6 +129,7 @@ add_library(service_core STATIC
129129
src/service/utils.cpp
130130
src/PresenceTripwire.cpp
131131
src/VirtualKeyboard.cpp
132+
src/HardwareManager.cpp
132133
)
133134
target_include_directories(service_core PUBLIC include src src/common ${OpenCV_INCLUDE_DIRS})
134135
target_link_libraries(service_core PUBLIC
@@ -143,7 +144,7 @@ if(nlohmann_json_FOUND)
143144
endif()
144145

145146
# Auth Service
146-
add_executable(linuxcampamd src/service/main.cpp src/HardwareManager.cpp)
147+
add_executable(linuxcampamd src/service/main.cpp)
147148
target_link_libraries(linuxcampamd PRIVATE service_core)
148149

149150
# CLI Tool
@@ -225,6 +226,11 @@ if(TARGET gtest)
225226
tests/test_pam_logic.cpp
226227
tests/test_config_parsing.cpp
227228
tests/test_camera.cpp
229+
tests/test_hardware_manager.cpp
230+
tests/test_presence_tripwire.cpp
231+
tests/test_ite8353_parser.cpp
232+
tests/test_sensor_factory.cpp
233+
tests/test_scoped_worker.cpp
228234
)
229235

230236
# The tests link against the service_core library to test internal logic without

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Since open-sourcing, I've put effort into making it hardware-agnostic and well-d
3434
- **Enhanced Enrollment**: HDR capture when supported, frame averaging for all cameras.
3535
- **Proximity Sensor Integration**: Native support for I2C HID human presence sensors (e.g., ITE8353) to detect human presence, optimize authentication, and reduce idle processing.
3636
- **Zero-Interaction Login**: Automatically wakes your displays and logs you in the moment you sit down, then automatically locks the OS when you walk away. (See [Threat Model](docs/THREAT_MODEL_AND_RISK_ASSESSMENT.md) for related security considerations, including walk-by unlocks and physical coercion).
37+
- **Universal Confirmation & Password Fallback**: Prevent silent privilege escalation via active user intent confirmation (`<Enter>`) for sensitive PAM actions like `sudo` or `su`, with an instant bypass for legacy passwords.
3738
- **Multi-Embedding Support**: Store multiple face embeddings per user for different lighting (`linuxcampam list`, `train --new`).
3839
- **PAM Integration**: Standard PAM module for Debian/Ubuntu.
3940
- **Security First**: [Threat Model & Risk Assessment](docs/THREAT_MODEL_AND_RISK_ASSESSMENT.md) included.
@@ -230,8 +231,8 @@ Shows the version of both the CLI client and the running daemon service.
230231
```bash
231232
linuxcampam version
232233
# Output:
233-
# Client Version: 0.9.7.4+ga8f02f6
234-
# Daemon Version: 0.9.7.4+ga8f02f6
234+
# Client Version: 0.9.7.5+ga8f02f6
235+
# Daemon Version: 0.9.7.5+ga8f02f6
235236
```
236237

237238
## Debugging

config/config.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ detection_threshold = 0.9
5858
; Default is 1000.
5959
; min_uid = 1000
6060

61+
; Require user confirmation (pressing Enter/Authenticate) before camera check for all non-exempt services.
62+
; This prevents silent privilege escalation (e.g., background sudo) by requiring explicit user intent.
63+
; Default is true.
64+
; require_confirmation = true
65+
66+
; Comma-separated list of PAM services that are exempt from the confirmation prompt.
67+
; Typically, these are login managers and screen lockers where the user explicitly initiated the login process.
68+
; Default is "gdm-password,sddm,lightdm,login,swaylock,i3lock,xscreensaver,kscreenlocker,kde,systemd-user"
69+
; confirmation_exempt_services = "gdm-password,sddm,lightdm,login,swaylock,i3lock,xscreensaver,kscreenlocker,kde,systemd-user"
70+
6171
; Whether to show the welcome message upon successful authentication.
6272
; Default is true.
6373
; show_welcome = true

debian/changelog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
linuxcampam (0.9.7.5-1) unstable; urgency=medium
2+
3+
* Release 0.9.7.5
4+
* Feat: Require interactive user confirmation for privilege escalation (UAC-style)
5+
* Feat: Add proximity wake-lock and background worker for sensor initialization
6+
* Fix: Prevent memory leaks in subprocess execution and ensure safe process tracking
7+
* Docs: Update threat model and risk assessment for new features
8+
9+
-- Vladimir Orlinski <contact.github.submerge594@slmails.com> Wed, 10 Jun 2026 22:17:20 +0200
10+
111
linuxcampam (0.9.7.4-1) unstable; urgency=medium
212

313
* Release 0.9.7.4

docs/CONFIGURATION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,14 @@ Protect against brute-force attacks by limiting the number of consecutive failur
159159
[Security]
160160
lockout_attempts = 5
161161
lockout_duration_sec = 300
162+
require_confirmation = true
163+
confirmation_exempt_services = gdm-password, swaylock, login, kdm, lightdm, sddm
162164
```
163165

164166
- **lockout_attempts**: Number of failed attempts before temporary lockout.
165167
- **lockout_duration_sec**: Duration of lockout in seconds (default 300s = 5 minutes).
168+
- **require_confirmation**: If `true` (default), blocks silent privilege escalation by requiring you to press `<Enter>` to invoke the camera, or type a password to seamlessly bypass face authentication altogether.
169+
- **confirmation_exempt_services**: A comma-separated list of PAM services that bypass the confirmation prompt. These are typically explicit login events where the camera should activate instantly to avoid user fatigue.
166170

167171
### Advanced Configuration Security
168172

docs/THREAT_MODEL_AND_RISK_ASSESSMENT.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ We use the STRIDE framework to analyze potential threats to the authentication p
112112
* **Threat 3 (Amplified Spoofing Window):** Automated wake and unlock constantly polls when presence is detected. An attacker can repeatedly present high-resolution masks or photos at their leisure while the user is away, increasing the window for brute-forcing the neural network.
113113
* **Mitigation:** This is actively mitigated by the daemon's existing brute-force protection (per-user lockout mechanism). After a configurable number of failed recognition attempts, the system enforces a strict cooldown period, neutralizing rapid spoofing attempts. Furthermore, IR liveness checks severely degrade the success rate of presentation attacks.
114114

115+
### 3.9 Silent Privilege Escalation (Confused Deputy)
116+
117+
* **Threat:** A malicious background script attempts to silently escalate privileges via `pkexec` or `sudo`. If the authorized user happens to be sitting in front of the computer, the camera passively authenticates the request without the user's knowledge or active intent, inadvertently granting `root` access to the malware.
118+
* **Mitigation:**
119+
* **Universal Confirmation:** The `require_confirmation` configuration (enabled by default) forces the PAM module to display an interactive prompt requiring the user to physically press `<Enter>` to confirm their intent *before* engaging the camera. This actively neutralizes silent escalation attacks for all non-exempt PAM services.
120+
* **Seamless Password Bypass:** The confirmation prompt now captures keystrokes (`"Press <Enter> for face auth, or type password:"`). If a user inputs a password, the module immediately aborts face authentication and passes the password securely (`PAM_AUTHTOK`) to the next module in the PAM stack (e.g., `pam_unix.so`). This avoids double-prompting while providing an instant opt-out for environments where users temporarily prefer passwords.
121+
* **Service Exemptions:** To prevent user fatigue, explicitly intentional authentication services (e.g., login managers like `gdm-password`, screen lockers like `swaylock`) are exempted from this confirmation prompt via the `confirmation_exempt_services` list.
122+
* **Residual Risk:** Fully mitigated by default. Administrators who manually add `sudo` or `polkit-1` to the exemption list actively assume this risk.
123+
115124
## 4. Risk Assessment Matrix
116125

117126
### 4.1 Methodology
@@ -145,6 +154,7 @@ Overall Risk is calculated by combining **Likelihood** (Low, Medium, High) and *
145154
| **Zero-Interaction** | Physical Coercion (Forced Unlock) | Low | Critical | **Medium** | Accepted Risk | Inherent to all biometrics (including fingerprints). Falls under organizational Risk Appetite; if unacceptable, disable LinuxCamPAM entirely. |
146155
| **Zero-Interaction** | Unintended Unlock (Walk-By after Lock) | Medium | High | **High** | No | User explicitly locks but remains in FOV. Disable zero-interaction unlock if at risk. |
147156
| **Zero-Interaction** | Amplified Spoofing Window | Medium | High | **Medium** | Yes | Polling increases attack window, but is effectively neutralized by existing auth lockouts and IR liveness checks. |
157+
| **Zero-Interaction** | Silent Privilege Escalation | Medium | Critical | **High** | Yes | `require_confirmation` blocks all unexpected services. Does not apply to exempt login managers. |
148158

149159
## 5. Future Security Enhancements (Roadmap)
150160

docs/man/linuxcampam.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: LINUXCAMPAM
33
section: 1
44
header: LinuxCamPAM User Manual
5-
footer: LinuxCamPAM 0.9.7.4
5+
footer: LinuxCamPAM 0.9.7.5
66
date: June 2026
77
---
88

docs/man/linuxcampam.conf.5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: LINUXCAMPAM.CONF
33
section: 5
44
header: LinuxCamPAM Configuration File
5-
footer: LinuxCamPAM 0.9.7.4
5+
footer: LinuxCamPAM 0.9.7.5
66
date: June 2026
77
---
88

docs/man/linuxcampamd.8.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: LINUXCAMPAMD
33
section: 8
44
header: LinuxCamPAM System Manager's Manual
5-
footer: LinuxCamPAM 0.9.7.4
5+
footer: LinuxCamPAM 0.9.7.5
66
date: June 2026
77
---
88

0 commit comments

Comments
 (0)