File: cgicso_command_execution.nasl

package info (click to toggle)
nessus-plugins 1.0.10-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,924 kB
  • ctags: 408
  • sloc: sh: 7,838; ansic: 3,415; makefile: 233
file content (85 lines) | stat: -rw-r--r-- 2,117 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

# This script is (C) Noam Rathaus

if (description)
{
 script_id(10779);
 script_name(english:"CGIEmail's CGICso (Send CSO via CGI) Command Execution Vulnerability");
 desc["english"] = "
The remote host seems to be vulnerable to a security problem in 
CGIEmail (cgicso).  The vulnerability is caused by inadequate processing 
of queries by CGIEmail's cgicso and results in a command execution 
vulnerability.

Impact:
The server can be compromised by executing commands as the web server's 
running user (usually 'nobody').

Solution:
Modify cgicso.h to contain a strict setting of your finger host.

Example:
Define the following in cgicso.h:
#define CGI_CSO_HARDCODE
#define CGI_CSO_FINGERHOST 'localhost'

Risk Factor: High

Additional information:
http://www.securiteam.com/exploits/5TP0W005FE.html";

 script_description(english:desc["english"]);
 script_summary(english:"Determine if a remote host is vulnerable to the cgicso vulnerability");
 script_category(ACT_GATHER_INFO);
 script_family(english:"CGI abuses", francais:"Abus de CGI");
 script_copyright(english:"This script is Copyright (C) 2001 SecurITeam");
 script_dependencie("find_service.nes", "no404.nasl");
 script_require_ports("Services/www", 80);
 exit(0);
}

port = get_kb_item("Services/www");
if (!port) port = 80;

dir[0] = "/bin/";
dir[1] = "/cgi-local/cgiemail-1.4/";
dir[2] = "/cgi-local/";
dir[3] = "/cgi/cgiemail/";
dir[4] = "/html/cgi-bin/";
dir[5] = "/cgi-local/cgiemail-1.6/";
dir[6] = string(cgibin(), "/");

if (get_port_state(port))
{
 for (i = 0; dir[i] ; i = i + 1)
 {
  url = string(dir[i], "cgicso");
 # display("URL: ", url, "\n");

  if (is_cgi_installed(url))
  {
   # display("CGI found at: ", url, "\n");
   data = string(url, "?query=AAA");

   req = http_get(item:data, port:port);
   soc = open_sock_tcp(port);
   if (soc)
   {
    send(socket:soc, data:req);
    buf = recv(socket:soc, length:1000);

    # display(buf);
    if ("400 Required field missing: fingerhost" >< buf)
    {
     security_hole(port:port);
     exit(0);
    }
    else
    {
     security_note(port:port);
     exit(0);
    }
   }
  }
 }
}