Ash Authentication令牌撤销逻辑漏洞分析

24 阅读2分钟

CVE-2025-25202:Ash Authentication令牌撤销检查逻辑漏洞

漏洞概述

Ash Authentication库在通过mix ash_authentication.install生成的action中存在有缺陷的令牌撤销检查逻辑。该漏洞会导致已撤销的令牌在过期前仍可被验证为有效。

影响范围

受影响版本:>= 4.1.0, < 4.4.9 修复版本:4.4.9

仅影响使用新版igniter安装程序(自AshAuthentication v4.1.0起)引导的应用程序,且使用了以下功能:

  • 魔术链接策略
  • 密码重置功能
  • 确认附加组件
  • 手动撤销令牌

影响分析

对于不同用户群体的具体影响:

  • 魔术链接策略用户:魔术链接令牌在过期前可重复使用(默认有效期为10分钟)
  • 密码策略中的密码重置用户:密码重置令牌在过期前可重复使用(默认有效期为3天)
  • 确认附加组件用户:确认令牌在过期前可重复使用(默认有效期为3天)

修复方案

官方补丁

该漏洞已在版本4.4.9中修复,升级时会显示编译时警告并提供修复说明。

自动升级

mix igniter.upgrade ash_authentication

手动升级

mix ash_authentication.upgrade 4.4.8 4.4.9

代码修复要求

需要修改:revoked? action:

  • :jti:token参数必须允许nil值
  • action必须返回:boolean类型

修复示例

action :revoked?, :boolean do
  description "Returns true if a revocation token is found for the provided token"
  argument :token, :string, sensitive?: true
  argument :jti, :string, sensitive?: true
  run AshAuthentication.TokenResource.IsRevoked
end

临时解决方案

  1. 删除生成的:revoked?通用action:这将使其使用AshAuthentication内部始终正确的实现
  2. 手动应用上述代码更改

安全评分

CVSS评分:6.3(中危) EPSS评分:0.066%(20百分位)

参考信息

  • GitHub Advisory:GHSA-qrm9-f75w-hg4c
  • 修复提交:team-alembic/ash_authentication@2dee552
  • NVD详情:nvd.nist.gov/vuln/detail…
  • 讨论渠道:Ash Discord的#ash_authentication频道