Defeating Facial Tracking: Red Team vs Blue Team

Scan your face. Trust the stream. A replay, a synthetic face and a borrowed identity attack different parts of that bargain. The lab puts the signal rules, missing evidence and challenge boundary on the bench, with code and results attached.

Scan your face. Prove you're over eighteen. Somewhere between those two sentences, a camera became a witness.

The witness has a driver, an operating system, a browser and whatever video the application actually receives. Before declaring that a blink proves anything, follow that path. Who supplied the frames? Who extracted the signals? Which component turned them into permission?

Discord's September 2026 age-confirmation documentation describes automatic age grouping for most users and several confirmation methods whose availability varies by region and device. It says facial age estimation runs on the device. That is a different account from this article's original claim that every user had to submit a facial scan. This October 27 update checks the documented choices, not a platform bypass.

The original “entire stack compromised in three hours” opening had no incident record behind it. Neither did its airport-mask anecdote. The useful story survives without either: a system that accepts evidence from a device has to decide what that evidence establishes.

Four questions behind one green tick

Face detection finds a face-shaped region. Recognition compares identity. Age estimation predicts an age or range. Presentation-attack detection asks whether an artifact is being presented to the sensor. Digital injection can enter after that sensor. A system can answer one question correctly and still grant the wrong thing.

A photograph can contain a perfectly recognizable face. A genuine adult can verify while somebody else operates the account. A detector can reject a print and accept a screen under different capture conditions. “Facial verification” is too large a label to tell us which boundary held.

NIST's software-only PAD evaluation examined 82 passive algorithms on conventional two-dimensional imagery. Depth hardware is not the only possible defense. The evaluation also gives us a better habit than announcing that masks beat cameras: name the presentation instrument, the capture conditions and the detector being measured.

Red Team: Seven Surfaces to Put on the Bench

Video loops

A recorded face can blink and move. A detector that treats the presence of motion as sufficient evidence can accept a recording. That is the hypothesis. To earn the finding, feed an owned recording through the actual capture path, retain the challenge and timestamps, and record the receiving system's decision.

A fresh unpredictable action sequence creates another demand on a fixed recording. It does not prove the frames came from a sensor, and a responsive generator can pose a different problem. The lab below tests the sequence boundary rather than pretending a thirty-second clip passes every product.

Deepfake face swaps

A driven face can combine one person's appearance with another person's movements. The interesting checks are temporal consistency, identity binding and where the generated frames enter the pipeline. A virtual source and a screen held to a camera do not exercise the same defenses.

The previous FOMM loop imported a nonexistent local module and treated an animation API as a working live frame pipeline. There was no checkpoint, dependency environment, latency measurement or receiving-system result attached. A real test needs those artifacts. The executable replacement here follows the existing detector's actual input contract and shows how a supplied all-clear feature vector is handled. It does not claim to generate or detect a face swap.

Printed faces and three-dimensional masks

A flat print and a shaped mask have different geometry. A three-dimensional mask can have a protruding nose. Saying “the mask is flat” quietly wins an experiment against an object you never tested.

The depth convention matters too. For camera-distance measurements, a closer nose normally has a smaller value than the eye plane. The original comparison reversed that relationship. This function calculates the relief in millimeters from already-aligned samples:

function depthReliefMm({ nose, leftEye, rightEye }) {
  if (![nose, leftEye, rightEye].every(value => Number.isFinite(value) && value > 0)) {
    throw new TypeError("Expected positive camera-distance millimeters");
  }
  return (leftEye + rightEye) / 2 - nose;
}

At nose 480 mm and eyes 500 mm, the relief is 20 mm. A flat fixture returns zero. A shaped mask with the same supplied distances also returns 20 mm. All three cases run in the capture-boundary checker. Geometry can describe a shape without telling you whether it is alive. Alignment, pose, sensor uncertainty and the measurement source still matter.

Infrared interference

Infrared illumination and visible-light capture expose different appearances. Materials, lighting and wavelength can affect landmarks or image quality. That makes a useful controlled capture experiment, not a universal recipe for disappearing from an IR system.

An obscured face is also not a successful identity substitution. Record whether the system rejects capture, asks for another attempt, accepts an incorrect identity or grants access through a fallback. Those outcomes belong in different columns. Switching to visible light cannot be declared a complete fix without testing that path too.

Virtual cameras and downstream injection

A virtual camera supplies frames through a software device. Browser device enumeration returns available devices subject to permission and policy. A friendly label does not authenticate a physical sensor, and a list containing “OBS” does not establish how another product handles it.

The receiving system may use its own checks, native capture or platform signals. Review those controls at the actual ingestion point. Blocking a device name leaves post-capture substitution as a separate question. Conversely, seeing a virtual device in the picker does not prove that verification accepted its stream.

Entirely synthetic faces

A generated face need not correspond to an enrolled person. Whether it changes an age estimate, passes a particular PAD detector or satisfies an identity comparison requires three different observations.

The old StyleGAN block mixed incompatible assumptions about implementation and checkpoint format, then asserted that its output passed all liveness checks. No such run was attached. Preserve the generator version, checkpoint hash, preprocessing and output clip before testing a detector. A convincing portrait is an input artifact, not a verdict.

Another person at the camera

A real person can satisfy a liveness test while the account belongs to somebody else. That exposes the binding between the person, the session and the later action. No amount of counting blinks establishes that the same person keeps using the account.

Reverification, recovery and session handling therefore need their own tests. There is no evidence here for the original claim that most products never verify again. The relevant question is what this product does when the account or device changes hands.

Blue Team: Run the Rule Path

The Facial Liveness Detection Lab already implements a rule scorer over supplied texture, motion, depth and remote photoplethysmography signals. It does not extract those features from video. Its thresholds are authored fixture settings, not calibrated operating points.

This is its actual fused decision function. assessSignals, in the same module, validates supplied ranges and returns null for missing checks:

function fusedDetect(signals) {
  const assessment = assessSignals(signals);
  const flagged = Object.values(assessment.checks).some(value => value === true);
  return { flagged, flags: assessment.checks, decision: flagged ? "flagged" : assessment.missing.length ? "inconclusive" : "clear", missing: assessment.missing };
}

Any observed adverse rule flags the record. With no adverse rule, missing evidence makes it inconclusive. Only complete nonflagging evidence produces clear. “Clear” means the rules did not fire. It does not mean the person is an adult, the face is live or the source is authentic.

The source-backed replay loads the actual module and evaluator from a trusted checkout. It checks the bundled six-record dataset, malformed evidence and an attack record supplied with the same signals as the benign fixture:

node facial_pad_replay.cjs /path/to/facial_liveness_detection_lab

The recorded result includes both source hashes and the dataset hash. Four declared attack records yield three flagged and one clear. Two declared bona-fide records yield one clear and one inconclusive. The attack-clear fraction is 1/4 for these authored inputs. It is not a field error rate.

The extra attack carrying the benign vector returns clear too. This is the actual data path: if an untrusted client authors the evidence, perfect range validation still cannot make those numbers a camera observation. The receiving service needs a trustworthy extraction path before the classifier's score becomes meaningful.

A Challenge That Actually Expires

The original “random challenge” block printed a fixed sequence and did not verify anything. This replacement issues three distinct actions, keeps its own copy, binds them to a session and consumes the challenge on a verification attempt by that session:

const crypto = require("node:crypto");

function makeChallengeGate() {
  const pending = new Map();
  function issue(session, now) {
    if (typeof session !== "string" || !session || !Number.isFinite(now)) throw new TypeError("Invalid session/time");
    const actions = ["turn_left", "turn_right", "blink", "look_up"];
    for (let i = actions.length - 1; i > 0; i--) {
      const j = crypto.randomInt(i + 1);
      [actions[i], actions[j]] = [actions[j], actions[i]];
    }
    const challenge = { id: crypto.randomBytes(16).toString("hex"), actions: actions.slice(0, 3),
      issued: now, expires: now + 10000 };
    pending.set(challenge.id, { ...challenge, actions: [...challenge.actions], session });
    return challenge;
  }
  function verify(id, session, observations, now) {
    const expected = pending.get(id);
    if (!expected || expected.session !== session) return false;
    pending.delete(id);
    if (!Number.isFinite(now) || now < expected.issued || now >= expected.expires) return false;
    if (!Array.isArray(observations) || observations.length !== expected.actions.length) return false;
    let previous = expected.issued;
    return observations.every((observation, index) => {
      if (!observation || observation.action !== expected.actions[index]
          || !Number.isFinite(observation.at) || observation.at <= previous || observation.at > now) return false;
      previous = observation.at;
      return true;
    });
  }
  return { issue, verify };
}

The complete checker runs 21 assertions across this gate, the depth function and the routing function below. An ordered in-window fixture succeeds once. Reuse, another session, expiry, reversal, pre-issuance timestamps, future timestamps, repeated times and a modified client copy fail. The other session's failed attempt does not consume the legitimate session's challenge. Recorded results.

node liveness_capture_boundary.cjs

The observations in this replay are authored objects. A video extractor must produce them using the server's challenge and a comparable trusted clock; accepting the client's action names and timestamps would surrender the boundary again. There is no vision model in this gate. It demonstrates request freshness and sequence checking, not physical liveness. Four actions taken three at a time yield only 24 possible orders. A recording library could cover them. The nonce identifies the request but is not embedded in authenticated video. Pending-state limits, persistent storage, concurrency across workers and capture binding remain implementation work.

Detection, Depth and Fusion Need Their Own Evidence

A real deepfake detector needs its model, weights, face crop, normalization, score meaning and held-out evaluation. The previous EfficientNetB4Detector example supplied none of those and called undefined helpers. An average of uncalibrated frame scores does not become a trustworthy clip decision because the threshold has two decimal places.

Depth can add a measurement that a flat screen lacks. It can also describe a shaped artifact. Texture, motion, pulse and depth can contribute evidence, but their errors are not automatically independent. Adding four confidence values with invented weights can conceal a missing sensor behind three convenient numbers. The actual scorer keeps unavailable evidence visible instead.

Its existing 15 signal assertions and eight evaluation tests pass again. They include an all-signals-pass synthetic miss. A native image integration test also passes: authored black, white and transparent PNGs, a JPEG and rejected invalid/oversized inputs go through Apple's image decoding and Vision observation path. Those decoded images produce no PAD signals and remain inconclusive in the evaluator. The native path has now read real image bytes; it has not measured presentation attacks or recognized an identity.

What Face ID Answers

Local biometric authentication can authorize a local application operation. It does not certify the user's age. LAContext has no attestationToken property, and successfully evaluating its biometric policy is not a signed claim that your server received genuine camera footage.

This replacement uses the real LocalAuthentication API:

import LocalAuthentication

func checkLocalBiometric(completion: @escaping (Bool, String?) -> Void) {
    let context = LAContext()
    var error: NSError?
    guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
        completion(false, error?.localizedDescription)
        return
    }
    context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics,
                           localizedReason: "Authenticate to this local application") { success, failure in
        completion(success, failure?.localizedDescription)
    }
}

The downloadable Swift source typechecks against the installed macOS SDK:

xcrun swiftc -typecheck local_biometric_check.swift

No authentication prompt was opened. A Mac without an available enrolled biometric authenticator can fail the availability check. The function returns a local result and an error description; it sends no age assertion or remote attestation.

Hardware-backed keys, app integrity and capture provenance are distinct mechanisms. A design claiming a trusted camera-to-verifier path must show that path and its attestation semantics. A Secure Enclave label alone does not route a browser video stream through it.

The Pragmatic Defense

Start with what the decision requires. A face-age estimate is not a matching identity record. A matching identity is not proof that the account remains with that person. A camera challenge is not proof of age. Keep those meanings separate all the way to the action being authorized.

The original routing function remains useful as a policy selector. Its labels are application choices, not measured assurance levels. An unknown level now fails explicitly:

function selectVerificationLevel(context) {
  if (context.risk === "low") return "basic_facial_recognition";
  if (context.risk === "medium") return "enhanced_facial_recognition";
  if (context.risk === "high") return "hardware_backed_verification";
  if (context.risk === "critical") return "document_verification";
  throw new TypeError("Unknown risk level");
}

Set context.risk from trusted application policy, not a field supplied by the person undergoing verification. The four destinations still need real implementations and evaluation; returning a string does not supply them. All four branches and the unknown-level rejection run in the capture-boundary checker.

Measure capture failures and legitimate-user rejection alongside attack outcomes. Keep retry and fallback paths in scope. Do not silently accept missing evidence, and do not call a forced image-decoding failure a successful defense if the next screen grants access anyway.

The privacy argument survives every technical correction. A platform asking for biometric input should explain why it needs it, what is processed where, what leaves the device and how alternatives work. Discord now documents alternatives; their availability has to be checked for the actual region and device. Neither a credit-card field nor an old account is universal proof of adulthood.

Where This Lands

The red team asks where the frames and verdict can be substituted. The blue team has to show where they are bound to the session and decision. A product can do useful work here. It has to demonstrate the useful part.

The lab now has a replayable rule path, explicit unavailable evidence, an image-ingestion check, a fresh challenge boundary and a depth calculation that does not mistake a sculpted nose for a heartbeat. Capture provenance, video feature extraction and measured model performance remain the next build. They are concrete jobs, not reasons to call the stack finished.

Code and evidence update, October 27, 2026: Replaced nonworking model/API snippets and guaranteed bypass claims with executable source-backed scorer, sequence and depth checks, plus a typechecked local-authentication example. Preserved all seven attack surfaces. No Discord account, age-gate bypass, biometric subject or live camera was tested.


GhostInThePrompt.com // Client controls the camera. The rest is theater.