Since only the first 32bits of the primary hash built in sha1_hosturi
are used as key in the cache tree and we reject entries when a hash
collision happens, it would be possible for an attacher to fill a
specific cache entry with "wrong" data and prevent actual caching.
Since a cache seed was already built for secondary key hashes we might
as well use it for primary hashes as well.
Reported-by: Claude (ANT-2026-9WRFEVJ3)
This patch should be backported to all stable branches.
/* hash everything */
blk_SHA1_Init(&sha1_ctx);
+ blk_SHA1_Update(&sha1_ctx, &cache_hash_seed, sizeof(cache_hash_seed));
blk_SHA1_Update(&sha1_ctx, trash->area, trash->data);
blk_SHA1_Final((unsigned char *)txn->cache_hash, &sha1_ctx);