Lemur: JWT verifier honors attacker-supplied alg, enabling ATOGHSA-r9gp-7f88-9r54
MEDIUMGHSA-r9gp-7f88-9r54 is a medium-severity (CVSS 4.8) CWE-347 vulnerability in lemur. A fix is available for lemur — see the affected versions and patch details below.
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for GHSA-r9gp-7f88-9r54.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-r9gp-7f88-9r54 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
lemurReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
| Field | Value |
|---|---|
| Title | Lemur 1.9.0: JWT verifier trusts attacker-supplied alg from token header — defense-in-depth gap; chain-dependent ATO with secret disclosure |
| Component | lemur/lemur/auth/service.py:130-137 |
| CWE | CWE-347 (Improper Verification of Cryptographic Signature) |
| Attack Prerequisite | Defense-in-depth gap on its own — no single-request exploit against PyJWT 2.x. Single-request ATO requires a separate disclosure issue that leaks LEMUR_TOKEN_SECRET, or a future migration to asymmetric signing without fixing this sink. |
| Affected Versions | github.com/Netflix/lemur version = "1.9.0". Same code present in every prior release that has the auth/service.py:130 block. |
Exploit Code & Lab Set-up
<h2 data-heading="Root Cause Analysis">Root Cause Analysis</h2> <p>The pattern in <code>auth/service.py:130-137</code> is what every JWT-library author warns against. <code>pyjwt.decode</code>'s <code>algorithms</code> parameter exists precisely to pin the server's accepted set; the documentation calls out that callers should never pass the value from the token header. The author of this block likely intended to support multiple deployment configurations (some on HS256, some on RS256) and dispatched on the token's claimed algorithm — but the right way to do that is <code>algorithms=current_app.config["JWT_ACCEPTED_ALGS"]</code> (a server-pinned list), not <code>algorithms=[header_data["alg"]]</code> (the attacker's preference).</p> <p>The PyJWT 2.x mitigation is the only thing standing between this code and a single-request <code>alg=none</code> ATO. That mitigation lives in PyJWT's <code>NoneAlgorithm.verify</code>, which raises <code>InvalidKeyError</code> when <code>alg=none</code> is supplied with a non-None key. Lemur passes a real key, so the path raises and Lemur catches it as <code>jwt.DecodeError</code> and returns 403. Good — but the protection is in the dependency, not in Lemur's code. A PyJWT-1.x backport, an accidental downgrade, or a future PyJWT behaviour change re-opens the door.</p> <p>The RS256→HS256 confusion variant is the more durable concern. If an operator migrates Lemur from HS256 to RS256 — a normal hardening step — the attacker pins <code>alg=HS256</code> in the header and uses the RS256 <em>public key</em> as the HMAC secret. PyJWT 2.x's <code>decode_complete</code> does call <code>_verify_signature</code> with the supplied algorithm, and if the algorithm is HS256 and the "secret" is the bytes of the RS256 public key, the verifier passes. The fix is a server-pinned algorithm list; if the server only accepts <code>["RS256"]</code>, an attacker-supplied <code>alg=HS256</code> token fails at the <code>algorithms</code> check before any key material is consulted.</p> <p>The MEDIUM 4.8 score honestly reflects what's exploitable today: the antipattern is real, the impact today is limited to (a) audit-log blinding and (b) a downgrade primitive that activates under separate conditions. I'm explicitly not claiming RS256→HS256 against current Lemur because Lemur today is HS256 — the "RS256 → HS256" trick doesn't apply because Lemur's secret arg is HMAC bytes, not an RSA pubkey. The fix is still worth making.</p> <h2 data-heading="Attack Scenario">Attack Scenario</h2>sequenceDiagram
participant Attacker
participant Lemur as Lemur API
participant Disclosure as Disclosure surface
participant Audit as Audit logging
Note over Attacker,Lemur: "Today: PyJWT 2.x mitigation holds for alg=none"
Attacker->>Lemur: "Bearer alg=none token with [payload]"
Lemur->>Lemur: "pyjwt.decode raises (alg=none + non-None key)"
Lemur-->>Attacker: "403 Forbidden"
Note over Disclosure,Lemur: "Chain step: separate disclosure leaks LEMUR_TOKEN_SECRET"
Attacker->>Disclosure: "trigger debug / SSRF / backup leak"
Disclosure-->>Attacker: "LEMUR_TOKEN_SECRET value"
Note over Attacker,Lemur: "Forge HS256 admin token with leaked secret"
Attacker->>Lemur: "Bearer alg=HS256 admin token signed with leaked secret"
Lemur->>Lemur: "algorithms=[HS256] (taken from header) — accepted"
Lemur-->>Attacker: "200 OK, role=admin"
Note over Audit: "alg=HS256 in audit log - no anomaly flag because attacker picks alg"
<h2 data-heading="Impact Assessment">Impact Assessment</h2>
<p>Today, in a fully-patched Lemur 1.9.0 on PyJWT 2.x, the standalone impact is C:L (audit-log surface is attacker-influenced) / I:L (an attacker who controls <code>alg</code> can downgrade a future verifier upgrade) / A:N. The vector requires no user interaction — the attacker just sends a crafted token directly — but AC:H reflects the real-world conditions that have to align (PyJWT version, future migration to asymmetric signing, or a separate disclosure issue) before standalone impact materializes. That's the 4.8 MEDIUM score. The chain step to single-request ATO depends on a separate disclosure issue, which I'm not claiming as part of this report.</p>
<p>The reason this is worth fixing now rather than later is that it's a one-line change with no behavioural risk, and the consequence of leaving it in place is a permanent downgrade vector against any algorithm migration Netflix later decides to do. Lemur's role in the certificate-signing pipeline makes its session tokens unusually high-value — anyone who forges a Lemur admin JWT can issue, revoke, and exfiltrate certificates across the org. The Lemur PKI compromise report submitted separately (ACME <code>acme_url</code> SSRF + creator IDOR) shows what an admin Lemur identity can do in practice.</p>
<p>If Lemur ever moves to asymmetric signing without fixing this sink, the score moves to CRITICAL on the same day. Fix it now.</p>
<h2 data-heading="Remediation">Remediation</h2>
<p>One-line server pin:</p>
<pre><code class="language-python"># lemur/lemur/auth/service.py:130-137
allowed_algs = current_app.config.get("JWT_ALGORITHMS", ["HS256"])
try:
payload = decode_with_multiple_secrets(
token, token_secrets, algorithms=allowed_algs
)
except jwt.DecodeError:
return dict(message="Token is invalid"), 403
</code></pre>
<p>Three follow-ups worth doing at the same time:</p>
<ol>
<li><strong>Log the algorithm the server actually applied, separately from the algorithm in the token header.</strong> This lets audit tooling see "the server enforced HS256 and the token claimed HS256" or, post-fix, "the server enforced RS256 and the token claimed HS256 — rejected", and flag mismatches.</li>
<li><strong>Pin <code>algorithms</code> to the smallest possible set.</strong> If Lemur only ever issues HS256, accept only HS256. Don't list every supported algorithm just because the library supports it.</li>
<li><strong>Migrate to asymmetric signing in a separate hardening PR</strong> once the algorithm pin is in. RS256 with key rotation removes the "leaked secret = forge admin" chain entirely.</li>
</ol>Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | lemur | all versions | 1.9.2pip install --upgrade 'lemur==1.9.2' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for lemur, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update lemur to 1.9.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-r9gp-7f88-9r54 is resolved across your whole dependency graph.
Workarounds
Restrict outbound requests from the affected component to an allowlist of hosts, block access to link-local and internal address ranges at the network layer, and require authentication on internal services so a forged request cannot reach them unauthenticated.
Frequently Asked Questions
Is GHSA-r9gp-7f88-9r54 in your dependencies?
Find it across PyPI, including transitive dependencies.