File: nikto_apache_expect_xss.plugin

package info (click to toggle)
nikto 1%3A2.1.4-2
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 2,276 kB
  • sloc: perl: 4,328; makefile: 11
file content (48 lines) | stat: -rw-r--r-- 1,963 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#VERSION,2.03
# $Id: nikto_apache_expect_xss.plugin 632 2011-02-19 02:49:31Z sullo $
###############################################################################
#  Copyright (C) 2008 CIRT, Inc.
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; version 2
#  of the License only.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
###############################################################################
# PURPOSE:
# Test Apache's expect header XSS
###############################################################################
sub nikto_apache_expect_xss_init {
    my $id = {
        name      => "apache_expect_xss",
        full_name => "Apache Expect XSS",
        author    => "Sullo",
        description =>
          "Checks whether the web servers has a cross-site scripting vulnerability through the Expect: HTTP header",
        hooks     => { scan => { method => \&nikto_apache_expect_xss, }, },
        copyright => "2008 CIRT Inc."
        };
    return $id;
}

sub nikto_apache_expect_xss {
    return if $mark->{'terminate'};
    my ($mark) = @_;
    my %headers = ('Expect', '<script>alert(xss)</script>');
    my ($RES, $CONTENT) = nfetch($mark, "/", "GET", "", \%headers, "", "apache_expect_xss");

    if ($CONTENT =~ /<script>alert\(xss\)<\/script>/) {
        add_vulnerability($mark, "Apache is vulnerable to XSS via the Expect header", 999974,
                          27487);
    }
}

1;