⚠️

سلب مسئولیت و اخلاق حرفه‌ای

این مطالب صرفاً برای اهداف آموزشی، پژوهشی و افزایش آگاهی امنیتی ارائه شده‌اند. هرگونه استفاده غیرمجاز، غیرقانونی یا سوءاستفاده از اطلاعات، ابزارها و روش‌های مطرح‌شده، کاملاً بر عهده مخاطب است. نویسنده و منتشرکننده هیچ مسئولیتی در قبال خسارات، آسیب‌ها یا پیامدهای ناشی از استفاده نادرست از این مطالب نخواهند داشت.

CVE-2026-139967: ash_authentication Audit Logs Expose Plaintext API Keys and Tokens | Alireza Bolbolabadi - Red Team Security
LOADING

CVE-2026-139967: ash_authentication Audit Logs Expose Plaintext API Keys and Tokens

Executive summary

CVE-2026-139967 is a credential-disclosure vulnerability in ash_authentication from team-alembic. The library's audit_log add-on records public action arguments in an extra_data field unless an argument is explicitly marked as sensitive. The API key authentication action failed to mark api_key as sensitive, causing plaintext API keys to be written to audit records.

The application's normal credential storage contains only API key hashes. That protection is undermined by the audit trail, where the original secret remains directly usable. An attacker who obtains the audit table, a backup containing it, or an administrative view of the entries could reuse the exposed keys to sign in as the users to whom they belong.

The same behavior can affect magic links, confirmation tokens, one-time passwords, TOTP values, and recovery codes when the corresponding actions do not mark those arguments as sensitive. Fix boundaries are ash_authentication 4.15.2 on the 4.x line and 5.0.0-rc.19 on the 5.0 release-candidate line.

Detailed analysis

How the vulnerability works

The audit_log add-on uses an opt-in redaction model. Public arguments are recorded verbatim unless the action author marks them with sensitive?. The API key sign-in action defined by ash_authentication.add_strategy.api_key did not apply that marker to its api_key argument.

Consequently, successful API key authentication—and each request processed by AshAuthentication.Strategy.ApiKey.Plug—could add the plaintext key to an audit entry's extra_data. The issue is therefore not a failure of key hashing or authentication logic. It is an accidental disclosure of the original credential through an observability subsystem.

Affected systems

The vulnerability applies to:

  • ash_authentication versions from 4.12.0 before 4.15.2.

  • ash_authentication versions from 5.0.0-rc.0 before 5.0.0-rc.19.

  • The commit identifier 255cfc9c0e511b7e0de39f8b3d676ae994fae06c, which is also listed in the vulnerability record.

Applications are exposed when they use an affected version and perform API key authentication or another affected authentication action whose credential argument was not marked sensitive. Merely installing the library is not sufficient to create an exploitable credential unless such an authentication event has been recorded.

Attack prerequisites and impact

An attacker needs read access to one of the following:

  • The application's audit table.

  • A database backup, snapshot, or export containing audit entries.

  • An administrative interface or report that displays audit extra_data.

No credential recovery or cryptographic attack is necessary. The disclosed value is already the working API key or authentication token. Reusing it can permit authentication as the associated user, with impact determined by that user's privileges.

Audit data often has a wider distribution than credential stores. For example, backups may be copied to separate accounts or regions, while administrative tools may expose audit rows to support or operations personnel. A pipeline that captures table contents can also move the secrets into logging or analytics systems. In each case, readers of the audit trail effectively become holders of authentication credentials.

The linked vulnerability record assigns a CVSS score of 6.7 and medium severity. The supplied source does not include the vector breakdown, so its attack-vector, privilege, user-interaction, and scope components cannot be independently stated here.

Related authentication secrets

Beyond API keys, the advisory reports that magic link and confirmation tokens, one-time passwords, TOTP values, and recovery codes were stored in the same way when the relevant action did not mark them sensitive. Their actual exposure depends on the action definitions and authentication flows used by the application.

Applications that do not use API key authentication should still review other credential-bearing actions for the same missing sensitive? protection. The underlying weakness is a permissive audit-log default combined with unmarked security-sensitive arguments.

Detection

Potential indicators include:

  • API key sign-in audit entries whose extra_data contains recognizable plaintext key material.

  • Entries for magic-link, confirmation, one-time-password, TOTP, or recovery-code actions containing unredacted values.

  • Audit tables, backups, snapshots, or exports that retain the affected extra_data field.

  • Administrative pages or log exports that render or transmit the complete field.

A useful exposure assessment combines the installed ash_authentication version with records of API key and other token-based sign-ins. Access to the audit table, its backup chain, administrative views, and downstream exports should be reviewed as credential-equivalent access.

Mitigation

Upgrading prevents new sensitive arguments from being recorded in the vulnerable form, but it does not remove secrets already stored in historical audit rows. Response therefore has two distinct parts: stop further disclosure and invalidate the disclosed credentials.

The available remediation path is to:

  1. Upgrade ash_authentication to 4.15.2 or later on the 4.x line, or to 5.0.0-rc.19 or later on the 5.0 release-candidate line.

  1. Issue and use new API keys for every account that authenticated with an API key during the affected period.

  1. Rotate any affected magic link tokens, confirmation tokens, one-time passwords, TOTP secrets, and recovery codes.

  1. Remove or redact exposed values from audit records, backups, snapshots, exports, and downstream log or analytics copies.

  1. Restrict audit-data access and prevent administrative interfaces from displaying raw extra_data unnecessarily.

  1. Review sign-in and audit activity for unauthorized use of exposed credentials before retiring the historical data.

For applications unable to upgrade immediately, marking credential arguments as sensitive? can address the redaction defect. Disabling audit logging for affected sign-in actions may also reduce exposure, but the supplied advisory does not identify a specific supported configuration option for that workaround.

Expert insight

This vulnerability illustrates why audit logging should be treated as a credential-bearing security boundary rather than passive operational telemetry. Hashing credentials at their primary storage location provides little benefit when a secondary system records the plaintext during use. The design creates a persistent secondary copy that is often less tightly protected and more broadly replicated.

The most important remediation detail is that a software upgrade alone is incomplete. Historical audit rows can retain working secrets indefinitely, including in backups that administrators may assume are inert because they are “just logs.” Credential rotation and historical-data sanitization are therefore part of the same exposure-remediation problem as changing the affected version.

No known exploitation, public proof of concept, or threat-actor activity is reported in the supplied source. This does not establish that exploitation has been absent. The exposure can remain silent because ordinary audit entries do not distinguish a legitimate API key sign-in from unauthorized reuse of a copied key.

منابع

·
← اخبار