Real-Time Prevention of Shoulder Surfing Attacks Through Object Detection

Shoulder Surfing Face Detection ML Kit Privacy Protection Real-Time Detection

Authors

  • Farras Lathief Department of Informatics Engineering, Faculty of Science and Technology, Universitas Islam Negeri Sultan Syarif Kasim Riau, Indonesia
  • Rahmad Abdillah Department of Informatics Engineering, Faculty of Science and Technology, Universitas Islam Negeri Sultan Syarif Kasim Riau, Indonesia
  • Novriyanto Department of Informatics Engineering, Faculty of Science and Technology, Universitas Islam Negeri Sultan Syarif Kasim Riau, Indonesia
  • Pizaini Department of Informatics Engineering, Faculty of Science and Technology, Universitas Islam Negeri Sultan Syarif Kasim Riau, Indonesia
May 29, 2026
May 31, 2026

Downloads

: Shoulder surfing is a social engineering attack in which an observer covertly views a victim’s device screen to steal sensitive information. Existing countermeasures, such as privacy films and screen-obfuscation software, operate passively and fail to definitively block observers at straight-on angles. This study proposes a real-time shoulder surfing prevention application for Android that integrates Google ML Kit Face Detection with the CameraX API and foreground service. The system detects multiple faces in the front camera field of view and triggers an automatic screen lock when more than one face satisfying four filtering conditions is detected: valid facial landmark structure, horizontal rotation angle below 36°, dynamic eye-open probability threshold adapted to ambient lighting, and a minimum bounding box area ratio for proximity validation. Testing on two devices with different hardware specifications across variations in observation distance (0.5–2 m) and lighting (bright and dim) confirmed the system's functional reliability. On the high-end device, the system achieved up to 17.21 FPS with a minimum response time of 74 ms, though this higher processing intensity resulted in greater battery consumption. Evaluation revealed that detection speed drops at extreme distances due to the loss of face tracking efficiency near the minimum detection threshold, and in low-light conditions due to hardware-level shutter speed constraints. Despite these hardware-dependent limitations, functional correctness was maintained on the mid-range device with response times consistently below 300 ms. Supplementary testing on disguised observer scenarios, including the use of a physical mask, sunglasses, and a face mask, further confirmed that the system successfully detected partially occluded faces as active threats, demonstrating robustness against deliberate concealment attempts. The results confirm that the system provides a successful, automated, on-device shoulder surfing prevention mechanism without requiring internet connectivity, cloud processing, or custom model training.