Course contentsShow
← Security
Lesson 1100 of 3,05223. Web Security - Modern Web AttacksFree lesson

HTTP/2 Server Push Security Risks

Analyzing server push functionality, cache poisoning via pushed resources, and cross-origin push attacks and mitigations.

HTTP/2 Server Push Security Risks

You'll learn how HTTP/2 server push can introduce cache poisoning, cross-origin attacks, and bypass security controls if not properly protected.

What Is HTTP/2 Server Push?

HTTP/2 allows servers to proactively "push" resources (CSS, JavaScript, images) to the client before the client requests them. While this can improve performance, it creates new attack surfaces because the server decides what resources the client receives.

Core Security Risks

Cache Poisoning via Pushed Resources
An attacker who can influence what the server pushes can inject malicious content into the victim's browser cache. If an attacker triggers a push of compromised JavaScript to /app.js, the browser may cache and execute it on future visits—even after the attack ends. This is like a store clerk putting counterfeit products on your shelf before you even ask for them.

Cross-Origin Push Attacks
A malicious server can push resources that appear to come from a different origin. If not properly validated, the browser might accept and cache these pushed resources. For example, evil.com could push a resource claiming to be from bank.com, potentially bypassing Same-Origin Policy protections if the browser doesn't validate the pushed resource's authority correctly.

Resource Exhaustion
An attacker can force the server to push excessive resources, overwhelming the client's cache or connection, leading to denial of service.

Mitigations

  • Validate push authority: Only accept pushed resources from origins that are authoritative for them
  • Respect CSP: Server push must honor Content Security Policy directives
  • Client control: Allow clients to refuse pushed resources using RST_STREAM frames
  • Cache partitioning: Isolate pushed resources by origin to prevent cross-origin contamination

Key Takeaway: HTTP/2 server push introduces risks by letting servers inject resources into client caches; proper validation, CSP enforcement, and cache isolation are essential to prevent cache poisoning and cross-origin attacks.