Incomplete cleanup in SmartCard (CVE-2026-95303)
When a PC/SC context is disconnected, the Smart Card Provider API removes connection receivers directly, bypassing the Mojo disconnect handler that closes the connection watcher pipe. This leaves the smart card guard state permanently active, potentially allowing a background Isolated Web App to bypass focus checks and reconnect to a reader.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: When a PC/SC context is disconnected, the Smart Card Provider API removes connection receivers directly via ReceiverSet::Remove. This bypasses the registered Mojo disconnect handler, failing to close the corresponding connection watcher pipe in the browser process. Consequently, the smart card guard state is permanently leaked, potentially allowing a background Isolated Web App to indefinitely bypass focus checks and reconnect to a reader.
Affected files:
chrome/browser/chromeos/extensions/smart_card_provider_private/smart_card_provider_private_api.cc
Estimated timestamp from git blame: 2025-03-04
Potential Root Cause
In SmartCardProviderPrivateAPI::OnMojoContextDisconnected, the browser-side provider API implementation attempts to tear down all active reader connections associated with a released PC/SC context:
// chrome/browser/chromeos/extensions/smart_card_provider_private/smart_card_provider_private_api.cc
void SmartCardProviderPrivateAPI::OnMojoContextDisconnected() {
...
const ContextId scard_context = context_receivers_.current_context();
ContextData& context_data = GetContextData(scard_context);
for (mojo::ReceiverId connection_receiver_id :
context_data.connection_receiver_ids) {
connection_receivers_.Remove(connection_receiver_id);
}
...
}
Under Mojo architecture, explicitly removing a receiver from a mojo::ReceiverSet via Remove() locally does not trigger the registered connection disconnect handler (OnMojoConnectionDisconnected).
However, OnMojoConnectionDisconnected() contains critical cleanup logic responsible for terminating the associated connection watcher remote (connection_watchers_) and updating internal tracking maps:
void SmartCardProviderPrivateAPI::OnMojoConnectionDisconnected() {
...
// Break the watcher pipe.
auto it = connection_watchers_per_receiver_.find(
connection_receivers_.current_receiver());
if (it != connection_watchers_per_receiver_.end()) {
connection_watchers_.Remove(it->second);
connection_watchers_per_receiver_.erase(it);
}
...
}
Because this handler is bypassed when a context is disconnected, the mojo::Remote<SmartCardConnectionWatcher> remains registered in connection_watchers_ indefinitely, leaking the watcher pipe and the associated tracking map entries.
Potential Security Impact
-
Background Reconnection Bypass: Normally,
ChromeOsSmartCardDelegate::HasReaderPermissionpermits reconnections only if the app has focus or has recently used the reader within a 15-second window (kSmartCardAllowedReconnectTime). Because the leaked connection watcher pipe remains open,SmartCardServicenever receives a pipe-closure notification, keepingPageSpecificContentSettings::IsInUse(SMART_CARD_GUARD)stuck attrueindefinitely. An attacker could potentially leverage this to reconnect to a smart card reader from a background IWA at any time, bypassing the 15-second limit and focus requirements. -
State Leakage & UI Spoof: The user-visible location-bar indicator showing that a smart card reader is "in-use" remains active permanently, hiding the fact that active communication has ceased.
-
Profile-Bound Memory Leak: Bidirectional lookup maps inside
SmartCardProviderPrivateAPIgrow with every context-initiated disconnection, causing a slow memory leak in a profile-keyed singleton.
Suggested Steps to Demonstrate/Trigger (Potential)
Note: These are potential steps. Our analysis is based on static code tracing, as our tooling agent does not currently have the capability to compile or execute ChromeOS binary environments.
-
Install an Isolated Web App (IWA) with
smart-cardpermissions on ChromeOS and grant it access to a reader. -
Execute JavaScript in the IWA to establish a context and connect to the reader:
JavaScript const ctx = await navigator.smartCard.establishContext(); const conn = await ctx.connect(reader, ...); -
Explicitly drop or close the context wrapper remote (
ctx) while keeping the connection remote (conn) alive. -
Move the IWA to the background and wait longer than 15 seconds.
-
Call
connect()again from the background. Due to the leakedSMART_CARD_GUARDactive state, the connection check will succeed from the background.
Proposed Fix
In SmartCardProviderPrivateAPI::OnMojoContextDisconnected(), explicitly look up and clean up the corresponding connection watchers and maps for each connection receiver ID prior to removing the receiver from connection_receivers_:
void SmartCardProviderPrivateAPI::OnMojoContextDisconnected() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
...
const ContextId scard_context = context_receivers_.current_context();
ContextData& context_data = GetContextData(scard_context);
for (mojo::ReceiverId connection_receiver_id :
context_data.connection_receiver_ids) {
auto watcher_it = connection_watchers_per_receiver_.find(connection_receiver_id);
if (watcher_it != connection_watchers_per_receiver_.end()) {
mojo::RemoteSetElementId watcher_id = watcher_it->second;
connection_watchers_.Remove(watcher_id);
connection_watchers_per_receiver_.erase(watcher_it);
connection_receivers_per_watcher_.erase(watcher_id);
}
connection_receivers_.Remove(connection_receiver_id);
}
...
}
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the code removes connection receivers directly instead of letting the normal disconnect handler run, so the associated watcher pipe and tracking maps are never cleaned up.
Impact
A background Isolated Web App could potentially bypass the 15-second reconnection limit and focus requirements, and the user-visible in-use indicator would remain active, hiding that communication has ceased; this is based on static analysis, not a live exploit.
What the attacker needed
ChromeOS device; Isolated Web App with smart-card permission; User grants reader access
The fix
The code should explicitly clean up the connection watchers and tracking maps for each connection receiver before removing the receiver.
How it was found
- Install an Isolated Web App with smart-card permissions and grant reader access.
- Run JavaScript to establish a context and connect to the reader.
- Drop the context wrapper while keeping the connection alive.
- Move the app to the background and wait more than 15 seconds.
- Call connect() again from the background; the leaked guard state allows it.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart card reader is a device that reads cards, and a web app can ask to use it. Normally, an app can only reconnect to the reader if it is in the foreground or used it recently. A bug in how the browser cleans up after an app disconnects leaves a 'still in use' signal stuck on, so a background app might be able to reconnect without permission.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.