Описание CookieConverter.getCookies решает, какие сохраненные файлы cookie прикрепить к исходящему запросу. Проверка применимости вложена в тест на наличие атрибута Domain, поэтому файл cookie без него, который является обычной формой сеансового файла cookie, полностью пропускает поиск и возвращается для любой цели URL. RFC 6265 требует обратного: файл cookie без атрибута Domain предназначен только для хоста и принадлежит хосту, который его установил.
Два других дефекта находятся в том же методе. The domain comparison has no notion of a registrable domain, so a `Domain` value of `com` matches every host under it, and the comparison returns true when it throws, so a failure to evaluate the check admits the cookie. Ни конвертер, ни MetadataTransfer, который несет сохраненный файл cookie для внешних ссылок, никогда не рассматривают хост, который его выдал.
Обработка файлов cookie является добровольной: для этого требуется, чтобы http.use.cookies был установлен в значение true, которое не является стандартным, а ключ cookie был указан в metadata.transfer. Документированный рецепт не работает так, как записано, потому что пример metadata.transfer во внутренней документации имен set-cookie, в то время как ключ, присутствующий в метаданных, является protocol.set-cookie, и передача точно соответствует именам ключей. Таким образом, затронутыми развертываниями являются те, где оператор определил правильный ключ, включил обработку файлов cookie и сканирует аутентифицированный сайт, страницы которого ссылаются или перенаправляются на другие хосты.
В этом случае сеансовый файл cookie аутентифицированного источника отправляется этим хостам. Смягчение Upgrade до 4.0.0, когда файл cookie без атрибута Domain отправляется только узлу, который его установил, однозначный домен отклоняется, и проверка домена не удается закрыть. Поскольку протокол еще не записывает хост, который выдал файл cookie, файлы cookie без атрибута Domain вообще не отправляются, пока этот хост не будет записан; операторы, полагающиеся на передачу файлов cookie, заметят это.
Ошибка в документации исправлена в том же выпуске. Пользователи, которые не могут обновиться немедленно, должны ограничить аутентифицированное сканирование топологией, чьи фильтры URL сохраняют его на источнике, который выдал учетные данные, и не должны полагаться на поиск файлов cookie в качестве границы. Вращающиеся учетные данные сессии, используемые для таких сканирований, целесообразны.
Кредит Independently сообщил Apache StormCrawler PMC n0mi1k, с доказательством концепции. Также найдено ASF - с использованием агентов Claude для изучения безопасности проектов с открытым исходным кодом, подтвержденных и сообщенных Apache StormCrawler.
Показать оригинальное описание (EN)
Description `CookieConverter.getCookies` decides which stored cookies to attach to an outbound request. The applicability check is nested inside a test for the presence of a `Domain` attribute, so a cookie without one, which is the ordinary form of a session cookie, skips scoping entirely and is returned for whatever target URL was passed. RFC 6265 requires the opposite: a cookie with no `Domain` attribute is host-only and belongs to the host that set it. Two further defects sit in the same method. The domain comparison has no notion of a registrable domain, so a `Domain` value of `com` matches every host under it, and the comparison returns true when it throws, so a failure to evaluate the check admits the cookie. Neither the converter nor `MetadataTransfer`, which carries the stored cookie to outlinks, ever considers the host that issued it. Cookie handling is opt-in: it requires `http.use.cookies` to be set to true, which is not the default, and the cookie key to be listed in `metadata.transfer`. The documented recipe does not work as written, because the `metadata.transfer` example in the internals documentation names `set-cookie` while the key present in metadata is `protocol.set-cookie` and the transfer matches key names exactly. Deployments affected are therefore those where an operator determined the correct key, enabled cookie handling and crawls an authenticated site whose pages link or redirect to other hosts. In that case the session cookie of the authenticated origin is sent to those hosts. Mitigation Upgrade to 4.0.0, where a cookie without a `Domain` attribute is sent only to the host that set it, a single-label domain is rejected and the domain check fails closed. Because the protocol does not yet record the host that issued a cookie, cookies without a `Domain` attribute are not sent at all until that host is recorded; operators relying on cookie transfer will notice this. The documentation error is corrected in the same release. Users who cannot upgrade immediately should confine an authenticated crawl to a topology whose URL filters keep it on the origin that issued the credentials, and should not rely on cookie scoping as a boundary. Rotating session credentials used for such crawls is advisable. Credit Independently reported to the Apache StormCrawler PMC by n0mi1k, with a proof of concept. Also found by the ASF -- using Claude agents to study the security of open-source projects, validated and reported by Apache StormCrawler.