Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-20-2006, 10:17 AM   #1
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Rep: Reputation: 30
changing Apache advertised name

Hi there,
I use mod_security to harden my apache server.
SecServerSignature "Microsoft-IIS/5.0" does a good job changing the server signature for fingerprint tools like nmap. Of course I don't expect to fool the best hackers but at leas some script kiddies

Apache also advertises its real name and version in ErrorDocuments like 404.
Not Found
The requested URL /aas.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.34 Server at Port 80
I know I could use ErrorDocument handler to serve a custom webpage, but I want to serve the same page just with servername changed.

How can I accomplish this?

There are the cgi variable, but I don’t know how/where to modify them….

Old 03-20-2006, 10:58 AM   #2
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30
ServerSignature Off, disables the advertisement of server name and version.
But how can I advertise another name and version to fool the possible intruders?
Old 03-20-2006, 11:35 AM   #3
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30

so, here we are...
I will come with the answer for the one that needs it:

Changing Web Server Identity
One of the principles of web server hardening is hiding as much information from the public as possible. By extending the same logic, hiding the identity of the web server makes perfect sense. This subject has caused much controversy. Discussions usually start because Apache does not provide facilities to control all of the content provided in the Server header field, and some poor soul tries to influence Apache developers to add it. Because no clear technical reasons support either opinion, discussions continue.

I have mentioned the risks of providing server information in the Server response header field defined in the HTTP standard, so a first step in our effort to avoid this will be to fake its contents. As you will see later, this is often not straightforward, but it can be done. Suppose we try to be funny and replace our standard response "Apache/1.3.30 (Unix)" with "Microsoft-IIS/5.0" (it makes no difference to us that Internet Information Server has a worse security record than Apache; our goal is to hide who we are). An attacker sees this but sees no trace of Active Server Pages (ASP) on the server, and that makes him suspicious. He decides to employ operating system fingerprinting. This technique uses the variations in the implementations of the TCP/IP protocol to figure out which operating system is behind an IP address. This functionality comes with the popular network scanner NMAP. Running NMAP against a Linux server will sometimes reveal that the server is not running Windows. Microsoft IIS running on a Linux servernot likely!

There are also differences in the implementations of the HTTP protocol supplied by different web servers. HTTP fingerprinting exploits these differences to determine the make of the web server. The differences exist for the following reasons:

Standards do not define every aspect of protocols. Some parts of the standard are merely recommendations, and some parts are often intentionally left vague because no one at the time knew how to solve a particular problem so it was left to resolve itself.

Standards sometimes do not define trivial things.

Developers often do not follow standards closely, and even when they do, they make mistakes.

The most frequently used example of web server behavior that may allow exploitation is certainly the way Apache treats URL encoded forward slash characters. Try this:

Open a browser window, and type in the address (two forward slashes at the end). You will get the home page of the site.

Replace the forward slash at the end with %2f (the same character but URL-encoded): The web server will now respond with a 404 (Not Found) response code!

This happens only if the site runs Apache. In two steps you have determined the make of the web server without looking at the Server header field. Automating this check is easy.

This behavior was so widely and frequently discussed that it led Apache developers to introduce a directive ( AllowEncodedSlashes) to the 2.x branch to toggle how Apache behaves. This will not help us much in our continuing quest to fully control the content provided in the Server header field. There is no point in continuing to fight for this. In theory, the only way to hide the identity of the server is to put a reverse proxy (see Chapter 9) in front and instruct it to alter the order of header fields in the response, alter their content, and generally do everything possible to hide the server behind it. Even if someone succeeds at this, this piece of software will be so unique that the attacker will identify the reverse proxy successfully, which is as dangerous as what we have been trying to hide all along.

Not everything is lost, however. You may not be able to transform your installation's identity, but you can pretend to be, say, a different version of the same web server. Or you can pretend to be a web server with a list of modules different from reality. There is a great opportunity here to mislead the attacker and make him spend a lot of time on the wrong track and, hopefully, give up. To conclude:

With a different server name in the Server header field, you can deflect some automated tools that use this information to find servers of certain make.

It is possible to fool and confuse a range of attackers with not quite developed skills. Not everyone knows of TCP/IP and HTTP fingerprinting, for example.

Small changes can be the most effective.

Now, let's see how we can hide server information in practice.

Changing the Server Header Field
The following sections discuss alternative approaches to changing the web server identity.

Changing the name in the source code
You can make modifications to change the web server identity in two places in the source code. One is in the include file httpd.h in Apache 1 (ap_release.h in Apache 2) where the version macros are defined:

#define SERVER_BASEVENDOR "Apache Group"
#define SERVER_BASEREVISION "1.3.29"
in httpd.conf also:

ServerSignature Off #doesn't advertise its name and version in ErrorDocumens like 404
ServerTokens ProductOnly


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Apache DocumentRoot walterbyrd Linux - Software 1 10-18-2005 04:30 PM
Apache -- Changing requested URL to another name AnthonyM Linux - General 0 09-24-2004 08:34 PM
Dell not honoring advertised price Dhimani General 13 09-03-2004 11:53 AM
Apache Changing Quotes to Question Marks tictocdoc Linux - Networking 3 05-16-2004 01:48 PM
changing Apache port GabeF Linux - Networking 5 10-07-2002 04:13 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration