HTTP Cache Poisoning and Host Header Injection

Thursday, June 12, 2008

A recent post came through the WASC mailing list today from Carlos Bueno regarding this topic. The basic gist is in the impact of utilizing the browser-supplied Host headers as a means for link consistency in programming your web code.

For example, assume the page ‘urltest.php’ contained the following

$host = $_SERVER['HTTP_HOST'];
$filename = $_SERVER["REQUEST_URI"];
echo 'http://'.$host.$filename;

Although a simple example, imagine using this variable as the root of any “a href” links you may want to make (by the way, it seems to be the default for PHP5 installations I’ve tested)

The problem lies in the ability for an attacker to arbitrarily change the Host: header information when talking to your web server. For example:

nc www.target.com 80
GET /urltest.php HTTP/1.1
User-Agent: Mozilla
Host: evilhacker.com#

which results in the following HTML output from the server

HTTP/1.1 200 OK
Date: Thu, 12 Jun 2008 19:42:23 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
Content-Length: 41
Connection: close
Content-Type: text/html; charset=UTF-8
http://evilhacker.com#/urltest.php

…returning the invalid Host header in our echo statement which was provided by the attacker.

The theoretical problem here lies in the ability in certain isolated situations to poison the server’s cache or poison an upstream proxy cache, which could mean an attacker could redirect links or other content embedded in the attacked site, while other users browse the vulnerable page….

I actually verified this in a couple of instances today on some real servers and it works, but while going through my Squid Proxy (in an attempt to capitalize on the cache-poisoning issue), Squid properly returned the valid host headers, even when I cleared the cache, so this is probably a very low-risk attack from a proxy cache-poisoning perspective, but I bet the method has other uses (we already do similar things when attempting HTTP Response-Splitting)

In shared hosting environments, it is possible to use this attack to force your browser to grab resources from another virtual host on the same server. I tested this on a shared server with 2 known virtual hosts, and found that by inserting an initial “Host:” variable referencing another host in my shared server, all subsequent calls would reference resources on the other domain (for example includes and images) where full paths where not used in the source code.

For example:

include 'file.php'

Would attempt to load the file ‘file.php’ from the forged host header running on the same machine…

I tested this on an Apache2/PHP5 installation running on Linux with 2 virtual host defs….works every time…I can swap include files for my own to run my own content…

If you have a web server on a shared (i.e. virtual) environment, you are at risk

22212
Vulnerabilities Webappsec->General
Post Rating I Like this!
Default-avatar
avelin injector http://blogdemellizos.blogspot.com/2014/03/contoh-naskah-drama-singkat-anak-sekolah.html
http://blogdemellizos.blogspot.com/2014/03/kata-kata-mutiara-bijak-malam-hari-indah.html
http://blogdemellizos.blogspot.com/2014/03/kata-kata-mutiara-bijak-ibu-kepada-anaknya.html
http://blogdemellizos.blogspot.com/2014/03/kata-kata-mutiara-doa-untuk-ibu-bunda-tercinta.html
http://blogdemellizos.blogspot.com/2014/03/contoh-naskah-drama-persahabatan-menyesal.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-mutiara-bijak-motivasi-indah-sore-hari.html

http://blogdemellizos.blogspot.com/2014/02/kata-kata-motivasi-mutiara-bijak-indah-sore-hari.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-galau-sedih-kesepian-tanpa-cinta-malam-hari.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-move-on-hati-yang-tersakiti-cinta.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-mutiara-hati-yang-paling-dalam.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-doa-mutiara-indah-buat-bunda-tercinta.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-doaku-indah-pagi-hari-doa-motivasi-bijak-hari-ini.html

http://blogdemellizos.blogspot.com/2014/02/kata-kata-jomblo-ngenes-lucu-gokil-ngaco-romantis.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-nasehat-mutiara-bijak-islami-pagi-hari.html
http://blogdemellizos.blogspot.com/2014/02/puisi-pagi-hari-ucapan-selamat-pagi-romantis.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-doa-indah-sabar-dan-ikhlas.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-nasehat-lucu-ngaco-gokil.html
http://blogdemellizos.blogspot.com/2014/02/kata-kata-ucapan-selamat-tidur-romantis.html

http://blogdemellizos.blogspot.com/2014/01/kata-kata-kesetiaan-cinta-sejati.html
http://blogdemellizos.blogspot.com/2014/01/pantun-gombal-cinta-romantis-gokil-lucu.html
http://blogdemellizos.blogspot.com/2014/01/kata-kata-mutiara-cinta-islam-untuk-wanita.html
http://blogdemellizos.blogspot.com/2014/01/kata-kata-romantis-cinta-malam-hari.html
http://blogdemellizos.blogspot.com/2013/12/kata-kata-galau-cinta-buat-pacar.html
http://blogdemellizos.blogspot.com/2013/12/kata-kata-nasehat-bijak-ayah-tercinta.html

http://blogdemellizos.blogspot.com/2013/12/kata-kata-nasehat-ibu-kepada-anaknya.html
http://blogdemellizos.blogspot.com/2013/12/kata-kata-nasehat-bijak-ibu-tersayang.html
http://blogdemellizos.blogspot.com/2013/12/kata-kata-bijak-pagi-hari-yang-cerah.html
http://blogdemellizos.blogspot.com/2013/11/kata-kata-doa-pagi-renungan-mutiara-pagi-hari.html
http://blogdemellizos.blogspot.com/2013/11/kata-kata-galau-sakit-hati-kecewa.html
http://blogdemellizos.blogspot.com/2013/11/kata-kata-cinta-menyentuh-hati.html

http://blogdemellizos.blogspot.com/2013/11/kata-kata-galau-karena-mantan-pacar.html
http://blogdemellizos.blogspot.com/2013/10/kata-kata-renungan-cinta-malam-hari.html
http://blogdemellizos.blogspot.com/2013/10/kata-kata-bijak-cinta-penuh-makna.html
http://blogdemellizos.blogspot.com/2014/11/kata-kata-nyindir-orang-sombong.html
http://blogdemellizos.blogspot.com/2014/11/kata-kata-malam-minggu-yang-sepi.html
http://blogdemellizos.blogspot.com/2014/11/kata-kata-cinta-buat-gebetan.html

http://blogdemellizos.blogspot.com/2014/11/kata-kata-kecewa-buat-pacar.html
http://blogdemellizos.blogspot.com/2014/11/kata-kata-sedih-buat-pacar.html
http://blogdemellizos.blogspot.com/2014/11/kata-kata-dibohongi.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-patah-hati-kecewa-karena-cinta.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-lucu-banget-bahasa-jawa.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-rindu-buat-pacar.html

http://blogdemellizos.blogspot.com/2014/10/contoh-surat-izin-tidak-masuk-sekolah.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-sakit-hati-kecewa-untuk-teman.html
http://blogdemellizos.blogspot.com/2014/10/gambar-dp-bbm-anak-racing.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-sindiran-halus-buat-teman.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-pacaran-jarak-jauh.html
http://blogdemellizos.blogspot.com/2014/10/gambar-wallpaper-bunga-melati-putih.html

http://blogdemellizos.blogspot.com/2014/10/kata-kata-aku-bahagia-bersamamu.html
http://blogdemellizos.blogspot.com/2014/10/tes-iq-online-indonesia.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-benci.html
http://blogdemellizos.blogspot.com/2014/10/cinta-bertepuk-sebelah-tangan.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-anak-racing-drag-balap-motor.html
http://blogdemellizos.blogspot.com/2014/10/model-kebaya-wisuda.html

http://blogdemellizos.blogspot.com/2014/10/kata-kata-sindiran-lucu-gokil-buat-pacar.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-sindiran-buat-orang-sirik-iri.html
http://blogdemellizos.blogspot.com/2014/10/contoh-surat-kuasa-pengambilan-bpkb.html
http://blogdemellizos.blogspot.com/2014/10/contoh-surat-permohonan-izin-cuti-menikah.html
http://blogdemellizos.blogspot.com/2014/10/contoh-surat-izin-tidak-masuk-kuliah.html
http://blogdemellizos.blogspot.com/2014/10/contoh-surat-permohonan-magang-kerja-resmi.html

http://blogdemellizos.blogspot.com/2014/10/contoh-slip-gaji-bulanan-karyawan-swasta.html
http://blogdemellizos.blogspot.com/2014/10/download-dp-bbm-lucu-gokil-unik-terbaru.html
http://blogdemellizos.blogspot.com/2014/10/sakitnya-tuh-disini.html
http://blogdemellizos.blogspot.com/2014/10/gambar-dp-bbm-sindiran-halus-buat-pacar.html
http://blogdemellizos.blogspot.com/2014/10/gambar-dan-kata-kata-doa-kristen-rohani.html
http://blogdemellizos.blogspot.com/2014/10/gambar-kata-kata-gokil-unik-keren-lucu.html

http://blogdemellizos.blogspot.com/2014/10/gambar-foto-kata-kata-gombal-cinta-romantis.html
http://blogdemellizos.blogspot.com/2014/10/gambar-dp-bbm-motivasi-semangat-pagi-hari.html
http://blogdemellizos.blogspot.com/2014/10/download-gambar-foto-kata-kata-cinta-romantis.html
http://blogdemellizos.blogspot.com/2014/10/wallpaper-kata-kata-galau-lucu-terbaru.html
http://blogdemellizos.blogspot.com/2014/10/gambar-kata-kata-cemburu-cinta-buat-pacar.html
http://blogdemellizos.blogspot.com/2014/10/wallpaper-kata-kata-mutiara-indah-terbaru.html

http://blogdemellizos.blogspot.com/2014/10/wallpaper-kata-kata-cinta-romantis-terbaru.html
http://blogdemellizos.blogspot.com/2014/10/wallpaper-kata-kata-lucu-gokil-unik-terbaru.html
http://blogdemellizos.blogspot.com/2014/10/gambar-foto-kata-kata-mutiara-bijak-islam.html
http://blogdemellizos.blogspot.com/2014/10/gambar-display-picture-bbm-galau-sedih.html
http://blogdemellizos.blogspot.com/2014/10/gambar-display-picture-bbm-mutiara-cinta-romantis.html
http://blogdemellizos.blogspot.com/2014/10/gambar-display-picture-bbm-lucu-unik-gokil.html

http://blogdemellizos.blogspot.com/2014/10/download-foto-foto-lucu-untuk-dp-bbm-terbaru.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-motivasi-galau-cinta-mario-teguh.html
http://blogdemellizos.blogspot.com/2014/10/gambar-dp-bbm-naruto-shippuden-terbaru.html
http://blogdemellizos.blogspot.com/2014/10/gambar-dp-bbm-kata-kata-mutiara-lelah-menunggu.html
http://blogdemellizos.blogspot.com/2014/10/kata-kata-lelah-hati-ini-menunggu-cinta.html
http://blogdemellizos.blogspot.com/2014/10/gambar-tulisan-galau-sedih-buat-dp-bbm.html

http://blogdemellizos.blogspot.com/2014/03/kata-kata-mutiara-cinta-suami-istri.html
http://blogdemellizos.blogspot.com/2014/10/gambar-dp-bbm-kata-kata-sakitnya-tuh-disini.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-pantang-menyerah.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-bijak-selingkuh.html
http://blogdemellizos.blogspot.com/2014/09/gambar-kata-kata-rindu-mantan-kekasih.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-sakit-kepala-pusing-mumet-jenuh.html

http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-bosan-bete-capek.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-karma-cinta-buat-mantan.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-mutiara-bijak-putus-asa.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-sayang-romantis.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-gokil-lucu-kocak-unik-terbaru.html
http://blogdemellizos.blogspot.com/2014/09/kata-kata-mutiara-bijak-sindiran-lucu.html

http://blogdemellizos.blogspot.com/2014/09/download-gambar-kata-kata-galau-sedih-kecewa.html
http://blogdemellizos.blogspot.com/2014/09/download-gambar-kata-kata-sakit-hati-kecewa.html
http://blogdemellizos.blogspot.com/2014/09/download-gambar-kata-kata-mutiara-bijak-terbaru.html
http://blogdemellizos.blogspot.com/2014/09/kata-kata-rindu-kangen-sahabat-tercinta.html
http://blogdemellizos.blogspot.com/2014/09/kata-kata-romantis-merindukan-seorang-kekasih.html
http://blogdemellizos.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-sindiran-mantan-penghianat.html

http://ikatakataromantis.blogspot.com/2014/01/kata-kata-romantis-buat-mantan-kekasih.html
http://ikatakataromantis.blogspot.com/2014/01/kata-kata-galau-kecewa-sakit-hati.html
http://ikatakataromantis.blogspot.com/2014/01/kata-kata-galau-sedih-patah-hati.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-sindiran-pacar-sok-sibuk.html
http://ikatakataromantis.blogspot.com/2014/09/kata-kata-menyindir-pacar-yang-cuek-jutek.html

http://ikatakataromantis.blogspot.com/2013/12/kata-kata-galau-sedih-romantis.html
http://ikatakataromantis.blogspot.com/2014/04/kata-kata-sindiran-buat-orang-sombong.html
http://ikatakataromantis.blogspot.com/2014/04/kata-kata-sindiran-buat-orang-munafik.html
http://ikatakataromantis.blogspot.com/2014/04/kata-kata-romantis-buat-istri-tercinta.html

http://ikatakataromantis.blogspot.com/2014/10/gambar-sedih-sakit-hati-buat-dp-bbm.html
http://ikatakataromantis.blogspot.com/2014/10/gambar-tulisan-galau-sedih-buat-dp-bbm.html
http://ikatakataromantis.blogspot.com/2014/09/kata-kata-motivasi-bijak-putus-cinta.html
http://ikatakataromantis.blogspot.com/2014/09/kata-kata-semangat-buat-patah-hati-karena-cinta.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-kata-kata-indah-buat-pacar-tercinta.html
http://ikatakataromantis.blogspot.com/

http://ikatakataromantis.blogspot.com/2014/09/gambar-kata-kata-sayang-tulus-sama-pacar.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-galau-lelah-capek-jenuh.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-keren-gaul-gokil.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-foto-dp-bbm-sakit-hati-karena-cinta.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-lelah-bosan-menunggu.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-kata-kata-marah-kecewa-kesal-buat-pacar.html

http://ikatakataromantis.blogspot.com/2014/09/kata-kata-mutiara-cinta-buat-mantan-kekasih.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-menghina-menyinggung-mantan.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-buat-orang-sirik-iri-dengki.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-sindiran-mantan-munafik.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-lucu-gokil-buat-mantan.html
http://ikatakataromantis.blogspot.com/2014/09/gambar-dp-bbm-kata-kata-sindiran-buat-pacar-egois.html
1417349035