# Async search stores authorization headers in clear text

Elasticsearch's .async-search index stored plaintext Authorization headers of async searches, letting superusers harvest other users' credentials for lateral movement.

- Payout: $1,000
- Severity: medium
- Program: Elastic
- Found by: alexbrasetvik
- Disclosed: 2021-01-19
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1042716
- Library page: https://bugbountylibrary.com/r/h1%3A1042716
- Tags: area:cloud domain:infra impact:ato impact:privesc kind:bounty platform:hackerone sev:medium tech:elasticsearch technique:source-review vuln:info-disclosure vuln:secrets-leak

**Target:** Elasticsearch .async-search internal index / _async_search API
**Root cause:** The async-search task persisted a copy of the original request's Authorization header in clear text within the .async-search index documents.
**Steps:**
1. Trigger an async search: `POST /_async_search?size=0&wait_for_completion_timeout=0` with body `{"query":{"match_all":{}}}`
2. Query the index to reveal stored headers: `POST /.async-search/_search` with body `{"_source":"headers.*"}`
3. Observe plaintext Authorization header values of other users' searches in results
**How found:** Noticed the .async-search index stores request data; hypothesized it also copies headers, then queried `_source: headers.*` to confirm plaintext Authorization values. Noted Kibana's 100ms default timeout makes async searches common.
**Exploitation:** A superuser reads .async-search and extracts other users' plaintext Authorization headers. With LDAP/AD-backed reused credentials, these can be replayed to impersonate users. Kibana's default 100ms waitForCompletionTimeout means many searches are already async, so victim headers are likely already present; otherwise lure a victim to a slow Kibana dashboard to force an async search.
**Escalation:** Chained with an XSS against a superuser victim to trivially exfiltrate the target's Authorization headers.
**Insight:** Internal task/result indices that snapshot request metadata (headers, auth) are a credential-leak surface—enumerate `_source` fields of system indices like .async-search, .tasks, and searchable snapshots for stored secrets.

## Proof of concept (copied exactly from the original report)

**Async search request with zero wait timeout**

```
POST /_async_search?size=0&wait_for_completion_timeout=0
{
  "query": {
    "match_all": {}
  }
}
```

**Query exposing stored authorization headers**

```
POST /.async-search/_search
{
  "_source": "headers.*"
}
```

