تسميم ذاكرة التخزين المؤقت وحماية طبقتها
تعلّم كيفية عمل هجمات تسميم ذاكرة التخزين المؤقت والخداع، وكيفية تحصين طبقة التخزين المؤقت ضدها من خلال التعامل الدقيق مع المفاتيح والترويسات.
تسميم ذاكرة التخزين المؤقت وحماية طبقتها درس مجاني في Caching Strategies: Redis + CDN + Edge Computing على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في 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.comCache 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-storeMonitoring 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.
تعلم Caching Strategies: Redis + CDN + Edge Computing مع معلم ذكاء اصطناعي — مجانًا
اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.
- الدورات
- 12
- الدروس
- 48
الأسئلة الشائعة
هل درس «تسميم ذاكرة التخزين المؤقت وحماية طبقتها» مجاني؟
نعم — نص درس «تسميم ذاكرة التخزين المؤقت وحماية طبقتها» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Caching Strategies: Redis + CDN + Edge Computing، انتقل إلى CoddyKit PRO. تتضمن دورة Caching Strategies: Redis + CDN + Edge Computing 4 دروس في المجموع.
ماذا ستتعلم في «تسميم ذاكرة التخزين المؤقت وحماية طبقتها»؟
تعلّم كيفية عمل هجمات تسميم ذاكرة التخزين المؤقت والخداع، وكيفية تحصين طبقة التخزين المؤقت ضدها من خلال التعامل الدقيق مع المفاتيح والترويسات. تتمرن على Caching Strategies: Redis + CDN + Edge Computing مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Caching Strategies: Redis + CDN + Edge Computing؟
لا تُشترط خبرة سابقة. Caching Strategies: Redis + CDN + Edge Computing على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «تسميم ذاكرة التخزين المؤقت وحماية طبقتها»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Caching Strategies: Redis + CDN + Edge Computing هذا؟
نعم. كل درس في Caching Strategies: Redis + CDN + Edge Computing يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- البدائل الاحتياطية وقواطع الدائرة في التخزين المؤقت
- أفضل ممارسات أمان ذاكرات التخزين المؤقت
- الاتجاهات المستقبلية في التخزين المؤقت
- تسميم ذاكرة التخزين المؤقت وحماية طبقتها