MagLive: Near-Field Magnetic Sensing-Based Voice Liveness Detection on Smartphones

Xiping Sun, Jing Chen, Cong Wu, Kun He, Haozhe Xu, Yebo Feng, Ruiying Du, Xianhao Chen · DOI

Abstract

Voice authentication systems are increasingly vulnerable to replay attacks using loudspeakers. We present MagLive, a passive voice liveness detection system that leverages a smartphone's built-in magnetometer. Unlike existing solutions that require specialized hardware or active acoustic sensing, MagLive detects the subtle magnetic field fluctuations caused by electromagnetic induction in loudspeaker voice coils. Our evaluation shows that MagLive achieves a Balanced Accuracy (BAC) of 99.01% with minimal latency, providing a robust and user-friendly defense against voice spoofing.

Introduction

Voice-based interaction and authentication, such as "Voiceprint" or "OK Google," have become standard features on modern smartphones. However, these systems are highly susceptible to spoofing attacks, where an attacker records a legitimate user's voice and replays it through a loudspeaker. Existing defenses often require multi-microphone arrays, active sensing (emitting high-frequency sounds), or specific user gestures, which can be intrusive or hardware-dependent.

The Spoofing Challenge

The primary threat addressed by MagLive is the replay attack. As illustrated in Figure 1, an attacker can record a human's voice, manipulate it, and replay it using a loudspeaker to deceive a smartphone's voice authentication system.

MagLive scenario and liveness detection against replay attacks.

MagLive Methodology

MagLive's core innovation is the use of the magnetometer as a security sensor. The system is based on a fundamental physical difference: human speech is biological and non-magnetic, whereas loudspeakers rely on electromagnetic induction. When a loudspeaker plays audio, the voice coil moves within a permanent magnet's field, creating detectable fluctuations in the local magnetic field.

Data Processing and Feature Extraction

MagLive captures magnetometer data at 100Hz and audio at 44.1kHz. A high-pass Butterworth filter removes the Earth's static magnetic field and ambient noise. The audio signal is used to segment the magnetic data, ensuring the system only analyzes signals during active speech.

Voice and magnetometer data for a Pixel3a replaying speech.

As shown in Figure 4, the loudspeaker's magnetic signature correlates with the voice magnitude. MagLive employs a custom neural network architecture, TF-CNN-SAF, which combines 1D-CNNs for temporal features and 2D-CNNs for time-frequency spectrograms. A Self-Attention-based Fusion (SAF) block adaptively weighs these features. To ensure device-irrelevance, the model is trained using supervised contrastive learning, maximizing the separation between "human" and "speaker" classes in the feature space.

Experimental Evaluation

The system was tested using a comprehensive dataset:

  • Human Data: 1,000 samples from 20 participants.
  • Spoofing Data: 8,000 samples replayed via 8 different devices, including high-end smartphones (P30, Pixel 3a), tablets, and smart speakers.
  • Environments: Lab, office, and inside a vehicle.

Key Results

  • Accuracy: MagLive achieved an average Balanced Accuracy (BAC) of 99.01% and an Equal Error Rate (EER) of 0.77%.
  • Efficiency: The system is lightweight, with an authentication latency of 0.1 seconds and a memory footprint of ~59.4 MB.
  • Robustness: Performance remained high across different user postures and background noise levels. The system is most effective when the sound source is within 6 cm of the device.

Discussion and Future Work

MagLive focuses on magnetic patterns rather than simple magnitude thresholds, making it robust to varying environmental magnetic fields. Because it detects the physical hardware (the speaker) rather than the audio content, it is inherently resistant to advanced digital attacks like adversarial audio.

However, limitations remain. Significant user movement (e.g., walking) introduces magnetic noise that can degrade performance. Future work will focus on developing motion-filtering models and expanding the dataset to include more diverse users and environments. Additionally, while the 6 cm distance constraint is effective for security, the team aims to improve the sensing range for better user experience.

Summary updated

BibTeX
@article{sun2026maglive,
  author = {Xiping Sun and Jing Chen and Cong Wu and Kun He and Haozhe Xu and Yebo Feng and Ruiying Du and Xianhao Chen},
  title = {{MagLive: Near-Field Magnetic Sensing-Based Voice Liveness Detection on Smartphones}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2026},
  doi = {10.1109/tifs.2026.3673129},
}
Figure