Caching Strategies: Redis + CDN + Edge Computing · レッスン

キャッシュポイズニングとキャッシュレイヤーの防御

キャッシュポイズニングや欺瞞攻撃の仕組みと、キーやヘッダーを慎重に扱ってキャッシュレイヤーを堅牢化する方法を学びます。

レッスン 4/413 ステップ

「キャッシュポイズニングとキャッシュレイヤーの防御」はCoddyKit上の無料Caching Strategies: Redis + CDN + Edge Computingレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはCaching Strategies: Redis + CDN + Edge Computing学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Caching Strategies: Redis + CDN + Edge Computingコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

What Is Cache Poisoning?

Web cache poisoning tricks a cache into storing a malicious response that is then served to other users. The attacker manipulates an input that influences the response but is not part of the cache key.

  • Attacker sends a crafted request
  • Origin reflects attacker input into the response
  • Cache stores it and serves it to everyone

Unkeyed Inputs Are the Risk

The root cause is an unkeyed input: a header or parameter that changes the response but is excluded from the cache key. If an attacker controls it, they poison the shared entry.

Example: Poisoning via a Custom Header

Imagine the origin reflects X-Forwarded-Host into a generated URL but the cache ignores that header. An attacker sets it to their domain, and the cached page now points everyone at attacker resources.

GET / HTTP/1.1
Host: example.com
X-Forwarded-Host: evil.com

Cache Key Hygiene

The primary defense is to include every input that affects the response in the cache key, or to strip dangerous headers before caching. Never reflect untrusted headers into cached output.

Cache Deception

Cache deception tricks the cache into storing private data under a public-looking URL. An attacker appends a fake static extension so the cache treats a sensitive page as a cacheable asset.

https://app.com/account/info.css   (still serves the private account page)

Defending Against Deception

Defend by caching based on the actual Content-Type and explicit rules, not just the URL extension. Never cache responses marked private or that set authenticated cookies.

Stripping Risky Headers

Configure the edge to drop headers an attacker should not control before they reach the origin or cache, such as forwarded-host style headers unless explicitly trusted.

proxy_set_header X-Forwarded-Host "";

Sanitizing Reflected Values

If the origin must echo a value, validate and encode it. Never build cacheable URLs or scripts directly from request headers without strict allow-lists.

Separating Authenticated Traffic

Authenticated responses should generally bypass shared caches. Route logged-in requests around the public cache, or mark them private, no-store so they are never shared.

Cache-Control: private, no-store

Monitoring for Poisoning

Watch for anomalies: sudden cache entries with unexpected hosts, spikes in 4xx after a deploy, or reports of users seeing foreign content. Detection lets you purge fast.

Hardening Checklist

Protect the cache layer by:

  • Keying on every response-affecting input
  • Stripping untrusted forwarding headers
  • Caching by content type, not URL extension
  • Never caching private or authenticated responses
  • Encoding any reflected request values

Quick Check

Test your cache security understanding.

Recap

You learned how cache poisoning and cache deception attacks exploit unkeyed inputs and URL-based caching. You saw defenses: rigorous cache-key hygiene, stripping untrusted headers, caching by content type, never sharing authenticated responses, and monitoring for anomalies.

無料で開始

AI チューターと学ぶ Caching Strategies: Redis + CDN + Edge Computing — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
12
レッスン
48

よくある質問

「キャッシュポイズニングとキャッシュレイヤーの防御」レッスンは無料ですか?

はい。「キャッシュポイズニングとキャッシュレイヤーの防御」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Caching Strategies: Redis + CDN + Edge Computingコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Caching Strategies: Redis + CDN + Edge Computingコースには全4レッスンが含まれています。

「キャッシュポイズニングとキャッシュレイヤーの防御」で何を学びますか?

キャッシュポイズニングや欺瞞攻撃の仕組みと、キーやヘッダーを慎重に扱ってキャッシュレイヤーを堅牢化する方法を学びます。 ブラウザで直接実行するハンズオンコードでCaching Strategies: Redis + CDN + Edge Computingを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Caching Strategies: Redis + CDN + Edge Computingを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのCaching Strategies: Redis + CDN + Edge Computingは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「キャッシュポイズニングとキャッシュレイヤーの防御」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このCaching Strategies: Redis + CDN + Edge Computingレッスンでコードを書いて実行できますか?

はい。すべてのCaching Strategies: Redis + CDN + Edge Computingレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. キャッシュフォールバックとCircuit Breaker
  2. キャッシュのセキュリティベストプラクティス
  3. キャッシュの今後のトレンド
  4. キャッシュポイズニングとキャッシュレイヤーの防御
← Caching Strategies: Redis + CDN + Edge Computingに戻る