Skip to content

Detect and block virtual displays during SEB sessions - #1548

Open
suryanshvermaa wants to merge 1 commit into
SafeExamBrowser:masterfrom
suryanshvermaa:master
Open

suryanshvermaa wants to merge 1 commit into
SafeExamBrowser:masterfrom
suryanshvermaa:master

Conversation

@suryanshvermaa

Copy link
Copy Markdown

Overview

Resolves #1547.

This PR extends SEB's existing display validation to detect and reject active
virtual displays. This addresses the reported SpaceDesk scenario where a
virtual display can be used to extend or mirror the SEB desktop to another
device.

Problem

Issue #1547 reports that SpaceDesk can be used during an SEB session to create
an additional virtual display.

SEB already validates the number and type of active displays, but the existing
validation does not distinguish virtual displays from physical external
displays.

As a result, a virtual display may pass the existing display validation rules.

Solution

The fix extends the existing Windows WMI display detection mechanism to
identify virtual display technologies.

Rather than adding a SpaceDesk-specific executable or service to a blacklist,
the change detects the underlying display technology reported by Windows.

Changes

  • Added Display.IsVirtual to identify MiraCast and IndirectWired
    display technologies.
  • Added ValidationResult.HasVirtualDisplay.
  • Updated DisplayMonitor.ValidateConfiguration() to reject an active display
    configuration when a virtual display is detected.
  • Added a warning log when an active virtual display is detected.
  • Reuses SEB's existing display-change monitoring and validation flow.

Detection

SEB already queries WmiMonitorConnectionParams and reads
VideoOutputTechnology when loading display information.

The new IsVirtual property uses the existing VideoOutputTechnology
enumeration and currently considers:

  • MiraCast
  • IndirectWired

as virtual display technologies.

This allows the validation to operate at the display layer rather than
depending on a specific SpaceDesk process or service name.

Behaviour

When an active virtual display is detected:

  1. SEB identifies the display as virtual.
  2. The display configuration is marked as invalid.
  3. SEB's existing invalid-display handling is applied.
  4. If the virtual display is connected while SEB is running, the existing
    display-change monitoring causes the configuration to be validated again.

Compatibility

The existing display validation rules remain unchanged for physical displays.

In particular:

  • AllowedDisplays continues to be enforced.
  • InternalDisplayOnly continues to be enforced.
  • Existing physical display technologies are not changed.
  • No additional polling mechanism or background thread is introduced.
  • Existing WMI display detection and error handling are reused.

Testing

Code Review / Static Validation

The implementation was reviewed against the existing display monitoring and
validation flow.

The change is limited to:

  • SafeExamBrowser.Monitoring.Contracts/Display/ValidationResult.cs
  • SafeExamBrowser.Monitoring/Display/Display.cs
  • SafeExamBrowser.Monitoring/Display/DisplayMonitor.cs

Build / Runtime Testing

I was not able to perform a local build or runtime test because the required
SEB build environment exceeds the resources available on my development
machine.

Therefore, I have not claimed a successful runtime test with SpaceDesk.

The intended validation scenario is:

  1. Start a build containing this change.
  2. Start an SEB session.
  3. Connect a SpaceDesk virtual display.
  4. Verify that Windows reports the virtual display using the expected display
    technology.
  5. Verify that SEB detects the virtual display.
  6. Verify that SEB rejects the display configuration.
  7. Disconnect the virtual display and verify the normal display validation
    behaviour.

Scope

The changes are limited to addressing the virtual-display scenario described
in #1547.

No SpaceDesk-specific process blacklist has been introduced.

…afeExamBrowser#1547)

Prevents students from using virtual display adapters (e.g., SpaceDesk, Duet Display, Miracast) to bypass SEB security by mirroring or extending the exam screen.

- Added IsVirtual to Display to check for MiraCast and IndirectWired WMI video output technologies.

- Updated DisplayMonitor.ValidateConfiguration to immediately reject active configurations containing virtual displays.

- Dynamically triggers the SEB display configuration lock screen if a virtual display is connected mid-session.
@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.41%. Comparing base (379d0f9) to head (6f4b9f0).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...feExamBrowser.Monitoring/Display/DisplayMonitor.cs 0.00% 7 Missing ⚠️
SafeExamBrowser.Monitoring/Display/Display.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1548      +/-   ##
==========================================
+ Coverage   26.40%   26.41%   +0.01%     
==========================================
  Files         576      576              
  Lines       30238    30245       +7     
  Branches     3283     3284       +1     
==========================================
+ Hits         7983     7990       +7     
- Misses      21950    21952       +2     
+ Partials      305      303       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dbuechel

Copy link
Copy Markdown
Member

Thank you very much for the contribution, it is much appreciated! We'll review and potentially merge it in the upcoming days.

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.

SpaceDesk use to bypass SEB security

2 participants