Online Book Reader

Home Category

Apache Security - Ivan Ristic [173]

By Root 1973 0

Probing for common configuration problems

Test to see if proxy operations are allowed in the web server. A running proxy service that allows anyone to use it without restriction (a so-called open proxy) represents a big configuration error. To test, connect to the target web server and request a page from a totally different web server. In proxy mode, you are allowed to enter a full hostname in the request (otherwise, hostnames go into the Host header):

$ telnet www.example.com 80

Connected to www.example.com.

Escape character is '^]'.

HEAD http://www.google.com:80/ HTTP/1.0

HTTP/1.1 302 Found

Date: Thu, 11 Nov 2004 14:10:14 GMT

Server: GWS/2.1

Location: http://www.google.de/

Content-Type: text/html; charset=ISO-8859-1

Via: 1.0 www.google.com

Connection: close

Connection closed by foreign host.

If the request succeeds (you get a response, like the response from Google in the example above), you have encountered an open proxy. If you get a 403 response, that could mean the proxy is active but configured not to accept requests from your IP address (which is good). Getting anything else as a response probably means the proxy code is not active. (Web servers sometimes simply respond with a status code 200 and return their default home page.)

The other way to use a proxy is through a CONNECT method, which is designed to handle any type of TCP/IP connection, not just HTTP. This is an example of a successful proxy connection using this method:

$ telnet www.example.com 80

Connected to www.example.com.

Escape character is '^]'.

CONNECT www.google.com:80 HTTP/1.0

HTTP/1.0 200 Connection Established

Proxy-agent: Apache/2.0.49 (Unix)

HEAD / HTTP/1.0

Host: www.google.com

HTTP/1.0 302 Found

Location: http://www.google.de/

Content-Type: text/html

Server: GWS/2.1

Content-Length: 214

Date: Thu, 11 Nov 2004 14:15:22 GMT

Connection: Keep-Alive

Connection closed by foreign host.

In the first part of the request, you send a CONNECT line telling the proxy server where you want to go. If the CONNECT method is allowed, you can continue typing. Everything you type from this point on goes directly to the target server. Having access to a proxy that is also part of an internal network opens up interesting possibilities. Internal networks usually use nonroutable private space that cannot be reached from the outside. But the proxy, because it is sitting on two addresses simultaneously, can be used as a gateway. Suppose you know that the IP address of a database server is 192.168.0.99. (For example, you may have found this information in an application library file through file disclosure.) There is no way to reach this database server directly but if you ask the proxy nicely it may respond:

$ telnet www.example.com 80

Connected to www.example.com.

Escape character is '^]'.

CONNECT 192.168.0.99:3306 HTTP/1.0

HTTP/1.0 200 Connection Established

Proxy-agent: Apache/2.0.49 (Unix)

If you think a proxy is there but configured not to respond to your IP address, make a note of it. This is one of those things whose exploitation can be attempted later, for example after a successful entry to a machine that holds an IP address internal to the organization.

The presence of WebDAV may allow file enumeration. You can test this using the WebDAV protocol directly (see Chapter 10) or with a WebDAV client. Cadaver (http://www.webdav.org/cadaver/) is one such client. You should also attempt to upload a file using a PUT method. On a web server that supports it, you may be able to upload and execute a script.

Another frequent configuration problem is the unrestricted availability of web server access logs. The logs, when available, can reveal direct links to other interesting (possibly also unprotected) server resources. Here are some folder names you should try:

/logs

/stats

/weblogs

/webstats

Examining responses to exceptional requests

For your review, you need to be able to differentiate between normal responses and exceptions when they are coming from the web server you are investigating.

Return Main Page Previous Page Next Page

®Online Book Reader