Authentication Assurance & Reauthentication Freshness
认证会话不仅要知道“用户曾经登录过”,还要记录认证方式、强度与时间新鲜度;高风险操作应基于 auth_time / MFA freshness / assurance 做 step-up 或 reauthentication,而不是仅凭长期 Session 存在就永久信任。
[!info] related notes
- 所属 MOC: 安全 MOC
- Session: Server-side Session 鉴权
- MFA: 多因素认证(MFA)
- Trusted Device: Trusted Device & Remember MFA
- Risk: Suspicious Login & Risk-Based Authentication
- Recovery: Password Reset & Account Recovery
Authentication Assurance & Reauthentication Freshness
一句话关系
Authentication answers:
用户是否完成过某次认证。
Reauthentication Freshness asks:
这次认证是否足够新、足够强,可以批准当前高风险动作?
所以:
session valid ≠ authentication fresh enough for every operation
Session Assurance Metadata
Session/Grant 可以保存:
- authenticated_at;
- auth_time;
- authentication methods;
- mfa_verified_at;
- assurance level;
- device/trust context;
- risk state;
- last_reauthenticated_at。
这些字段让 Authorization / Policy 能判断:
当前动作需要什么级别的近期证明。
Step-Up
普通浏览:
existing session → enough
高风险动作:
- change password;
- change email;
- disable MFA;
- add trusted device;
- export sensitive data;
- create API key;
- payment / transfer;
可能要求:
existing session
- recent strong reauthentication → allow
这叫 step-up authentication。
Freshness Window
不要设计一个全局数字:
all sensitive actions → authenticated within exactly N minutes
更稳定的设计是:
action risk → required assurance → maximum authentication age
例如:
low-risk profile read → existing session
change email → recent password/MFA
disable WebAuthn → recent phishing-resistant factor or equivalent policy
具体时间窗口应由产品风险、法规、标准和 UX 决定。
Idle Timeout、Absolute Lifetime、Freshness
三个概念不同:
Idle Timeout
多久没有用户活动。
Absolute Session Lifetime
Session 最长能存在多久。
Reauthentication Freshness
上一次足够强认证距离现在多久。
一个 Session 可以:
- 仍未过 absolute expiry;
- 最近仍有活动;
- 但高风险动作所需的 reauth 已过 freshness window。
NIST AAL 心智模型
NIST 的 assurance framework 会按 AAL 规定:
- periodic reauthentication;
- inactivity handling;
- 某些 AAL 下重新呈现部分或全部 factor。
关键知识不是死背某个时间值,而是:
Session Secret 本身不能无限期替代原始认证因素。
不同 assurance level 对重新认证强度和周期要求不同。
auth_time
如果 Token / assertion 带:
auth_time
它表示原始或最近一次认证事件时间。
Relying Party 可以据此判断:
now - auth_time <= acceptable age ?
Federated login 中尤其重要:
IdP session still alive ≠ RP-sensitive action automatically has fresh authentication
RP 可能要求 IdP 重新认证,而不是静默复用旧 SSO session。
Reauth 后 Rotate Session
Reauthentication 成功后,应考虑:
- rotate Session ID;
- rotate/reissue tokens;
- update auth_time;
- update assurance;
- prevent session fixation;
- bind new security context。
不要只是:
set reauthenticated=true forever
Password Re-entry
要求用户重新输入 Password 是一种 reauthentication。
但如果账户平时依赖强 MFA / WebAuthn,高风险动作是否仅 Password re-entry 足够,要看 assurance policy。
例如:
disable MFA → only password
可能降低原有认证强度。
Biometric / Device Unlock
本地设备 biometric/PIN 是否能被远端服务视为 reauthentication factor,取决于:
- 是否通过可信 authenticator protocol;
- 是否 cryptographically bound;
- verifier 能否验证 authenticator assertion。
单纯“手机刚解锁过”通常不是远端 RP 可以可靠证明的事实。
Risk Event Reauthentication
OWASP 建议在高风险事件后触发 reauthentication,例如:
- password/email change;
- account recovery;
- suspicious login;
- new device enrollment。
所以 freshness 不只是时间函数,也可以是:
risk event → existing assurance invalidated / downgraded → reauthenticate
Session Assurance Downgrade
安全事件发生时,可以:
session remains technically alive but assurance = downgraded
然后:
ordinary read → allowed
sensitive write → require reauth
这比“所有异常都全局 logout”更灵活。
学习检查
- Session valid 与 authentication fresh 有什么区别?
- idle timeout、absolute lifetime、reauth freshness 分别回答什么问题?
- 为什么高风险动作不应只看用户是否已登录?
- auth_time 在 federated login 中为什么重要?
- reauthentication 成功后为什么应该更新/轮换 Session security state?
- password re-entry 为什么不一定总是足够的 step-up?
- suspicious login 为什么可以让已有 Session assurance 降级?
- 设计一个 change-email 的 reauthentication freshness policy。