Skip to content

fix(security): M5c hidraw hardening — enumeration, FFI bounds, credential parsing#142

Merged
Jesssullivan merged 1 commit intomainfrom
sid/m5c-hidraw-hardening
Apr 3, 2026
Merged

fix(security): M5c hidraw hardening — enumeration, FFI bounds, credential parsing#142
Jesssullivan merged 1 commit intomainfrom
sid/m5c-hidraw-hardening

Conversation

@Jesssullivan
Copy link
Copy Markdown
Owner

Summary

Updates zig-ctap2 submodule with security hardening (Jesssullivan/zig-ctap2#25):

  • hidraw enumeration: scan /sys/class/hidraw/ instead of hardcoded 0-15 range; fallback to 0-255 if sysfs unavailable
  • HID descriptor parser: proper bounds check before reading data bytes (prevents OOB read on malformed descriptors)
  • FFI buffer overrun prevention: size check before every @memcpy to caller-provided output buffers
  • Credential ID bounds: reject IDs >1024 bytes in CTAP2 parser (spec-compliant keys are 16-256 bytes)
  • Error granularity: new DevicesNotAccessible / CTAP2_ERR_NOT_ACCESSIBLE distinguishes "no FIDO devices" from "found but can't open" (permissions/udev)

Test plan

  • Linux CI builds zig-ctap2 successfully
  • Existing CTAP2 unit tests pass
  • Fork CI (Nix flake check) passes

Points to Jesssullivan/zig-ctap2#25:
- Scan /sys/class/hidraw/ instead of hardcoded 0-15 range
- FFI buffer bounds checks before all memcpy to caller buffers
- Credential ID size bound (1024 bytes max)
- HID descriptor parser bounds hardening
- New CTAP2_ERR_NOT_ACCESSIBLE error for permission issues
@Jesssullivan Jesssullivan merged commit 3f511be into main Apr 3, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant