Global liveness counters that never reset let a blink from one scan satisfy the next. The check passes for a photo because a real person passed it earlier.
What goes wrong
A photo held up to the camera should never pass a liveness check. This one can, as long as a real person blinked at the same app earlier. The signal that proves liveness lives in module-global variables: a blink counter, some eye-state flags, a timestamp. They accumulate as blinks are detected, and once confidence crosses a threshold the scan is accepted.
Nothing resets them when a new scan starts. A blink from any previous session still counts, so the next scan begins with confidence already banked. Present a static photo, add no blink at all, and the stale credit alone can push it over the line. State that outlives the session it describes is the bug. Liveness that carries over is not liveness.
The pattern
let blinkScore = 0 // module-global, never reset
let eyesWereClosed = false
function onFace(face) {
if (blinked(face)) blinkScore += WEIGHT
if (blinkScore >= THRESHOLD) accept() // credit from any past scan
}function startScan() {
const s = { blinkScore: 0, eyesWereClosed: false } // per-session
return {
onFace(face) {
if (blinked(face, s)) s.blinkScore += WEIGHT
if (s.blinkScore >= THRESHOLD) accept()
}
}
}Every gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.
Why it matters to you
Presentation attacks against liveness usually take effort, a printed mask or a replayed video loop. This one needs a photo and patience, because the app did the hard part by remembering a blink it should have forgotten. Any check whose state is global and long-lived will eventually accept the wrong thing.
Scope liveness state to a single scan and initialize it at the start of every attempt. If a value from a previous session can change the outcome of this one, the session boundary is not real.
Check your own code
- Find security-relevant counters and flags held at module or singleton scope.
- Confirm every one is reset at the start of a new session, not just at process start.
- Prefer per-session state objects over shared mutable globals for any accept or reject decision.
- Test two scans back to back: a passing one, then a spoof, and assert the spoof fails on its own.