You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "hanicz (via GitHub)" <gi...@apache.org> on 2026/08/12 08:52:32 UTC
[PR] KNOX-3413: KnoxToken passcode verification accepts a valid passcode f… [knox]
hanicz opened a new pull request, #1345:
URL: https://github.com/apache/knox/pull/1345
…or a different token
[KNOX-3413](https://issues.apache.org/jira/browse/KNOX-3413) - KnoxToken passcode verification accepts a valid passcode for a different token
## What changes were proposed in this pull request?
The cache abstraction conflates two token models. For JWTs the key is the entire serialized JWT (self-authenticating, and identity is derived from that same token). For passcodes, validity is a property of the `(tokenId, passcode)` pair, but the cache stored only the passcode while identity came from a separately supplied `tokenId`.
The only check that binds the passcode to the token identifier is `validatePasscode(tokenId, passcode)`, which compares
`tokenMAC.hash(tokenId, issueTime, userName, passcode)` against the passcode stored for that specific tokenId. On success it records the verification in a shared, per-topology cache (`SignatureVerificationCache`) keyed on the passcode string alone.
Because the guard at `AbstractJWTFilter.java:571` is `hasSignatureBeenVerified(passcode) || validatePasscode(tokenId, passcode)`, and tokenId/passcode are two independently attacker-controlled fields (parsed from Base64(tokenId)::Base64(passcode) at JWTFederationFilter.java:213-215), a caller who has verified its own passcode once can then present that same passcode paired with a different, victim tokenId.
Key the passcode verification cache on the `(tokenId, passcode)` pairing instead of the passcode
alone. Introduce one private helper and update the three passcode-path call sites. The JWT path
(`verifyTokenSignature`, keyed on `serializedJWT`) is unchanged.
Also adds new regression test for the scenario.
## How was this patch tested?
Unit tests
Tested locally with two new topologies (tokenissuer, tokenconsumer)
```
curl -vku admin:admin-password -X "GET" "https://localhost:8443/gateway/tokenissuer/knoxtoken/api/v2/token?lifespan=P0DT1H0M"
curl -vku tom:tom-password -X "GET" "https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token?lifespan=P0DT1H0M"
curl -vk -H "Authorization: Basic replaced_tokenid_token" -X "GET" "https://localhost:8443/gateway/tokenconsumer/auth/api/v1/pre"
```
## Integration Tests
N/A
## UI changes
N/A
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KNOX-3413: KnoxToken passcode verification accepts a valid passcode f… [knox]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1345:
URL: https://github.com/apache/knox/pull/1345#issuecomment-5264883133
## Test Results
40 tests 40 ✅ 6s ⏱️
3 suites 0 💤
3 files 0 ❌
Results for commit 51b2a798.
[test-results]:data:application/gzip;base64,H4sIAJ48fGoC/12Myw6DIBQFf8Ww7gJEEfozDXIhualKw2PV9N+L1md3Z+Yk8yYOBxvJveK3isSMaQfIQSf0U0FRsBxpvhq6wSNmY/7ME1/FHMJpHC7ChuDDakKe9uK8L8GfOHoLn3ILn2vGjyOmAqRlfa07JS1tbK9EzUFTAOZAso4zJsC0CqyU5PMFychUl/8AAAA=
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KNOX-3413: KnoxToken passcode verification accepts a valid passcode f… [knox]
Posted by "hanicz (via GitHub)" <gi...@apache.org>.
hanicz merged PR #1345:
URL: https://github.com/apache/knox/pull/1345
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org