← All issues

[26] WKDateTimePicker SetForScope writes to freed self

Severity: Medium | Component: WebKit UIProcess iOS forms | 7b904b1

Rated Medium because the diff fixes a UAF in the UI process: a SetForScope RAII guard tied to _isDismissingDatePicker outlived self when [_datePickerController dismissViewControllerAnimated:NO completion:nil] re-entered runloop work that dropped the last reference to the WKDateTimePicker, then wrote NO into freed memory at scope exit.

Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm

- (void)removeDatePickerPresentation
{
if (_datePickerController) {
if (!_isDismissingDatePicker) {
SetForScope isDismissingDatePicker { _isDismissingDatePicker, YES };
- [_datePickerController dismissViewControllerAnimated:NO completion:nil];
+ [protect(_datePickerController) dismissViewControllerAnimated:NO completion:nil];
}
_datePickerController = nil;
}
}

Use-after-free via RAII scope-guard outliving its enclosing object across an Objective-C re-entrancy boundary.

Three call sites wrapped: removeDatePickerPresentation, plus WKFormPeripheralBase's beginEditing/endEditing for the same controlBeginEditing/controlEndEditing shape. WKDatePickerPopoverController.mm similarly protects a __weak _delegate.

🔒

The ownership and lifetime story behind a single-byte write into freed UI-process memory, including what an attacker would need to turn this into something more than a crash.

Subscribe to read more

🔒

Four reusable audit patterns identified, covering RAII scope guards, IPC-driven UIKit dismissal paths, and weak-ivar dereferencing across WebKit's iOS UI process.

Subscribe to read more