Форум русскоязычного сообщества Ubuntu


Автор Тема: Доступ к вебприложению работающему в гостевой системе в virtualbox  (Прочитано 1776 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
Всем доброго тня!
У меня такая задача:
Возникла необходимость создать среду для пентеста в условиях virtualbox на ноутбуке.
На систему Ubuntu 16.04 установила virtualbox. В качестве среды выбрала такую концепцию - Атакующая машина собсно будет Ubuntu 16.04 (хостовая) а уязвимая(гостевая) будет "Web secutity dojo"(в виде образа виртуальной машины). Там есть много разных веб приложений на которых можно проводить тесты безопасности одно из них "Damn Vulnerable Web Application" которое там работает по адресу "http://localhost/dvwa/login.php".
Настройка сети между хостовой и гостевой - Attached to: Bridget Adapter, Name: wlp3s0. Соединение между ними вроде как есть. проверяла командой ping.
Собственно вопрос: Как мне из браузера хостовой машины попадать на приложение запущенное в гостевой. Опыта в таких настройках мало как и понимания. Сижу ломаю голову уже вторые сутки. Я так поняла что где то в сервере запущенном на гостевой машине нужно поменять этот "localhost" на локальный ip адрес этой машины. Так?
Буду благодарна за помощь  ???
« Последнее редактирование: 27 Апреля 2018, 06:10:56 от Volkonskaya »

Оффлайн Гамлиэль Фишкин

  • Участник
  • *
  • Сообщений: 153
  • Ubuntu MATE 16.04.4 x64 Ubuntu user since 2009
    • Просмотр профиля
    • about me
Как мне из браузера хостовой машины попадать на приложение запущенное в гостевой.
Насколько я понимаю, по IP-адресу.ifconfig

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
Вывод команды ifconfig на хостовой машине:
enp2s0    Link encap:Ethernet  HWaddr a8:1e:84:43:59:f5 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:454 errors:0 dropped:0 overruns:0 frame:0
          TX packets:454 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:39767 (39.7 KB)  TX bytes:39767 (39.7 KB)

wlp3s0    Link encap:Ethernet  HWaddr 90:cd:b6:7a:fc:91 
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::b104:7a3a:969f:1123/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9284 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6098 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12405210 (12.4 MB)  TX bytes:623031 (623.0 KB)

А это вывод гостевой:
dojo@dojo:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:5a:0d:dd 
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::8cd1:372c:9ea3:975f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:118 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8823 (8.8 KB)  TX bytes:14874 (14.8 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:09:b4:d0 
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::7c36:6033:8d7a:c3ea/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1723 (1.7 KB)  TX bytes:9695 (9.6 KB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:35578 (35.5 KB)  TX bytes:35578 (35.5 KB)
Ссылка в браузере хоствой машины вида - "http://192.168.1.111/dvwa/login.php" не дает нужного результата. Что я делаю не так? :'(

Оффлайн Гамлиэль Фишкин

  • Участник
  • *
  • Сообщений: 153
  • Ubuntu MATE 16.04.4 x64 Ubuntu user since 2009
    • Просмотр профиля
    • about me
Ссылка в браузере хоствой машины вида - "http://192.168.1.111/dvwa/login.php" не дает нужного результата.
Могу предположить, что на гостевой машине (веб-сервере на ней) ограничен доступ по IP-адресу. Или что веб-сервер на гостевой машине слушает не 80 порт. Доступны ли, к примеру, адреса http://192.168.1.111/ и http://192.168.1.111:8080/?

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
После перезагрузки ip сменился. Теперь он такой 192.168.0.109
Ни 192.168.0.109/, ни 192.168.0.109:8080/ не отвечают  :'(
Может быть что то в параметрах iptables гостевой машины нужно подровнять?
dojo@dojo:~$ sudo iptables -L
[sudo] password for dojo:
Chain INPUT (policy DROP)
target     prot opt source               destination         
ufw-before-logging-input  all  --  anywhere             anywhere           
ufw-before-input  all  --  anywhere             anywhere           
ufw-after-input  all  --  anywhere             anywhere           
ufw-after-logging-input  all  --  anywhere             anywhere           
ufw-reject-input  all  --  anywhere             anywhere           
ufw-track-input  all  --  anywhere             anywhere           

Chain FORWARD (policy DROP)
target     prot opt source               destination         
ufw-before-logging-forward  all  --  anywhere             anywhere           
ufw-before-forward  all  --  anywhere             anywhere           
ufw-after-forward  all  --  anywhere             anywhere           
ufw-after-logging-forward  all  --  anywhere             anywhere           
ufw-reject-forward  all  --  anywhere             anywhere           
ufw-track-forward  all  --  anywhere             anywhere           

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ufw-before-logging-output  all  --  anywhere             anywhere           
ufw-before-output  all  --  anywhere             anywhere           
ufw-after-output  all  --  anywhere             anywhere           
ufw-after-logging-output  all  --  anywhere             anywhere           
ufw-reject-output  all  --  anywhere             anywhere           
ufw-track-output  all  --  anywhere             anywhere           

Chain ufw-after-forward (1 references)
target     prot opt source               destination         

Chain ufw-after-input (1 references)
target     prot opt source               destination         
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:netbios-ns
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:netbios-dgm
ufw-skip-to-policy-input  tcp  --  anywhere             anywhere             tcp dpt:netbios-ssn
ufw-skip-to-policy-input  tcp  --  anywhere             anywhere             tcp dpt:microsoft-ds
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:bootps
ufw-skip-to-policy-input  udp  --  anywhere             anywhere             udp dpt:bootpc
ufw-skip-to-policy-input  all  --  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST

Chain ufw-after-logging-forward (1 references)
target     prot opt source               destination         
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-input (1 references)
target     prot opt source               destination         
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-output (1 references)
target     prot opt source               destination         

Chain ufw-after-output (1 references)
target     prot opt source               destination         

Chain ufw-before-forward (1 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere             icmp source-quench
ACCEPT     icmp --  anywhere             anywhere             icmp time-exceeded
ACCEPT     icmp --  anywhere             anywhere             icmp parameter-problem
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
ufw-user-forward  all  --  anywhere             anywhere           

Chain ufw-before-input (1 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ufw-logging-deny  all  --  anywhere             anywhere             ctstate INVALID
DROP       all  --  anywhere             anywhere             ctstate INVALID
ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere             icmp source-quench
ACCEPT     icmp --  anywhere             anywhere             icmp time-exceeded
ACCEPT     icmp --  anywhere             anywhere             icmp parameter-problem
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
ACCEPT     udp  --  anywhere             anywhere             udp spt:bootps dpt:bootpc
ufw-not-local  all  --  anywhere             anywhere           
ACCEPT     udp  --  anywhere             224.0.0.251          udp dpt:mdns
ACCEPT     udp  --  anywhere             239.255.255.250      udp dpt:1900
ufw-user-input  all  --  anywhere             anywhere           

Chain ufw-before-logging-forward (1 references)
target     prot opt source               destination         

Chain ufw-before-logging-input (1 references)
target     prot opt source               destination         

Chain ufw-before-logging-output (1 references)
target     prot opt source               destination         

Chain ufw-before-output (1 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ufw-user-output  all  --  anywhere             anywhere           

Chain ufw-logging-allow (0 references)
target     prot opt source               destination         
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

Chain ufw-logging-deny (2 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere             ctstate INVALID limit: avg 3/min burst 10
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-not-local (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL
RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type MULTICAST
RETURN     all  --  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST
ufw-logging-deny  all  --  anywhere             anywhere             limit: avg 3/min burst 10
DROP       all  --  anywhere             anywhere           

Chain ufw-reject-forward (1 references)
target     prot opt source               destination         

Chain ufw-reject-input (1 references)
target     prot opt source               destination         

Chain ufw-reject-output (1 references)
target     prot opt source               destination         

Chain ufw-skip-to-policy-forward (0 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere           

Chain ufw-skip-to-policy-input (7 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere           

Chain ufw-skip-to-policy-output (0 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere           

Chain ufw-track-forward (1 references)
target     prot opt source               destination         

Chain ufw-track-input (1 references)
target     prot opt source               destination         

Chain ufw-track-output (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW
ACCEPT     udp  --  anywhere             anywhere             ctstate NEW

Chain ufw-user-forward (1 references)
target     prot opt source               destination         

Chain ufw-user-input (1 references)
target     prot opt source               destination         

Chain ufw-user-limit (0 references)
target     prot opt source               destination         
LOG        all  --  anywhere             anywhere             limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere           

Chain ufw-user-logging-forward (0 references)
target     prot opt source               destination         

Chain ufw-user-logging-input (0 references)
target     prot opt source               destination         

Chain ufw-user-logging-output (0 references)
target     prot opt source               destination         

Chain ufw-user-output (1 references)
target     prot opt source               destination 

Пользователь добавил сообщение 27 Апреля 2018, 12:04:29:
В файле /etc/apache2/ports.conf написано что сервер слушает 80 порт.
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Что же не так? :-\

Попробовала отключить файервол.
Теперь при попытке зайти на сервер браузер выдает:
Forbidden
------------------------
You don't have permission to access / on this server.
Apache/2.4.18 (Ubuntu) Server at 192.168.0.109 Port 80
« Последнее редактирование: 27 Апреля 2018, 12:17:34 от Volkonskaya »

Оффлайн Гамлиэль Фишкин

  • Участник
  • *
  • Сообщений: 153
  • Ubuntu MATE 16.04.4 x64 Ubuntu user since 2009
    • Просмотр профиля
    • about me
Ни 192.168.0.109/, ни 192.168.0.109:8080/ не отвечают  :'(
‹…›
В файле /etc/apache2/ports.conf написано что сервер слушает 80 порт.
‹…›
You don't have permission to access / on this server.
Возможно, дело в конфигурации виртуального хоста. В каталоге /etc/apache2/sites-enabled/ есть мягкие ссылки на одноимённые файлы, находящиеся в каталоге /etc/apache2/sites-available/; весьма вероятно, что такая ссылка одна: /etc/apache2/sites-enabled/000-default.conf, указывающая на /etc/apache2/sites-available/000-default.conf. В этом файле есть блок <VirtualHost> (возможно, не один).

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
Да нашла вот вывод:
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www


        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Дирректива ServerName?? С ней что то не так? ???
« Последнее редактирование: 27 Апреля 2018, 19:55:52 от Volkonskaya »

Оффлайн bezbo

  • Старожил
  • *
  • Сообщений: 1742
    • Просмотр профиля
Directory должна быть внутри VirtualHost

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www


        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

Запихнула. К сожалению резльтат тот же  :-\

Оффлайн bezbo

  • Старожил
  • *
  • Сообщений: 1742
    • Просмотр профиля
Определитесь с AllowOverride (None или All) и покажите:
sudo apache2ctl -t

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
AllowOveride All

sudo apache2ctl -t
[sudo] password for dojo:
Syntax OK

Перезагрузила сервер. Результат тот же. Может .htacces?
« Последнее редактирование: 27 Апреля 2018, 21:08:34 от Volkonskaya »

Оффлайн bezbo

  • Старожил
  • *
  • Сообщений: 1742
    • Просмотр профиля
sudo apache2ctl -M | grep php?

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
dojo@dojo:~$ sudo apache2ctl -M | grep php
[sudo] password for dojo:
 php7_module (shared)

Оффлайн bezbo

  • Старожил
  • *
  • Сообщений: 1742
    • Просмотр профиля
если на гостевой http://localhost/dvwa/login.php работает, то проверяйте сетевые настройки гостевой ос в режиме моста

Оффлайн Volkonskaya

  • Автор темы
  • Новичок
  • *
  • Сообщений: 45
    • Просмотр профиля
да на гостевой приложение работает.

Настройки Network:

Attached to: Bridged Adapter
Name: wlp3s0
Promiscuous Mode: Allow All
+ Cable Connected

-------------
Вот и все настройки. Какая то жесть. Такие танцы с бубнами на ровном месте..
Нет больше вариантов как попробовать можно исправить ситуацию а?
« Последнее редактирование: 27 Апреля 2018, 23:19:18 от Volkonskaya »

 

Страница сгенерирована за 0.067 секунд. Запросов: 25.