hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

flame
here is a nice tutorial i have found 2day
http://www.itd.state.ia.us/security/doc/Wi...ws_Apache_2.doc

Downloading Apache 2.0
Apache Web Site
http://httpd.apache.org

Download Site
http://www.apache.org/dist/httpd/binaries/win32/


Download the msi file of Apache 2.0 for Windows


Installation of Apache 2.0


Double-click the Apache msi file to begin installation

Welcome Screen
Click Next
License Agreement
Read the license, click Accept, and then click Next
Read This First
Read the Apache documentation, then click Next
Server Information
Enter the appropriate domain name
Enter the appropriate server name
Enter the administrator's email address
For Internet web servers, select port 80 installation as a service
For local web servers only, select port 8080 and manual startup
Setup Type
A Typical Installation is an appropriate setup
Select Custom if you wish to remove documentation or add programming libraries
Destination Folder
Select your installation folder for Apache
It is recommended to not install Apache on the system drive
Ready to Install
Click Next to install
Installation Complete
Click Finish to complete installation









Configuring Apache 2.0 (Non-SSL version)


Apache is configured using text-based configuration files. The main configuration file 'httpd.conf' controls Apache's system environment. This section will cover security related variables in this configuration file.


Run: Start Menu à Programs à Apache HTTP Server à Configure Apache Server à Edit the Apache httpd.conf Configuration File


Section 1: Global Environment

ServerRoot - be sure to set this to the location where Apache installed itself

Listen 80 - This sets the web port number where Apache http listens (default is 80)


Section 2: 'Main' Server Configuration

ServerAdmin - set to a valid administrator email address

DocumentRoot - be sure to set this to the directory where your main web files are located

UserDir - this allows all local users to create their own homepage that is automatically available on the Apache web server. It is recommended to put a pound (#) in front of this variable to disallow user web page publishing.

The following snip of tags located in the Apache configuration file disallows viewing of any files that begin with '.ht'. If you have any files that you wish to not allow viewable access via web browser (.exe for example), then use this snip to create your own special filter and place within the httpd.conf file.


<Files ~ "^\.ht">

Order allow,deny

Deny from all

</Files>


Note the logging variables for later viewing and formats

ErrorLog

LogLevel

LogFormat

CustomLog

Default Directory Aliases can be removed if not used. An Alias is a virtual web directory. A ScriptAlias is an executable virtual directory (such as cgi-bin). Each alias directory is defined by the keyword 'Alias' and then encompassed by a set of <Directory> tags. To disable aliased directories, pound out (#) each Alias tag and everything within (and including) each <Directory> tag.

It is recommended to remove the 'manual' virtual web directory from the configuration file.

If the 'cgi-bin' is not used, remove that virtual directory as well.

IndexIgnore - set any filenames or extensions that you do not wish to be listed when a directory listing is performed on a directory







Windows Settings


Run: Administrative Tools à Computer Management à Local Users and Groups


Create a user account 'Apache' and give the account a difficult password

Leave 'User must change password at next logon' unchecked
Set 'User cannot change password'
Set 'Password never expires'
Remove Apache from all group memberships


Within Windows Explorer, set the following NTFS permissions:


Grant the Apache account the following rights to the 'Apache Group' folder where Apache was installed:

Read & Execute, List Folder Contents, and Read
Grant the Apache account 'Write' access to the 'logs' directory as well

Apache Group\Apache2\logs
Grant appropriate rights to the Apache content directories

See Appendix A below
Deny access of the Apache account to certain system files

See Appendix B below


Run: Administrative Tools à Services


Apache Service configuration

Go to 'Properties' of the Apache2 service
Select the 'Log On' tab
Select 'This account' and enter the information of the Apache user account







Appendix A:


Data Type
Example Directories
Examples
NTFS File Permissions
Apache Permissions

Static Content
\Apache Group\Apache2\htdocs
.html
Administrators (Full Control)

System (Full Control)

Apache (Read)
Alias

Script Files and Executables
\Apache Group\Apache2\cgi-bin
.pl, .php, .dll
Administrators (Full Control)

System (Full Control)

Apache (Execute)
ScriptAlias




Appendix B:


Files located within 'C:\Winnt\system32\'

at.exe
cacls.exe
cmd.exe
command.com

cscript.exe
debug.exe
edlin.exe
finger.exe

ftp.exe
ipconfig.exe
krnl386.exe
nbstat.exe

net.exe
net1.exe
netsh.exe
posix.exe

rcp.exe
regedt32.exe
regini.exe
regsvr32.exe

rexec.exe
rsh.exe
runas.exe
runonce.exe

srvmgr.exe
sysedit.exe
syskey.exe
telnet.exe

tftp.exe
tracert.exe
usrmgr.exe





Please send feedback and comments to Jared.McLaren@itd.state.ia.us
virus
A reference would have been nice smile.gif
hermel
THX for the nice Tut smile.gif
bitwild
check the practicals posted on giac.org
many apache papers (mostly unix based)

f.e.
/practical/Jacqui_Chau_GCUX.pdf
/practical/GCUX/Sean_Heare_GCUX.pdf
/practical/ryan_barnett_gcux.zip
virus
There are loads of good papers on giac .... one should definitely go through their library :thumbs
Sparkles
for windows users, why not use Appserv and then go from there...
but in saying that if you cant edit a conf file(s) then you got problems...

Sparkles
barty32
got a german one:

ow to secure an Apache
-= WinApache Securing (2.0.0 - 2.0.39) =-
written by Skynet

Einführung:
-----------

Es gibt mehrere Möglichkeiten, einen Apache Server vor anderen Hackern zu sichern. Zum Einen durch vortäuschen eines Unix-Apaches, zum Anderen durch verhindern des Zugriffs auf die TFTP.EXE, FTP.EXE, NC- und TELNET.EXE.

Unix-Apache vortäuschen:
------------------------

Eine recht schöne Art, einen Apache vor Scannern zu verbergen. Hierdurch wird anstatt "Apache/2.0.36 (Win32)" z.b. "Apache/2.0.45 (Unix)" angezeigt.

Wie??? Ganz einfach: Ladet per FTP von eurem Stro aus dem bin-dir das Apache-Verzeichnisses (z.b. C:\Apache\Apache2\bin) die Datei "libhttpd.dll" auf euren Rechner herunter. Nun ladet ihr euch einen Hex-Editor wie der von www.bpsoft.com herunter. Nun installiert ihr den Hex-Editor und macht nen Rechtsklick auf die libhttpd.dll und geht auf "Hex Edit with Hex Workshop". Nun drückt ihr F3, gebt bei Value "(Win32)" (ohne Anführungszeichen) ein, macht nen Haken bei "Either" und klickt auf OK. Nun seid ihr an der Adresse, an welcher der Header übergeben wird. Dort müsste etwas mit "Apache/2.0.x.x (Win32)" stehen. Das x steht dabei für die Version des Apaches. Guckt nach, ob in der Ecke unten Rechts das Wort "OVR" schwarz und nicht grau ist. Ist es grau, dann drückt einmal die EINFG oder INS Taste. Nun könnt ihr im Header alles Editieren was euch beliebt. Ihr könnt anstatt Apache z.b. IIS eintragen oder weiss der Geier was. Klickt dazu an irgend eine Stelle in der Rechten Spalte, dort wo ihr editieren wollt. Danach könnt ihr einfach die Sachen überschreiben. Ihr müsst aber darauf achten dass ihr die Dateigröße nicht ändern dürft (Das passiert, wenn OVR grau ist). Ihr könnt sehen, dass nach der letzten Klammer in "Apache/2.0.x.x (Win23)" drei Punkte sind. Ihr dürft NUR bis zum ersten Punkt überschreiben, die Punkte dürfen auf keinen Fall überschrieben werden und es darf auch nach den Punkten nix überschrieben werden. Wenn ihr fertig seid, speichert die Datei mit einem Klick auf die Diskette ab.

Nun connected ihr wieder per FTP auf den Stro den ihr Securen wollt, geht in das Bin-Verzeichnis des Apaches und drückt dann STRG+R. Danach gebt ihr folgendes ein: "site exec apache -k stop" (ohne Anführungszeichen). Danach überschreibt ihr die "libhttpd.dll" mit eurer editierten Datei, drückt wieder STRG+R und gebt folgendes ein "site exec apache -k start". Danach könnt ihr überprüfen ob es gelungen ist indem ihr folgendes in eurem Browser eingebt:

http://ip.des.gehackten.servers/TestObEsGeht

Wenn dort ganz unten euer gewünschter Header steht, ist es gelungen: Die Scanner können euren Server nicht mehr finden!

EXE-Dateien Löschen
-------------------

Ihr könnt natürlich auch die EXE-Dateien, die zur Dateiübertragung benötigt werden, löschen. Geht dazu in das System32 Verzeichnis des Windows-Verzeichnis (Bspw. c:\winnt\system32) und löscht dort die TFTP.EXE, FTP.EXE und TELNET.EXE. Wartet danach ein paar Sekunden. Refresht danach mal und guckt nach, ob die Dateien immer noch da sind. Wenn ja, probiers mit Möglichkeit2 aus.

Policies setzen
---------------
Nehmt ein Remote Tool um auf die Registry eures Stros zuzugreifen, wie z.b. Shadow Remote oder Optix. Geht in die Registry und geht in HKEY_CURRENT_USER\Software\Policies\Microsoft. Erstellt dort nen Schlüssel namens Windows. Geht nun dort rein, erstellt unter HKEY_CURRENT_USER\Software\Policies\Microsoft\Wind

ows einen Schlüssel namens System. Geht auch in diesen Schlüssel rein. Ihr befindet euch nun in HKEY_CURRENT_USER\Software\Policies\Microsoft\Wind

ows\System. Dort erstellt ihr folgende DWORD Einträge (die Werte stehen dahinter):

DisableTFTP 1
DisableFTP 1
DisableNC 1
DisableTELNET 1

Die 1 bedeutet, dass TFTP, FTP, NC und TELNET zwar für den Admin auf dem lokalen PC, aber nicht für die User von draussen erreichbar und ansprechbar sind. Wenn ihr dort eine 2 eintragt, sind die Dienste weder für den Admin noch für euch erreichbar. Ein Hacker kann den Server zwar Scannen, aber nicht Hacken.

Schlusswort
-----------

Eine Kombination aus der ersten und der zweiten ODER dritten ist schier unmöglich zu hacken!

Viel Spass!

Thanks t°U for tut
aura
Ty for this.
SyN/AcK
Only problem with this is that it assumes the usage of Apache 2, but since so many of the mod packages do not work with apache 2, widespread usage of the server has been slow.
MrK
Best advice I can give: run inside a chroot without root privilege: this way there are no outside filehandles, no SUID apps, nothing short of a kernel hole will get you out of the restricted environment.
reiTan
Another apache tip: In your httpd.conf you can change the 'ServerTokens' value to 'ProductOnly' so when someone grabs it's banner it doesnt report the apache version.
You can also change the ErrorDocument value to point to a custom 404 page
Note: IE doesnt like small 404 pages and displays its default one
Digital_Spirit

The big issue with most people is php, always make sure that shell_exec is disabled on your servers.
If you are offering shared hosting, it might be a good idea to disable mod_ssl and restrict ssl to dedicated servers. smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.