Недостаточная уязвимость Session Expiration в компоненте Apache Camel Keycloak. Эта проблема затрагивает Apache Camel: от 4.16.0 до 4.18.5, от 4.19.0 до 4.22.2. При включении интроспекции токена на верблюжьем ключе KeycloakSecurityPolicy (useTokenIntrospectiontrue), процессор безопасности проверяет токен доступа запроса, отправляя его на конечную точку интроспекции токена Keycloak's OAuth 2.0, и принимает токен, пока ответ сообщает о его активности.
Конечная точка интроспекции сообщает о том, что маркер неактивен после истечения срока его действия, поэтому на этом пути активный флаг - это то, что обеспечивает истечение срока действия маркера. Результаты интроспекции кэшируются по умолчанию (introspectionCacheEnabledtrue, introspectionCacheTtl60 секунд), и обе реализации кэша, отправленные с компонентом, ConcurrentMapTokenCache и CaffeineTokenCache, истекли через фиксированное время после его вставки, не ограничивая это время временем жизни заявлением exp, которое кэшированный ответ уже нес. KeycloakSecurityProcessor, в свою очередь, проверял только активный флаг результата на каждом пути, который использует самоанализ, и никогда не сравнивал exp с текущим временем. Таким образом, ответ, кэшированный незадолго до истечения срока действия токена, был подан на более поздние запросы, несущие тот же токен для настроенного time-to-live после истечения срока действия токена, и эти запросы были приняты с ролями и разрешениями, которые несли истекший токен, хотя RFC 7662, который определяет самоанализ токена, заявляет, что ответ, содержащий exp, не должен кэшироваться сверх этого времени.
Токен доступа предоставляется абонентом при каждом запросе, как правило, в качестве токена носителя в заголовке авторизации, поэтому абонент, удерживающий токен, который был действителен ранее, может продолжать использовать его после истечения срока действия, пока кэшированная запись жива. Окно ограничено introspectionCacheTtl, который составляет 60 секунд по умолчанию и 300-600 секунд, где следовала рекомендация документации для внутренних служб, и он открывается только для токена, что тот же процесс Camel интроспектировал и кэшировал, пока токен был все еще активен. Проблема не дает ничего, кроме того, что уже содержал токен: он не допускает подделки токенов и эскалации привилегий, а интроспекция токенов не включена по умолчанию, поэтому серьезность оценивается средой.
На локальный путь проверки JWT, используемый при отключении интроспекции, эта проблема не влияет. Пользователям рекомендуется перейти на версию 4.23.0, которая исправляет проблему. Если пользователи находятся в потоке релизов 4.22.x, то им предлагается обновиться до 4.22.2.
Если пользователи находятся в потоке релизов 4.18.x, то им предлагается обновиться до 4.18.5. Линии выпуска 4.16.x, 4.17.x и 4.19.x-4.21.x достигли конца жизни до того, как эта проблема была решена и не получит исправления, поэтому развертывания на них должны перейти к поддерживаемому выпуску. Для развертываний, которые не могут быть немедленно обновлены, установите introspectionCacheEnabledfalse на KeycloakSecurityPolicy, чтобы каждый запрос сверялся с конечной точкой интроспекции, которая сообщает об истёкшем токене как неактивном, по цене одного вызова интроспекции на запрос.
Опускание introspectionCacheTtl только сужает окно и не закрывает его.
Показать оригинальное описание (EN)
Insufficient Session Expiration vulnerability in Apache Camel Keycloak component. This issue affects Apache Camel: from 4.16.0 before 4.18.5, from 4.19.0 before 4.22.2. When token introspection is enabled on the camel-keycloak KeycloakSecurityPolicy (useTokenIntrospection=true), the security processor validates the access token of a request by sending it to Keycloak's OAuth 2.0 token introspection endpoint, and accepts the token while the response reports it as active. The introspection endpoint reports a token as inactive once its exp (expiration) time has passed, so on this path the active flag is what enforces token expiry. Introspection results are cached by default (introspectionCacheEnabled=true, introspectionCacheTtl=60 seconds), and both cache implementations shipped with the component, ConcurrentMapTokenCache and CaffeineTokenCache, expired an entry a fixed time after it was inserted, without bounding that lifetime by the exp claim that the cached response already carried. KeycloakSecurityProcessor in turn checked only the active flag of the result, on every path that uses introspection, and never compared exp with the current time. A response cached shortly before the token expired was therefore served to later requests carrying the same token for up to the configured time-to-live after the token's expiry, and those requests were admitted with the roles and permissions the expired token had carried, although RFC 7662, which defines token introspection, states that a response containing exp must not be cached beyond that time. The access token is supplied by the caller with each request, typically as a bearer token in the Authorization header, so a caller holding a token that was valid moments earlier could keep using it after it expired, for as long as the cached entry lived. The window is bounded by introspectionCacheTtl, which is 60 seconds by default and 300 to 600 seconds where the documentation's recommendation for internal services was followed, and it opens only for a token that the same Camel process introspected and cached while the token was still active. The issue grants nothing beyond what the token already carried: it allows no token forgery and no privilege escalation, and token introspection is not enabled by default, which is why the severity is assessed medium. The local JWT verification path, used when introspection is disabled, is not affected by this issue. Users are recommended to upgrade to version 4.23.0, which fixes the issue. If users are on the 4.22.x releases stream, then they are suggested to upgrade to 4.22.2. If users are on the 4.18.x releases stream, then they are suggested to upgrade to 4.18.5. The 4.16.x, 4.17.x and 4.19.x to 4.21.x release lines reached end of life before this issue was resolved and will not receive a fix, so deployments on them must move to a supported release. For deployments that cannot upgrade immediately, set introspectionCacheEnabled=false on the KeycloakSecurityPolicy, so that every request is checked against the introspection endpoint, which reports an expired token as inactive, at the cost of one introspection call per request. Lowering introspectionCacheTtl only narrows the window and does not close it.
Характеристики атаки
Последствия
Строка CVSS v3.1