⚠️

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

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

OTS Expire Override Lets Unread Secrets Persist Indefinitely | Alireza Bolbolabadi - Red Team Security
LOADING

OTS Expire Override Lets Unread Secrets Persist Indefinitely

Overview

A server-side validation flaw in OTS, the One-Time Secret share service, allows the client-supplied expire query parameter to override an operator's configured maximum secret lifetime. The advisory identifies the issue as GHSA-6PPQ-9X26-5R92.

When an OTS instance has a positive SECRETEXPIRY configuration, its intended policy is that created secrets should not outlive that limit. A request to the secret creation endpoint with expire=0 can nevertheless create a secret without an expiration timestamp. The behavior affects both supported persistence paths described in the advisory: Redis-backed storage and in-memory storage.

This is primarily a retention-control bypass. It can also contribute to unbounded storage consumption when attackers repeatedly create secrets that are never read.

How the Bypass Works

The flaw is rooted in insufficient validation of the expire parameter before it reaches the persistence layer. A zero value is not consistently treated as an invalid request or constrained to the configured maximum. Instead, it is interpreted as a request for no automatic expiration.

Redis-backed deployments

In the Redis backend, a zero expiration is passed to go-redis Set. Under those semantics, Redis stores the key without an expiration. The record therefore remains available until it is explicitly deleted or otherwise removed.

In-memory deployments

The memory backend interprets the value as a zero time.Duration. As a result, no expiry timestamp is recorded for the entry. A non-expiring secret can consequently remain in the process's memory until another event removes it.

Both paths allow the creation request to succeed and return a valid fetch URL. The supplied advisory does not indicate that the request is rejected, logged as suspicious, or otherwise distinguished from a normal secret-creation request.

Why Unread Secrets Matter

OTS retains the one-time behavior that makes the service useful: a secret is removed after it is successfully read. This limits the impact of the issue in some scenarios, but it does not eliminate the policy violation.

A secret created with expire=0 and subsequently retrieved is still consumed. The risk arises when the secret is never read. In that case, the entry can remain in Redis or process memory indefinitely, even though the operator configured SECRETEXPIRY to enforce a finite maximum lifetime.

This distinction is important when assessing exposure:

  • The defect does not automatically make a successfully retrieved secret reusable.

  • It can leave confidential material available for retrieval later if its URL is later disclosed or guessed.

  • Repeated unauthenticated creation requests can increase the volume of unread retained data.

  • The original confidentiality promise attached to the configured TTL is no longer reliably enforced.

Exposure and Threat Model

The advisory states that the secret creation endpoint is reachable without authentication. No account, session, cookie, or other credential is required to trigger the behavior. Internet-exposed OTS instances are therefore within the affected request surface.

Exploitation requires only control of the creation request's query string. The supplied context does not report exploitation in the wild, a public proof-of-concept exploit, or associated threat campaigns. It also does not provide affected version ranges, so operators cannot use the available information to determine whether a particular release is vulnerable without consulting a maintained advisory or upstream source.

The absence of reported threat activity should not be interpreted as evidence that the endpoint is harmless. It is a simple request that can be generated through ordinary browser or command-line HTTP tooling and does not require a specialized exploit chain.

Storage and Availability Effects

For Redis deployments, persistent zero-TTL keys can expand the dataset beyond the retention volume expected by the operator. For in-memory deployments, the same pattern increases resident process memory. Either condition can contribute to resource exhaustion over time if creation requests repeatedly outpace secret consumption.

The practical availability impact depends on deployment scale, rate limits, reverse-proxy controls, backend memory limits, Redis eviction settings, and whether the instance is intentionally public. Those controls are not specified in the supplied context, so the vulnerability's real-world severity cannot be reduced to a single universal rating.

The data-retention concern can be more significant than a transient resource issue. If an OTS instance is used to exchange credentials, recovery codes, personal information, or other sensitive material, operators may reasonably rely on SECRETEXPIRY to limit how long unread copies remain available. The bypass invalidates that assumption for affected requests.

Detection and Review

Because the creation endpoint accepts the request as normal, relying on application responses alone may not reveal exploitation. Operators should compare actual retained-secret counts with expected creation and consumption trends, particularly in Redis-backed instances where key cardinality is directly observable.

Useful review points include:

  • Redis keys associated with OTS that have no expiration.

  • In-memory entries with no expiry timestamp, assessed through available administrative instrumentation or process metrics.

  • Creation traffic containing expire=0, if request logs retain query strings.

  • Sudden growth in unread secrets without a corresponding increase in successful reads.

  • Existing zero-TTL records created before enforcement was corrected.

Query-string logging can itself expose secret-related metadata, so access to those logs should be restricted and reviewed accordingly.

Corrective Direction

The appropriate server-side correction is to enforce the retention policy independently of untrusted client input. The creation endpoint should reject a zero duration or any value that exceeds the configured maximum. Coercing out-of-range values to the configured maximum is another possible design, but only if that behavior is explicit and consistently implemented.

Validation must occur before either backend receives the expiration value. Applying a backend-specific correction would leave the other storage path exposed and could produce inconsistent behavior during migrations.

A reverse proxy that strips or rewrites the expire parameter may reduce exposure in the interim, but it is compensating control rather than a complete application fix. Existing records also require separate review because changing future creation behavior does not automatically impose a TTL on secrets already stored without expiration.

Severity Assessment

The issue is assessed as medium for this article. The creation primitive is unauthenticated and trivial to exercise, but the supplied context also establishes important constraints: a secret is still deleted after a successful read, no exploitation activity is reported, and no affected version range or fixed release is supplied.

The medium rating reflects the combination of a straightforward policy bypass, indefinite retention of unread secrets, possible confidentiality consequences, and a plausible storage-growth path. It is not based on a published CVSS vector, because none is provided in the context. Deployments should reassess the rating based on whether the service is publicly exposed, what data it handles, whether creation is rate-limited, and what backend resource controls are active.

·
← اخبار