summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2025-06-29 02:29:33 +0100
committerGitHub <noreply@github.com>2025-06-29 02:29:33 +0100
commit711b109246dc7d7e3881ccf70dce4adceefb4b02 (patch)
tree8c12759de3302ba7d433e30748e8eb8bee73d567
parent6347d18a2d4ffa041e175655e8669041e1f45d53 (diff)
Mitigate VIA keylogger security issues (#25414)
Co-authored-by: Nick Brassel <nick@tzarc.org>
-rw-r--r--builddefs/common_features.mk3
-rw-r--r--docs/ChangeLog/20250831/PR25414.md5
-rw-r--r--quantum/via.c8
3 files changed, 16 insertions, 0 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
index 90231c9a96..c122afcff9 100644
--- a/builddefs/common_features.mk
+++ b/builddefs/common_features.mk
@@ -635,6 +635,9 @@ ifeq ($(strip $(VIA_ENABLE)), yes)
635 RAW_ENABLE := yes 635 RAW_ENABLE := yes
636 BOOTMAGIC_ENABLE := yes 636 BOOTMAGIC_ENABLE := yes
637 TRI_LAYER_ENABLE := yes 637 TRI_LAYER_ENABLE := yes
638 ifeq ($(strip $(VIA_INSECURE)), yes)
639 OPT_DEFS += -DVIA_INSECURE
640 endif
638endif 641endif
639 642
640ifeq ($(strip $(RAW_ENABLE)), yes) 643ifeq ($(strip $(RAW_ENABLE)), yes)
diff --git a/docs/ChangeLog/20250831/PR25414.md b/docs/ChangeLog/20250831/PR25414.md
new file mode 100644
index 0000000000..bee901c6ca
--- /dev/null
+++ b/docs/ChangeLog/20250831/PR25414.md
@@ -0,0 +1,5 @@
1# Mitigate VIA keylogger security issues [#25414](https://github.com/qmk/qmk_firmware/pull/25414)
2
3VIA's keyboard matrix testing functionality, which allows users to identify active key presses, has been identified as a potential security concern by community members and security researchers. This feature has been demonstrated to enable unauthorized keystroke capture, with documented examples showing how malicious scripts could exploit this capability to create keyloggers. A recent security assessment revealed that user credentials could be compromised by exploiting the matrix testing function combined with VIA's keycode assignment queries. In this attack scenario, a script could remain active during a locked session and capture password input when users authenticate upon return.
4
5The QMK team notified the VIA team of this security vulnerability on May 17, 2022, and made multiple subsequent attempts to coordinate a mitigation strategy. Despite repeated outreach, the VIA team has provided no acknowledgment or response to these security concerns. Given the severity of the potential security implications and the lack of engagement from the VIA team, the QMK team has unilaterally implemented a security enhancement that modifies the keyboard matrix testing functionality to prevent the reporting of key press events. This change prioritizes user security and data protection over potential feature compatibility concerns within VIA.
diff --git a/quantum/via.c b/quantum/via.c
index 3682b4ab2b..9446811af6 100644
--- a/quantum/via.c
+++ b/quantum/via.c
@@ -22,6 +22,10 @@
22# error "DYNAMIC_KEYMAP_ENABLE is not enabled" 22# error "DYNAMIC_KEYMAP_ENABLE is not enabled"
23#endif 23#endif
24 24
25#ifdef VIA_INSECURE
26# pragma message "VIA_INSECURE is enabled - firmware is susceptible to keyloggers"
27#endif
28
25#include "via.h" 29#include "via.h"
26 30
27#include "raw_hid.h" 31#include "raw_hid.h"
@@ -318,7 +322,11 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
318 uint8_t rows = 28 / ((MATRIX_COLS + 7) / 8); 322 uint8_t rows = 28 / ((MATRIX_COLS + 7) / 8);
319 uint8_t i = 2; 323 uint8_t i = 2;
320 for (uint8_t row = 0; row < rows && row + offset < MATRIX_ROWS; row++) { 324 for (uint8_t row = 0; row < rows && row + offset < MATRIX_ROWS; row++) {
325#ifdef VIA_INSECURE
321 matrix_row_t value = matrix_get_row(row + offset); 326 matrix_row_t value = matrix_get_row(row + offset);
327#else
328 matrix_row_t value = 0;
329#endif
322#if (MATRIX_COLS > 24) 330#if (MATRIX_COLS > 24)
323 command_data[i++] = (value >> 24) & 0xFF; 331 command_data[i++] = (value >> 24) & 0xFF;
324#endif 332#endif