Estou trabalhando em uma maneira de enganar o cisco vpn-client, modificando as rotas no sistema local para obter um status chamado tunelamento dividido.
Eu sei que não tenho o direito de fazer isso sem a permissão do administrador da rede VPN e não pretendo usar isso. No entanto, este é um desafio para mim entender melhor o roteamento no Windows, talvez até mesmo uma prova de conceito que eu possa usar para mostrar a alguns administradores que confiar nessa caixa de seleção em seu software não tem nenhuma utilidade para a segurança.
Vamos lá, aqui está o que encontrei. Está tudo modificado para endereços de rede privados. O cenário é um trabalhador remoto trabalhando em sua rede soho 192.168.81.0 e conectando-se via cisco-vpn à rede corporativa 192.168.71.0. O VPN-Host para a configuração Cisco é neste exemplo modificado para 192.168.10.5.
O trabalhador remoto está conectado à sua rede soho via WLAN, suas configurações normais de IP, enquanto não estiver em VPN, são semelhantes às seguintes:
Drahtlos-LAN-Adapter Drahtlosnetzwerkverbindung:
Verbindungsspezifisches DNS-Suffix: soho
Beschreibung. . . . . . . . . . . : Intel(R) Centrino(R) Ultimate-N 6300 AGN
Physikalische Adresse . . . . . . : 00-00-00-00-00-01
DHCP aktiviert. . . . . . . . . . : Ja
Autokonfiguration aktiviert . . . : Ja
IPv4-Adresse . . . . . . . . . . : 192.168.81.105(Bevorzugt)
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.81.254
DHCP-Server . . . . . . . . . . . : 192.168.81.254
DNS-Server . . . . . . . . . . . : 208.67.222.222
8.8.8.8
195.66.0.3
NetBIOS über TCP/IP . . . . . . . : Aktiviert
A tabela de roteamento no sistema parece nada espetacular como esperado:
===========================================================================
Schnittstellenliste
15...24 77 03 20 82 20 ......Intel(R) Centrino(R) Ultimate-N 6300 AGN
===========================================================================
IPv4-Routentabelle
===========================================================================
Aktive Routen:
Netzwerkziel Netzwerkmaske Gateway Schnittstelle Metrik
0.0.0.0 0.0.0.0 192.168.81.254 192.168.81.105 25
127.0.0.0 255.0.0.0 Auf Verbindung 127.0.0.1 306
127.0.0.1 255.255.255.255 Auf Verbindung 127.0.0.1 306
127.255.255.255 255.255.255.255 Auf Verbindung 127.0.0.1 306
192.168.81.0 255.255.255.0 Auf Verbindung 192.168.81.105 281
192.168.81.105 255.255.255.255 Auf Verbindung 192.168.81.105 281
192.168.81.255 255.255.255.255 Auf Verbindung 192.168.81.105 281
224.0.0.0 240.0.0.0 Auf Verbindung 127.0.0.1 306
224.0.0.0 240.0.0.0 Auf Verbindung 192.168.81.105 281
255.255.255.255 255.255.255.255 Auf Verbindung 127.0.0.1 306
255.255.255.255 255.255.255.255 Auf Verbindung 192.168.81.105 281
===========================================================================
Ständige Routen:
Keine
Após conectar-se à VPN, o dispositivo de rede virtual é adicionado ao sistema:
Ethernet-Adapter LAN-Verbindung 2:
Verbindungsspezifisches DNS-Suffix:
Beschreibung. . . . . . . . . . . : Cisco Systems VPN Adapter for 64-bit Windows
Physikalische Adresse . . . . . . : 00-00-00-00-00-02
DHCP aktiviert. . . . . . . . . . : Nein
Autokonfiguration aktiviert . . . : Ja
IPv4-Adresse . . . . . . . . . . : 192.168.71.186(Bevorzugt)
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.71.1
DNS-Server . . . . . . . . . . . : 10.2.20.12
10.2.20.13
Primärer WINS-Server. . . . . . . : 10.2.20.12
Sekundärer WINS-Server. . . . . . : 10.2.20.13
NetBIOS über TCP/IP . . . . . . . : Aktiviert
Drahtlos-LAN-Adapter Drahtlosnetzwerkverbindung:
Verbindungsspezifisches DNS-Suffix: soho
Beschreibung. . . . . . . . . . . : Intel(R) Centrino(R) Ultimate-N 6300 AGN
Physikalische Adresse . . . . . . : 00-00-00-00-00-01
DHCP aktiviert. . . . . . . . . . : Ja
Autokonfiguration aktiviert . . . : Ja
IPv4-Adresse . . . . . . . . . . : 192.168.81.105(Bevorzugt)
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.81.254
DHCP-Server . . . . . . . . . . . : 192.168.81.254
DNS-Server . . . . . . . . . . . : 208.67.222.222
8.8.8.8
195.66.0.3
NetBIOS über TCP/IP . . . . . . . : Aktiviert
A tabela de roteamento é modificada para o seguinte:
===========================================================================
Schnittstellenliste
22...00 00 00 00 00 02 ......Cisco Systems VPN Adapter for 64-bit Windows
15...24 77 03 20 82 20 ......Intel(R) Centrino(R) Ultimate-N 6300 AGN
===========================================================================
IPv4-Routentabelle
===========================================================================
Aktive Routen:
Netzwerkziel Netzwerkmaske Gateway Schnittstelle Metrik
0.0.0.0 0.0.0.0 192.168.81.254 192.168.81.105 25
0.0.0.0 0.0.0.0 192.168.71.1 192.168.71.186 21
127.0.0.0 255.0.0.0 Auf Verbindung 127.0.0.1 306
127.0.0.1 255.255.255.255 Auf Verbindung 127.0.0.1 306
127.255.255.255 255.255.255.255 Auf Verbindung 127.0.0.1 306
192.168.71.0 255.255.255.0 Auf Verbindung 192.168.71.186 276
192.168.71.186 255.255.255.255 Auf Verbindung 192.168.71.186 276
192.168.71.255 255.255.255.255 Auf Verbindung 192.168.71.186 276
192.168.81.0 255.255.255.0 Auf Verbindung 192.168.81.105 281
192.168.81.0 255.255.255.0 192.168.71.1 192.168.71.186 281
192.168.81.105 255.255.255.255 Auf Verbindung 192.168.81.105 281
192.168.81.105 255.255.255.255 192.168.71.1 192.168.71.186 281
192.168.81.254 255.255.255.255 Auf Verbindung 192.168.81.105 100
192.168.81.255 255.255.255.255 Auf Verbindung 192.168.81.105 281
192.168.10.5 255.255.255.255 192.168.81.254 192.168.81.105 100
224.0.0.0 240.0.0.0 Auf Verbindung 127.0.0.1 306
224.0.0.0 240.0.0.0 Auf Verbindung 192.168.81.105 281
224.0.0.0 240.0.0.0 Auf Verbindung 192.168.71.186 276
255.255.255.255 255.255.255.255 Auf Verbindung 127.0.0.1 306
255.255.255.255 255.255.255.255 Auf Verbindung 192.168.81.105 281
255.255.255.255 255.255.255.255 Auf Verbindung 192.168.71.186 276
===========================================================================
Ständige Routen:
Netzwerkadresse Netzmaske Gatewayadresse Metrik
0.0.0.0 0.0.0.0 192.168.71.1 1
===========================================================================
Como você pode ver, o cliente Cisco VPN adiciona uma rota padrão que tem um Metrik baixo e envia todo o tráfego para o túnel. A antiga rota padrão não foi removida, mas o AFAIR simplesmente não foi usado por causa do Metrik inferior da VPN. Além disso, a nova rota padrão se torna permanente, o que é realmente irritante, pois é inútil, após uma reinicialização o cliente VPN não será executado e a rota não deverá mais estar lá. Mas quem sabe como funciona o Cisco ;-)
O que me fez iniciar este desafio foi o seguinte caminho:
192.168.10.5 255.255.255.255 192.168.81.254 192.168.81.105 100
Pelo que entendi, essa rota faz tudo funcionar, já que é a rota que todo o túnel VPN tem para usar essa rota para tirar o tráfego da interface real. Então pensei que não deveria ser muito difícil modificar o roteamento para obter o tráfego padrão de volta da interface real para o gateway real e apenas o tráfego da rede remota para o túnel VPN.
Comecei excluindo as rotas padrão e, em seguida, adicionando uma nova rota padrão como era antes da conexão VPN. Em seguida, adicione uma rota específica à rede remota:
route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.81.254 IF 15
route ADD 10.2.31.0 MASK 255.255.255.0 192.168.71.1 IF 22
Depois disso, a tabela de roteamento parece boa para mim:
===========================================================================
Schnittstellenliste
22...00 00 00 00 00 02 ......Cisco Systems VPN Adapter for 64-bit Windows
15...00 00 00 00 00 01 ......Intel(R) Centrino(R) Ultimate-N 6300 AGN
===========================================================================
IPv4-Routentabelle
===========================================================================
Aktive Routen:
Netzwerkziel Netzwerkmaske Gateway Schnittstelle Metrik
0.0.0.0 0.0.0.0 192.168.81.254 192.168.81.105 26
10.2.31.0 255.255.255.0 192.168.71.1 192.168.71.186 21
127.0.0.0 255.0.0.0 Auf Verbindung 127.0.0.1 306
127.0.0.1 255.255.255.255 Auf Verbindung 127.0.0.1 306
127.255.255.255 255.255.255.255 Auf Verbindung 127.0.0.1 306
192.168.71.0 255.255.255.0 Auf Verbindung 192.168.71.186 276
192.168.71.186 255.255.255.255 Auf Verbindung 192.168.71.186 276
192.168.71.255 255.255.255.255 Auf Verbindung 192.168.71.186 276
192.168.81.0 255.255.255.0 Auf Verbindung 192.168.81.105 281
192.168.81.0 255.255.255.0 192.168.71.1 192.168.71.186 281
192.168.81.105 255.255.255.255 Auf Verbindung 192.168.81.105 281
192.168.81.105 255.255.255.255 192.168.71.1 192.168.71.186 281
192.168.81.254 255.255.255.255 Auf Verbindung 192.168.81.105 100
192.168.81.255 255.255.255.255 Auf Verbindung 192.168.81.105 281
192.168.10.5 255.255.255.255 192.168.81.254 192.168.81.105 100
224.0.0.0 240.0.0.0 Auf Verbindung 127.0.0.1 306
224.0.0.0 240.0.0.0 Auf Verbindung 192.168.81.105 281
224.0.0.0 240.0.0.0 Auf Verbindung 192.168.71.186 276
255.255.255.255 255.255.255.255 Auf Verbindung 127.0.0.1 306
255.255.255.255 255.255.255.255 Auf Verbindung 192.168.81.105 281
255.255.255.255 255.255.255.255 Auf Verbindung 192.168.71.186 276
===========================================================================
Ständige Routen:
Keine
Porém, após essa modificação posso me conectar à rede remota perfeitamente como nas rotas que o cisco vpn-client adicionou, mas não à internet.
Como não vejo nada de errado com as rotas, verifiquei novamente, se o Cisco bagunçou meu sistema DNS, mas isso está intacto na interface WLAN.
Ethernet-Adapter LAN-Verbindung 2:
Verbindungsspezifisches DNS-Suffix:
Beschreibung. . . . . . . . . . . : Cisco Systems VPN Adapter for 64-bit Windows
Physikalische Adresse . . . . . . : 00-00-00-00-00-02
DHCP aktiviert. . . . . . . . . . : Nein
Autokonfiguration aktiviert . . . : Ja
IPv4-Adresse . . . . . . . . . . : 192.168.71.186(Bevorzugt)
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.71.1
DNS-Server . . . . . . . . . . . : 10.2.20.12
10.2.20.13
Primärer WINS-Server. . . . . . . : 10.2.20.12
Sekundärer WINS-Server. . . . . . : 10.2.20.13
NetBIOS über TCP/IP . . . . . . . : Aktiviert
Drahtlos-LAN-Adapter Drahtlosnetzwerkverbindung:
Verbindungsspezifisches DNS-Suffix: soho
Beschreibung. . . . . . . . . . . : Intel(R) Centrino(R) Ultimate-N 6300 AGN
Physikalische Adresse . . . . . . : 00-00-00-00-00-01
DHCP aktiviert. . . . . . . . . . : Ja
Autokonfiguration aktiviert . . . : Ja
IPv4-Adresse . . . . . . . . . . : 192.168.81.105(Bevorzugt)
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.81.254
DHCP-Server . . . . . . . . . . . : 192.168.81.254
DNS-Server . . . . . . . . . . . : 208.67.222.222
8.8.8.8
195.66.0.3
NetBIOS über TCP/IP . . . . . . . : Aktiviert
É aqui que meu cavalo morre e preciso da ajuda de vocês. Existe alguém que possa me dar uma dica sobre o que sinto falta e/ou entendo de errado? Existe algum BlackHats por aí?
Responder1
Estou com o mesmo problema há alguns meses. Tive que me desconectar e tive acesso à Internet. Conecte-se para que eu possa ter acesso aos recursos corporativos.... Uma dor.
Minha solução temporária foi instalar um Sonatype Nexus (proxy para dependências) no Debian Linux e conectar-se comvpnc. Normalmente você pode instalá-lo com apt-get/yum etc.
Quando esta solução não foi suficiente, instalei o vpnc em minha máquina Windows com vpnc-fe http://sourceforge.net/projects/vpncfe/ (VPNc Front-End) na parte superior.
Minha configuração exigia uma configuração de segurança perfeita chamada "Force-NTT". Vereste tópico. Mais tarde você precisa colocar o seguinte script em postconnect.bat:
[Copiar caso o tópico caia]
Obrigado, rodekerken! Aqui está o resultado final, sem necessidade de ajustes manuais para quebrar as rotas divididas:
@echo off
REM By: capt-tagon
REM
REM Post-Script.bat to take VPNC's Route Table into Windows 7 land. Erases bad route table entries,
REM extracts gateway, assigned IP, Netmask, and Cisco split route entries and resubmits them to
REM Windows 7 so the routing all works. Condensed from other entries on the VPNC-FE forae and combined
REM with information gleaned from VPNC client for Linux to find all the passed parameters useful
REM to making this work. Additional by rodekerken noted below, thank you for helping finish it out.
REM
setlocal enabledelayedexpansion
echo.
echo Post-Script Begin
echo.
REM Gather Connection Data
REM
REM Parameters passed have space at end, see "HELP SET" at Console Prompt for explanation of
REM substring extraction
REM Strip space from TUNDEV, INTERNAL_IP4_ADDRESS, VPNGATEWAY, CISCO_SPLIT_INC
REM This will be broken if VPNC-FE is fixed to not export parameters with the trailing space.
REM
set MyTUNDev=%TUNDEV:~0,-1%
REM By: rodekerken
REM From the top of the router table printout, look for a line like
REM 14...00 ff 5d b0 44 aa ......TAP-Win32 Adapter V9 to find the if number.
REM A way to find out the interface number automatically and extractis this:
for /f "tokens=1 delims=." %%a in ('route print ^|find "TAP-Win32"') do set MyIF=%%a
set MyIP=%INTERNAL_IP4_ADDRESS:~0,-1%
set MyMask=%INTERNAL_IP4_NETMASK:~0,-1%
set MyVPN=%VPNGATEWAY:~0,-1%
REM Number of Routing Table Entries for Split Tunnel
set MyCiscoSplit=%CISCO_SPLIT_INC:~0,-1%
REM Date Time functions
set ANSIDate=%date:~10%%date:~4,2%%date:~7,2%
set StartTime=%time:~0,2%%time:~3,2%%time:~6,2%
REM Display Connection Data
echo Tunnel Device : [%MyTUNDev%]
echo Tunnel IntFace: [%MyIF%]
echo Tunnel IPAddr : [%MyIP%]
echo Tunnel NetMask: [%MyMask%]
echo Tunnel VPN-GW : [%MyVPN%]
echo .
echo Date Connected: [%ANSIDate%]
echo Time Connected: [%StartTime%]
echo .
REM Cisco Routes are 0 index, 6 Routes = 0-5
echo Cisco Split Routes: [%MyCiscoSplit%]
REM Display Bad Route Table
echo.
echo Bad Route Table
route print | find "%MyIP%"
echo.
REM Delete Bad Split Route entries and add back with proper Gateway.
REM Extract Cisco routing table information to feed to "ROUTE ADD"
REM Number of entries passed in Array Index CISCO_SPLIT_INC
REM For x below, value is 0 to CISCO_SPLIT_INC - 1
REM Address is passed in CISCO_SPLIT_INC_x_ADDR
REM NetMask is passed in CISCO_SPLIT_INC_x_MASK
REM
REM By: rodekerken
REM A way to loop and enumerate and evaluate the routes is like this:
set /A MyCiscoSplit-=1
for /L %%i in (0,1,%MyCiscoSplit%) do (
set SplitAddr=CISCO_SPLIT_INC_%%i_ADDR
set SplitMask=CISCO_SPLIT_INC_%%i_MASK
for /f %%a in ('echo !SplitAddr!') do set SplitAddrEval=!%%a!
for /f %%a in ('echo !SplitMask!') do set SplitMaskEval=!%%a!
echo Route%%i !SplitAddrEval! !SplitMaskEval!
route delete !SplitAddrEval! >nul
route add !SplitAddrEval! mask !SplitMaskEval! %MyVPN% metric 1 if %MyIF% >nul
)
REM Display Corrected Route Table
echo.
echo Corrected Route Table
route print | find "%MyVPN%"
echo.
echo Post-Script End
echo.
Também adicionei estas rotas após o "FOR":
route add 1111.120.120.0 mask 255.255.255.0 0.0.0.0 metric 1 if %MyIF%
route add 1111.185.19.0 mask 255.255.255.0 0.0.0.0 metric 1 if %MyIF%
route add 10.0.0.0 mask 255.0.0.0 0.0.0.0 metric 1 if %MyIF%
[Observe que as duas primeiras rotas têm endereços incorretos/falsos. Você precisa mudar isso de qualquer maneira]
Para que meu script funcione repetidamente, você precisa criar um "disconnect.bat" contendo a remoção de rotas:
route delete 1111.120.120.0
route delete 1111.185.19.0
route delete 10.0.0.0
Apenas os meus 0,02€