Face Anti-Spoofing: Liveness Detection and Replay Attacks

A photo can resemble the account holder without the account holder being there. Here is what a liveness check adds to web login, where its limits are, and how to respond when a check fails.

Back to Knowledge Center
By FACEIO Engineering Team Updated

What Is Face Anti-Spoofing?

Face anti-spoofing helps distinguish a person in front of a camera from something presented in their place, such as a portrait on a phone screen. Detecting that kind of attempt is called presentation attack detection (PAD).

Imagine a customer signing in to a billing portal. Face matching asks whether the capture resembles an enrolled user. Liveness detection looks for evidence that a live person is present during capture. A good likeness answers the first question, not the second. Neither check determines whether the customer may change a billing address.

In FACEIO, Liveness and Face Spoof Protection is an application setting and is off by default. Check it in the application you actually use for login. PIN Code validation is a separate setting: asking for a PIN does not turn on spoof protection.

What Counts as a Presentation Attack?

The key is what the camera sees. In a presentation attack, someone puts an object or display in front of the sensor. These three examples help explain why a face match alone is not enough.

A phone plays a recording in front of a webcam. The arrows trace the video from the phone display to the camera lens.
In a screen replay, the webcam captures a new frame of an old recording. A live camera feed is not proof that its subject is present.

Printed Photo Attacks

A printed portrait can contain the same facial features as the enrolled image. Recognizing those features does not establish that the person in the portrait is present.

Screen Replay Attacks

A phone playing a recording can show the account holder moving or blinking. There is motion in the picture, but the camera is looking at a screen, not the account holder.

3D Mask Attacks

Unlike a flat picture, a physical mask has depth and moves with its wearer. Evidence that a check handles printed photos does not establish how it performs against masks.

Active vs. Passive Liveness Detection

The difference is whether the user has to respond to a prompt. Both approaches assess the capture; neither identifies the account on its own.

Active Liveness Detection

An active check might ask the person to turn their head in a particular direction. The response has to fit this session’s prompt; movement alone is not the point. Consider what happens if a customer cannot perform the requested action.

Passive Liveness Detection

A passive check assesses the capture without asking the person to perform a gesture. That avoids an extra task for the user, but a poor capture can still be inconclusive. A failed check is not a finding of fraud.

When comparing tools, ask which presentation attacks were tested, on what cameras, and how often genuine users were rejected. For an independent example of how narrowly to read a result, see NIST’s evaluation of passive software-based PAD on conventional 2D images. It is not a certification of FACEIO.

What to Do When a Face Check Fails

In fio.js, enrollment and authentication can reject with different error codes. Choose the next step based on what the widget reports. Do not issue a session or approve an action on the strength of a client-side callback alone.

The browser cannot get a usable capture

fioErrCode.PERMISSION_REFUSED means camera access was not granted in time. Offer a way to check browser permissions or use another sign-in method. fioErrCode.NO_FACES_DETECTED means no face was found in time; suggest better lighting or adjusting the camera. Neither result means a spoof was detected.

The face is not recognized

fioErrCode.UNRECOGNIZED_FACE during sign-in is a matching failure, not a PAD alert. Offer a bounded retry or your existing recovery process. Do not attach a new enrollment to an existing account until the user has independently established control of it.

The capture is flagged as a suspected presentation attack

When spoof protection flags an attempt, the widget can return fioErrCode.PAD_ATTACK. Stop the current attempt. Tell the user, for example, “We couldn’t complete the face check. Try another sign-in method.” Do not expose detector details or treat the flag as proof of misconduct.

Keep the account decision on the server

Limit repeated attempts and keep a minimal record of the time, request context, and outcome. A failed capture may not identify anyone: do not assume it returned a Facial ID, or lock an account solely because a browser reported an error. Follow your privacy and retention policy without storing face images or biometric hashes in error logs.

How to Test Liveness Checks Before Rollout

Start with the browsers and cameras your customers use. The standard FACEIO web flow uses a webcam or phone camera; a successful check on a well-lit laptop tells you little about completion on an older phone.

In a pilot with consenting users, record the number of completed attempts as well as failures. Separate camera-permission problems, unrecognized faces, and suspected presentation attacks. A single “failed login” count cannot tell you whether to improve camera instructions or review a security decision.

When reviewing pilot results, ask two separate questions: how often did the check stop a genuine customer, and how often did it accept a known replay? A camera permission denial belongs in neither group: no capture reached the liveness check.

Follow one legitimate customer through a failed check. Can they use an accessible alternative without weakening the account recovery rules? Verify that canceling the widget or exhausting retries leaves the protected action unapproved.

Are Deepfakes the Same as Presentation Attacks?

No. Deepfake describes how media was created or altered. Presentation attack describes how it reaches the sensor. A synthetic video shown to a webcam on a screen is a presentation attack. A substituted digital feed is an injection risk: there may be nothing in front of the lens for a camera-based check to inspect.

If a vendor reports good results against photo and screen replays, do not read that as evidence of protection against every synthetic feed. Ask about injection separately. For login, keep PIN validation and server-side access checks in place independently of the liveness result.

Choose a tool for the question at hand. Meeting Shield reports risk signals in supported browser meetings; it does not authenticate a portal user. If you are reviewing an uploaded video rather than a live sign-in, use the guide to investigating deepfakes and AI-generated content instead.

A Release Check for Your Login Flow

Use a test account to confirm the behavior of the whole application, not just the widget. Before enabling the flow for customers:

  • Check the application settings. Verify spoof protection in the intended FACEIO application, along with PIN validation and allowed domains.
  • Check the denial path. A canceled or flagged login must not create a session. A failed step-up check must not authorize the pending action.
  • Check the recovery path. A legitimate customer who cannot use the camera should have an alternative. Switching methods must not grant access before account ownership is verified.
  • Check what support sees. Record enough context to investigate a failed request without saving camera captures or labeling a customer as an attacker.

Frequently Asked Questions

Can a photo pass a face recognition check?

A photo can resemble the enrolled user closely enough for a face matcher. A liveness check asks a different question: is a live person present during capture? No check detects every presentation attack.

What does PAD stand for in face authentication?

PAD stands for presentation attack detection. The attack is the presentation of a photo, screen replay, mask, or other artifact to the camera. PAD is the attempt to detect it.

Does liveness detection catch every deepfake?

No. A video shown on a screen and a digitally substituted camera feed reach the application in different ways. Results against screen replays alone do not establish protection against digital injection.

Do users need a depth camera?

No. The standard FACEIO browser flow uses a webcam or phone camera and does not require a depth or infrared sensor. Camera permission and a usable capture are still needed.

What does a FACEIO spoof alert mean?

fioErrCode.PAD_ATTACK means the capture was flagged as a suspected presentation attack. Do not grant access from that attempt. Apply your retry or recovery policy rather than treating the alert as proof of fraud.

Related Guides

Test Spoof Protection in Your Application

Open your test application in the FACEIO Console, enable Liveness and Face Spoof Protection, and check what a customer sees when authentication cannot be completed.

Open FACEIO Console View Getting Started